Learn to code through play

TL;DR: guided tutorials creating visual effects through visual code is the easiest onramp to coding.

For folks who don’t have several hours a day to devote to acquiring a new profession, you can still learn programming painlessly over time using visual code to program games.

I’ve ordered these from easiest and most playful to most like real programming. If one stumps you, go back to an easier one until you’re comfortable and confident again. Practice a few times a week or, even better, a little bit each day.

Once you realize that you can code and figure stuff out, you may be ready to prepare for a full time job programming. Check out my other posts geared towards that.

How to learn Carfax’s tech stack from scratch

TL;DR: watch online tutorials for and make your own projects with nextjs (react and typescript), and java spring boot.

Just skip past what you already know. The links below are free but it is more time efficient to get a paid subscription to LinkedIn Learning or Pluralsight for only a few hundred dollars. That way you have access to curated content that is time efficient.

Learn the lingo

Before you’re ready to follow along, it helps to get the lay of the land and the vocabulary.

Follow step by step tutorials on your own computer


Now that you have the lay of the land, it’s time to get a website running on your own computer. The easiest way to get started in 2021 is to 1) Download https://code.visualstudio.com/download and 2) follow a video tutorial on next.js to learn react, javascript, frontend and backend development. Javascript is the #1 language on the web, you can use it on the front and backend. Typescript enhances javascript with types.

You can follow https://developer.mozilla.org/en-US/docs/Web/Tutorials and https://developer.mozilla.org/en-US/docs/Learn/Front-end_web_developer to get a more holistic introduction to front end web development.


Yes, Nextjs is also a backend but it is good to round out your knowledge of the backend by learning Java Spring Boot. Most backends are written in Java at Carfax and Java is also the #2 language on the web today.

A more comprehensive overview may help you to Get started with Java .

Make your own projects

Now that you’ve watched a few tutorials, it is time for you to start building something on your own. Come up with an idea for a website or app and try to build it. You will get stuck. You will look around the web for answers. You will watch other people doing similar things. You will persevere and figure it out. This is web development! Frustrating and fun.

Getting hired at Carfax

Now that you’re experienced with Carfax’s tech stack, why not apply for a Full Stack Role at Carfax?

Here are some things that might help you get hired:

  • Get familiar doing coding exercises on HackerRank
  • Work with a buddy on a project. At Carfax, we get stuff done as a team using scrum so it would be great to see that you have some experience with that.
  • Deploy some of your projects to AWS
  • Create a portfolio website that shows off your projects

Check out my other blog posts on learning to code

Comparing Models in python

At work, I’ve been building predictive models. As I began to iterate on my models (Linear, DNN, Wide and Deep), I discovered that I needed a framework for comparing the models. After doing some reading, I landed on doing k-fold Cross Validation and then comparing the Mean Squared Error distributions of the test sets of the 2 models using the t-test for statistical significance.

Here are some useful snipbits:

Calculating mean squared error with numpy

mean_squared_error = ((A - B) ** 2).mean(axis=0)

A convenience wrapper around Scikit-learn’s KFold.split

from sklearn.model_selection import KFold

def split(pandas_dataframe, n_splits=10):
    k_fold = KFold(n_splits=n_splits)
    for train_indices, test_indices in k_fold.split(pandas_dataframe):
        print("train sz {}, test_sz {}".format(len(train_indices), len(test_indices)))
        yield pandas_dataframe.iloc[train_indices], pandas_dataframe.iloc[test_indices]

The t-test for comparing the 2 sets of mean squared errors you get from your 2 k-fold comparisons

from scipy import stats

def print_stat_sig(old_mses, new_mses, old_total_mse=None, new_total_mse=None, label_mean=None):
    statistic, pvalue = stats.ttest_rel(old_mses, new_mses)
    print(statistic, pvalue)
    if pvalue < 0.01:
        # Small p-values are associated with large t-statistics.
        print('Significant: reject null hypothesis, i.e. there is a statistically significant difference')
        print('old mse mean {:.3E}, new mse mean {:.3E}'.format(np.mean(old_mses), np.mean(new_mses)))
        if label_mean:
            print_diff_and_percent_diff("{:d}-fold ".format(len(old_mses)), label_mean, math.sqrt(np.mean(old_mses)), math.sqrt(np.mean(new_mses)))
            if old_total_mse:
                print_diff_and_percent_diff("total", label_mean, math.sqrt(old_total_mse), math.sqrt(new_total_mse))
        print('Not Significant: null hypothesis cannot be rejected, i.e. these 2 sets of values may have come from the same place')


Hadoop finally hits home

Big Data has finally produced results for my team at work. Other parts of the business have been working on transforming our company wide data lake into a structured, post business rule cache in Hadoop. Our team is now able to do terabyte scale transformations on this dataset in hours instead of weeks. We’re also able to delete code and reimagine processes. It’s been a long time in coming but we’re finally there. Thanks to the open source community for delivering the goods: Hadoop, Cassandra, and MongoDB.


Deploying Multiple Grails Apps to Tomcat7

Lately I pushed my second grails app to my production tomcat server. The second app failed to startup. /var/lib/tomcat7/logs/catalina.out gave a long list of errors the first of which was…

 Database may be already in use: “Locked by another process”. Possible solutions: close all other connection(s); use the server mode [90020-173].

It turns out that the databases were named the same in the grails-app/conf/DataSource.groovy file.

The fix is to make the names of the production databases to be meaningful and thus different. For instance, change  the bold part to something different.


