From Wikipedia, the free encyclopedia
  (Redirected from User:^zer0dyer$)
Jump to: navigation, search

Hello, I'm Curtis Dyer, and I mainly endeavor to better understand a variety of topics within computer science and The Art of Computer Programming.

The following user page entails the history of my gradual interest in computers and software design, in particular. I also endeavor to post any interesting snippets of code I manage to write. Feel free to drop in and say "Hi" on my discussion page, if you feel so inclined.

CISCO Curriculum and Self-sufficient Study[edit]

Back in high school, I nurtured only a passing interest in computer science. However, I found myself in a CISCO computer repair class called A+ and got my first taste of how experts deal with the newbies. The teacher was, I see now in hindsight, a wizardly network admin. The class consisted of little lecturing; our teacher briefly explained binary, hexadecimal, and a few RAID configurations. From there on out, we were all on our own as we trudged through the curriculum on the web. There were a few students who already knew the teacher and they worked together on various projects on their own. The rest of the semester was generally dull, as we droned away on old Windows 95 machines, without much help and enduring sitting on unpleasant, deformed stools.

The problem was that, as someone completely unfamiliar with computer hardware, there was no context given for the vast amounts of facts we had to memorize. The class entailed all the excitement of memorizing particular permutations of a playing card deck. Without any frame of reference for understanding how the many components that make up the inner workings of a PC come together to allow us to complete our day-to-day tasks, it made the course incredibly dry, indeed.

A Chance Meeting with HTML[edit]

Due to the fast pace of the A+ course and my lack of eagerness for memorizing arbitrary model numbers for arbitrary hardware components, I wasn't completing the chapter assignments on time. I decided to get caught up on as much of the assignments as possible at home, and I ended up managing a B+ for the class. The next semester was to cover the N+ course, which is the CISCO networking course, but continuing meant seriously rearranging my schedule. And due to my already unpleasant experience in A+, I was more than eager to find a different class altogether. By chance, I remembered my old typing teacher taught a telecommunications class, in which HTML was taught. Luckily, I was able to get in, albeit after the first week had passed in the second semester.

As an aside, telecommunications was an inaccurate term for that course, since all that was taught was HTML (the kind that elicits profuse vomiting).

Down the Rabbit Hole[edit]

Unfortunately, the teacher treated her students like children and was often very patronizing. However, she left me alone for the most part. I found that the class had already gone over the basics of creating an HTML document. It didn't make much sense to me at first, so I figured I would need to catch up on my own. I was already fascinated by how Web sites worked, so I went home and avoided homework to Google search "HTML tutorials." My original intent was to just get some of the basics down so I wouldn't be lost in class. I managed to find, which is where I managed to learn the whole of the semester in one week, plus more. HTML itself isn't too complicated, it's not that difficult to learn the very basics in an afternoon.

Although I picked up the basics quickly, it wasn't until about a year later that I broke many bad habits and started writing well-formed and semantic markup. This process makes it easier to maintain Web sites over a long period of time and makes it easier to consistently manage stylistically.

The more I studied on my own, the more I realized the textbook was using horribly deprecated (outdated) markup. Unfortunately, the teacher didn't recognize these problems at all. Our final project involved making a basic Web site that involved employing various skills covered throughout the semester. Oddly, I decided to base my site on teaching basic HTML and CSS. Unfortunately, I wasn't nearly as informed as I fancied myself, and a good deal of the information about CSS I wrote was plain wrong. In hindsight, attempting to write a quality informative article on something can actually be a great tool in showing where your weakest points of understanding are.

An Introduction to Netiquette[edit]

