Posts

Just when you least expected it, they will screw you.

Image
 I was using Visual Studio Code with Gemini Code Assist to create a variation of an existing Python script. After a few minutes of back and forth, I got the desired code running. But when I try to run the same script again on the terminal, nothing happens. WTF? Thankfully, I asked Gemini to rebuild the file for me, and a few moments later, I got it back into my VSC editor. However, a minute later, the issue repeats itself.  What good is it to have an IA to write code for you if the file content with the code disappears seconds or minutes later? And it's not that the file disappears, it is just that suddenly the file becomes 0 bytes long. When asked about it, Gemini hinted that, as I was working on a Dropbox folder, it might be a known synchronization issue of Dropbox. Knowing the possible cause of the problem helps, but being a paying customer of Dropbox makes me wonder if I want to keep on supporting them. This is not the first weird issue I have had with them, but other prob...

Part contour simplification, with a twist

Image
 Many vector graphic algorithms have a cost proportional to the number of segments of the shapes involved. Thus, many different polygon simplification algorithms have been developed over the years. The main idea is to represent the original shape, but reduce the total number of edges of the shape's contour.  A favourite of mine is the Douglas-Peucker algorithm. It uses an error parameter that allows the user to tune the acceptable error introduced by the simplification. That works well in many scenarios, but as you may guess, it does not work well for some of my needs. Free form 2D nesting packs groups of parts inside bins, in my case, those bins are rectangles. The rules are that any two parts cannot overlap. Nesting libraries will determine where to place each part inside a bin and what rotation to apply to the part. The number of parts and the number of edges per part have a big influence on the time required to perform the nesting operation. So, being able to simplify the...

One step forward, one step backward

Image
 While it was nice to be able to get a faster 2D nesting code, its efficiency was far from perfect. So, looking at the nesting results, you could see how it could have been done much better in certain cases.  And what we usually do when we overcome a hurdle is to look for the next one. In my case, I realized one of the heuristics of the code was to place small parts inside the unused space of the bounding box of the larger parts. That is ok, but what could be better is to use all the free space of a bin once the first placement of large parts is over.  This time, I leaned on another Chinese AI tool, called GLM-4.5 from the  z.AI company.  I explained the above idea in the chat, and I waited for the magic to happen. I used Roo Code within Visual Studio Code, accessing GLM-4.5 API. A few minutes later, I had a newer version of the library. I was pleasantly surprised when I saw a significant improvement in its packing ability, proving that the new heuristic was a ...

Knocking my socks off!

Image
As I mentioned in my previous entry, I migrated a library from Java to C++ to make it easier to use from Python. I tested its performance on both Linux and OSX, and it was on par with the Java version. Sample file S266.txt would take around 45 seconds on my computer using the Java version, and the C++ version needed thirty-something seconds on a M1 MacBook Pro running OSX, a bit less than that on an i9-13900 server running Linux. From that, I could not claim there was a huge difference in performance compared to the original Java runtime. But I wanted to make a fair comparison, and I wanted to face the trouble of building the library for Windows. It was not a challenge, but it took a while. Let me summarize all the steps I needed to cover: Install Microsoft's Visual Studio (Community Edition) Install Microsoft's vcpkg (C++ package manager) Install CMake. Install dependencies (tbb, gtest, boost, pybind11) Clone the project repository . Build the project. It took me like an hour...

Migrating a Java library to C++ so it can easily be used from Python

Image
Today, we embarked on an ambitious software engineering journey: migrating a sophisticated 2D bin packing program from its original Java implementation into a high-performance C++ library, complete with Python bindings for ease of use. The goal was to retain 100% of the original complex packing logic while unlocking the raw speed of C++. The heart of this migration involved replacing Java's powerful java.awt.geom.Area class. We chose the world-class Boost.Geometry library as its C++ counterpart, meticulously re-implementing every geometric operation, from simple transformations to complex polygon intersections and subtractions. This formed the foundation upon which we rebuilt the original program's advanced packing heuristics. We successfully ported a multi-stage packing strategy, including bounding-box placement, a "drop" simulation for gravity-fed placement, and iterative compression algorithms. However, real-world testing with complex, high-vertex-count polygons r...

From frustration to simplicity

Image
Today, I set out to configure a remote access VPN for my small office. My first choice was L2TP/IPsec with StrongSwan and xl2tpd , mainly because it’s supported natively by Windows. It seemed like a solid option; secure and well-documented. But several hours later, after wading through IKE version mismatches, arcane config options, and ambiguous Windows error codes, I hit a wall. Despite correctly setting up IPsec and L2TP, Windows insisted on trying IKEv2, and StrongSwan repeatedly rejected the connections. Exhausted by endless logs and incompatible defaults, I decided to abandon the legacy stack and try something different: OpenVPN . In under ten minutes, using the widely respected OpenVPN install script by Angristan , I had a working VPN server. The script handled everything—certificates, firewall rules, user config—and generated a ready-to-go .ovpn file. I dropped it into OpenVPN Connect on Windows , hit "Connect", and just like that, it worked . Sometimes the best t...

PyMeshLab: Awesome Power, Quirky Edges – A Gentle Guide for the Adventurous 3D Wrangler

Image
If you’ve worked with 3D meshes in Python, you’ve probably heard the name PyMeshLab . It’s the “Python face” of the legendary open-source MeshLab—famous for its ability to clean up, repair, and process even the messiest 3D models. And truly, PyMeshLab is a fantastic tool : powerful, open, scriptable, and (for most operations) robust. But—let’s be honest—getting started with PyMeshLab sometimes feels a bit like entering a quirky, magical forest: full of treasures, but you might trip on some roots along the way . Here’s my little “cautionary tale” and field guide to the weirdness you may encounter, and how to laugh it off while getting things done. 1. “Is That a Snake or a Camel?!”: The Naming Circus You’ll quickly notice that the naming of filters and methods in PyMeshLab is... creative . Sometimes you call a mesh processing function by a method like compute_normal_for_point_sets() . Other times, the same operation is invoked using apply_filter('compute_normal_for_poin...