Jay Paulynice

My scratchpad where I write about life, tech, cars, music, business and more.

De-Mystifying Learning To Play The Guitar

I have always found it helpful to write about new concepts I’ve learned. While I love writing code, sometimes I get an intense desire to learn or do something new.

Having said that, I recently picked up the guitar and to my surprise, it has been a lot easier than I thought.

I took a few music theory classes during my college years, but I never cared to learn an instrument until now. I can play a few notes on the piano like the start of Beethoven’s Fur Elise (thanks! to a girl friend who taught me), but I can’t really play a full song.

To a lot of people, music is an art and mystery they think they must have a natural ability for. I fell into this trap and hence why I never tried to learn an instrument.

The reality is music is all about learning abstract concepts. For example, Math uses the language of numbers and symbols to abstract the world. Music is really the same, but uses notes written on the staff to represent concepts like time, pitch, melody, etc. Math comes to most people easily because they are constantly dealing with those numbers and symbols in everyday tasks without thinking why a five is the shape it is (it’s that shape because we agreed what a five is universally).

Some of the things, I’ve learned so far playing the guitar:

It’s all about the chords (aka: the strings to hold down) and the strings to strum while holding a chord.

Someone might say: duh!

But that removes all the mystery of playing the guitar! The untrained person sees strings and fret wires, but the trained person sees chords: shapes they form with their fingers. I believe an experienced guitarist can play the guitar without an actual physical guitar. As a novice guitar player, after a few days of intense practice I can already feel how it comes naturally.

Before my guitar arrived, I picked up this book at my local Barnes and Noble:

Some of the basics of music in general:

How do we know what notes to play? In the picture below, we can see the abbreviation FACE starting with the first space going up so F-A-C-E for the spaces. The lines start with E from the bottom and so on so E-G-B-D-F for the lines.

How do we know how long to play a note?

And the time signatures (i.e: 4/4, 3/4 etc…at the beginning of the song):



The basics of the guitar:

The guitar has 6 lines with the thickest at the top and thinnest at the bottom and with each line representing a note (EADGBE). It’s also divided by fret wires with the first fret being fret 1.

Some basic chord shapes:

When I need to know what a chord shape looks like, I simply Google it. A chord shape has x, o, and numbers. The numbers represent the fingers you use from the index (1) to the pinky (4). x means you do not strum that string. o means you play the string open while holding down the numbers.

The C chord:

The G chord:

Some more chords:

What I’ve found the most difficult is moving from one chord to another smoothly and that I believe is the difference between an experienced and a novice guitarist.

Now that we know what chords look like, ever wonder how experienced guitarists can play without looking at their fingers?

The dots at the top of the guitar.

If you look closely, you’ll see the dots on the 3rd, 5th, 7th, 9th frets and 2 dots on the 12th fret. It’s somewhat of a cheat code!

That’s all for now. I will post some more as I learn more.


Building an OAuth2 Server and Resource

This is part of an authentication service I’ve been working on for a small app. The project is open source on my github here: oauth2-provider-resource. I decided to open source it in the hope that it may help someone trying to build a similar service.

My Year In Startup Land

It’s been quite some time since I last wrote on this blog. My hope is to write more often from now on maybe once a week.

