Technology

Creating Downloadable CSV (Or Any Other) Files In Browser With JavaScript

Many of us have wanted to create downloadable content straight from the browser.  I remember several years back where it was more difficult and the solutions were not clean.  Today, it is much much more simple and clean.  Enter Blob URLs.

In this example, I have an object of arrays.  These arrays may or may not all be the same length.  The csvify function accounts for this by letting the user optionally specify a default value and whether or not the pad at the beginning or at the end for arrays that aren’t the same size as the max.

It’s what comes after the csvify function that allows all this to work.  To make this csvified data downloadable, I first create a blob.  This blob contains the csv data and is created with the csv mime type.  I then create a url from that blob using createObjectURL and set that url as the href attribute on the download link.

Links:

Posted by Chad Dotson in Programming, Software Engineering, Technology, Tips, 0 comments

“On The Job Training” vs “On The Job Learning”

A career in programming consists more of “on the job learning” than “on the job training.”

Training

Training as something someone else teaches you to do.  There may or may not be any real expectation of advancing the concepts covered in the training.  The analogy would be that if you work in a sprocket factory, you are not taught about the design of the sprocket nor any concepts behind the design of sprockets, you are taught how to make sprockets given direction.  Training is limited, it can only take you so far in a programming career.

Learning

Learning is progressive and continual and a critical necessity for a career in programming.  You should spend lots of time learning concepts, principles, and techniques.  Then you should attempt apply and further those ideas.  A good programmer is always learning from their experiences and asking, “How can I do this better?,”  “Have I clearly communicated my intentions?,” and “Did I do a good job?”  Will you ever find that you have done a bad job or written crappy code, most certainly!  I think that realization is a sign of progress.

TLDR; Be a good programmer, don’t stop learning.

Posted by Chad Dotson in Key Concepts, Programming, Software Engineering, 0 comments