environment {
  production { 
    dataSource { 
    dbCreate = "update" 
    url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE" 

Of course after this, you’ll need to redeploy (you’ll need to replace *.war with the specific version you want to deploy).

path/to/your/grails/project $ grails war
$ cp target/*.war /var/lib/tomcat7/webapps
path/to/OTHER/grails/project $ grails war
$ cp target/*.war /var/lib/tomcat7/webapps
$ sudo /etc/init.d/tomcat7 restart

Apache2 proxy for Tomcat7


Tomcat runs on port 8080 by default

You’ll put the following 2 lines in your /etc/apache2/sites-available/example.com file

ProxyPass /logger http://localhost:8080/logger
ProxyPassReverse /logger http://localhost:8080/logger

Make sure that the folder and the tomcat deployment are the same name or it won’t serve static content correctly.



MaxClients in Apache2 is a canary for other vhost logging misconfiguration

I first noticed a problem when the browser started timing out with the message “Establishing Secure Connection”.

I checked Apache’s log at /var/log/apache2/error.log and found the following

[error] server reached MaxClients setting, consider raising the MaxClients setting

I knew at 12:30 am I wasn’t getting that many legitimate users. I noted my other_vhost_access.log were getting huge and showing the following spam.

www.clayweidinger.com:80 – – [29/Mar/2014:00:16:50 -0500] “GET http://ib.adnxs.com/bounce?%2Fttj%3Fid%3D2443770%26cb%3D%5BCACHEBUSTER%5D%26referrer%3D%5BREFERRER_URL%5D%26pubclick%3D%5BINSERT_CLICK_TAG%5D HTTP/1.0” 200 0 “http://www.cashwargames.com/view/6407/barbie-pop-diva.html” “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20100824 Firefox/3.6.9”
www.clayweidinger.com:80 – – [29/Mar/2014:00:16:50 -0500] “GET http://ib.adnxs.com/ttj?id=2382498&cb=[CACHEBUSTER]&pubclick=[INSERT_CLICK_TAG] HTTP/1.0” 302 0 “http://www.wealthsuperman.com/index.php/component/k2/itemlist/category/42-credit-cards” “Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; en) Opera 11.00”

I disabled logging by commenting out the line in /etc/apache2/conf.d/other_vhost_access_log.




A meme is a picture with words on it?

ES: Our quality of life depends on recognizing we are agents of cultural adaptation. What we say and do matters. Looks can be deceiving, we are stronger than we think.

I recently overheard a coworker say that “A meme is a picture with words on it.” Understated. Every idea we have, word we speak, and action we perform has the potential to go viral just as this media format has. A meme loosely refers concepts that live in the mind or behaviors  that spread for whatever reason.

The word meme was patterned after gene, the basic unit of inheritance on the biological level. I guess changing the ‘g’ to a ‘m’ signaled that this was about the mind. Ask Richard Dawkins who coined the term. Genes and memes are similar but there is one huge important difference that is at the heart of my mission here.

Genes and memes spread: Some ideas spread with wild success. Malcolm Gladwell, in his book the Tipping Point, documents this. Chip and Dan Heath offer a framework for summarizing what makes ideas memorable in their book Made To Stick. As a member of a 7 billion strong human population, our genes must match our environment.

Genes and memes affect our behavior. Genes are our nature. Memes are our nurture. There is no sense arguing over which one has more of an effect on our behavior. They both do. My point is that we have conscious control over one: Memes.

Self-reflection and self-direction, consciousness and conscientiousness, mindfulness and right action: these are the stuff of memes. More than just funny pictures, they make this world a prison or paradise.


How to Learn How to Dev

Learning software development takes lots of time and grit.  In other words, it takes passion. The best motivation is to see your personal projects working. However, I have learned that diving in to building your project is not the fastest road to success. It is better to learn about how to use existing software that does similar things and then bridge that gap.

Of course, it is best to have a mentor to help you find software similar to what you imagine, but I’ll assume that if you’re reading this post it is because you want to learn to be a dev but don’t have a mentor and don’t have any idea where to find one. That’s the position I was in.

  • Google around for popular technologies that you can be gainfully employed at. If lots of people like to use it and make money doing so, chances are you can to.
  • Watch tutorial videos to get going quick.
    • Follow along with the tutorial on your own machine. Reproduce what they did. Only make modifications once you have the replication working exactly as expected.
    • udacity.com: starts at very basic level, interactive coding assignments give excellent immediate feedback
    • pluralsight.com: best if you are already a technical user trying to learn a different tech stack.
  • Google errors. Look for Stack Overflow answers that are highly rated or check-marked (as the answer)
  • Have interesting projects that push you to learn new technologies and get them working.
  • If you have been beating your head against a frustration for several hours, change your context. Do something else. If you are tired or it is late, go to sleep. Live to fight another day. Chances are that you’ll solve it in 15 minutes when you wake up tomorrow.
  • Listen to developer podcasts to hear what’s popular, important or perilous.
  • Find a mentor or dev community. Go to local users groups. Bounce ideas off other people.

Why devs blog IMHO

Here are some reasons why I think dev’s blog or at least ought to. The last is the most important

  1. Share ideas with a much broader audience than in an email list or chat room
  2. Establish themselves as knowledgable/skillful in a particular area
  3. Catalog problems/solutions for personal quick reference

The faintest ink is better than the best memory. As a full stack dev using multiple languages and frameworks, I often find myself in the situation of needing to re-figure out what I have already discovered. If it is not possible automate the problem away (viz. make executable documentation) then a blog post documenting the problem and solution are the best products you can give yourself and the world.