Today, I was building a REST client for one of the REST server applications using Python. I decided to use Python requests library for writing my REST API client. Requests is a very easy to use library that you can use to quickly bootstrap your REST API client. Writing REST client for REST endpoints was a matter of an hour. This REST API client will be used from our custom Jython(JVM implementation of Python) REPL. REST API has only two endpoints that return JSON objects. Response of first endpoint was fed to the second endpoint. I was returning the JSON response as Python dictionary. User can change values of the first response and pass it to the second API call. In Python, you work with dictionary as shown below. Continue reading
Let me start with the confession that I am not an expert Python developer so this might not be a surprise for some of you. Yesterday, I was working on a Python REST API client using awesome
requests library for one of my server application. To quickly hack my client, I created a Python virtual environment using
virtualenv and installed required libraries using
pip. I was ready to play with Python(again). I created a new file
abc.py and added a method. For demonstration, let’s suppose our method is called
hello, as shown below. Continue reading
Last week we learnt the basics of Slick library. We started with a general introduction of Slick, then covered how to define a table definition, custom mappers, and perform insert queries. Today, we will learn how to perform
select queries with Slick. Slick allows you to work with database tables in the same way as you work with Scala collections. This means that you can use methods like
sort, etc. to process data in your table.
You can read the full blog here https://github.com/shekhargulati/52-technologies-in-2016/blob/master/05-slick/README.md
Welcome to the fourth blog of 52-technologies-in-2016 blog series. Today, we will get started with Slick. Slick(Scala Language-Integrated Connection Kit) is a powerful Scala library to work with relational databases. Slick is not an ORM library. It bases its implementation on functional programming and does not hide database behind an ORM layer giving you full control over when a database access should happen. It allows you to work with database just like you are working with Scala collections. Slick API is asynchronous in nature making it suitable for building reactive applications. Although Slick itself is asynchronous in nature, internally it uses JDBC which is a synchronous API. Slick is a big topic so today we will only cover basics. I will write couple more parts to this blog.
The core idea behind Slick is that as a developer you don’t have to write SQL queries. Instead, library will create SQL for you if you build the query using the constructs provided by the library.
You can read full blog here https://github.com/shekhargulati/52-technologies-in-2016/blob/master/04-slick/README.md
So far in this series, we have looked at finatra and sbt open-source Scala projects. This week I decided to learn Stanford CoreNLP library for performing sentiment analysis of unstructured text in Scala.
Sentiment analysis or opinion mining is a field that uses natural language processing to analyze sentiments in a given text. It has applications in many domains ranging from marketing to customer service. Few years back, I wrote a simple Java application using Naive Bayes classifier to determine whether people liked a movie or not based on sentiment analysis of tweets about a movie.
From the Stanford CoreNLP website,
Stanford CoreNLP provides a set of natural language analysis tools. It can give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, and mark up the structure of sentences in terms of phrases and word dependencies, indicate which noun phrases refer to the same entities, indicate sentiment, extract open-class relations between mentions, etc.
You can read full blog here https://github.com/shekhargulati/52-technologies-in-2016/blob/master/03-stanford-corenlp/README.md
Welcome to the second blog of 52-technologies-in-2016 blog series. From last year, I have started using Scala as my main programming language. One of the tools that you have to get used to while working with a programming language is a build tool. In my office projects, we use Gradle for all our projects be it Scala or Java. In most of my personal Scala projects, I have started using
sbt as my preferred build tool.
sbt is a general purpose build tool written in Scala. Most of the time we try to hack our way while using a build tool never learning it properly. As Scala will be the language that I will cover most in this series, I decided to thoroughly learn
sbt this week. We(developers) often underestimate the importance of learning a build tool thoroughly and end up not using build tool in the most effective way. Good working knowledge of a build tool can make us more productive so we should take it seriously.
You can read full blog here https://github.com/shekhargulati/52-technologies-in-2016/blob/master/02-sbt/README.md
Few days back I had a requirement that I had to use boto3 with Jython. boto3 is AWS EC2 python SDK that you can use to work with various Amazon Cloud API’s. Jython is the JVM implementation of Python. We were packaging our Jython scripts and boto3 and its dependencies inside a JAR. boto3 and Jython work great together when you use them in a normal way i.e. when boto3 can load its data model files from file system. This does not work when you package your script and its dependencies inside a JAR as the model files are then not available on the filesystem but are available on the classpath. In this blog, I will show you how we used boto3 to overcome this limitation. Continue reading