This post is part 3 of 92 in the series Programming by Stealth

In the previous instalment we introduced HTML, learned about HTML tags in the abstract, and looked at a basic template for all HTML pages. Over the next few instalments we’ll be working our way through the common HTML tags.

There are two major types of HTML tags, block-level tags, and inline tags, though it should be noted that there is a much less common third type which is a hybrid of the two, referred to as inline-block. For now, we’ll be ignoring these odd-balls.

Block level tags define regions of content – things like titles, paragraphs, lists, list items, and so on. Inline tags affect parts of a block – for example, a few words within a paragraph can be marked for emphasis. With practice the distinction will be comes obvious, especially when we get to the more advanced aspects of CSS, but the different in type can be confusing. A handy way of remembering the difference is that opening a new block-level tag will always start a new line on your page.

In this instalment we’ll start with some of the most common block-level tags.

Read more

Tagged with:

This post is part 2 of 92 in the series Programming by Stealth

The first baby-step we’ll take towards real programming is the Hyper-Text Markup Language, better known to us all as HTML. HTML is not a true programming language, it is instead a simpler beast known as a markup language – it adds context to text. HTML allows us to mark certain parts of a document as headings, other parts as paragraphs, and yet other parts as being emphasised etc.. Like with programming, we are conveying meaning to the computer, but the range of possible things we can ‘say’ is much smaller and simpler.

Modern best practices for web development are the result of decades of evolution. We’re going to ignore all the techniques that time and experience have shown to be mistake, and jump straight to the end of the story – modern best practice. There have also been many versions of HTML over the years, and again, we’re going to jump straight to the end of the story, and use the latest incarnation of the Hyper-Text Markup Language, HTML5.

Before we dive into the specifics, I want to take a moment to explain the larger context in which we’ll be using HTML. When HTML was originally developed, it was designed to describe both what different elements of a web page were, and, what they should look like. Experience has taught us that this is a terrible idea, so we no longer use HTML in this dual role. Instead, HTML is now just half of a duo of languages used to create a web page – the other partner being Cascading Style Sheets, or CSS. We use HTML to describe what each part of the page is, and CSS to describe how each marked up element on the page should be styled.

We’ll be moving on to CSS once we finish describing HTML. Until we get CSS, the web pages we create will look exceptional plain and frankly boring, but don’t worry, we’ll move on to CSS soon enough, and then you can really let your creative juices fly!

Read more

Tagged with:

This post is part 1 of 92 in the series Programming by Stealth

Computer programming is a very powerful skill – it literally lets you tell computers exactly what to do. Contrary to what you may believe, learning to program is not about learning any specific programming language, but about learning the principles shared by all languages. Once you grasp the fundamental principles, you can move from language to language with relative ease. In my two decades of programming I have programmed in X86 Assembler, BASIC, C, C++, Java, JavaScript, Perl, PHP, BASH, Lisp, Maple, Matlab, and more. While doing so I’ve also made use of other computer languages that are not quite programming languages, but still involved telling a computer what you mean like SQL, HTML, CSS, XML & JSON. The point I really want to drive home is that you are not a Java programmer, or a PHP programmer, or a Perl programmer – you are a programmer! The tool you happen to use most today is unlikely to be the one you use most a decade from now. 15 years ago I did 90% of my programming in Java, 10 years ago, PHP, today, Perl, next year, who knows!

In case you hadn’t guessed yet, I’m not going to pick a single computer language for this series of tutorials. I’m very deliberately going to make use of a pallet of languages, and I’m going to focus on the underlying principles, rather than the specific peculiarities of any given language.

In order to help bring everyone along, I’m also not going to go from zero to real programming in one go. The plan is to sneak up on programming in small steps – hence the title of the series. We will be using computer languages from the start, but initially, they won’t be programming languages. Also, in order to be as inclusive as possible, I’m going to avoid vendor-specific languages – that means no Apple Script, no VB Script, no Objective C, and no C# (pronounced ‘see-sharp’ BTW). Instead, I’m going to use the most universal platform of all – the world wide web. We’re going to sneak up on programming by learning to create web pages.

Read more

Tagged with:

This is the second part of a two-part post – read part 1 here.

In part 1 we learned how to use the command line too hsxkpasswd to generate passwords, and how to use various flags to specify custom password generation configurations, and word sources. In this second part we’ll look at how to save these customisations for future use with .hsxkpasswdrc files.

Read more

Tagged with:

