Easily search a java list using java 8 predicate functions.
“Make improvements, not excuses. Seek respect, not attention.”
― Roy T. Bennett, The Light in the Heart
Searching, sorting and iterating are some of the fundamental operations required when using a list. Searching refers to finding one or more objects in the list that match a given condition. In this article, we look at some methods for searching a list in java.
Continue reading “Searching a List in Java”
Learn how to sort a List in java. Use Java 8 Lambdas to compose sort conditions.
“You can only be afraid of what you think you know.”
― Jiddu Krishnamurti
Sorting a list is a very common requirement when programming in java. Out of the box, java provides for sorting using a performant algorithm so there is no need to roll your own algo for the purpose. In this article, we demonstrate how to sort a list in java.
Continue reading “Sorting Lists in Java”
Introduction to Sorting Dictionaries in Python
Dictionaries in python are unsorted. They are stored by the hash value of the key, and this allows for fast lookup. In this article, we show a couple of ways in which dictionaries can be sorted.
Continue reading “Sorting Dictionaries in Python”
Python supports sets which are a collection of unique elements and provide operations for computing set union, intersection and difference.
“The world is a book and those who do not travel read only one page.”
― Augustine of Hippo
A set is a collection of unique elements. A common use is to eliminate duplicate elements from a list. In addition, it supports set operations like union intersection and difference.
Continue reading “An Introduction to Python Sets”
Learn how to use Python Scrapy to Extract information from Websites.
“When life gives you lemons, chunk it right back.”
― Bill Watterson
Scrapy is a python-based web crawler which can be used to extract information from websites. It is fast, simple and can navigate pages just like a browser can.
Continue reading “Getting Started with Scrapy”
Learn how to list contents of a directory from python. Also, easily find and process files matching conditions from your python program.
“If at first you don’t succeed, destroy all evidence that you tried.”
― Steven Wright
There are several methods to list a directory in python. In this article we present a few of these along with the caveats for each.
Continue reading “Listing a Directory With Python”
Learn how to build regular expression patterns for parsing phone numbers, emails, etc.
Regular Expressions provide a powerful method to handle parsing tasks while handling texts. Whether the problem is a simple search for a pattern, or splitting a string into components, regular expressions are widely used today.
Continue reading “Regular Expressions Examples”
Learn how to use Jackson Streaming to convert a large CSV to JSON.
“We are a way for the cosmos to know itself.”
― Carl Sagan, Cosmos
Let us today look into converting a large CSV to JSON without running into memory issues. This previous article showed how to parse CSV and output the data to JSON using Jackson. However, since that code loads the entire data into memory, it will run into issues loading large CSV files such as:
Continue reading “How to Convert Large CSV to JSON”
Learn how to use the Timer and the TimerTask classes to implement simple task scheduling for your application.
“Humor is reason gone mad.”
― Groucho Marx
Scheduling tasks to run is a need which sometimes arises in a java program. Maybe you want to run periodic cleanup of some resource. Or check on the status of some job. Or maybe fetch a URL which might not be available the first time.
Continue reading “Using Timer Class to Schedule Tasks”
Learn how to massage data using pandas DataFrame and plot the result using matplotlib in this beginner tutorial.
“There is only one thing that makes a dream impossible to achieve: the fear of failure.”
― Paulo Coelho, The Alchemist
Matplotlib is a graphics and charting library for python. Once data is sliced and diced using pandas, you can use matplotlib for visualization. In this starter tutorial, we take you through the steps to do just that.
Continue reading “Pandas Tutorial – Using Matplotlib”