The last year has been my crazy journey working on startup ideas. I left my role at Akamai, where I worked on very interesting projects on the web security team, to pursue ideas that I’ve always been interested in, but never took the time to follow through. Some of the projects I’ve worked on:

  • Medviv is a HIPAA compliant, cloud-synced app that helps patients easily stay on top of their health. Medviv uses AI/ML to learn about each user’s unique situation, so it can deliver custom notifications for appointments and refills, medication updates, and personalized healthcare. Received a lot of positive feedback from Boston Scientific’s Connected Patient Challenge and was a top 6 submission with 104 crowd votes and 3.9/5 from the judges who are MDs, PhDs, and veterans in the field. I hope to launch the beta version by the end of the year or early next year.

    Beta preview:

  • RESTfender is an IoT platform to connect and secure internet of things (IoT) devices from botnets. The project is launched with a number of users. Participated in YCombinator’s Startup School and have gotten some investor attention. Had a nice interview with the Techstars Paris program, but the product wasn’t quite ready to be accelerated. Would have been nice to spend my summer/fall in Paris, but alas! I’m currently working on it on the side collecting feedback, adding features and fixing bugs.

    Tech stack: React front-end, Django/Python/Django REST Framework API, Java reverse proxy, Apache Kafka, Spark, Zookeeper, Cassandra, Postgres, and a mixture of other things. The app is also integrated with Stripe for payments.

    Demo: RESTfender

  • Finally published JigDraw in the Google Play store, which is an app where users create jigsaw puzzles using their own drawings from the app. While it’s currently open source, I plan to publish a premium version that will be $1.99. The idea is to have a marketplace where you can sell your drawings so others can use them to make their own jigsaw puzzles.

    My attempt at drawing Simba from The Lion King:

    Full Demo:

I will write a much longer post soon about all the things I learned in the time from the maxed out credit cards, nights spent wondering the meaning of life, sleeping on the floor, almost fainted on a hot day, drinking away the sorrows and craving steak. On the other hand, it was totally worth it. I learned just about everything under the sun: marketing, selling, design, psychology, etc.


Building A Raspberry Pi 3 Cluster

I will write a much longer post about this at some point, but these are some pictures I took while building my raspberry pi 3 cluster.

I ordered a raspberry pi 3 when it came out on February 29, but it took 2 weeks to arrive and in total coincidence arrived home on pi day, 3/14.

I went to the Micro center here in Cambridge to find some more hardware to hook up my pi3, but to my surprise, I found they had several pi3’s at hand. I grabbed a few to build a cluster and this is the end result. I haven’t decided what project I will do with them, but this is just for fun for now.

Up and running:

4-node cluster:

The raspbery pi 3 unboxing:

The supplies:

The original PI:

Fixing Apache Mahout’s Connection Pooling Datasource Warning

I’ve meant to write about this some time ago, but forgot. While using Mahout to build a recommendation engine with a datasource like MySQL or PostgreSQL, one of the warnings one usually encounters is this:

“You are not using ConnectionPoolDataSource. Make sure your DataSource pools connections to the database itself, or database performance will be severely reduced.”

This is a weird warning because even if you’re using a connection pool, the warning will not go away.

Last week, I got very annoyed and decided to fix it. I dug through the source code on github and found this code in AbstractJDBCInMemoryItemSimilarity.java:

In order to create an item similarity based recommender with data stored in a MySQL database, we would do something like this:

MySQLJDBCInMemoryItemSimilarity extends SQL92JDBCInMemoryItemSimilarity which in turn extends the abstract class AbstractJDBCInMemoryItemSimilarity where the data source type is checked to make sure it is a ConnectionPoolDataSource type as above.

The fix is rather simple, but takes some time to dig through the code and figure it out. Here I’m using Spring to autowire my dataSource object, creating the tables and populating them with some initial data SpringDataConfig.java:

This requires commons-dbcp dependency like this:

The difference is instead of returning a dataSource that is an instance of DriverManagerDataSource, we return a new ConnectionPoolDataSource that takes in our normal data source. Mahout then takes care of the connection pooling as follow:

That’s it.

Detecting malicious web attacks with my simple server

Within the last week, I’ve noticed that my blog was frequently down with this error:

My first thought was that I must be getting a lot of visits, but eventually everything would go back to normal. So I restarted the mysql server and apache then all was fine. A couple hours later, I tried accessing my blog again and realized it was down again for the upteenth time.

With the small web server I’ve been working on, I decided to see what’s going on and where the traffic is coming from. I stopped my apache server and installed git, java and gradle on my ubuntu instance.

Once I got the code on the ubuntu instance, I started up my simple web server on port 80 and realized something weird…it seems that someone is running a distributed denial of service attack against my wordpress blog. Instead of using several machines, they’re running on the same IP but different port.

Request signature:


