My two weeks programming on a Chromebook challenge
Posted on September 11, 2017 by Paul
- Introduction
- Chromebook Developer Mode
- Crouton Ubuntu CLI
- Crouton Ubuntu LXDE
- Crouton Ubuntu C++17 development using GCC 7
- Chromebrew a Chrome OS package manager
- Chrome OS native development
- Conclusions
A few days ago, I bought a Chromebook for testing purposes. I was curious to see if it is possible to use it as a general development machine. My challenge is to use only the Chromebook and my iPhone for the next two weeks. I’m allowed to use local or external servers as long as I access these from my Chromebook.
In its default configuration, a Chromebook is not a developer machine. Chromebook was designed to be used as a cloud connected device, that can be used occasionally offline. The machine has a strong emphasis on security and ease of use for Internet related tasks: browsing, writing documents, email and so on.
Building Python 3.7 from source on Ubuntu and Debian Linux
Posted on June 30, 2017 by Paul
Updated 13 July 2019
This is a short article about building Python 3.7 from source on Ubuntu 18.04 or Debian 10 Linux. At the time of this writing, on Ubuntu LTS the default Python version is 3.6 and on Debian stable the default is Python 3.7.3 (which is slightly older than the current stable Python version).
Python 3.7 comes with many more improvements vs the old versions. You can read more about what’s new in Python 3.7 here. The procedure described in this tutorial also works with Windows Subsystem for Linux, WSL, aka Bash on Ubuntu on Windows and it should work with the latest Raspbian on a Raspberry Pi device.
Another advantage of building Python from source is that you will be able to install latest versions of various libraries like OpenCV, Pillow and so on. As an example, at the end of the article I will show you how to use pip to install the Pillow image library.
Compiling GCC 10 on macOS Mojave
Posted on May 21, 2017 by Paul
Updated 29 May 2020
In this tutorial, I will show you how to compile from source and install the current stable version of GCC on your macOS computer. The instructions from this tutorial were tested with latest version of Command Line Tools and Mojave (macOS 10.14). If you are using Catalina (macOS 10.15) check this tutorial.
Clang, the default compiler for macOS, supports only C, C++, Objective-C and Objective-C++. If you are interested in a modern Fortran compiler, e.g. you will need gfortran that comes with GCC. Another reason to have the latest stable version of GCC on your macOS is that it provides you with an alternative C and C++ compiler. Testing your code with two different compilers is always a good idea.
Building GCC 10 from sources could take some time, in my case it took a few hours on a MacBook Air with a 16GB of RAM.
Emacs 25 on Windows Subsystem for Linux
Posted on May 18, 2017 by Paul
Recently, a reader of this blog asked me about using Emacs under Windows Subsystem for Linux. According to the WSL documentation, Emacs, Vim and other Linux applications that run from console should work just fine. Turns out that the situation is a bit more complex. At the time of this writing, Emacs works fine for normal text editing. But, when you try to install a new package directly from Emacs, the program is stopped and sent to background and doesn’t seem to be able to cleanly recover when you use fg. From a practical point of view, this makes Emacs, under WSL, useless if you need to install any package that is not built in.
Fortunately, there is a workaround for the above bug and I will show you in this post how to avoid the problem. As far as I know, Emacs under WSL seems to work without a problem only if you install a desktop environment like Xfce 4. The idea is to use the GUI version of Emacs when you need to install a package. For normal editing, you can use Emacs from the WSL console.
Building GCC 10 on Windows Subsystem for Linux
Posted on May 4, 2017 by Paul
Updated 8 May 2020
In this article, I will show you how to compile from sources GCC 10.1 on WSL, Windows Subsystem for Linux with Ubuntu 20.04. The default version of GCC, at the time of this writing, is 9.3. GCC 10.1 has complete support for C++11, C++14, C++17 and partial support for C++20.
GCC 10.1 has C++14 support enabled by default. If you want to try the new C++17 support use the -std=c++17 flag, example:
Swift Alamofire tutorial uploading and downloading images
Posted on May 2, 2017 by Paul
This is a short tutorial about uploading and downloading images with Alamofire from an iOS, Swift 3, application.
I assume that you have the latest Xcode installed on your Mac, and that you know how to code small iOS applications in Swift 3.
I also assume that you have access to a server, ideally you have your own server with a domain name and a SSL certificate installed. If this is not the case, you can use a local Apache or NGINX web server. Personally, I use the free version of MAMPP which allows me to easily switch between Apache and NGINX if necessary. A good alternative to MAMPP is XAMPP. As a side note, macOS comes with an old version of Apache and PHP 5.3 already installed.
Getting started with Swift 3 on Windows Subsystem for Linux
Posted on April 19, 2017 by Paul
Recently, I’ve played a bit with Swift 3 on WSL (Windows Subsystem for Linux). In this article, I will show you how to install the latest stable version of Swift under WSL. Combining the open source Swift compiler with a text editor like Visual Studio Code is quite a pleasant coding experience, as you can see in the next screenshot:
Using the Windows Subsystem for Linux with Xfce 4
Posted on April 16, 2017 by Paul
In my previous article, I’ve shown you how to install WSL, the Windows System for Linux, on a fresh Windows 10 Creators Update. Officially, at the time of this writing, WSL supports only command-line applications. However, you can install graphical Linux applications and run these under WSL if you have an X server like VcXsrv or Xming, on your Windows machine.
Assuming that you have a working WSL installation, start Bash on Ubuntu on Windows, or open a Command Prompt and type bash in it. First step is to install a window manager. From my experience, Xfce works reasonably well with WSL:
Install WSL - Windows Subsystem for Linux
Posted on April 15, 2017 by Paul
Updated 11 July 2018
Starting with Windows 10 Creators Update (April 2017) it is possible to use unmodified Linux binaries on Windows using the Windows Subsystem for Linux aka WSL. The advantage of WSL is that you can run Linux applications without the extra weight of a virtual machine. At the time of this writing, July 2018, WSL on Windows 10 gives you the choice between a couple Linux distributions like Ubuntu, Debian, Suse and so on. In this article I will show you how to install and use the Ubuntu 18.04 app.
There is also a video version of this tutorial:
If you want to run WSL on your Windows 10 installation, make sure that you have a 64 bits machine with a 64 bits Windows. If this is the case, check if your system is updated (you should have Windows 10 version 1803 or above). You can check what version of Windows you have by going in Settings → System → About:
Transferring data between Matlab and Armadillo
Posted on April 12, 2017 by Paul
In this article, I will show you how to move data between Matlab and Armadillo, specifically how to move matrices between the two. If you need an introduction in how to install Armadillo on your system, check my previous article.
Easiest approach is to transfer data between Matlab and Armadillo using text files. For example, the next Matlab code will generate some data and save it in a text file that can be loaded from Armadillo:
Reading the matrix from matlab_data.txt in Armadillo can be done with:
Getting started with Armadillo a C++ Linear Algebra Library on Windows, Mac and Linux
Posted on March 24, 2017 by Paul
In this article, I will give you a quick introduction in how to get started with Armadillo, a C++ Matlab like Linear Algebra Library on Windows, Mac and Linux. Armadillo is particularly interesting for Matlab users that want to port their code to C++ for speed. Please note that Armadillo is not a drop in replacement for all Matlab functionality. If your code uses some specialized Matlab toolbox, you will need to find another library to complement Armadillo or implement the missing functionality from scratch.
Armadillo uses BLAS and LAPACK for matrix operations. It is recommended that you install an optimized version of the above libraries on your system and not the reference implementations from Netlib. I will guide you on how to install accelerated versions of BLAS and LAPACK for your operating system, in the install sections of this article.
Install NumPy, SciPy, Matplotlib with Python 3 on Windows
Posted on February 25, 2017 by Paul
Updated 26 January 2020
This is a short tutorial about installing Python 3 with NumPy, SciPy and Matplotlib on Windows.
There is also a video version of this tutorial:
We’ll start by installing the latest stable version of Python 3, which at the time of this writing is 3.8. Head over to https://www.python.org/downloads/ and download the installer. The default Python Windows installer is 32 bits and this is what I will use in this article. If you need the 64 bits version of Python, check the Looking for a specific release? section from the above page.
iOS Remote Push Notifications with a Node.js backend
Posted on February 14, 2017 by Paul
In this tutorial I will show you how to get started with Swift 3 and iOS 10 push notifications, using your own custom Node.js server. Please note that there are plenty of alternatives to the custom server solution I will present here, like Firebase and similar services, these will start charging you a monthly fee after you reach a certain number of users. Using your own server is advantageous if you want complete control over what software you run on it and how you store and use your data.
If you want to follow this tutorial you will need to be a paying member of the Apple Developer Program and have an iOS device. It is also recommended, but not required, that you have a working web server with root access. Personally, I tend to use DigitalOcean, but you can use any VPS provider. For the purpose of this article, I will show you how to use a local web server.
Arduino buzzer player with adjustable volume - playing a part of Für Elise by Ludwing van Beethoven
Posted on January 31, 2017 by Paul
The code for this post is on GitHub: https://github.com/sol-prog/Arduino_music.
In this article, I will show you how to play music with the Arduino, using a passive piezo buzzer. You can see the final result in the next video:
Beginning C Game Development with SDL 2 - video series
Posted on January 22, 2017 by Paul
This is an ongoing video series about beginning C game development with SDL 2 by our partner AtoZ Programming Tutorials. While the videos where recorded on Windows 10, everything should work the same on macOS and Linux as long as you use SDL 2 and a C99 compiler like GCC, Clang or Visual Studio 2015/2017.
Currently, the series presents how to setup SDL 2 on Windows using Visual Studio 2015 and Code::Blocks. Let us know in the comments section if you would like to have SDL 2 setup videos for macOS and Linux.
Setup SDL 2 with Visual Studio 2015