traviscj/blog

Posts

January 24, 2014

Ditching the consumer grade wireless router

My fiancée and I both spend a fair bit of time working from home, so we notice downtime almost immediately. We had a NETGEAR WNDR3400 which periodically disconnected one or the other of us, or just didn’t seem very zippy anymore. I was originally considering a top-of-the-line router, such as an Airport Extreme, a NETGEAR Nighthawk AC1900, or an ASUS RT-AC66U.

I had been looking into alternatives for a while, and decided to pull the trigger on the following setup:

read more
December 29, 2013

language fluidity

I have learned a lot of programming languages over the course of my life. So I wanted to do two things:

  1. Discuss a few effective ways to pick up a new language.
  2. Discuss a few references that I’ve found helpful for some languages. I should start with a disclaimer: I do enjoy learning new languages, but mostly I enjoy creating things in those languages. I’m not sure all the effort I have spent learning many languages would not have been better spent learning many fewer languages to a deeper level, but I do feel like it is extremely important to learn principles, not languages, and to use the best tool for a particular job. Many times principles are most clearly illustrated with contrast between languages, and many more times a particular tool has been a patently poor choice for a particular job.

That being said, it’s important to know your “first tongue” languages in significant depth.

read more
November 16, 2013

square

I probably should have been working on my thesis, but I had a phone interview with Square. I wanted to write a bit of code to get myself “warmed up” but wanted it to be kinda fun. So I decided to write some code that drew a square.

#include <iostream>
using namespace std;

int main() {

    cout << "+";
    for (int i=0; i<8; i++) cout << "-";
    cout << "+" << endl;

    for (int j=0; j<5; j++) {
        cout << "|";
        for (int i=0; i<8; i++)
            cout << " ";
        cout << "|";
        cout << endl;
    }

    cout << "+";
    for (int i=0; i<8; i++) cout << "-";
    cout << "+" << endl;

    return 0;
}

which yields a nice little square:

read more
October 27, 2013

some setup notes

zsh

Zsh is an amazing (mostly) drop-in replacement for bash.

On OSX, just run

> brew install zsh

You also want to install oh-my-zsh.

I went a little crazy with plugins. My list is:

plugins=(autojump brew git git-flow gnu-utils gpg2 osx textmate zsh-syntax-highlighting history-substring-search)

SSH

I ssh a lot. So I have a bunch of host entries in my .ssh/config file. Each looks like:

Host [shortname]
     Hostname [hostname]
     User     [username for hostname]
     IdentityFile [my home directory]/.ssh/[id_rsa file for this host]

You also need identity files for hosts you use. I tend to use a different one on each host I connect to; some might consider this overly paranoid. Probably it’d be better to use 1 key but only for a shorter period of time. In any case, you need to use

read more
October 23, 2013

overly-ambitious-isqo and the design of numerical codes

I have finally released the overly-ambitious-isqo project on github!

I wanted to call out two particular design concerns I had.

rich language

My first goal was to try very hard to build up the C language to very succinctly express the main algorithm in src/isqo_functor.cpp in extremely rich language. It seems like numerical code is typically implemented with loops like for (int i=0; i<N; i) and method calls like deltal(xhat, mu). I have found it much easier to reason and think deeply about codes like for (int primal_index=0; primal_index < num_primal; primal_index) and method calls like linear_model_reduction(penalty_iterate, penalty_parameter).

read more
October 17, 2013

a really simple iterative refinement example

I wanted to have a quick example of what iterative refinement is and looks like.

Suppose you wanted to solve the (very simple!) problem of solving 5.1x=16, without dividing by decimal numbers. (Yes, this is a bit contrived–I’m not sure why you would be able to divide by an integer to get a decimal, but not divide by a decimal to get a decimal. Bear with me.)

The standard way would be, of course, to simply evaluate x = (5.1)^{-1}16=3.137254. But this is not available–you can’t find an inverse of multiplying by 5.1!

read more
September 20, 2013

C/C++ Values, Pointers, and References

I had an embarrassing realization: While C does have an address-of operator, it does not include reference variable or pass-by-reference syntax. It’s embarrassing because I should have realized that it was a C++ invention; I guess some of my “C” code actually really has been C++ code.

For future reference, here’s the current summary of my understanding:

var *var &var
int xv=3; value invalid memory location of value
int *xp=&xv; memory location value memory location of pointer.
int &xr=xr; value invalid memory location of value (all invalid in C)

As one other note, there are three ways you can pass things in C:

read more
August 19, 2013

Numerical Development on OSX (in the Command Line)

I’ve been working on C implementations of my research projects, which can of course be a perilous project. I’ve found some tools that make it hugely, hugely better.

Homebrew

You can’t do a list like this without mentioning homebrew. You want homebrew instead of MacPorts or Fink or bailing twine and chewing gum or whatever else you were thinking about using. Just do it: You can find the homepage at brew.sh or just install with:

read more
July 31, 2013

spring-mass visualization

I’m working on a paper about an algorithm for hotstarting nonlinear program solves; one application of this might be in the realm of nonlinear model predictive control. In these types of models, we first define the physical equations for the system under consideration. They are subject to some control parameters, which are just a mathematical representation of the input we could give the system. We also define an objective–something that we would like to minimize(usually something like time or energy).

read more
July 30, 2013

python decorators

I came across something that I think is actually pretty neat. Python supports ``decorating’’ functions, which lets you define behaviors that essentially wrap around a given function. The benefit is that you can write a simple function and decorate it to do something fancier.

I realized I wanted to do this with a simple timing output. Say my function was just something really simple like

def f_plain(x,y):
    print("x + y = {}".format( x+y))
    return x+y
print ("---")
print (f_plain(1,3))

Now, to time it, I could define a function like:

read more
  • ««
  • «
  • 8
  • 9
  • 10
  • 11
  • 12
  • »
  • »»
© traviscj/blog 2025