Skip to main content

Python

If you are like me and sometimes you forget the syntax on how to sort a list of custom objects by property then this tutorial is for you.  It seems like there is always a need to sort and manipulate custom objects by property and that was my why I wanted to write this tutorial.  To demonstrate how to take a custom list of objects and sort those objects by a specific property.  In the case of this tutorial I have chosen to use a date property because sorting by date is a very real world example of something you may run into in the work place, but the same code would also work for numbers or

If you have ever wanted to know how to open a file using Python, but were unsure of the syntax, or exactly how Python works with files, then this tutorial is aimed at you.  This tutorial aims to walk you through the basics of how to use Python to open a file using two different real world scenario's.  The first scenario I walk through how to use Python to open a file from the command line using the file as a command line argument passed in from STDIN.  The second scenario I use Python to open a file that is referenced from a file path anywhere in your program.

If you have ever wanted to use Python list comprehensions, but were unsure of the syntax or exactly how they worked, then this tutorial is aimed at you.  This tutorial aims to walk you through the basics of how Python list comprehensions work with three real world examples.  In the tutorial below I have three examples of the power of Python list comprehensions;  The first example illustrates how to setup and create a basic list comprehension.  The second example get's a lot more complex and uses two nes

Since the announcement of CoreML at WWDC this year I have been very excited to get in and start researching all the capabilities of Apple's new machine learning framework. One of the ideas I had to test the capabilities of CoreML was to build a recommendation engine to provide users of an application with musical recommendations based upon a library of known selections. CoreML would be used in this recommendation engine to fit musical selections to a machine learning model called a linear regression model.

If you have ever wanted to compile and install multiple versions of Python side by side on the same Linux or Mac machine then this tutorial will walk you through how to set that up.  One reason you might want to run different versions of Python at the same time is to test out a specific implementation or test different environments against a specific feature.  Thankfully, running multiple versions of Python at the same time can be setup with relatively few steps.  Let's get started!

 

If you have ever wondered how to find a substring inside another string in Python then hopefully this tutorial will help walk you through how to do that.  As an example, in Python 2.7 or above, if you have ever wondered how to determine if the substring "Agnosticdev," is part of the parent string "Hello Agnosticdev, I love Tutorials," then this tutorial will show you how to indicate, with a boolean value, the existence of the substring.

Looking ahead to the rollout of Swift 4 on Jun 5th at WWDC I have been scanning the Swift Evolution Github page to get a feeling of which of the proposals will make the cut for Swift 4 and which proposals will push ahead to later version of Swift 4.*.  One proposal in-particular that caught my attention was proposal 168, for multi-line string literals.

Recently, I was working on some Python code where I needed to keep track of an ordered list of functions to where I could call these functions again at any given time based upon a numeric index.  Think of this situation like a list keeping track of an object by index, but instead, I wanted to keep track of a functions by index.  My first thought was to try and create some sort of generic object that could manage all of these functions and the specific ordering that I needed.

I was recently asked in a computational project to generate prime numbers to be used in public key hashing routines.  The idea was that I needed to write an algorithm that finds prime numbers between a specific range and then those prime numbers would be randomly assigned to a list and then multiplied together in sequence to produce large complex numbers that would then, in turn, be concatenated together to form variations of public keys.

PyData Chicago 2016
Featured Post

This past weekend I am happy to have attended PyData Chicago 2016, put on by PyData and held at the University of Illinois Chicago at the UIC Student Center.  PyData Chicago 2016 was a conference all about using Python along with data science and open source tools to help data scientists, developers, and academics better get their jobs done in a more efficient way.  Before I go any further...