Quickie: Configuration Headers

We all know (or at least we should know) that we can use #define to create macros that replace names with values during the preprocessor phase of compilation. Sometimes, it's very important for us to have the ability to change large amounts of code very quickly, because we have a new size limit for

Tools vs APIs

If you are making a product that will employ unique self-signed certificates and private keys, how would you go about it? The two basic techniques are: Run a tool like OpenSSL's cert tool, either at user discretion or through a script Build the certificate generator directly into your program Let's take a quick look at what each

Weird Things in SQL

SQL, as we have already established, is built on collections of tables. These tables can be linked together by queries to form increasingly complex tables, which allows us to draw conclusions that would otherwise be extraordinarily difficult to obtain. There are some very powerful (yet weird) things we can do to create more useful queries. Aliases By

SQL Databases – It’s All in the Plan

It doesn't take very long to learn SQL, because it's a very simple scripting language with only four basic operations. No matter how complex you make your queries, with any number of conditions and tests, ultimately it boils down to CRUD. Why is it, then, that so few people can develop databases effectively? Like all

Building a Simple SQL Database

So, we've looked at the four basic SQL commands, but we haven't really seen any useful examples of how they would work. In a moment, we'll look at a set of commands that will create a basic database, fill it with some values, and run a simple SELECT command. These commands are designed to run

CRUD – The Things SQL Can Do

CRUD: Create, Read, Update, Destroy. These are the four basic database operations. Logically, they're the four basic data operations as well. CREATE - The act of producing new data which has not previously been introduced to the system. This data can be produced internally (through calculations, mostly) or externally (through input). READ - The act of retrieving

Patterns: Shielding Inputs with const

One of the key worries I have heard from those ill-informed OOP programmers is that C cannot protect inputs you pass into functions. They use private fields and retrieval functions to ensure that the stored value is protected from unwanted modification. However, this concern is addressed by C's const keyword. Taking a const value There are times

Linux + C – Awk Example: Line Counter

Like most things, learning awk is much easier with examples. Today we'll look at a simple awk script which counts lines of code based on their type. The Code: linecount The following code uses a lot of regular expressions to determine the nature of a line. There are three formats for these if statements: if($0 ~ /REGEX/)

Linux + C – AWK for Beginners

Now that we know how valuable awk is, we can start to look at how we use it. The Three Phases There are three stages of an awk script: BEGIN - happens exactly once at the start of the program END - happens exactly once at the end of the program ...and the main loop We usually use the BEGIN