CJ Virtucio

Software Solutions

Polyglot, DevOps

Overview

When tasked with an R-based project, you might find yourself wanting to connect to an Oracle database. ROracle is one library you can use. This post is a guide on installing the library on CentOS 7.

Oracle Instant Client

First thing we need to do is install the right dependencies.

Install the yum repo and gpg key for Oracle Instant Client:

export ORACLE_INSTANT_CLIENT_VERSION=18.3
export ORACLE_YUM_URL=https://yum.oracle.com 
export ORACLE_HOME=/usr/lib/oracle/${ORACLE_INSTANT_CLIENT_VERSION}/client64
export ORACLE_YUM_REPO=public-yum-ol7.repo 
export ORACLE_YUM_GPG_KEY=RPM-GPG-KEY-oracle-ol7 

rpm --import ${ORACLE_YUM_URL}/${ORACLE_YUM_GPG_KEY};
curl -o /etc/yum.repos.d/${ORACLE_YUM_REPO} ${ORACLE_YUM_URL}/${ORACLE_YUM_REPO};
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/${ORACLE_YUM_REPO}; 
yum-config-manager --enable ol7_oracle_instantclient; …
read more

Working with Rscript without a strong statistics background can be a little daunting. Some of its functions seem to have pretty mysterious properties, and the documentation can be a challenge to grok without prior knowledge. One such function I’ve recently encountered is quantile.

The wikipedia article defines quantiles as:

cut points dividing the range of a probability distribution into continuous intervals with equal probabilities, or dividing the observations in a sample in the same way.

If you think of a dataset as a stream, a quantile is a point that divides the stream into a segment. There are several kinds, but perhaps the most common is the quartile. Quartiles are cutpoints that divide datasets into four parts. So, if you have a dataset of [1, 2, 3, 4, 5, 6, 7, 8], the first, second, third, and fourth quartiles are 1, 2, 3, 4, respectively.

I ran into an …

read more
Not just engineering

Developers sometimes get too engrossed in polishing up their technical abilities. They forget that code is only part of software development; there are others like managing expectations, and establishing trust with stakeholders. The following advice speaks to the non-technical half of the process, and is particularly relevant for junior and mid-level software engineers.

Take initiative

Mentorship can be great, but it’s not always available. Senior engineers are typically too swamped to give new developers the guidance they may (rightfully) expect.

You need to take a proactive approach. Onboarding documentation is prone to falling behind on current processes, especially when there’s a transition being made. This is usually the case for enterprise shops transitioning a legacy system to modern cloud-based deployment. Ask …

read more

About two weeks ago, I spoke about composition as a software engineering concept. Today’s topic is about a tool for bringing two components together: the interface.

In general, an interface is how two components communicate with each other. In a peer-based system, this means that a client and a server don’t talk to each other directly. Rather, the client goes through some well-defined entry point. With REST, for instance, clients can always assume that POST and PATCH mean very specific things, without having to know anything about the server. This way, the server can freely change anything about its own implementation without affecting any would-be client, so long as it continues to follow the REST protocol.

Most object-oriented programming languages have an operator named interface. This operator allows you to define some sort of contract about what methods …

read more

I’ve been programming for 3 years now, and something I’ve seen come up regularly is the concept of composition. My first encounter was with Eric Elliot’s Medium post on functional composition in Javascript.

My initial impression was that composition was a new idea that was popularized through the rise of Functional Programming. But then I started looking into dependency injection, which apparently had its origins in Java. This led me to the concept of favoring “Composition over Inheritance”, a best practice in object-oriented Java. More recently, I came across a hackerrank problem named “Roads and Libraries”, which basically boils down to figuring out the different components in the graph.

At a higher-level, you have the concept of modularity. It more or less aims to solve the same problems that object-orientation does: …

read more
Introduction

The internet is a system of components that are independent and interact only through messages. This is the RESTful web architecture. Clients and servers send each other representations of state, and do not share state. Hence the name Representational State Transfer (REST).

In law, we have this concept of ‘fortuitous events’. Things can go wrong, and many times they’re beyond anyone’s control. Maybe your internet goes down. Maybe a flash flood inundates the server room. Generally, events like these relieve both parties of a contract of their obligations to each other. Sounds a lot like REST, doesn’t it? Stateless system, independent components; they’re not bound to each other beyond the messages they actually send.

But because ‘the contract is the law between the parties’, you can ‘override’ this rule. Sometimes it’s helpful when you need to incentivize …

read more

Dynamic Programming is a powerful tool in solving algorithms. You basically take a problem, and attack it by saying that it’s the outcome of solving its sub-problems. In a way, it’s no different than the Divide and Conquer approach for recursive calls, except that you remember the results of solving those sub-problems as you go along so that you won’t end up having to solve them again. Let’s take a look at an example.

// Problem: You are given two arrays of equal length, each representing an assembly line. Each index represents 
// a station in the line. The value at each index represents the cost of transferring the machine from
// the previous station. Of course, putting the machine into the line in the first place carries a cost
// in itself. Write a function that returns an array representing the transfer costs per station of the
// path that involves …
read more
PAGE 1 / 1