Since version 3.5, the Crypt::HSXKPasswd password generating perl module ships with a command line interface to the password generator called hsxkpasswd. This provides a way for non-Perl programers to access the vast majority of the module’s functionality.

The easiest way to install the module, and it’s accompanying terminal command is via CPAN:

sudo cpan Crypt::HSXKPasswd

Once the module is installed, you’ll have access to the hsxkpasswd terminal command.

Getting started is simple, run the command with no arguments at all and it will generate one password using the default settings:

bart-iMac2013:~ bart$ hsxkpasswd
@@26.MEASURE.below.LIFT.95@@
bart-iMac2013:~ bart$

If you want more passwords, pass a number as an argument, and you’ll get that many passwords:

bart-iMac2013:~ bart$ hsxkpasswd 10
~~08!hole!VOWEL!then!45~~
$$49^monday^YELLOW^remember^22$$
//69-express-MONDAY-edge-54//
--42~KITCHEN~save~COLD~40--
==51%REPLY%even%AUGUST%28==
%%63&list&INSIDE&train&58%%
^^19!spain!CONGO!spain!01^^
::30@SMILED@from@PERIOD@90::
&&05%decimal%THREE%remember%80&&
..47^ROAD^dress^BERLIN^11..
bart-iMac2013:~ bart$

Read more

Tagged with:

The letters JSON stand for JavaScript Object Notation, but that doesn’t really help you understand what it is, and what it’s for. JSON may have it’s origins in JavaScript, but it’s moved on from there. JSON has become a very popular human-readable plain-text format for sending structured data between applications.

In short, JS is a way of representing data that both computers and humans can read and understand. Think of it as XML’s younger better looking cousin 🙂

Note that this article is intended to be a JSON primer, not an exhaustive description of the format.

Read more

Tagged with:

This post is part 35 of 39 in the series Taming the Terminal

The previous instalment we introduced the HTTP protocol. In this instalment we’ll look at three terminal commands which make use of the HTTP protocol.

We’ll start by browsing from the terminal, and then move on to a pair of very similar commands for making HTTP requests from the terminal. These two commands can do many things, but we’ll focus on two specific use-cases, downloading files, and viewing HTTP headers.

Read more

Tagged with:

This is a quick-start guide to using the free and open source Crypt::HSXKPasswd Perl module for generating secure but memorable passwords.

As I write this post the module is not on CPAN yet, and still in beta form. The module can be downloaded from the project’s GitHub page.

This article assumes you have the module installed – you’ll find installation instructions here.

Before we get stuck into some sample code, let’s first summarise the module’s philosophy.

The module is built around the idea of using common words as a kind of lattice around which to build passwords that are long, have a wide coverage of characters, and yet are still memorable. An ideal HSXKPasswd password will contain a mix of upper and lower case letters, some digits, and some symbols.

The module starts building a password by randomly closing a given number of words from a given dictionary. There can then be an optional number of digits added as pseudo words to the front and/or the back of the initial list of words. Next, a symbol can be used to separate the words, and finally a symbol can be used to pad the front and/or back of the password.

Think of it like this:

correct HORSE BATTERY staple
23 correct HORSE BATTERY staple 45
23*correct*HORSE*BATTERY*staple*45
--23*correct*HORSE*BATTERY*staple*45--

Read more

Tagged with:

Until Crypt::HSXKPasswd comes out of beta, I’m not going to upload it to CPAN, so until then, the betas need to be manually installed. You can get the latest release of the library by downloading the appropriate .tar.gz file from GitHub.

For Perl regulars, the process is likely to be familiar, because the module is packaged using the very popular Module::Build. The process is quite straight forward, but there are a few potential pitfalls for the uninitiated.

For quick reference, here are the commands needed to install the module:

perl Build.PL
sudo ./Build installdeps
./Build
./Build test
sudo ./Build install

Read more

Tagged with:

This post is part 34 of 39 in the series Taming the Terminal

In the previous instalment we finished a five-part series on SSH. Before moving on, lets take a moment to step back and look at the big-picture. The five SSH instalments are all part of the now long-running series on networking. We have been working our way through the networking stack since instalment 23. We started at the bottom of the stack, and have worked our way up. We are not exploring protocols in the Application Layer.

In this instalment we’re moving on from SSH to HTTP, the protocol that powers the world wide web.

Before we look at some HTTP-related terminal commands, we need a basic understanding of how HTTP works, so that’s what this instalment is all about.

Read more

Tagged with:

« go backkeep looking »