Page 2 of 5
Having a virtual machine running macOS opens up a lot of opportunities for learning. If you are into security, you can set up a VM for your security lab. Or if you want to learn networking or kernel debugging, it is also helpful to use a VM. The other option is risk breaking your work machine in your experiments (not fun). To build our VM, we need to use Disk Images, another topic that is useful in other areas.
Read More...
Hello,
Happy Thanksgiving, for the ones who celebrate it. It’s always important to be grateful for everything we have, so no matter if you don’t directly celebrate Thanksgiving. Maybe use it as an excuse and think of all the things that you have to be grateful for :).
Alright, in this week’s newsletter I want to share with you a podcast I’ve been enjoying a lot.
The name of the podcast is The History of Computing, you can add it to your favourite podcast player. I use Overcast, so here is the link to the latest episode.
Read More...
Apple provides the Launch Services API so we can interact with different applications from our current process. We can define URL schemes for our apps, and when that URL is opened, our app gets launched. We can also specify which application to open when a file associated with a specific Uniform Type Identifier (UTI) is being opened. This is registered in the Launch Services database. In this post, I’ll show you how to interact with the Launch Services API to register URL schemes and UTIs.
Read More...
If you’ve used the Swift Package Manager, you have interacted with its handy command-line tool. When creating command-line tools, we strive to provide an easy to use interface. One of the main characteristics of a good CLI tool is how it handles parameters. In this post, I’ll show you how to use Swift Package Manager’s TSCUtility module, and especially ArgumentParser to parse arguments for your swift command-line tools.
Let’s start by defining the common types of arguments we get in command-line tools:
Read More...
State machines are used to model systems that can be thought of as a collection of states, and a collection of events that cause state changes. Many of the systems we want to model can be abstracted to a state machine. For example, elements in a Game, devices like vending machines, ATMs, etcetera. In this post, I’ll explain what State machines are, and give a simple example of the implementation of a general state machine.
Read More...
Hello,
So glad that the weekend is here, time to relax. I found this post that you might find interesting. It is about the reason that 80x25 became the standard display.
There are many things we do out of habit and end up forgetting why we started doing them in the first place. One example in my case is that I try to always keep my commit messages in under 72 characters per line. I don’t claim to be 70 years old and got used to it by using IBM’s 3270. What happened is that I read this Tpope’s article on writing good git commit messages, where he explains the reason why 72 characters per line is the ideal. The relevant reason is this:
Read More...
System libraries are typically defined using C, that means we need a way to make them available to Swift. In this post, we are going to explore how to use the Swift Package Manager to give us access to C libraries, be it system or user-defined.
Let’s start by talking about Swift modules.
*NOTE: check the following GitHub repositories for the code:
- Csqlite3 gives us access to
sqlite3.h C system library. - SQLiteTester a Swift package executable that uses the
Csqlite3 module. - SQLite3 a wrapper that provides a Swifty interface to the SQLite3 C library.
- SQLiteClient a Swift package executable to test SQLite3.
#Swift modules
Read More...
Hello,
This year Unix turns 50! You can check the website thatBell Labs created for the commemoration. I’ve always found these stories fascinating. I can only imagine how cool it would be to be part of the team that built something as impactful as Unix. I’ve always wanted to be part of a team of “scientists” that changes the futures. I remember reading Nerds 2.0.1 and getting sad that those times have already passed, but also enjoying the storytelling.
Read More...
Long gone are the days when single process single thread was the norm. We now take multithreading for granted, we expect all our applications not to lockup when we interact with them. We expect them to handle multiple users at the same time, etcetera. In this post, I’ll explain what multithreading is and how to use threads (using pthreads) in Swift.
Before someone tells me that in 2009 GCD (Grand Central Dispatch) was introduced, I know. This post is aimed at anyone that wants to understand how multithreading works using threads. To use threads directly in Swift, we need to interoperate with C code. We need to go down to using pthreads directly. We’ll go from the basics of threads and then write a Server simulator using threads.
Read More...
Hi,
How was your week? I hope it was a good one. It was a busy week for me. I was worried I wouldn’t be able to publish an article this week. But I made it.
I enjoy writing these articles. I wish I had more time to dedicate to research and writing, but I’m happy that I can dedicate at least a small amount of time every week.
Anyways, it’s the weekend, so it’s time to relax. I’m a fan of AudioBooks and podcasts. So on Saturdays, I take some time to get a coffee and listen to an interesting story. If you are a fan of audio content, here is one of my favourite podcasts:
Read More...