Category Programming
I needed to trust my gut feelings: Kotlin and Android
In this year top-5 promising languages list, I put Kotlin in fifth place among the languages that you should definitely check in 2017. This week Google I\O announced that Kotlin is now an officially supported language for Android Development. I like to be right in my forecast. However, I need to be honest. Back then, I didn’t know well why I put it there. I just had some kind of ethereal intuition.
In the article I wrote:
How to build rusqlite on Windows
Yesterday I spent way more time than needed for compiling this dependency on Windows. The problem is that the error was not informative enough and hard to google, and, mostly, that there is no standardized way to look for installed libraries in Windows. Just to be clear, there is no reliable way to use pkg-config
on Windows as in Unix-like systems.
The problem
The rusqlite crate is an ergonomic binding of SQLite in Rust. To work, it needs the original library installed. Unfortunately, on Windows is relatively hard to find the path or the list of the installed development libraries. It is not impossible, but it is harder because Windows ecosystem has not a standard software or API to obtain this information. If you try to blindly add rusqlite
as a dependency and compile your crate you get a cryptic error:
Any news from Clojure front?
Some days ago, I was cleaning my Code folder from old snippets and test projects when I found an old Clojure package I did to test some Clojure feature. I remember that I kept the project sleeping in my Code folder because I thought that it would come in handy when Clojure 1.9 would be released. However, I left that project stub back in February 2016, more than a year ago. That raise the question: where is Clojure 1.9?
Most Promising Programming Languages of 2017
Another year, another 5 promising programming languages you should keep an eye on in 2017. As usual, I’d like to write the warning I put here every year: in this list, you will not find programming languages for hiring purposes, but for very long-time investments and for pure programming fetish.
So, now that you know what I am talking about, here we go with the top 5 for 2017.
Top 5 Promising Programming Languages for 2017
Rust
How to build a Telegram SpyBot
Internet/Tech literate people continuously talk about privacy. The majority of people, however, do not care. This is hard to digest for the first group of people, but it is the truth and we should start considering this fact to make things better in the future.
Why I’m talking about this? Because, in the last weeks, I’ve found an extremely easy way to spy any Telegram group. It is not a dark market secret (in fact it is perfectly documented in the Telegram Bot API), but works perfectly because nobody cares. While every internet and privacy activist is talking about how Google, Facebook and Yahoo are spying on our email, telegram bots that are actually logging all the messages in all the groups in plain text. They are bot, by unknown programmers, without ToS, without anything, reading all your messages and potentially storing them who knows where.
So, I will explain to you how to build a Telegram SpyBot. Hopefully you can use it to teach some privacy lesson to your friends.
Python for Practical Statistics
These days were a bit busy. I want to break the silence with an interesting link to a video. This is an interesting and fun to watch talk coming from the last PyCon. It talks about “practical statistics”, that is, how you can try to produce (or validate) a model when you can not compute the analytic model of a phenomenon. Many of the technique he describes can be used to any language, so it is suitable even if you do not program in Python. Anyway, look that, it is worth it. Moreover, this is just an excuse to suggest you to look around all the other videos from PyCon. They are well made and there are some interesting talk that should be watched.
My view on Elixir and Clojure
Elixir and Clojure are two uprising and fun functional languages. As you know, I talked about both of them in the article on the most promising languages of 2016, and, in fact, they are the only real functional languages I mentioned in there.
At the time, I didn’t really explore these two languages in deep, and in fact, I think I was a bit too hard on Clojure. During this half year, I had the opportunity to go deeper in Clojure and my opinion on the languages increased accordingly. Moreover, Clojure 1.8 came out just a month later with some nice improvements and the upcoming Clojure 1.9 (with the introduction of the `clojure.spec`) seems to push the bar even further. So, yeah, I was wrong on a big point: Clojure is advancing quite fast.
TypeScript Binary Heap
Yesterday I converted a Binary Heap data structure in TypeScript. The original code is here, in the Eloquent JavaScript online book by Marijn Haverbeke.
In short, a Binary Heap is a common data structure for a priority queue. We want to put inside the queue many values (or an object) and you want to extract the smallest value (or the object with the smallest score) in the most efficient way.
This JS implementation the Eloquent Javascript book is pretty common, so I decided “to typify it”. The result is in the following Gist:
How to use Rust in Python (Part 3)
You can follow the links to read the first part and the second part of this series.
In the previous part we have seen how to pass not trivial data to Rust functions such as a Python list. It is still not enough, though. In many cases we need to pass complex data structure back and forth from a Rust library. We may need to pass quaternions, 3D points, trees, a list of “books”… In short: anything.
Learning how to pass custom aggregated data types to Rust libraries (and back to Python) will be the focus of this part!
How to use Rust in Python (Part 2)
You can find the first part of this article HERE.
In the previous part we have seen how to run simple Rust functions with integer arguments. This is not enough, of course. We need to go further by passing Python lists to Rust functions.
The problem is that it is not possible to pass directly a Python list to a C interface. Python lists (we can call them Plists) are complicated beasts, you can easily see that they are objects full of methods, and attributes and… Stuff.
|
|
We need first to convert this in something edible from a Rust library. But first things first.