The Layman's Guide to git Sync'ing

  • Posted on: 25 June 2016

This article primarily deals with syncing a local git repo with a remote, for beginners, or for people who can't get interested in the details of source control, or for people who want to be interested in the details of source control, at a later date, and are looking for an entry point.

I'll go over a little personal history here with respect to git; skip it if you feel like it.

History

Recently at my place of work, I suggested that we move to git.

Variadic template make_CString for MFC's CString

  • Posted on: 27 February 2016

For reasons beyond my control, I often work with a codebase that makes use of Microsoft MFC's string class, CString. CString has its detractors and proponents. I don't have a whole lot to add to the debate that hasn't been said already. Instead, I'm going to focus on using C++ variadic templates to get around one of my least favorite CString "anti-idioms". Since I'm not overly familiar with variadic templates, I plan to go over them in slow-mo.

My First Experiment with C++'s std::thread

  • Posted on: 30 January 2016

std::thread is a big step forward for multi-threaded applications written in C++. I suppose people have written their own cross-platform thread wrappers before, but for the rest of us, there's no more dealing with POSIX threads vs. Windows threads etc. std::thread is also far more 'natural' to C++ than openMP is out of the box, which is what I used pretty often in the past. By natural, I mean that one can write:

Tutorial: using cURLcpp to Create a C++ Web Reader in Ubuntu

  • Posted on: 8 March 2015

In this article, we're going to create a C++ application with cURLcpp that reads a webpage and prints the HTML source to stdout.

I wanted to try cURLcpp as opposed to the tried and usually true cURLpp, mostly for fun.

The bulk of the article is really a "for-dummies" guide to setting up your environment to do so. I won't really go into detail about how to use cURL or cURLcpp. In fact, we're just going to compile the first example from the cURLcpp readme. Once you've got a good cURLpp development 'environment' setup, it shouldn't be too hard to cut and try different cURLpp features and code.

Prereqs:

LT Spice Tutorial: Custom Blocks / Parameterized Subcircuit Models

  • Posted on: 18 January 2015

In this tutorial, I'm going to introduce an extremely useful feature in LT Spice -- how to create a custom, parameterized part. I don't actually know what to call the resulting 'object' Maybe a block, a model, custom subcircuit, custom part -- I'm not sure.

The point is, you're going to have a custom circuit that you can create a simple symbol for, and then import and use with other circuits. Furthermore, instances of your custom model can have per-instance parameters!

For our example, we're going to create a simple model for a low pass circuit. We'll be able to import this block into other circuits, but each can have its own 3 dB roll-off frequency.

To start, we have to draw the model...



Drawing the model circuit.

Hexadecimal Clocks in Javascript (to be updated)

  • Posted on: 10 January 2015

Hexadecimal clocks are pretty cool. They just take the hours, minutes and seconds of the current time, and concantenate them to form a hexadecimal color. We can do whatever we want with the color, I suppose. For example, if the time were 11:14:45, we would display the color #111445.

This is the 'classic' hexadecimal clock, which was described above. I have reproduced it here:
Original Hex. Clock

Here's a slightly different mapping. In this mapping, we use a 12-hour/am/pm clock, and use the hexadecimal equiavlent of the hours for the red digts in the hex color. For example, 11:14:45 am maps to #0B1445. Here it is:
Hex. Clock - Hex Hours Representation.

Debugging Custom C++ Types in Codeblocks (Code::Blocks)

  • Posted on: 14 December 2014

When I develop C++ on Linux, and I'm not in a purist/makefile/command-line mood, I like to use Code::Blocks. It doesn't quite have the feature set that Eclipse does, but Eclipse always feels a bit cumbersome to me. On the flipside, Code::Blocks seems much more lightweight.

In this article, I'm going to explain how to debug custom types with Code::Blocks. First, let's look at a motivating example. Here's a cpp file that defines and uses a simple array class, myarray:


#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cstdlib>

class myarray
{
    public:

    myarray(int sz):
        n(sz),
        arr( new double[sz] )
    {}

    ~myarray(){ delete[] arr;}

    double* arr;
    int     n;

};


int main ()
{
    std::cout << "custom type test" << std::endl;

    int n = 5;

    myarray the_array(5);

Alpha-Surf, my half-baked Google Chrome Extension

  • Posted on: 9 December 2014

A while ago, I hurt my wrist in a way that made it painful to use the mouse. This obviously put quite a hindrance on my ability to effectively surf the internets.

I was able to get around on most websites pretty easily with keyboard shortcuts, but I found that tabbing through links was still pretty tedious and time consuming.

I was using Google Chrome at the time, so I decided to try to write up an extension to help me 'tabigate' through links on a page more effectively. The extension would let me tab through links based on the first letter of the text in the link. For example, if you wanted to get to this link:

Blog Home

You could hold down the 'X' key to activate the letter-based tabbing, and then press the 'b' key. Only links that began with 'B' would be tabbed through. Maybe 'X' is a poor choice for activation, but most of the special keys have functions I didn't want to hijack.

Pages