Most of the common data formats, such as CSV, XML, and JSON, use plain text to store complex data or somehow interpret that plain text as something it’s not. The programmer’s job is to translate the plain text and generate the proper type of complex data.
Continue reading
Category Archives: Exercise
Increasing Brightness
Recently, I did some graphics programming. The task I gave myself was to highlight a JPEG by drawing a box around an interesting part of the image. The puzzle was which color to make the box so that it would stand out.
Continue reading
Oscillation
Going back and forth happens frequently in the real world, and not just when you forget to pick up something at the store. Pendulums swing back and forth. The tide rises and falls. Politicians waffle.
Continue reading
Swapping Strings
Last month’s Exercise was rather silly: Rarely do you need to swap elements between two integer arrays. As Chris pointed out in the Exercise’s comments, “Would it not be easier to just use the array which contains the values you need?” Indeed, it is, which leads up to this month’s Exercise.
Continue reading
Swapping Arrays
I’m amazed, and a bit envious, when I look at other programming languages to discover a rich variety of functions, or “methods,” that do specific tasks the C language lacks. One of these tasks deals with arrays.
Continue reading
Filename Extractor
Last month’s Exercise demonstrated a filename-extractor, but it cheated: The filename was always the same: same text, same length. That’s not always the case in the real world.
Continue reading
Right String
A recent web page programming puzzle reminded me of an old BASIC language function, RIGHT$. The “right-string” function returns the rightmost n characters from a string. Such a function would have helped me greatly in my web page programming task.
Continue reading
The URL Decoding Filter
Last month’s Exercise was to write a filter that converts ASCII text into a percent-encoded format. This month, you’re task is to reverse the process: White a filter that converts a percent-encoded string back into the original ASCII.
Continue reading
The URL Encoding Filter
URL encoding is a method of translating ASCII codes (not just text or URLs) into what’s often referred to as percent encoding. You’ve probably seen this format on your web browser’s address bar or in a search engine’s text. The encoding format is necessary to preserve the original content as plain text.
Continue reading
Change Due
Consider the penny. It’s one cent, which was once a worthy sum before the government devalued the currency to the point where trays of pennies linger unwanted on convenience store checkout counters across the land. Why not do away with the penny?
Continue reading