Computers

by Bradley Knockel

Computers and the Internet are the future, and I have always enjoyed learning about them. When I first starting having fun with them, it helped me save money, and it later became a very valuable skill. Not everyone needs to learn programming or learn how to build robots, but some computer fluency will become more and more necessary!

The goal of the following is to present things anyone can do to become good with computers. If you have a college degree in computer science or computer engineering, this is not for you. That is, I won't talk about the cool fancy stuff—FPGAs, GNU Make, collaborative file sharing (such as Git or SharePoint), databases, making GUIs, CAD, image/video editing, parallel computing, encryption, GPU programming, quantum computing, and deep machine learning—partly because I have little experience with much of the fancy stuff! I will instead attempt to get you coding as painlessly as possible!

You may wish to just take classes instead of reading the following, but you actually don't need classes to learn basic programming! I have never taken a class in the computer department! For me, my primary motivation to learn has been conversations with people I know, and I hope this webpage to continue that conversation.

I will be assuming a certain level of understanding and access to technology, so let's figure out what you need. You should know about Wi-Fi, how files are saved on a computer (via software and hardware), how to type, how to install and run software, etc. Learning how to use computers is a crucial skill, so, if you cannot do this, stop reading right now and buy a cheap laptop—though a bit nicer than the ones that are basically tablets with a keyboard (that is, do not get a Chromebook)—and find a place (such as your school or a library) with Wi-Fi! Then come back here after several days of playing around with the laptop. You may even want to learn Excel.

Recently, phone plans such as Project Fi let us buy smartphones without having to pay for expensive data plans (though they also offer highly customizable data plans), and there is no contract to sign. This plan is just $20 a month for basic phone service in addition to having to buy a compatible smartphone. Living in the modern world without text messaging and a cell phone is difficult, so $20 a month is a great way to get this, and the cost of the smartphone is about the same as a laptop, so we now have Internet access! No need for a computer! However, this is great for people who do not care to learn to be a techie or learn any professional skills. If money is a concern, I instead recommend getting a crappy (used?) flip phone and buying a laptop for Internet. Laptops are far more powerful than smartphones (for example, taking college classes is much easier with a laptop!). Then, you can always upgrade your phone situation to Project Fi and/or get Wi-Fi at your home as your new tech skills and education eventually get you a better job.

The first thing to know is how to learn about computers. There is a simple procedure for solving any computer problem. Young people tend to do this intuitively, but the cycle is simple for anyone...

  1. Play around with the computer to see what all the stuff does in hopes of finding what you need or something useful for the future. In the process, you quickly get a feel for things.

  2. Google it. I cannot overemphasize this. Everything you think to do has been done before. Every problem you face has been faced before by anyone from beginners to experts. So Google it.

  3. Repeat this cycle until you are satisfied!

Honestly, I Google constantly. Either I haven't done something before and have multiple tabs open for all the various examples, tutorials, and reference manuals, or it has been a while, so I don't remember the exact syntax for doing something, and Google quickly reminds me.

Also, I play around all the time. Almost everything I have learned is because I tried to do something or another often because I broke something or another and had to try to fix it. Everything we break and every mistake we make is just another opportunity to play around and learn something!

In reality, one should not play around completely freely. Click on the following to learn how to be safe...

I usually think of computers as toys, but, when getting files or sharing information, think of them as powerful dangerous tools. It is human nature to need to experience a bit of harm before learning anything, and I have detected malware on my computer before, but let's do our best to learn to be careful sooner than later.

Of the major types of operating systems—Windows, macOS, and Linux for normal computers as well as Android and iOS for mobile devices—Windows (and to some extent Android) is often in danger of malware. In fact, it is theoretically possible for any operating system to become accidentally infected with malware, and any device is in danger of identity theft if connected to unsafe Wi-Fi networks (mobile and wired connections can also sometimes be unsafe!). So everyone should give some effort to be safe. Malware can delete all your files or steal your identity, and an unsafe network can steal your identity.