After high school, I continued my pursuit of knowledge in all things Web design, which meant spending a great deal of time on the Internet. During this time, I rekindled my childhood fascination with programming. At the age of 13 or so, I had become intrigued by tinkering with QBASIC on an old MS-DOS computer my dad had. After we had upgraded to a machine with Windows 98, I had found QBASIC wasn't installed and assumed you just couldn't get it anymore. My dad had printed some information about Java, but to download the Java environment meant tying up the phone line for over a day (good ol' dial-up on a 56k modem).

My desire to better learn the interactive nature of Web design led me to Perl, a commonly used scripting language with a wide variety of applications. In particular, I had wanted to have a server-side script that sent email. I had very little luck with installing Perl and Apache Web Server on my computer, as I found configuring everything correctly quite confusing. At that time, I had XP Home, which doesn't include IIS, Microsoft's Web server. I then figured that I may as well find a Web host so I could avoid the hassles of setup and get straight to coding. So, I looked for any free hosts which offered Perl. I then found Aboho (which has since gone the way of Davy Jones' Locker).

At first, I had little patience for dealing with people online; my intentions were rather self-serving. I posted the minimum required amount of posts on the forum to get an account started. After ticking off the admin with my impatience, I figured I should stick with working at developing offline. However, my continual failures with configuring Apache brought me back to Aboho again. When I finally got to know some people, I really started to enjoy my stay. Once I got my account, I was pretty astounded by all that you could do. Not surprising, I had quite a lot of questions in my quest to better learn Web development.

Online, it's easy to lose sight of the simple fact you're dealing with actual people when only interacting via text. It's one of the more important lessons I've learned on the web.

It was because of Aboho that I ventured to learn PHP (thanks to pentapenguin), which was the first scripting language in which I became fluent.

Still Learning[edit]

Today, I still maintain a Windows development machine running Apache with PHP as the primary server-side tool. My interest in programming has led me to tinker with plenty of other languages, as well. Aside from PHP, I have also used ActivePerl and the mod_perl Apache module here and there. I have come to admire the elegant C implementation of Python, but have not had the chance to use the language very frequently. I use MySQL for database management.

I gained some *nix experience by working on remote Web servers via PuTTY. As a result, I became more interested in software development on GNU/Linux platforms. I will generally work on my Ubuntu installation when writing and testing code.

These days, while I still enjoy aspects of Web development (Canvas API), I'm more keen on learning how the machine works at a lower level. This led me to C, which has quickly become one of my favorite languages due to its spartan, elegant nature.

Thanks to online friends, STFW/RTFM, and Usenet, I've become comfortable with HTML, CSS, JavaScript, PHP, Perl, Apache configuration, and C. Apart from learning programming languages, I endeavor to better learn the fundamentals of computer science by studying and implementing abstract data types, such as lists or trees.


In high school, I studied German. My German teacher was Scottish, and proudly hung the Royal Standard of Scotland behind his desk. He was an educated, well traveled soccer coach. He also taught French. He was a terrific teacher and helped us foster critical thinking skills.

Recently, in college, I have been garnering more interest in mathematics and biology.

How to Become a Programmer[edit]

Learning the Art[edit]

Everywhere you look, there will be promises to teach you Language [X] in [Y] Hours/Days. Personally, I have yet to witness any real shortcuts to proficiency. Computer programming is an art, a way of thinking. It combines careful, analytical thinking with more creative lateral thinking to find solutions. However, like any specialized skill, it requires time to attain mastery. Although, I've never felt comfortable considering myself a "true expert," I just happened to realize one day, I was trying to help answer people's questions more often than ask my own. Although I prefer to keep learning and understanding, I do appreciate just how far I've been able to progress.

Not everyone has the same approach to learning, but I genuinely feel if you have a strong desire to understand how things work, you have a good state of mind with which to approach programming. Even if you're still not sure, you might be amazed at how much even the basics of programming can change how you look at the seemingly magic box that empowers all the software you use each day.

When it comes to learning, some might prefer starting with basic programming concepts, while others might wish to just dive right into learning a programming language by tinkering at a program's source code. One of my favorite stories about learning how to program was written by a talented programmer and comp.lang.c newsgroup contributor named Peter Seebach. He describes how he got introduced to computer programming by tinkering with the source code of a Unix game called Hack.[1] Sometimes, the spark that starts it all is just reading or tinkering with the bits of code that look like plain English.

It can be easy to get a bad taste in your mouth with regard to computer programming if your first book assumes you will be running on a certain platform, patronizes you, or perhaps inundates you with too much at once. The key is to know the audience at whom the book is targeted. Good books will provide the fundamental framework of important ideas by challenging you and not attempting to lie when something either takes time or lies out of the scope of the book. It's not beneficial to you if the author attempts to shoehorn in more concepts or techniques than can possibly be fully explored in a single beginner's text.

Try not to forgo the challenge process, it is essential. Even if you opt out of exercises, you will inevitably need to experience the growing pains when building your own programs. I don't mean to make the task seem too daunting, but it's very important to not be put off by slow progress. It's going to take quite some time before you produce your first serious piece of software. However, you might find that as you slowly grow, bits and pieces start to slowly illuminate and come together in sometimes surprising ways.

Choosing your Tools[edit]

The programming language is the tool you use to communicate with the computer. When you set out to learn your first language, it's the underlying concepts that comprise the fundamentals of computer science; they transcend any one language. However, you need to start somewhere, and the question still remains, "Where?"

Although there is no standard answer, there are some languages that can be easier to pick up than others. Eric S. Raymond, a notable programmer and author in the open source initiative, wrote a document entitled, How to Become a Hacker, in which he covers the challenge of choosing a first language. He recommends learning Python as a first language. It can be a good beginner language, as it enforces some good coding habits right from the start. Current versions of PHP (most commonly used for Web development) are also quite nice. These scripting languages will allow you to create some interesting and useful things without needing a lot of prerequisite knowledge.

In general, the Web is a very popular platform on which to develop (as of this writing). If you think you might be interested in developing on the Web, you may be pleasantly surprised at the quick pace when starting out of the gate. However, due to this, people can easily pick up bad habits and practices, due to the prevalence of poorly written, yet ubiquitous code snippet repositories, which provide some functionality that's often sought after by beginners.

If you intend to target Web development, consider learning the following technologies before studying a scripting language, like PHP or Python:

  1. HTML (HyperText Markup Language): this isn't a programming language, but it's the fundamental markup language that structures Web documents. If a pencil is the programming language, the sheet of paper is the HTML document. In my experience, HTML is very easy to learn, but can take some time to master.
  2. CSS (Cascading Style Sheets): also not a programming language, but is the method by which HTML documents are styled. You can essentially create a series of style properties within a single text file, which will be interpreted by the browser to display various things like font styles, size, and other aspects of a document's appearance. This is useful for easily styling a whole set of HTML documents without the need for copy-and-paste.

Learning General-purpose languages like C, C++, or ECMAScript, depending upon your approach, can sometimes seem difficult. General-purpose programming languages are designed to be able to run in a wide variety of environments. An environment can mean anything from Windows, Unix, Mac, to the small, custom kernel for a CPU that runs in a robotic arm. The cost of this flexibility comes with the price of being relatively minimalistic, so that it can fit anywhere people need it to. For that reason, you often need to learn at least some of the specifics of the environments on top of learning the language itself. This is because the language needs to work in tandem with its environment to produce useful programs. Although sticking to the basic, standard portion of a general-purpose programming language is generally simpler, you will still need to learn the basic usage of a compiler, which is responsible for building the program from the human-readable source code that you write. Furthermore, you will most likely be limited to the command line on the common desktop OSes like Windows, Mac, and Linux.

To aid in building complicated software, such as application software, integrated development environments (IDEs) are offered to streamline the process. IDEs are programs that provide a more convenient interface that abstracts some of the complexities of system tools responsible for building desktop applications. It's a good place to tinker and learn some high-level concepts. In computer science, high-level refers to concepts that are abstract, and distanced from the 1s and 0s that are read at the machine level. Conversely, low-level refers to concepts that are closer to the machine.

The drawbacks of using IDEs as a beginner means that it's easier to forgo understanding the basic tools that all run in tandem to build programs. If you ever change to a platform that doesn't have your IDE of choice, and you don't understand the basics that happen behind the curtain, you will have a hard time adapting.

Google is your Friend[edit]

The best skill I have taken from learning Web development and programming is how to make the best use out of Google and generally finding solutions self-sufficiently. The next best skill is to develop a tough skin when dealing with others on the web. A lot of experts are curt and concise. Don't fawn, but don't posture; be efficient with your and others' time. Self-sufficient Google searching is a priceless tool, which is useful in many situations even outside of programming. The path to actually growing is identifying problems or puzzles that interest you, and which you can approach in logical, structured steps. You can then turn them into pieces of a program. This is the essence of programming: mapping real world problems to logical steps, which make up a program. The art of visualizing and implementing these steps transcends any one language, but learning many languages is what refines and perfects your abilities.

Let's expand on real world problems relating to code. Once you've studied the basic components that make up programs, find something in your everyday life that you think could be made easier if you had a tool doing it for you—maybe it's checking certain things in news feeds, maybe it's automatically generating a shopping list—it should be something that you'd actually like to use. Try and think how those basic program components could be combined to reach the desired outcome. You would use Google or your textbook to fill in the blanks. For example, if you need to know what day of the week it is in your program, you'd simply search for information on date handling in your language of choice. This goal-driven nature of learning about a language can make all the difference in retaining information and gaining a more intuitive understanding of concepts.

When you are forced to apply new concepts in the context of your own meaningful projects, it has a far greater impact than simply passively reading about the general concept in a tutorial or textbook. The experience of crafting your first useful program is a thrilling and satisfying step—even if you do regard it poorly years later.

Favorite Code Snippets[edit]

Here, I've listed some interesting (and some not so interesting) code snippets for people to peruse.

Never use Magic Quotes in PHP[edit]

Well, as many of you probably already know, magic quotes was nothing more than a bothersome misfeature, and has been removed from PHP for quite some time. Despite this, you may not have a choice to outright dismiss this feature when dealing with certain legacy systems. Whenever possible, ensure magic quotes is disabled within php.ini. On Apache servers, you can also usually set php.ini directives within .htaccess files.

To conditionally remove magic quotes only when it is enabled, we might use something like the following:


if ( get_magic_quotes_gpc() ) {
   $lambda = create_function('&$s','$s=stripslashes($s);');
   array_walk_recursive($_GET, $lambda);
   array_walk_recursive($_POST, $lambda);
   array_walk_recursive($_COOKIE, $lambda);


You might want to only alter the superglobal that's relevant, however.

Power Sets and C[edit]

Steve Gibson, computer programmer and security professional, maintains his own news server, and while lurking, I noticed someone had asked a question about how to generate all the possible substrings of a string, where the substrings are delineated by dots. For example, given the string, "abcd", we would generate:


As it turns out, this problem can be modeled well by the notion of power sets, where the power set, P(S), is defined as the set of all subsets for some set S. The power set includes the empty set and S itself. The size of a power set is given by |P(S)| = 2n where n is the size of the set, S. From a combinatorics perspective, we can view the subsets in the power set as a series of combinations of length 0 to n:

However, in our case, we end up with 2n - 1 substrings, because we cut the amount of subsets in half by skipping odd integers in order to leave out substrings resulting in separators appearing before the first letter or after the last.

The solutions I had seen posted in the newsgroup seemed circuitous and were, if I recall correctly, written in Visual Basic! I decided to implement the power set solution in C and utilized bitwise logic rather than operating on a string or, worse, an array of integers.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/* we can use the left shift operator to test only the bit in position ``x'' in an integer ``n'' */
#define BITTEST(n, x) ((n) & (1u << (x)))

static void powerset(const char *data, const char *sep, FILE *fp)
  size_t i, j;
  size_t len = strlen(data);

  /* this is equivalent to 2^len */
  size_t nset = 1 << len;

  /* we avoid placing separator on outside ends of string */
  for (i = 0; i < nset; i += 2) {
     for (j = 0; j < len; ++j)
        fprintf(fp, "%s%c", BITTEST(i,j) ? sep : "", data[j]);
     putc('\n', fp);

int main(void)
  powerset("abcd", ".", stdout);
  return 0;


  1. ^ Seebach, Peter. Growing Up in C. <>. Accessed 4 April 2014.

External links[edit]

See also[edit]