The attacker is using IP and trying to brute force a post request with some xml file to my wordpress xmlrpc.php page. Notice also they’re trying to access my blog IP directly. It could be some targeted attack against Digital Ocean where my ubuntu instance lives or the attacker just has a list of random IP’s they’re trying to attack. The content length also varies but is always in the 250-300 bytes…283 bytes in the case above.

Knowing this info, I modified my code to match the signature and silently drop the request:

Added a request request filter and defined these values:

The filter method:

Check if the signature match:

Then modified the code that handles the request to simply log the IP

The resulting logs from my simple web server showing the logged request and that the response is dropped:

I will add some more details later, but that’s all for now.

Simple Java web server – Part 2

This is a continuation from my last post on creating a web server in Java. The first part went through some basics of the Java NIO API’s…specifically using ServerSocketChannel, Selector, and SelectionKey to setup a thread to asynchronously read and write data to a channel/client.

To try the server, I deployed a sample backbone & marionette app I was working on then using chrome to test it:

Here I have the chrome dev tools opened and we can see all the requests the browser makes to build the html page.

Some server logs

I will add some more details soon. But the goal now is to make the simple web server highly scalable then make it secure through the SSLEngine which has a sample code here: Oracle SSL Engine Demo

Creating a simple web server in Java

This post is part of some ideas I have been working on. Initially, I was just curious about how to create a web server in Java…a simple server that accepts an http request and returns a response. As expected, the Java API is extremely high level…hiding all the nitty gritty details of network programming (TCP, IP, UDP etc…). Fortunately, I found this book: Unix Network Programming which is a definite reference on sockets/networking. While it’s written in C, I found the examples quite easy to read and understand.

As usual, the code is on my repository: simple-java-web-server

Main thread:

Initializing the server:

Implementing the run method:
As long as the server is running, continuously check to see if a client wants to do something: i.e: accept, connect, read or write.

Accepting client connections and registering the client for reading:

Reading from and writing to the client:
This is a rather simple server and reading and writing is done on the same thread. Here we read all the data from the client and based on the request, write back to the client with a response.

Configuring our application with spring annotations:

Finally the Main class responsible for running the server:

Jacoco coverage for multi-project Gradle setup

This post is about setting up a Gradle multi-project build with Jacoco to get an aggregate test code coverage report. This is something I struggled with at first, but with some free time in my hands yesterday, I set out to make it work finally.

The example is part of a Seed Project I have been working on for REST API using Jersey2/Spring.

See build.gradle for full example. The end results:

Coveralls integration:

Simple Html reports:

Building A Simple Movie Recommendation Engine

The goal of this blog post is to build a simple movie recommendation engine using Apache Mahout.

The code is on my github here: Movie Recommendation Engine.

I first came across Apache Mahout a couple years ago while researching machine learning libraries for a music application I was working on. Mahout’s goal, according to the official Apache web page, is “to build an environment for quickly creating scalable performant machine learning applications.” The latest version 0.10 seems to offer just that and more combined with Hadoop and several new features.

But today, I just want to look at a simple use case of building a movie recommendation API. The Use case:


  • A list of users
  • A list of movies
  • Similarities between movies…movie 1 and movie 2, etc.
  • Users preferences for each movie

For a given user recommend a number of movies.

This is similar to the feature we see all the time on Amazon after buying a book: “You might also be interested in that book”. This falls under the collaborative-filtering algorithms families whereby we have a database of user preferences for certain items like movies, books, etc and similarity between the items. Using that data, we can predict what a user would prefer.

Data Model:

The data model is somewhat simple:

  • users table stores user info
  • items table stores movie details
  • taste_preferences stores user preference for a movie
  • taste_item_similarity table stores similarity between movies

To start, I created an interface for the recommendation engine. While the data can be stored in a MySQL database, it can also live in a CSV file. Also recommendations can be user based or item based. With user based recommendations, the idea is to look for similar users and what items they like. Item based recommendation on the other hand mean given several user preferences for items, find similar items. Therefore, we can have multiple implementations.


MySQL Item Based Recommendation Implementation:

Initializing the recommender:

Recommending movies:

Getting movie details:

Example Response:

« Older posts

© 2018 Jay Paulynice