Imagine a computer without Internet, network file sharing, or USB flash drives. This computer is essentially unable to be hacked or be infected, but it is also a mostly useless computer because the whole point of living in the information age is to share information between computers! Whenever information is shared, common sense goes a long way towards keeping our computers safe. Ultimately, it is our responsibility to be safe. Specifically, at least be sure to do the following things (they should seem quite obvious, but it worth being explicitly told)...

  • You may not believe how many people use terrible passwords such as any variation of "123456", "qwerty", "111111", "password", "google", any single-word password, etc. for important things. And you may not believe how many people use the same password for both silly and important things, allowing anyone who even accidentally gets their silly password to get everything (you should ideally have many good passwords). Keep in mind that your personal email should be considered as important as a bank account because criminals can use your email account with the "forget your password?" feature of many websites to get into lots of your accounts. Please understand that criminals are sophisticated, and they will feast on your information and money if you are an effortless target for them. It is a crime for people to use your identity and steal your money, so don't "aid and abet" them via laziness. For example, when someone gets their car stolen when they warm up the engine on a winter morning by leaving the keys in the ignition, it's a sad situation that the car is stolen and that we live in an unsafe world, but how embarrassing to not even try to protect oneself!

  • When online or over the phone, make people prove their authenticity before giving them any secure information, else you are an easy target for a phishing scam. Just because someone learned the name of your IT person before calling you or knows the name of your bank (or got it right by a lucky guess), this actually should raise red flags rather than put us to ease. Most phishing attempts are pathetic—email or calls from your bank or IT department from a bizarre email address with links to bizarre URLs—and even the clever phishing scams can be avoided by Googling a bit or realizing that banks or IT departments will never ask you for (or send a link that asks for) your secure information or login. Don't even follow the links (including the unsubscribe link) or respond in any way to suspicious emails to avoid having your email address verified by spam lists. Only follow links if their domain name is good (you can see the URL by hovering your mouse or holding a tap on the link), and keep in mind that bigsavings.chase.com is the bank chase.com, but chase.bigsavings.com is a trick. Oh, and if it isn't obvious from life in general, any get-rich-quick link is a scam.

  • Do not let your device automatically connect to any Wi-Fi network, so that you can manually connect to only those networks you know to be official. Automatically connecting to known networks is fine, but it's the unknown ones that can cause problems because someone can be intercepting all the information (called a man-in-the-middle attack). Feel free to manually connect to a possibly unsafe network as long as you do not plan on logging into any secure website or using less-than-secure apps.

  • Do not do private things like online banking or logging in to your personal email over any public Wi-Fi network or on a random public (possibly infected) computer. Any hacker on the same network or who has used the computer before could be waiting for you. Cellular data networks are typically safe, but be very sure to use a strong PIN (or other form of security) in case your device is lost or stolen. Certain public computers can be safe, especially if technology such as Deep Freeze is used to restore the computer to its pristine state upon every reboot. Websites that have https:// in front of the URL are much safer than websites with http:// (unless the computer you are using is compromised).

  • Notice and remember how your computer asks you for permission to run an executable file. For example, on Windows, any .exe file is an executable file, and you have almost certainly run .exe files to install various software. If you receive a file from a USB flash drive, from a file-sharing network, email, Internet, etc., and your computer asks you for this permission (even if the file is not .exe), think very carefully before accepting. All malware can be avoided by never allowing programs to run that should not run. Of course, these executable files will be disguised as other types of file or inside a file on your USB flash drive or on a file-sharing network that has been corrupted, but do not let it run if there is any doubt! To remove doubt, Google around before running a file. If your computer runs programs on USB drives automatically, do not let your USB flash drive enter computers that belong to other people until you deactivate your computer's autorun behavior!

  • Don't install any suspicious app from Google Play. Their security is worse than Apple's App Store (because they value freedom and large selection of apps more than Apple's App Store).

  • If your computer is stolen and it had any passwords saved (by a web browser or inside a file), the thief can very easily get those passwords (unless you happen to encrypt your hard drive or the folder that contains the passwords!). If you don't encrypt your hard drive or folder, the password you use to get into your computer is very easily bypassed by booting into a USB flash drive with an operating system on it (you can create and boot into an Ubuntu bootable USB drive in a matter of minutes). If your unsecured computer is stolen, you will need to change all your passwords. As for mobile devices, these tend to be more secure if stolen, and there are often ways to erase your device remotely if desired.

  • If you get rid of an old computer that did not use drive encryption, smash the hard drive because deleted files are often still on the hard drive. If it is an old magnetic hard drive (HDD), you may not have to smash the drive if you zero-fill it. A newer SSD is trickier. All of this is discussed here.

  • An infected device that isn't completely disabled should be put into quarantine (no USB flash drives or file sharing or accessing private information) until fixed. Turn the device off whenever possible in case someone has been granted access to your files. If the infection cannot be removed, before doing any type of system restore, sending your personal files that are not backed up already to a place like Google Drive can be wise. Google Drive scans incoming files for malware, so you can then safely download files back onto your restored system. You may wish to change your Google password after this as well as any other passwords that may have been stolen while your computer was infected.

  • As an honorable mention because social media is here to stay, be safe on social media. If you don't want to be stalked, don't accept friend requests from strangers. To prevent from being a loser, be kind and don't cyberbully. Treat interactions on social media as you would real life. Your happiness is also at risk. I still don't fully understand why people put their social lives on public display on the Internet, but that's my problem, though I think that it's good advice to reduce social media to be a happy person.

Being safe is much easier if you have your own laptop and Wi-Fi or if you have your own mobile device with data plan. In this modern world, I feel that having at least one of these items is as necessary as clothes or electricity, and I think most people agree with this?

Luckily, security technology is improving. Many websites, apps, and banks are getting better as they often force us to do the smart thing by requiring good passwords and requiring us to change them every so often. The United States is still lagging behind the credit-card security of the rest of the world, but the US has finally introduced chip readers, which helps. Windows 10 now comes with Windows Defender, though Windows users may still want to install Malwarebytes and CCleaner (free of charge) to manually scan the computer every so often (and be sure to allow Windows to automatically update everything). Macro viruses used to be embedded in Microsoft Office macros (you would be infected when you clicked "enable macro" on files infected by macro viruses), but Windows Defender prevents these now. For the really sensitive stuff, many devices have file encryption capabilities, and there are protocols such as PGP that allow for very secure encryption of individual files. For security nerds, sites like PayPal are not just for quickly sending your friends money, but can easily allow for secure transactions with businesses.

Step 1: take control of your files

Much software tries to lock us out of using other software. Apple software that comes with macOS or iOS is probably the worst in this (Apple tries to create a computing experience that is a bubble that works wonderfully within the bubble but that does not work with software outside the bubble). Software companies try to make us dependent on them so that we will not switch. For example, the worthless software that typically comes with a computer often stores our files (photos, music, etc.) in a hierarchy of folders that is essentially impossible to manually navigate. If we import files into this software, it will not simply remember where the files are, but it will copy the files and stick them into the convoluted hierarchy of folders. Do not let the software companies lock us into their convolution! If we have to use the software, when we're done with a file, export it from the software and manage it yourself!

Have the attitude of not blindly using software that comes with your computer. If you do choose to use the software, take control of your own files rather than letting the software put them in random places on your computer or on the cloud. Organize your files yourself in folders on your computer or in the cloud. Do not let software manage your files unless this software gives you control.

There are a few exceptions when using built-in software is best. For example, on an iOS device, we can use the Photos app on macOS to automatically sink our photo libraries to a Mac's Photos app so that we never have to plug our device into our computer to do the transfer. We can then quickly export the files to .jpg files on the Mac and delete them from the Photos library. Basically, use the built-in software only to transfer the files out of the software! You can also use icloud.com instead of the Photos app, but this currently only lets you export as .png files (not .jpg).

While doing this, you will need to learn file types. Music is almost always .mp3. Videos can be many different things. Photos should usually be .png (for images of text where precision details should be maintained) or .jpg (for photos that need compression). A good file type to use for word processors is .docx, since many various word processors can use these files.

An advantage to this approach is that our files will be safer. The software that we should not be using tries to think for us, which is especially annoying when the software has bugs. Files can get accidentally deleted if we do not know what our computer is doing with them. Also, knowing where all important files are allows us to do a complete backup! The city of Santa Fe once lost a bunch of critical investment records when the user of a computer that was reformatted was not keeping track of where these important files were on the computer.

Personally, I go so far as to never use the "My Documents" folder. Very many programs litter this folder with their garbage, so I just store my files in my own location!

Step 2: backup your files

Hard drives fail, computers are stolen, houses catch on fire, power surges fry computers (surge protectors are wise), and other mistakes happen, so, now that you know where all your files are, you can choose how you want to back them up. I always act as if my hard drive will erase my data at any moment. Take advantage of free cloud storage (for example, your Google account gives you 15 GB free in 2017), and maybe get an external backup hard drive. For convenience, consider using cloud storage instead of keeping files on your computers/devices (for example, I keep slides and grade books on my Office 365 account so that I can access them anywhere). Use your external drive to backup all your files still stored on your computers. Use any remaining cloud storage as backup for the most important files on your computers.

Personally, I have a vast number of files that I never want to lose (photos, notes, documents, codes, etc.). I use a simple free program called Duplicity to backup my Linux and Mac to my external backup drive (formatted as single-partition FAT32, and I used MacPorts to download Duplicity on my Mac). This program automatically encrypts and compresses all my files, it only backs up changed files (also keeping old versions), and it keeps my folders in the same hierarchy if I were to retrieve them. I have very few important files on my Windows partition (and none of them need encryption), so I just put all my Windows files in a Dropbox folder that automatically syncs with dropbox.com on the cloud. For my most important files on my Linux and Mac, I create encrypted .zip files (using the zip -er command) and store them on Google Drive.

As for backing up passwords, I am sure to backup the necessary files in my Firefox (I also export and backup my bookmarks every so often). I may also have a file that contains many of my passwords, and I was sure to hide it and to be sure to never use the word password in the file or its filename. So the only passwords I really need to remember are the ones I use to get into my computers or to decrypt my backups.

Step 3: version control (if needed)

There is fancy software such as Git or SharePoint for collaborating in a group where files are being edited by many different people. I don't care to say much about this.

I just want to discuss how to manage multiple versions of our own files when creating and editing these files. Basically, keep all versions, and save new versions in a new file or location. For example, I often reuse various files for different classes I teach. I have a folder for each semester I teach, and, if I reuse something that I plan on editing, I copy the files to the current semester's folder. Each semester is different (different number of weeks, different textbook, different school, etc.), so each version is different. Then in future semesters, when I make en even newer version, I just look through previous versions for things I like and can quickly merge them.

If doing more careful edits to code for analyzing or simulating data/files, I have seen people waste much time by not employing a bit of organization (especially important if the code takes a long time to run!). I always keep the original files of the code that I downloaded in a .zip file (or one can choose to simply document the URL and version number). I then document the changes I make to the original. Instead of constantly changing the same files over and over (which inevitably become littered with old baggage), I create a new file and/or folder for each new task, test, or idea I try. If I do this correctly, I only need to backup the original .zip file, the documentation file I make on how to create my different versions, the original code's documentation, and usually some other key files, because these should allow you to reconstruct everything in a relatively quick amount of time. When I am looking at some output from the code, I know exactly the version of the code that created it by which folder it is in! I don't have to constantly redo everything when I inevitably forget which version did what. I delete versions that prove to be worthless, but otherwise I just let the various versions sit on my hard drive until I feel like deleting all of them years later (but always keeping the original code and my documentation).

Saving money

Before smartphones and while living in a tiny studio apartment, I got the idea to use my desktop computer for everything that I could. It was my phone ($60 a year through Skype after buying a headset), my television (all good shows let you stream them for free back then), music player, filing cabinet, newspaper, and video game console. As you can imagine, my life became much more difficult when Comcast's Internet was down from time to time. I am no longer as poor as I was, but I still enjoy being clever to save a bit of money.

Here is my list of things to make having a computer and Internet as cheap as possible...

The joy and fun of being clever makes this all the more satisfying! You will learn a lot and feel empowered! You may become happier than an overly materialistic person.

Coding

Do you want to make a webpage? Do you want to be able to automate tasks and create unique solutions to interesting problems?

If so, keep reading! And start playing around with code because that's the best way to master it! The goal here is to get general computer knowledge so that you can tackle any problem. This should well prepare you for any programming course or coding project you care to undertake. Now that you've paid for a computer and Internet, why not do cool things with it—all for free!

After I learned about basic coding, I would be playing some puzzle game and think to myself that a computer could solve it quite quickly, and some of my greatest delights in life have been writing successful code to solve some problem or puzzle I encounter in daily life!

One day when I was a college student, I was chatting with a coworker. He showed me how easy it is to make a webpage. Just open a text editor (Notepad on Windows or TextEdit on a Mac), then copy and paste the several lines of HTML in the previous link into the file and save the file as index.html, which you can now open in a web browser by double clicking! Seriously, do it. Right now. You can still right click the file to open it with your text editor to make changes. I recommend to explore W3Schools at the previous link! You will learn much more than HTML! The simplicity of how text files control computers just blew me away and opened up a world of great possibility!

Fancy software to do the fancy HTML stuff for you exists, but I just do HTML by hand in a text editor. In fact, text editors will become your best friend if you want to do any type of coding. HTML is not actually coding yet, but it is a good introduction to using text editors. You will want to get a good one (on Windows, Notepad is trash, and Notepad++ is much better). Text files are the simplest files you can imagine. In a text file's simplest form, every byte (1 byte is 8 bits, where each bit is a 0 or 1) is a letter/symbol, which allows for 28 = 256 unique symbols such as letters, numbers, spaces, tabs, etc. This simplest type of file is called an ASCII text file.

The text file that you are reading right now (computers.html) is slightly more complicated because I can enter in any of over a million §ρεč¡ął Ćħαяãċ†ē®ŝ such as those in the lower-case Greek alphabet:
   α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω
This type of file is called a UTF-8 text file, and you can view the underlying UTF-8 text file you are reading by right clicking the screen and selecting "View Page Source". Coding is almost always done with ASCII, but markup languages like HTML usually use UTF-8. The first 128 ASCII characters correspond to the same 8-bit sequences in UTF-8, so there usually is no need to care about the differences. However, the special UTF-8 characters use multiple bytes, and the software reading the file needs to know if it should interpret these sequences of bytes as one or multiple characters. If anything beyond the first 128 ASCII characters are encountered, the software typically assumes UTF-8, but it is best practice to specify the encoding (using the first 128 ASCII characters). Take a look at the page source again to see where, at the top of this file, I specify the charset to be UTF-8.

To do real coding, you will not only need a good text editor, but you also need to become familiar with your computer's command-line shell/terminal. On a Mac, run the Terminal application. On Windows, it's called the Command Prompt. The terminal is how you can tell your computer to run (or compile) your codes, and it is how you can configure and install various software. When you run your (simple) programs, any output or input the code needs is done through the terminal. Computers used to be primarily terminals. Modern computers now have fancy graphics, but I think of these graphics as being only an eye-friendly way of doing what the terminal does. In fact, you may eventually find that clicking through menus or other graphical interfaces is tedious compared to knowing a quick command. In fact, graphical applications can be thought to be just like any other program/command run from a terminal because they can be run from a terminal! Once fully harnessed, the terminal is often more powerful than the graphics—unless of course you are doing something inherently visual/graphical such as making a spreadsheet or designing a flyer—so dive in!

At this point, I must recommend eventually learning another operating system than Windows. You will eventually want a coding environment on your computer, for which Windows is not designed (Windows is more for gaming and office use). Perhaps you should not worry about this immediately because it may be educational to attempt all the following in Windows just so you see you different operating systems compare, but real developers often avoid Windows (unless they are creating Windows applications!). I highly recommend Linux (especially Ubuntu Linux), which is open source and free of charge, and you can dual boot Linux with your Windows or a Chromebook (you will get a choice when turning on your computer which operating system you wish to use), or you may wish to first try to run Linux virtually using VirtualBox (free of charge and lets you easily transfer files between operating systems). There is a steep learning curve when switching to a new operating system, but knowing Linux will unlock many doors in your computational future, and learning a second operating system helps understand how operating systems work. My brother setup my computer to dual boot Linux and Windows when I was in college, and I hated it, but I later started to primarily use my Linux partition as I learned more about computers. A Mac can acquire Linux functionality via software such as MacPorts, so some people prefer Mac over Linux because Mac is more aesthetic/enjoyable and works with more hardware peripherals and more software. But Linux is what we really want since Linux is the most powerful, does not waste memory, is easily expandable via package management, does not have viruses or bloatware, and is free of charge, and you don't lose hardware&software support because we keep Windows. Linux loses graphical flashiness in favor of the power to configure the computer and to directly control the computer's resources. Nearly all supercomputers and web servers run Linux (and Android phones are based on Linux!). If you later decide that you don't like Linux, you can simply never boot into it or even erase it from your disk.

Linux has a very powerful command-line language called Bash. Bash is the default used in an Ubuntu Linux terminal and also in a Mac's Terminal. You should get familiar with Bash via a Bash tutorial. You would not believe the amount of effort I have saved myself when analyzing huge amounts of data in a huge amount of files by writing a few clever Bash scripts (which can then be easily reused in the future for similar tasks by making small modifications). Familiarize yourself with Bash so that you know its usefulness before you waste your time doing something the hard way.

Now that we are familiar with editing text files and using a terminal, we need to learn how to code! This will take work, but this is where all the rewards come from! I think of coding as playing with LEGOs. Once you get the idea of how the pieces connect, you can build whatever you imagine. If you get stuck on anything or do something cool, please send me a message! Following is a list in order of easiest to hardest of various interesting projects you may wish to attempt (the list will likely grow as I myself play around with different things). At the end of the day, coding is coding. It does not really matter which language(s) you first use because knowing one language will allow you to much more easily learn another.

  1. Complete the game Lightbot (requires Flash) to get the basic idea of how coding works.

  2. A simple coding language is JavaScript. I have had endless fun playing around with JavaScript in my HTML files. You can learn JavaScript at W3Schools. I especially liked combining JavaScript with CSS to create webpages that would:
       • beat like a heart
       • allow people the ability to change backgrounds on a webpage and inject HTML into a region of a webpage
       • have password-protected areas that can be hacked into where trying to hack incorrectly results in being rick-rolled, and hacking correctly results in a JavaScript surprise!
       • etc!
    Try to do something unique to force you to learn it instead of copying from someone else (eventually, you can reuse code from others, but everyone needs to first understand how code works).

  3. Another simple programming language is TI-BASIC for your TI graphic calculator (calculators are computers too!). If you like math, this may be the place to start. Your calculator's manual will have a chapter on programming, which you should read, and the manual will have sample programs which you should try and extend to suit your own purposes (such as a quadratic equation solver or a program to convert from any temperature unit to any other). I once easily made it through a college statistics class by simply writing a program to do each of the various calculations that were expected of us. I always just did my programming on the calculator itself, and I believe there is software to do it on a computer's keyboard, but my opinion is that any code complex enough to require a computer's keyboard should not be run on a calculator.

  4. Learn PHP at W3Schools. PHP lets you do things like let people email you feedback on an HTML webpage, or you can create a webpage that serves specialized or randomized content depending on who is viewing or when they are viewing. However, because PHP is run by a web server (and not the client's web browser like JavaScript), you will need to download and configure your computer to be an Apache HTTP Sever (Apache will probably have PHP enabled by default). Nginx is fancy popular web server that high-traffic websites often use, but Apache is all you need. You will configure your Apache web server via editing text files with settings then restarting the Apache server, and you will view your webpage, index.php, by typing localhost into your web browser where you would normally type any other URL. Or, you can use websites like 000webhost to host your low-traffic website for free! Either option is tricky. The external-server option can be fun because you may got the opportunity to learn how to use SSH and SFTP to connect to remote servers!

  5. Write some Bash scripts in Linux. Do various useful tasks such as taking every .jpeg file in a folder and reducing their size and renaming them to .jpg files. You can actually do this in a single line!
       for f in *.jpeg;do convert "$f" -resize 50% "${f/.jpeg}.jpg";done;rm *.jpeg
    Often just a single line such as
       grep -ir --color 'phrase' *
    can be very powerful (it will search the data of all files in the folder and recursively search subfolders for text files containing the phrase specified between the quotation marks). I once was a substitute teacher for Albuquerque Public Schools during the summer when there were few jobs, so I wrote a Bash script (using the Wget, grep, then sed commands) that would log into my school account every minute and make a repeating noise if a job existed (and optionally automatically accept the job for me). Huzzah! Computers should be fun, so lookup and install the cowsay command (on a Mac, Macports is needed to get this), and use it whenever you can!

  6. Python is an extremely popular language. Complete the Python Challenge (and a Python tutorial to help you). If you like puzzles, be sure to start the Python Challenge during the beginning of a break from work and school when it's OK to stay up late at night for several nights in a row! Once you learn Python, it can be very useful! Python is even often used for scientific computing via the SciPy packages, which can easily be run in Linux (and on a Mac via MacPorts). If you just want to learn one language, Python is what you want because it is simple yet powerful. I regularly discover people doing amazing things with Python!
    Anyway, there are two somewhat incompatible versions, Python2 and Python3, and I recommend using Python3 so that you don't end up like me not knowing anything about the most current version. Anyway, Python is very easy to install on Linux if it isn't installed already, and, on macOS, I recommend using MacPorts to get Python versions and any modules. You can select which version your code uses by changing the numbers in the first line of the Python code, which should look something like this
       #!/usr/bin/env python3.5
    If you are ever curious which command is being run by the above, type the following command into a terminal
       which python3.5
    and you can change which command is being run (if there are several of the same name) by adding to or changing the order of the locations in the terminal's $PATH variable (I'll let you figure out how to make this change permanent).

  7. You may now wish to learn a "real" (compiled) language like C++. Operating systems are often written in C++! You should probably take a class or buy a book to learn this, but you can create the most basic programs simply by Googling around a bit. Once you know C++, you will be able to learn any other language. C++ and Fortran are the languages used in scientific computing (Fortran is simpler than C++) due to their power and efficiency. Unlike all the languages mentioned previously, this is not a scripting language that is parsed when run. Instead, the code is first compiled into a binary file (strings of 0's and 1's that are understood by your operating system as direct messages to the CPU) that can be run after compilation. The advantage of compiling (especially with modern optimized compilers) is that the code runs much faster. However, once compiled, the binary file cannot be run on different operating systems or on computers with different types of CPU. By the way, the open-source software I previously mentioned is simply software where the code/source (and not only the binary files) is made freely available to anyone who would want to edit or compile it.
    Here is an example of source code and binary files for various operating systems. To run the correct binary file, you must first find out if your computer is 32-bit or 64-bit. With Linux and Mac, you will need to change the file permissions to executable and then run in a terminal. I recommend trying to compile the source code (in the .cpp file) yourself! You may notice how ridiculously large the Windows (.exe) binary files are, and you would be correct to question how Windows ever became so popular.

  8. Finally, check out CodeFights. Every once in a while, I will participate in a challenge if it looks interesting, which helps keep my coding skills sharp. There are things for beginners, so why not check out the website? If you care about coding more than I do, maybe you can turn coding into a career, and this site may be part of how you do that! Though, be cautious of competitions that value speed over quality. Both are important, but speed without quality becomes a nightmare for any large project (whereas quality without speed is just an inconvenience).

I grew up on a computer game called ZZT, which is actually a game-creation tool rather than a game. Few people would have the patience to program such old things anymore, though playing people's ZZT games can still be kinda fun since there was tons of creativity. My attempts to make an elaborate ZZT game as a child really inspired me into caring about computers. I could program my own (in hindsight, crappy) games in middle school! This experience and then using my TI calculator to help in my future math class inspired me showing how useful and powerful computers are! Later in college, I taught myself HTML and became fascinated by the power of the Internet. We all need experiences like these to inspire us if we are going to fully harness the power of computers! So start playing around to find your own experiences! Programming my Arduino (see the Computer Engineering section below) has been the most recent "ZZT" in my life!

You may be venturing into a world of logic, a world closely related to the world of mathematics. If you choose a mathematical project such as trying to solve a puzzle, you will explore the space of what can be computed and of which algorithms are the best. Before Gödel's incompleteness theorems (in 1931) people imagined that it may be possible to write a computer program that could prove or disprove any mathematical statement (and solve any puzzle), but we now know from Gödel that life is a bit more complicated because logic itself has its limits and that no such program can be written. We are left with a situation where logical proofs will always need to be pursued farther in the pursuit of an answer that may not even exist. We cannot always know in advance which algorithm is best or which problems have solutions, so let's start playing around!

  • Design code that runs with minimal memory in the least time.

  • Design code into pieces that can be easily reused.

  • Document your code using comments (and document entire projects with separate documentation files). Even you will forget what your code does when you look at it a year from now if you don't document the crucial parts. Don't write the obvious stuff like "this is a loop", but instead give the purpose of the loop. Especially document any clever tricks or subtle points along the way. For clarity (and efficiency), pack your data into arrays (rather than separate variables), and name the array something clear and concise.

  • Always understand how the code works so that you know (and document) its limitations.

  • Find a way to continuously test your code while you are writing it (perhaps by using sample data where the answer is already known). It is much more difficult to find errors if they are hidden in a mess of untested code.

  • Become fast at debugging code by commenting out sections and printing/outputting intermediate steps to find where the error occurs.

  • Err on the side of too much planning and testing than on the side of being bad code. Anything worth doing is worth doing well. No one wants to have to restart an entire project because it was built on a foundation of laziness. I have seen lazily written code that gives nightmares to anyone who must work with it.

  • Do not worry if your code is perfectly optimized for readability and speed. The vast majority of effort can be spent optimizing the final few finishing touches, so code by the philosophy: "If it ain't broke, don't fix it." But do not let this be an excuse to be lazy.

Modern Coding Environments

The goal with coding up until now was to learn the basics in a way that was free of charge. However, the old-school way can become tedious, and using modern software can do all the tedious stuff for you (sometimes still free of charge!). Another advantage to modern coding environments is that they are typically designed to easily be run on any operating system (Windows, Mac, or Linux), so some people who claim to be coders can get away with only using Windows. These coding environments are called integrated development environments (IDEs).

Modern IDEs can be quite expensive. Luckily, schools and work often provide it for free, and there are usually open-source alternatives. There are also some less than legal ways of easily obtaining software, but keeping less-than-legal software updated is a huge pain in the butt, and malware is common in less-than-legal software.

The world's best hackers and algorithm designers are not dependent on IDEs. The best often use (or at least can proficiently use if needed) a good text editor (probably vim) and a good terminal (probably one that runs Bash). Actually, one could argue that they are only using the terminal because vim runs directly in the terminal! For the rest of us mortals, IDEs can be very helpful and save lots of time. Even the best usually use some combination of the basics and IDEs. As for me, I have grown fond of gedit in Linux and TextEdit in Mac (simple text editors), and I use IDEs called MATLAB or Mathematica when I can, though I enjoy Bash and Python almost just as much.

Now that you know the basics of computers, perhaps learn more specialized things only if helpful for a class or job (by the way, new things are much easier to learn now that you know the basics). Why learn some specific tool beyond the basics unless you have a specific reason? You can end up wasting your time. There are a million ways to do anything, and there often is no correct way. For example, you can compile almost any language (even Mathematica code). So you can either try to learn all million ways of doing something or you can simply wait to learn the way you need to do it. The basics of coding are always the same, so focus on learning the basics for now. However, you may wish to play around with an IDE or two.

  • MATLAB is a great example of modern coding software. It has a built-in text editor and terminal that are optimized for the MATLAB scripting language. The MATLAB language is wonderful as it can do anything a calculator can do and far more. As is the case of most modern languages, it lets you focus on solving problems instead of worrying about silly details of the computer (creating and accessing complicated data structures is almost effortless once you learn how), which makes it truly a joy to use after doing other languages. MATLAB is quite expensive (though schools often provide it to students for free), and there luckily is an open-source alternative called GNU Octave that can more-or-less run the same MATLAB scripts (though it lacks the finesse, expansion packs, speed, and nice graphics of MATLAB). Also, the SciPy packages are another free open-source alternative that avoids the awkwardness of Octave, however scripts written for MATLAB are not expected to easily work with SciPy (and SciPy is not an IDE). Another downside of using MATLAB is the lack of transparency and lack of detailed control needed in high-performance scientific computing, but it sure is nice to use when you can get away with it (or as initial testing and exploration in a coding project that will eventually need to be written in another language).

  • A programming language simply called R and its IDE called RStudio is similar to MATLAB. It is optimized for statistical analyses and, unlike MATLAB, is open-source and free of charge!

  • If you aren't developing software and instead want to quickly solve some problem or do some calculations, Mathematica is the IDE! It is designed around the concept of a notebook (pen and paper), which is just brilliant. Coding feels like brainstorming on a notebook, except this notebook is a very intelligent computer that can figure out whatever you ask it to do. To then clean up your notebook to make it look professional is very easy to do! Mathematica makes your fancy calculator look like a kindergartener in comparison. The CEO, Stephan Wolfram, is an absolute genius (he is the Wolfram in WolframAlpha). Mathematica has a few limits in its ability to do complicated and optimized scientific computing, so, in my work, I would use C++ or Fortran to simulate a whole bunch of data, then I would as quickly as possible import the data files into Mathematica for any further processing or analysis. Mathematica can cost a pretty penny, but it might be worth it. Also, Mathematica (and free WolframAlpha) can do symbolic math! For example, the command
       Integrate[ 2*x*Cos[x^2], x]
    returns sin(x2)! None of these other IDEs in this list can do symbolic math (though MATLAB has a add-on toolbox that can do some stuff).
    If you instead use Python's free-of-charge SciPy packages, there is a SymPy module that you can use to do a good amount of symbolic math, and, if you really want to, you can play around with something called Jupyter to get an IDE based on the concept of a notebook!
    Other options are Maple (a not cheap IDE very similar to Mathematica) and wxMaxima (a free-of-charge IDE that lacks power).

  • Various programming languages such as C++ have various specialized IDEs, and I'm not super familiar with any of them. These environments are all very similar to MATLAB except they use languages other than MATLAB, and, if the language must be compiled, you may not have MATLAB's nice terminal to run single commands. A very expensive IDE is Visual Studio, which is useful for large projects and works with a few different programming languages, and open-source alternatives exist (also, there's a free version of Visual Studio), but Visual Studio only runs on Windows. In some cases, Visual Studio essentially codes for you! Even though they aren't technically programming languages, many people (not me) prefer to write LaTeX and HTML in special software.

  • Java—no relation to JavaScript!—is usually written in IDEs (though it can be written in any text editor). Java is very popular because it is clean and safe, and it has an awesome feature: if you write code for one operating system, it will usually run on them all! This works because each computer needs to install the Java virtual machine (aka Java) to run Java programs, and it is this virtual machine that runs Java programs as a layer between the operating system and the program itself (instead of the operating system directly running a binary file). Your code must only run on a virtual machine without worrying what type of computer is running the virtual machine.

  • LabVIEW. Are you controlling actuators (motors and servos)? And/or are you collecting or responding to data from sensors/detectors? If so, use LabVIEW. The visual layout of the code allows one to make virtual control panels (buttons on your screen) to operate your physical (non-virtual) equipment even as the code is running. Cool stuff! But it can be pricy.

  • You know of Excel? Well, it—or Google Slides or any other free spreadsheet software—may surprisingly be just what you're looking for. I have actually used it in professional research. MATLAB would do the real analysis on the huge data files over days and weeks, and MATLAB would output results into a single large-but-not-huge Excel spreadsheet where each row corresponded to a particular experiment. Whenever there is a not-gigantic amount of data (as was the case with MATLAB's results) that can be presented in a spreadsheet, Excel might be the way to go. Excel is very powerful, and being able to visually analyze the data is very fast and helpful. I recall being able to instantly notice irregularities or other features because the data was literally all directly in front of my face. Further analysis was later done by importing the Excel file into MATLAB, but being able to see the data in Excel while the data was being generated over the weeks really helped in fine-tuning MATLAB's analysis.

Do-It-Yourself Computer Engineering

So far, I have mostly focused on the computer-science (software) side of computing largely because it is something I can do while sitting around my apartment! For software, I don't have to wait for things to ship and arrive, and I can immediately play around with all sorts of things, so I don't have to plan as much. However, with a bit of hardware, you can do a lot!

Let me make you aware of two very cheap pieces of electronics that might change how you view technology: Raspberry Pi and Arduino. They are both computers and are quite different from each other. They are both standard hardware. With them and with your basic understanding of coding, a whole world of possibilities arise. Neither computer is more than $40! The Arduino is somewhat cheaper.

If you get a Raspberry Pi, you will own a fully-functional computer! You will need an SD card (and a way to connect the SD card to a "normal" computer for the initial install of Linux onto the SD card). You probably will also want to buy a dedicated power supply (instead of having it depend on a "normal" computer's USB for power). After an initial setup of its network setting which requires various cables to connect a monitor, keyboard, and mouse, you will be able to access your Raspberry Pi over Wi-Fi (using SSH or SFTP). At this point, you can store your tiny Raspberry Pi anywhere near a power outlet and a router, and you will program, control, and access it via a "normal" computer. Or you can connect a monitor, mouse, and keyboard directly to your Raspberry Pi. You will feel like you're using and setting up any other Linux computer because you are.

Once your Raspberry Pi is setup...

Considering software, the Arduino is much simpler than a Raspberry Pi. You program an Arduino via Arduino software on your "normal" computer that talks through a USB connection to the Arduino. The programming language is C or C++. You do not have to buy an SD card or load on an operating system because the Arduino does not have an operating system! Because of this, the Arduino cannot run multiple programs at once or easily switch between a very large number of diverse activities. Without an operating system to run the programs, the single program you write for it is everything. However, the Arduino is perfect for doing simple dedicated tasks such as play Piano Tiles 2 on a touchscreen (and here's how to do it). For more complicated projects, the Arduino could be activated by something else (like a Raspberry Pi or a Bluetooth module) via its input pins to do some specialized task. I recommend using an Arduino for "electronic" applications as opposed to "computer system" applications. While the Arduino has simple software, on the hardware side, it can be powered more easily than a Pi, can supply more power than a Pi, has built-in analog reading capability, and is better for carefully timing events.

By the way, the Arduino is open-source hardware, so you can buy other brands of the exact same model, and the Arduino software will work the exact same with your device. However, you may wish to buy the Arduino brand to support the company that comes up with the designs. The Raspberry Pi is not open-source hardware.

There are similarities with a Raspberry Pi. For example, you will need USB cables and power supplies. So, for both the Raspberry Pi and Arduino, I recommend buying starter kits, which also come with all kinds of "toys": wires, resisters, LEDs, etc. You don't know what you need or what's best until you can play around with all the "toys"! Each individual "toy" is very cheap, but the shipping and handling fees add up making a starter kit a smart purchase.

Of course, the main limitation of using the Arduino to play Piano Tiles 2 is the physical interface at the screen. This person ran the game on a virtual Android called BlueStacks (a free program on a "normal" computer that simulates an Android device), then you can make a program to directly read and click to 4 pixels on the screen! I have been known to use simple Linux programs/commands I found online called xdotool and grabc to write a Bash script to do stuff like this. For Piano Tiles 2, I wrote a Python script for my Mac, and I did better than the video! For reading the screen and moving the mouse using Python, I installed the py27-pyobjc-quartz port using MacPorts, and I load this module in my Python code via the line
   import Quartz.CoreGraphics as CG
The trick was putting pauses before clicking/unclicking mouse events, which prevents events from being ignored if they are too close together in time. I could have done even better if I cared to optimize the timing and run things on a faster computer/software. Note that, for this script to work on Linux, it must be modified by first installing the python-xlib (or python3-xlib) package then loading the Xlib module (instead of the Quartz module).

If you want to pursue mechanical or electrical engineering, you may wish to attempt one of the following more-complicated projects...
   • Robots! These are somewhat basic since they only use Arduino, though the more impressive ones use more than Arduino.
   • More sophisticated Raspberry Pi robots!
   • Christmas-tree lights using Arduino
   • More Christmas-tree lights
   • Amazing Christmas lights
   • And more amazing lights! If you look in the video description, he explains how he did it! At the heart is a Raspberry Pi running a special operating system that is sending signals to controllers using ethernet!
   • The following is the easiest Christmas idea. It is free and requires building nothing because it has already been built for us! Sadly, this Christmas tree is not always connected to then Internet. When it is connected to the Internet, it is then broadcast via live YouTube streaming! When it is available over winter holidays, try doing the following command to light up the tree!
   sudo ping6 -i 0 <insert IPv6 address here>
Sudo is needed because this is ping flooding! If it does not work, go to ipv6 test to make sure that your Internet connection (likely your router) has IPv6 enabled! Surprisingly, the ping6 command is given more freedom on macOS than on Linux allowing for a much higher frequency of pings on macOS. On either OS, using ping6 in Bash in interesting ways is awkward, so I wrote this Python script to allow us to do interesting things! Just run it with sudo as described in the file! My brother had told me about the tree initially, so I emailed him my script. While sitting in an airport, he immediately whipped up this very cool Python script in response! He has a PhD in computer science, so his code has finesse! I added most of the comments when I first read his code, and I recommend reading the comments on the top of my code at some point. An interesting project for you may be to take my brother's code and cut the cycle time in half by always lighting up the tree with two colors—each the RGB complementary color of the other—at the same time (be careful with sleep or try to make sure that alternating pings are complementary colors). If you do this, colorsys.hsv_to_rgb(hue, 1, 1) is a way to shorten the code quite a bit!
   • Playing guitar using programmable Legos! Oh, and then there's all these great Lego ideas!

To accomplish these things, you will likely want to go to a makerspace or hackerspace! Also, online forums such as StackExchange are great! CNM has a makerspace, and CNM has a Hacker Space that has participated in Pi Wars before (the website has great instructions on how to build a robot yourself). Getting involved and meeting people is essential to getting things done!


000webhost logo