The programming thread.

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe
Visual Studio has its own way of setting up the environment, sometimes it's hard to know which tool version it's using. You should be able to open a prompt with the same env, maybe the comparison will show something more, then.

And its CMake... I'm not even sure if it's entirely compatible with a self-installed CMake. It has to be easier with VS Code (or CLion, but $$$).
 
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
...And its CMake... I'm not even sure if it's entirely compatible with a self-installed CMake. It has to be easier with VS Code (or CLion, but $$$).
Yes. That's why you had to specify cmake_minimum_required(VERSION 3.6.1) (or was it 3.6.2)?, to ensure using the "correct" (MS) CMake. Apparently -but maybe that applied only to VS 2017 (I'm mostly using 2022 for new projects).

pibbuR++ 67
 
Last edited:
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe
Ah right, it may depend on the version too. :wall:

Still, I used to like their IDE, but it's been a *very* long time since I did C++. As you said, it's more at ease with .NET.
 
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
Regarding performance of Vulkan vs OpenGL, here's a quote from the 3D rendering Cookbook:

"A very important thing to remember when switching from OpenGL/AZDO to Vulkan is that it is not necessarily going to give you any significant performance boost. The GPU hardware is the same and all the graphics rendering functionality exposed by Vulkan is almost identical to that found in OpenGL. One of the major Vulkan design goals is to considerably reduce the CPU time spent in the driver, therefore if your application is limited by the GPU rendering performance, it is highly unlikely that Vulkan will give you better performance."

pibbuR who still thinks Vulkan is fun. But alas, so is openGL.
 
Last edited:
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Myrthos

Cave Canem
Joined
Aug 30, 2006
Messages
11,212
Developer quizzes: https://quizzes.madza.dev/
The categories are a bit geared towards web development. But, it could be fun to test your knowledge in some areas.
I only scored 74% on both HTML and HTTP quizzes :)
 
Joined
Aug 30, 2006
Messages
11,212

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe
It's mostly web-oriented but I managed to get 90+ in Git and Sql. ;)

For Python, C++, Java, Regex and a few others, I like HackerRank. There's a clear description of the problem to solve, an editor to write the code, and a series of tests to verify that it's correct. To spice it up, not all tests are visible, there are hidden vicious corner cases (you can "buy" them with a few points if you're stuck). :D

It's worth knowing there are a few mistakes in the last advanced Python problems (not many). I solved all 115 of them, plus some of the other series.

The site is actually made for recruiters as well, I've already been sent a link to custom questions by an HR department.
 
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe

Myrthos

Cave Canem
Joined
Aug 30, 2006
Messages
11,212
All 115 of them? Good thing you have nothing better to do :p
 
Joined
Aug 30, 2006
Messages
11,212

Zloth

I smell a... wumpus!?
Joined
Aug 3, 2008
Messages
7,751
Location
Kansas City
...One of the major Vulkan design goals is to considerably reduce the CPU time spent in the driver...
Ah, so that's why Egosoft is using it for X4.
 
Joined
Aug 3, 2008
Messages
7,751
Location
Kansas City

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
Puh!! 1 1/2 days of a lot of work. I decided to switch build system for my now quite huge Qt application (PibburWorks - I promise I will tell you more about that. Some time.) from qmake to cmake. Partly because cmake is useful for many types of projects. Partly because it's fun.

I made a couple of mistakes:
  1. Waiting to make the switch until the project was this huge.
  2. Reorganizing the directories as recommended by cmake people.
  3. Changing the names and files of a couple of classes.

2) and 3) both needed doing, but at the same time as trying to get cmake working (which involved finding out how to do a couple of things not explaiend very well in the tutorials/documentation)??? Not very wise.

Still got work to do, but finally. it's up and running again now.

pibbuR who decided not to bang his head at nearby walls this time.
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe
CMake seems powerful and flexible but I've only used it occasionally (read: tried hard to understand how I could make it work) on a project made by a colleague. One day maybe.
 
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
One Problem with cmake is that there is a lot of very advanced things you can do. The book CMake Best Practices is 400 pages long. I needed only the first chapter of a Qt Tutorial on building Qt apps with cmake for the things I used.

Now, there are no doubt better ways of doing what I want to do, and there are still a lot I don't fully undersand (but copy blindly).

Starting your cmake expedtion on someone elses work -Ouch!!!.

project(MyProject VERSION 0.42 DESCRIPTION "pibbur" LANGUAGES CXX)
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Myrthos

Cave Canem
Joined
Aug 30, 2006
Messages
11,212
My company has an arrangement with O'Reilly allowing us to get access to all their books (can be read online only) and videos. It's a great resource, also for private stuff :)
 
Joined
Aug 30, 2006
Messages
11,212

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
A short update on my programming journey.

I have worked using C++ and OpenGL with the Qt framework for a while. For simple 2D graphics, there is this QOpenGLWidget widget which implements OpenGL, but which can be used almost exactly like ordinary (QWidget) widgets for graphical output.

I've programmed a semi-random creation of a Sierpinski triangle (see the PS), displaying the result using both an ordinary QWidget (which I assume uses GDI+ under windows), and the QOpenGLWidget.

Here is the end result after 100 000 iterations:
Sirpienski.png
As said both widgets can be used almosty identically. I only had to make 2 changes for the OpenGL output: an explicit background drawing call, and a tiny modification of the resize event.

Creating the 100 000 iterations triangle takes less than 1 second. To illustrate the time needed for graphical output, I displayed the current result for every 1000th iteration. Using QWidget the ordeal took 25 seconds. Using OpenGL it took 5. Additionally, moving the output within the widget display was very sluggish for QWidget, but still smooth for OpenGL.

QpibbuR::haveFun(true);

PS. The Sierpinski triangle is a fractal. It's created by dividing a triangle in 4 parts, and then remove the central one. The procedure is repeated for each sub-triangle again and again... And again. As the number of iterations increase the total area of the non-empty subtriangle parts approach zero, while the accumulated length of all contours approach infinity.

The triangle can be created in many ways, I chose a semi random approach, where I started with a point in the middle of the triangle, and from there created a new point halfway to one of the corners, randomly selected by for instance tossing a dice: 1,2-> top corner, 3,4 -> bottom left....., then created a new point from there halfway again to a corner determined by the dice cast... 100 000 times. DS.

PPS. Qt also supports Vulkan to some degree, although not as elegantly as OpenGL. There are limitations. I may try it eventually, but probably not before suppoort is more complete. Which will likely happen - however, given the around 20 fold increase in detail and therefore size of Vulkan code compared to openGL, I assume this may take some time . DS
 
Last edited:
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
Good idea, of course. However, the code I've written is unoptimised in many ways. I've prioritised making the code general, by heavy use of polymorphism. Which in this case no doubt increases run time significantly. There are ways I can avoid this and still make the code general.

Be prepared for more updates.

void pibbuR_DoSomething() override;
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe
Good idea, of course. However, the code I've written is unoptimised in many ways. I've prioritised making the code general, by heavy use of polymorphism. Which in this case no doubt increases run time significantly. There are ways I can avoid this and still make the code general.

Be prepared for more updates.

void pibbuR_DoSomething() override;
It's just interesting to use multithreading because it shows many new interesting problems, regardless of the performances. It's even more "exciting" with UI applications. But maybe you've already had fun with that, or you'd rather save it for later.

That being said, I have no idea if this particular case is interesting to parallelize.
 
Joined
Aug 29, 2020
Messages
5,762
Location
Good old Europe
Top Bottom