Render a markdown table to docx with pandoc
Suppose you’re like me, in the middle of editing a Word document, and you realize that you’re fed up with Word. So you tell it to a colleague, who happily tells you: use pandoc, it can render docx files! So here you go, and you first try to convert this simple markdown: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | City | Population | Immigrants (%) | |:---------------|:-----------:|---------------:| | Laval | 440,000 | 31.5 | | Gatineau | 285,000 | 15.5 | | Trois-Rivières | 140,000 | 4.5 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Then you run this command, with a lot of hope: ...
Proof of Prompt
When I’m doing freelance software development projects and I’m asked how much time things will take, it’s always very hard to answer. It’s a very high dimensional problem, and you have many degrees of freedom: how much should you charge, should you do it per hour or not, if you use AI how should it be factored in the efforts and time you report, what is the separation between the stuff that you charge and the stuff for which you don’t charge, does asking questions to your client to better understand the problem, on Slack in the weekend, count as time or not? Facing these doubts, and if they forgo the route of charging by the hour (which can be logistically quite painful, and can lead to its own kind of bad outcomes) I guess that most people are quite happy to fudge a rough number for a flat rate, do a couple of rounds of negotiation, reach an agreement, and call it a day. They implicitly accept that the outcome of this process can go both ways: either you estimated too low, and this way you will lose something, or the contrary. And you hope that in the grand scheme of things, things should average out in a reasonable way: either your loss, or their loss, who cares in the end? But is is really working this way? ...
Ignore Your Check Engine Light at Your Own Peril
Currently in my car I have the “check engine” light being on, but it’s ok, because I know what is the problem, my mechanic told me that it’s <something>, and that even though it’s not ideal, it can wait while he finds the part to repair it (apparently it’s not so easy to find). There is something I don’t like about this though: if there is a NEW problem appearing, I won’t know about it, because this check engine light has only one state, and now it’s being used. ...
Learning Persian with Anki, ChatGPT and YouTube
I’ve been learning Persian (Farsi) for a while now, and I’m using a bunch of tools for it. The central one is certainly Anki, a spaced repetition app to train memory. I’m creating my own never-ending deck of cards, with different types of content, for different purposes. The most frequent type of cards is grammar focused phrases (very rarely single words) coming sometimes from my own daily life, but also very often directly from videos of the Persian Learning YouTube channel, created by Majid, a very talented and nice Persian teacher, in my opinion. ...
An Excel-like editable data grid widget with Streamlit
I recently spent a lot of time trying to come up with an interactive data grid widget in Streamlit. It needed to be a bit like Excel: the value you enter in a cell should trigger the recomputation of the value in another cell. At first I assumed it would be relatively easy, but given the powerful state management model at the heart of Streamlit, I found out that it wasn’t. State management for UI programming remains a hard problem, no matter what is the environment. The most difficult aspect of React programming, for instance, is certainly state management. The user-driven asynchronous nature of a UI makes it an inherently difficult problem. ...
What if AI Had Come First?
Imagine an alternate history in which AI, in the sense of our current LLMs, had come first. This possibly means that things would have looked much more like they did in the 2001: A Space Odyssey movie: computers having a user interface so powerful that you don’t really need anything else (apart from a set of fancy looking dashboards maybe). But this is not what we got. First we got something that looked quite a bit like an idealized “command box” (not vocal though, but textual), with which you could give instructions to the computer, almost as if you were talking to it. But not quite. These instructions had to be expressed in a “language” that the computer could understand, and of course it was far from human natural language. Very close to that command box was the notion of a written program that you could give to the machine, and which would be executed as a kind of chain of commands, in long form, with more elaborate logic and syntax. ...
AI in the Enterprise (what do you really think will happen?)
There’s a cottage industry of AI gurus who extol the virtues of being open about the advent of AI in the enterprise. Don’t be shy about it, AI is powerful enough as it is, and it can already help in the current state of its evolution (mainly, powerful chatbots that have access to certain “tools”, and vendor APIs with which to build some more customized applications, backed by cloud LLMs). ...
On Being Obsessive or Efficient
I was recently thinking about a dimension of intelligence and the mind that might have played a role in my school results of the past, and also my taste for computer programming. When you are taking an exam, careful management of your time might be a very good skill to possess, in the sense that if you are stuck on a given hard question, it might be preferable to rapidly switch on another one, with the goal of maximizing your overall exam grade, rather than completeness. But for some people, this, in itself, is difficult. ...
Conveying Math Intuition Is Hard
3blue1brown recently felt the need to add a supplementary video to its Grover’s algorithm introduction. Apparently, a lot of people have been confused by what I believe is basically just the logical structure of the concept, or why this algorithm is interesting and surprising in the first place. For someone who only knows about classical computing and a little about algorithm complexity, the simplest way to get an intuition about Grover’s algorithm might be to first consider this: ...
Extremely Quick Pacman-based OOP Primer
I have a friend who wanted to have a quick idea about whether he should use classes and objects for his project. Of course I told him that it depends.. on many aspects. He says that he doesn’t really like tutorials, so here I want to propose something more compact: the skeleton of a Pacman game, just the most basic concepts, without any bells and whistles (so of course not playable, although almost runnable). ...