Code Vamping

Comment Systems for Static Websites

Published on 2018-12-30

Static websites are fast and tend to be simple to maintain. But the lack of processing on the server side means that comments (and other interaction) is a bit of a hassle. Below is a list - by no means complete - of the systems for doing comments on a static website. In the end, they all amount to the same thing; using a server to serve comments. The differences are all around whose server are you using....


Spirit X3 File Organization

Published on 2018-12-24

For larger Spirit-based project, organizing the source code well can lead to more efficient builds and increased maintainability. Of course, this is true for any project. But the heavily templated nature of even a fully realized Spirit parser makes this doubly so. Figuring out how to take advantage of separate compilation while maintaining the ability for each of the pieces to see the needed type/template information is not trivial....


Spirit X3 Error Handling

Published on 2018-12-17

Once your parser grammar grows beyond a few rules/parsers, handling errors will become a priority. Being able to give feedback about where things went wrong, what exactly went wrong, and possible fixes are all things you would like to provide. It might also be nice to see if you could recover the parsing process from the point of failure and continue parsing to maybe find other problems. All code can be found on github....


Integrate VirtualBox and PuTTY

Published on 2018-12-10

This is a simple Powershell script to automate starting and logging into a headless VBox VM using PuTTY. My main development environment is a VirtualBox VM running Arch Linux on top of a Windows 10 host. While I could work directly on the console, I like to have multiple windows up - one that has vim running and one that I use for things like running hugo server. So, I start the VM headless and connect to it with one or more PuTTY sessions....


Rust Move vs Copy

Published on 2018-12-03

I’ve been looking at the Rust Ownership model . The skinny is that Rust has made mostly opposite decisions from C++. Copy vs Move An assignment in Rust is by default, a move. The original variable is declared as invalid and using it will net you a hard error at compile time. The example used in the docs is: let s1 = String::from("hello"); let s2 = s1; println!("{}, world!", s1); That last line will not compile because s1 is no longer valid....


Building the Latest Version of Hugo

Published on 2018-11-27

My mobile development environment is a chromebook with an arm64 (AArch64) architechure. It does have Linux (crostini) support. So, that means that I have a functional Debian Buster distribution. But the version of hugo that is currently in buster is 0.47 and I need at least 0.49 for the Hugo theme I’m developing. This short article show the process I finally came up with for getting that newer hugo....


Live on codevamping.com!

Published on 2018-11-21

Now officially live on the new blog at codevamping.com! The new site uses: Hugo - site building Jeffprod - theme Netlify - hosting Zapier - automated build for scheduled posts Google - as domain registrar. GitHub - for repostory hosting. I still have posts to migrate from the old site. That is a bit of pain, since it wasn’t originally written in Markdown. One tool that has been indispensible is Dillinger....


Chrome OS Linux Container (crostini) tips

Published on 2018-11-18

The new Linux Containers available on some ChromeBooks are manna from heaven if you are developer. Having a full blown Debian based distribution just a click away makes supported ChromeBooks very usable development platforms. And getting such a device can be cheap.

Here is a set of tips to help make things a little nicer.

...


Dotfile Maintenance

Published on 2018-11-12

Here is a party I’m a bit late in joining. And it is one of those ideas that makes you smack your head wondering why you didn’t think of it. Config file tweaks For years, I’ve maintained a tar.Z bundle that contains a .profile, .cshrc, .bashrc, .vimrc etc. You can tell how old it is by the fact that I still maintain it with compress rather than gzip. When I started it, gzip did not exist....


Dairying in Mongolia

Published on 2018-11-07

This will be a bit off from the normal fodder for this blog, but I thought it was interesting. Lets start with a bit of biology. Babies naturally produce an enzyme called lactase that allows them to digest the main sugar component of milk - lactose. Many (globally it would be most) people lose that ability near puberty. This leads to lactose intolerance and the GI issues it can cause. Many people of European heritage, however, are lactase persistent and maintain the ability to digest lactose - to the delight of the dairy industry....


Musical Sensors

Published on 2018-10-25

Vibrating cantilevers has a long history of being used as sensors, but almost always in the micro-domain. The cantilever is frequently etched into silicon or other substrate. The weight of even single molecules can be measured or detected. The idea is fairly simple. Change the distribution of weight on the cantilever, and the frequency of vibration will change. It can even be used as a motion detector since acceleration in the same plane as the natural vibration will either start the cantilever vibrating or will change the frequency of the vibration....


