TL;DR — Dataclasses are a great solution for creating a simple and extensible model class that wraps the underlying Cloud Firestore client. To install, do this: pip install
firestore_model. Check it out here
In this article, I’ll quickly demonstrate how to upload an image file to Google Cloud Storage from a Flask app on App Engine Standard. Additionally, I’ve added a bit of code that crops and resizes the image before storing it.
In this tutorial we'll take a look at the slice operator of the Numpy array. This feature of Numpy is virtually indespensible when working with multi-dimensional arrays.
Shortly after launching this site in 2015, I became very busy with work and life and didn't make enough time for maintaining it. In the meantime, I worked on many interesting projects and learned a lot. I'm looking forward to getting back into the rhythm of writing about my experiments and work in programming and various tech. In an attempt to bolster some momentum and reacquaint myself with the code for this site, I've spent the past few days making some long intended updates which have included the following:
In the last article we took a look at a simple k-means implementation using Python. In this article we will sophisticate our previous work by doing away with hard coded data, replacing the Vec class with Numpy arrays and visualizing results using matplotlib. The source code for this iteration can be found here. We will not go through it line by line, but we will look at the most significant improvements.
In this article we will build a k-means clustering algorithm. We will use plain old Python and no other third party code. The goal of this article is to convey the basic structure of the k-means algorithm by developing a minimal working example capable of clustering a 2D dataset. It is expected that you understand basic programming, simple vector math and that you have at least some idea about how k-means works. Let's get started.
In my last article I wrote about how to create an Icosahedron using Swift and SceneKit. The example used hard-coded values for the vertices and indices that define the shape. In this article, I'll show how we can create a sphere using that same data for initial values combined with an iterative algorithm. The algorithm takes each face of the Icosahedron and sub-divides it into four new triangles. The vertices of which are turned into new faces to be once again sub-divided in the next iteration.