Category Archives: Uncategorized

JetBrains Is Cool

Building new habits and learning new tools can be really hard and overwhelming, but I’ve finally forced myself to start taking full advantage of the JetBrains tools I have access to as a student, and I wish I had done this a long time ago.

I’ve also been taking advantage of JetBrain’s docs and tutorials, and I’m finding them super helpful, so I thought I’d share a couple here.

JetBrains CLion: Quick CMake Tutorial

https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html

CLion is a cross-platform IDE for C and C++. It has integrated C/C++ debugging with GBD or LLDB, as well as integrated memory-related debugging via Valgrind Memcheck. CLion is designed for development in C and C++, as well as Rust and Swift, and it also provides support for other languages such as CMake, Python, and JavaScript. There are also plug-ins you can add, like editor themes or support for languages.

I’m currently using OpenGL and GLSL for a couple projects, and CLion has already helped me a ton finding random errors or bugs that would have taking me a lot longer to track down otherwise.

For example, after working with vectors all yesterday, I groggily tried to determine the size of a vec3 array by multiplying sizeof(my_array) by sizeof(glm::vec3), causing my program to attempt to access an invalid memory address, which resulted in a segfault and my program immediately crashing.

However, CLion flagged this line of code I had written as “suspicious”, so looking at its list of suggestions pointed me to the problem. Even though you can multiply the size of an array by the size of its type, the IDE was able to realize that that’s a rather suspicious thing to do, and helpfully suggest I review my code.

Another thing I’ve been forcing myself to learn recently is how to use CMake, and JetBrains helpfully has a tutorial to get you started: https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html

This tutorial walks you through creating a CMake project, writing your CMakeLists.txt file, creating debug and release configurations, and linking libraries and source files. It even covers how to get started with dynamic libraries such as Boost, and how to work with CTest.

There’s also a separate tutorial for Unit Testing with CLion as well: : https://www.jetbrains.com/help/clion/unit-testing-tutorial.html.

JetBrains Rider: Unit Testing Tutorial

https://www.jetbrains.com/help/rider/Getting_Started_with_Unit_Testing.html

Rider is a cross-platform .NET IDE that can be used for everything from web and application development to game engines like Unity and Unreal. As with CLion, there’s support for lots of languages, such as C#, F#, JavaScript, TypeScript, HTML, and SQL, and you can add plug-ins for additional features and support.

Rider has been really helpful for improving my C#, which I’m currently using to build games in Unity, and which I’ve previously used for C#/.NET web development. C# is sometimes described as an easier-to-learn, higher-lever version of C++, and I find it to have a lot of specific quirks that require a lot of referencing to the Microsoft documentation.

Rider is super handy at catching mistakes and suggesting subtle improvements as you go, that helps to get your program working, but also improve your coding and develop better coding practices as you work. For example, it will mark attributes or methods that can be made private or readonly, which I find really helpful.

This tutorial on unit testing walks you through adding unit tests to your project, and helps you write your first tests. I used the NUnit testing framework, but there are several others available as well. Testing your code is always incredibly important, and adding unit tests that are easy to edit and easy to run makes everything easier.

If you’re a student, check out JetBrains’ free educational license. There are also some JetBrains products that are free to use, such as the Community Editions of PyCharm or IntelliJ IDEA.

Posted 11-11-2021

Piet, Esoteric Programming Language

Today I learned about the esoteric programming language Piet, designed by David Morgan-Mar, aka Dangermouse.

Morgan-Mar’s website includes Piet’s succinct Design Principles, which read: “Program code will be in the form of abstract art.” The language is named after the abstract painter, Piet Mondrian.

(I discovered Piet after looking up another esoteric language, Whitespace, which is a programming language comprised entirely of whitespace characters.)


Piet programs are bitmaps built from “codels”, which are blocks of color. There are 20 distinct colors in the Piet language. Here is the color chart from David Morgan-Mar’s website:

A color chart of reds, yellows, greens, cyans, blues, magentas, black, and white, with their hexadecimal values.

Figure 1: A color chart of reds, yellows, greens, cyans, blues, magentas, black, and white, with their hexadecimal values.


Piet compilation is guided by a pointer that travels the image, using continuous colored areas to direct its path. Piet uses a single stack to store all data values, and data values can only exist as integers. Data can be read in or printed out as Unicode characters.


Piet has its own community of coders, and you can find many cool examples of Piet programs on Morgan-Mar’s website here: https://www.dangermouse.net/esoteric/piet/samples.html. Here’s one of my favorite (and one of the most minimal visually) programs from that page, Euclid’s Algorithm by Clint Herron:

A working program in the esoteric language Piet: a small square subdivided into colored blocks in yellow, red, blue, purple, pink, white, and black.

Figure 2: A working program in the esoteric language Piet: a small square subdivided into colored blocks in yellow, red, blue, purple, pink, white, and black.


Learn more about Piet here: https://www.dangermouse.net/esoteric/piet.html

Read more about esoteric programming languages on Wikipedia: https://en.wikipedia.org/wiki/Esoteric_programming_language

Check out Esolang, the esoteric programming languages wiki here: https://esolangs.org/wiki/Main_Page

And lastly, here’s a painting by the original Piet, “Broadway Boogie Woogie Piet Mondrian”, by Piet Mondrian, 1942-1943:

An abstract painting comprised of yellow, blue, red, and white rectangles of different sizes arranged on a grid, titled Broadway Boogie Woogie, by Piet Mondrian, 1942-1943, MoMA collection.

Figure 3: An abstract painting comprised of yellow, blue, red, and white rectangles of different sizes arranged on a grid, titled “Broadway Boogie Woogie”, by Piet Mondrian, 1942-1943, MoMA collection.


11-04-21

Modulo Magica

In my spare time I’ve been playing around with MagicaVoxel. Today I was experimenting with using modulo operations to stagger the cells of a model over multiple layers. I originally thought this would be useful for exporting .obj models that could then be imported elsewhere as independent cells. It wasn’t! But it was still fun playing with numbers and colorful cubes.

Here’s the original layers I was working with:

Screengrab of MagicaVoxel editor showing several solid voxel layers across the y-axis, displayed in a colorful gradient of pinks and yellows.

The colors are from a map I was using to generate the original model. I output these values as colors to help me debug my code. Also it’s pretty.

Here’s a screengrab of what it looked like midway:

Screengrab of MagicaVoxel editor showing voxel layers spread across the y-axis, where each layer contains cells with the same x and z coordinants as its neighbors, displayed in a colorful gradient of pinks and yellows.

My math was off at this point, so the cells aren’t staggered correctly.

And here’s another screengrab of what it looked like once I got the cell-staggering to work:

Screengrab of MagicaVoxel editor showing voxel layers spread across the y-axis, where each layer contains cells with x and z coordinants distinct from its neighbors, displayed in a colorful gradient of pinks and yellows.

Each original layer is now blasted out evenly across multiple layers.

Go check out MagicaVoxel → https://ephtracy.github.io/

10-13-21