Onyx Spec Page

Published on 2018-10-22

I figured I better at least start the Onyx Spec page, so I did. You can find it in the Menu. Built in types are there now. Onyx Spec...


The Onyx Project

Published on 2018-10-14

I have decided to design, and build my own computer language. It will be called Onyx. I agree, that is a pretty big task. So we will take a bit at time. Design Criteria I don’t really have a whole lot yet. You might think of onyx as C++ EXCEPT - meaning, it acts like C++ EXCEPT these differences. Over time the list will grow and I’ll turn it into a full-feature language spec....


Spirit X3 Separate Lexer Part II

Published on 2018-10-08

Last time, we looked at the lexer and supporting staff. This time, we will look at the primitive parser and final usage. The full code is in GitHub . tok The tok parser is quite simple. Give it the TokenType to look for and it returns true if that is indeed the next token in the stream. This is the beauty of the separate lexer. The lexer is responsible for the hard work of classifying the characters and splitting them up into logical chucks....


Spirit X3 Separate Lexer - Part I

Published on 2018-09-29

Back in this post, I said about Spirit .. …it would be very feasible to write a lexical analyzer that makes a token object stream available via a ForwardIterator and write your grammar rules based on that. But is it ? really? The short answer is - Yes it is feasible, but probably not a good idea. The long answer is the journey we’ll take on the next two posts....


Static Exceptions

Published on 2018-09-27

Dynamic Exceptions have their flaws. Herb Sutter has proposed a replacement known as Static Exceptions . Lets look at it a bit. Before we do, we need to look at the C+11 feature std::error_code std::error_code and Friends Anyone who has done any coding in C knows about good old errno, the global int that many system functions will set to signal a problem. This, of course, has many problems, not the least of which is that different platforms could and did use different integer values to represent the same error....


MSSQL Pivot

Published on 2018-09-25

Pivots (turning a column’s values into actual columns) is a very common activity. Spreadsheet programs have robust support for it. But Standard SQL? Not so much. The Problem Create Table orders ( orderNumber int, sku char(3), quantity int, salesPerson varchar(10) ); insert into orders values ( 1, 'ZR34', 2, 'Mary'), ( 1, 'AS99', 1, 'Mary'), ( 2, 'ZR34', 1, 'Jim'), ( 2, 'MB01', 1, 'Jim'); The ubiquitous order table with the SKU, quantity and sales person....


Identifier Parsing in Boost::Spirit X3 - Custom Parser

Published on 2018-09-22

This time around, we will use a custom parser to handle the keywords. I really hadn’t planned on making this a series, but there you go. This will be the last - I think. Upgrades I started from the code from the last post, but did make a minor adjustment. I made underbar (’_‘) a valid character in an identifier. auto const ualnum = alnum | char_('_'); auto const reserved = lexeme[symtab >> !...


Identifier Parsing - Redux

Published on 2018-09-20

The ink hadn’t dried1 on my Identifier Parsing post when I realized that there was indeed a better way to handle multiple keywords. In that post I stated that a symbols<T> parser would not help because it suffered the same problem as lit(). Which is true. What I missed was that, of course, you could use the same trick with symbols as you did with lit() to make it work....


The Tools

Published on 2018-09-18

I thought I would take a moment and document my current development environment. The main computer runs windows 10. However, the development computer is actually a VirtualBox ArchLinux client running on that Win 10 box. I use X11 Forwarding to display back to an cygwin/X server running on the host. I am currently using Codelite as my IDE, though it has some rough edges. GNU compiler suite rounds things out....


Identifier Parsing in Boost::Spirit X3

Published on 2018-09-16

In Boost.Spirit X3, parsing identifiers is a bit tricky. If you are used to the distinction between lexical analysis and syntactical analysis (as I am), Spirit can take some getting used. Lexical analysis is done in the same grammar as the syntactical analysis. So the ubiquitous IDENT token type is now a grammar rule. To be sure, it doesn’t have to be this way. Spirit parsers work on iterator pairs, so it would be very feasible to write a lexical analyzer that makes a token object stream available via a ForwardIterator and write your grammar rules based on that....


Day One

Published on 2018-09-13

So, I decide to join the blogging crowd. It remains to be seen if it sticks. Why? I’ve been doing some home-brew software development lately and found that there were some things I wanted to say and no place to say them. So here is that place. This won’t be all about software development. There will undoubtedly be some music-ish things thrown in. And things about music software and probably software music too....