So far, this series has looked at how to create PostgreSQL arrays, how to retrieve data from them, and how to get the length of an array’s outer and inner dimensions. But one of the most common actions that we’ll want to do with an array is look inside to see if a particular value…
Friends of mine, who are not software developers, have a small, retail Internet business. The original developers created the application in Python, and my friends are looking for a full-stack Web/Python developer to help them. Frustrated with their inability to find someone who can commit to their project, my friends have decided to hire offshore developers, which…
I’ll admit it: When arrays were added to PostgreSQL a number of years ago, I thought that this was a really bad idea. I’m a firm believer in normalization when it comes to database design and storage; and the idea of putting multiple values inside of a single column struck me as particularly foolish. Besides,…
If you use a modern, open-source Unix shell — and by that, I basically mean either bash or zsh — then you really should know this shortcut. Control-R is probably the shell command (or keystroke, to be technical about it) that I use most often, since it lets me search through my command history. Let’s…
It’s always fun to start a new project. I should know; I’ve been a consultant since 1995, and have started hundreds of projects of various shapes and sizes. It’s tempting, when I first meet a new client and come to an agreement, to dive right into the code, and start trying to solve their problems.…
I teach Ruby and Python to a lot of people — in formal courses, and in one-on-one pairing sessions, both online and in person. I’ve found that for many people, the whole notion of functional programming seems strange and difficult, as well as something of a waste of time. After all, if you have objects,…
We’re nearly at the end of my tour of the “reduce” function in Ruby and Python. Just as I showed in the previous installment how we can implement the “map” function using “reduce”, I want to show how we can implement another functional-programming standard, “filter”, using “reduce” as well. As before, I’ll show examples in…
This is another installment in my “reduce” series of posts, aimed at helping programmers understand this function, with examples in both Ruby and Python. So far, we have seen how we can build a number of different types of data structures — integers, strings, arrays, and hashes — using “reduce”. But the really interesting use…