Brad Lucas

Programming, Clojure and other interests

Auto Increment Key In Postgresql

October 7, 2017

In MySql and MariaDB you can create a unique identity value for rows with the AUTO_INCREMENT attribute. PostgreSQL has the same idea with the SERIAL attribute.

 name VARCHAR(254) UNIQUE,

The example also shows how to have a column which stores the time when the record was created.

Continue reading →

Install PostgreSQL On A Mac Using Brew

October 6, 2017

To install Postgres on a Mac you can use brew.

$ brew update
$ brew install postgres

To create a database for yourself and login.

$ createdb `whoami`
$ psql
Continue reading →

Clojure Ads Txt Crawler Saving To A SQLite Database

October 5, 2017

SQLite is a small self contained SQL database engine that reads and writes to a normal file. It is a good first pass for adding database storage to your application. It's easy to use and with a single file to deal with offers no real issues. Being a SQL database though means you won't be far off if you decide to up your database requirements to Postgres or some other database system.

My recent project of building a Clojure Ads.txt file crawler is a good target for SQLite support for a couple reasons. One is that the project is simple and works just fine writing to result files but having a database would be good in the long term especially as the project grows. Second is that the original Python Ads.txt file crawler defaulted to writing to a SQLite database. I figure the Clojure project should at the very least be able to do the same.

The results of adding SQLite are in the repository if you are curious.

Continue reading →

Git Stash Pop Conflict

October 4, 2017

It is true that creating branches in Git are easy and cheap so you don't really need to git stash something. But, sometimes you don't want to save something to a branch because you really want it to be a temporary thing so you stash it.

Sometimes though you'll stash something then merge your feature branch and when you git pop conflict the stash back you'll have a conflict.

You'll see "unmerged paths" which is your clue to this situation.

What to do?

Continue reading →

Ads Txt Top 100 Domain Results

October 3, 2017

The Clojure Ads.txt crawler is working well. Using the top 100 domains list from the crawler creates the following results:

Domains with Ads.txt files

Domains without Ads.txt files

Continue reading →