The programming thread.

Opti what? Well, "opti" - so I guess this has something to do with computer cameras? ;)
 
Joined
Aug 3, 2008
Messages
8,238
Location
Kansas City
tl;dr: Hello World the Qt5 way

OK.. Here's that famous program wrtitten for Qt 5, using the Qt Creator IDE. Except for the Xml, it's much simpler than the Win32 API version. And most of the code was created visually. And there's far more C++ code.

It's not as beautiful as the Win API (IMO), but it's practical (and probably powerful) so I'll explore it further. And it will work on Linux.

4 files:
//main.cpp: Main Program
#include "mainwindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

-----------------------------------------------------------------------------------------------
//mainwindow.h: Main window class declaration
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();

private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

----------------------------------------------------------------------------------------
//mainwindow.cpp: Main window cclass definition
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}

MainWindow::~MainWindow()
{
delete ui;
}

---------------------------------------------------------------------------------------------
//mainwindow.ui: User interface
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="StatusLabel">
<property name="geometry">
<rect>
<x>170</x>
<y>250</y>
<width>191</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Hello Pibbur</string>
</property>
<property name="textFormat">
<enum>Qt::plainText</enum>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

protected: pibbuR

PS. Whatabout MFC? Mostly given up on that. It's old, as is most documentation. And VS support left something to be desired. Wizards worked (after changing a few settings). Building MFC applications from the ground up, which is the way I like to learn things caused linking problems (where is the cdecl __main function?). No help found when searching the net (admittedly I used Startpage in stead of Google, maybe Google could have found some). I finally got it working after installing VS 2015, using the exact same source code. I suppose I could have got it working on 2019 by adjusting more VS properties, but I couldn't find any info about what to change, and there are a lot of them!!! (Yes, I already had set MFC to be used as shared libraries). Got a bit fed up, and assuming that more problems would appear the further I went, I tried Qt, and haven't looked back. DS.

PPS: Thanks to the zloth for the emoji riddance tip . DS.
 
Last edited:
Joined
Nov 11, 2019
Messages
2,097
Location
beRgen@noRway
...
C# is not only quite fast now, if you want to do new things you should use .NET core, which means everything will run on linux and/or windows.
...
Didn't know that about .Net Core. I knew that you can develop for linux using VS, but I assumed that only applied to console applications. And you still have to do the programming in Windows.

pibbuR who will appreciate being corrected if he's (not unlikely) wrong.
 
Joined
Nov 11, 2019
Messages
2,097
Location
beRgen@noRway
Didn't know that about .Net Core. I knew that you can develop for linux using VS, but I assumed that only applied to console applications. And you still have to do the programming in Windows.

pibbuR who will appreciate being corrected if he's (not unlikely) wrong.

https://medium.datadriveninvestor.c...-desktop-apps-on-linux-with-xaml-bf3dbba9afa0

All possible, see above link.

You can also use Microsoft Maui , but it is very new, and might not work perfectly yet.
 
Joined
Oct 25, 2006
Messages
6,292
WinForms is mature, supported by both Windows and Mono, but it's dated and requires some amount of boilerplate code (usually generated by VS).

It's possible to take the problem the other way round, and use Gtk with .NET (GtkSharp), but I honestly don't know if that's easy. There is an integration package for Visual Studio, or you can use MonoDevelop (but it's probably less user-friendly).
 
Joined
Aug 29, 2020
Messages
10,159
Location
Good old Europe
I am studying now programming language - C++ and I am interested in it!
 
Joined
Sep 21, 2021
Messages
2
academia_vs_business.png


pibbuR who is something in between. No academic career in sight. And no commercial. In other words, a waste of ... things.
 
Joined
Nov 11, 2019
Messages
2,097
Location
beRgen@noRway
I think I need to put that error message in somewhere - except I'll blame Microsoft. ;)
 
Joined
Aug 3, 2008
Messages
8,238
Location
Kansas City
I am at the moment exploring Gtk for GUI applications (have tested Qt, but I want to look at alternatives). ATM I've switched to Linux, as using Gtk seems a bit easier there.

One question:. I would like to use the same compiler under Windows and Linux. Anyone having experience with installing g++ under Windows? An alternative could be the Intel OneAPI (assuming I get it to work on my Window machine with a Ryzen processor. I have an Intel CPU in my Linux machine). Or CLANG, but that one supports very few C++20 features AFAIK.

Regarding Gtk. I Would like to go for version 4, but for Ubunto, the only C++ interface (Gtkmm) supported is version 3.24 (Gtk 4 installs fine using apt, but not Gtkmm 4. I assume C++ under Gtk4 needs gtkmm 4). Allegedly openSuse support gtkmm 4, but I don't think I'll change the OS for that. It IS possible to install gtkmm from source, but that seems a bit more complicated than my current Linux programming knowledge supports.

pibbuR who is nonetheless having FUN!!!!!

PS I'm using VSCode as my IDE. I must say, with the neccessary extensions it works very well. DS.

PPS. One more thing: I've previously used Make for building large projcets. But that is a loong time ago. Trying out CMake now, it's huge and complicated, with LOTS of options, but the basics aren't too difficult. And VSCode supoports it. DS.
 
Joined
Nov 11, 2019
Messages
2,097
Location
beRgen@noRway
I think I'm going to learn yet another programming language: Aussie++

G'DAY MATE!

IMPOHT ME FUNC HitTheSack;
IMPOHT ME FUNC ChuckSomeDice;

THE HARD YAKKA FOR dreamtime IS () <
GIMME "'boutta get some winks mate";

I RECKON I'LL HAVE A WALKABOUT UNTIL (YEAH, NAH) <
GIMME "zZz…";

HitTheSack(1000);

YA RECKON ChuckSomeDice(0, 6) == 0 ? MATE FUCK THIS;​
>

GIMME "that nap was bonza mate!";
>

dreamtime();

CHEERS C***!


Code example is taken from here: https://aussieplusplus.vercel.app/ which also to some degree documents the language.

Apparently it is possible to use the language. There is a Github project: https://github.com/zackradisic/aussieplusplus/

pibbur who also would like to take a look at TenneC if he could find a link to it.

PS. I am a bit disappointed that there doesn't seem to be a "Hello world" program in Aussie++, so here is my attempt:

G'DAY MATE!

IMPOHT ME FUNC HitTheSack;
IMPOHT ME FUNC ChuckSomeDice;

THE HARD YAKKA FOR dreamtime IS () <
GIMME "Hello world";​
>

dreamtime();

CHEERS C***!


I'm pretty sure about the syntax, but I must admit I'm abit unsure about the correct spelling of "Hello world".
DS.

PPS. Regarding TenneC, I have, a loong time ago, seen it on the net, but I can find it now. DS.
 
Joined
Nov 11, 2019
Messages
2,097
Location
beRgen@noRway
Most popular programming languages in November:

tiobe-nov-2021.png


A couple of things puzzles me:
  • C at number 2. more polpular than C++ and C#
  • Visual Basic at number 6
  • Assembly language at number 8.
  • Several programming languages which I thought would be included are mssing, such as Kotlin, Ruby, Javascript…
And one more question: Is Sql really a programming languag? Oracle PL/SQL is, so is MS TransactSql. But Sql in itself?

select r.nick || ' who writes things' from sysadm.rpg_watch_member_list r where r.knows_sql=true and r.first_name like 'la*' and r.nationality='NO' and p.does_occasionally_make_mistakes=true
 
Joined
Nov 11, 2019
Messages
2,097
Location
beRgen@noRway
A couple of things puzzles me:
  • C at number 2. more polpular than C++ and C#
  • Visual Basic at number 6
  • Assembly language at number 8.
  • Several programming languages which I thought would be included are mssing, such as Kotlin, Ruby, Javascript…
And one more question: Is Sql really a programming languag? Oracle PL/SQL is, so is MS TransactSql. But Sql in itself?
Maybe part of the answer is what they meant by "popular", it's vague. There's not much information on the population they surveyed either: The TIOBE Programming Community index is an indicator of the popularity of programming languages. The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Popular search engines such as Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings. It is important to note that the TIOBE index is not about the best programming language or the language in which most lines of code have been written. - I wouldn't trust that.

I rather like StackOverflow's statistics, their questions are more precise:

No travesty like Visual Basic there, thankfully; not in the top 20 anyway, it's lower than that (probably people who have to suffer it in Excel for scripts in small companies).

As for SQL, I'd say that it depends on the context. It is a domain-specific language, you can program server requests, but it's not a general-purpose programming language.

I'm surprised Kotlin is not higher, shouldn't Android development have boosted it more? I would really hate to use Java for that (I've done it a little bit in the past), it has badly evolved and using patterns such as coroutines or even lambdas requires so much more boilerplate code.
 
Joined
Aug 29, 2020
Messages
10,159
Location
Good old Europe
(copying this from another thread because I'm going off-topic)

Good stuff.

Bit off-topic, but after collecting this stuff, I use an open-source Bookstack server to organise things into electronic scrapbooks. It's technically a wiki, but I don't really think of it like that; it has a paradigm of organising things into shelves, books, chapters and headings, and to me it's just a great way to organise pretty much anything I want to write down. I've used other software over the years that had more functionality, but I've found the clean simplicity of this system works best, for me.

When I find interesting new images, I'll add them to a notebook with perhaps a couple of ideas. I find the bookcase metaphor just helps me organise things in context, which makes it more likely that go back and get some value from past ideas. (And also for website bookmarks - a pile of a thousand bookmarks is of almost no value, but when I put the links in context, I'll actually go back and use them.)
That software could be interesting to organise a scrapbook of scripts and pieces of code, it looks like it can handle highlighting of a multitude of languages with CodeMirror.

For example, I try to keep trace of typical problems I encounter in Linux, like fixing a problem with the greeter or useful operations with pacman, zypper, apt, and so on. Or pieces of code and patterns of frameworks.

I used DokuWiki in the past. It can be very simple to install since it has a file mode, which should not have any performance issue except for very large wikis. I still requires a web server with a PHP module, of course. I'm not sure if it can do nice printouts, I have never tried.
 
Joined
Aug 29, 2020
Messages
10,159
Location
Good old Europe
I just use MS Notes. It uses the same notion of books, chapters and pages, but names them differently. I also don't need a separate server and it is synced on all my devices automatically. I don't use the storage space for anything else, so the free version has more than enough room for notekeeping.
 
Joined
Aug 30, 2006
Messages
11,223
No travesty like Visual Basic there, thankfully; not in the top 20 anyway, it's lower than that (probably people who have to suffer it in Excel for scripts in small companies).

I'm still running big VB6 monoliths for my company, running like a charm on Windows Server 2019 / Citrix. The VB6 runtime is included in every Windows installation. (Every other needed .dll or .ocx file kann be included in the same directory as the .exe file via an additional .manifest file)

VB6 in the hands of a good programmer, still runs circles around every C# or C++ programmer regarding development time and is very friendly for agile development.
For me it is the last real RAD-platform. Delphi is still there, but bloated up a bit.
 
Joined
Oct 18, 2006
Messages
19,818
Location
Germany
I'm still running big VB6 monoliths for my company, running like a charm on Windows Server 2019 / Citrix. The VB6 runtime is included in every Windows installation. (Every other needed .dll or .ocx file kann be included in the same directory as the .exe file via an additional .manifest file)

VB6 in the hands of a good programmer, still runs circles around every C# or C++ programmer regarding development time and is very friendly for agile development.
For me it is the last real RAD-platform. Delphi is still there, but bloated up a bit.

I doubt many languages can be more efficient than C# or Kotlin, especially with asynchronous code, but we must both be biased with what we're used to. :) VB has probably evolved since I last saw it, I see it received features like collections, regular expressions, LINQ and generics, for ex. I suppose C# and VB share a lot in common from .NET.

My comment was for the most common programming needs these days and honestly, I'm surprised C# is that high on the list because it's quite MS-oriented too. I know there's Mono for Linux and macOS, but the advantages are uneven, and the main frameworks only partially ported and compatible. Maybe it comes from gaming development. ;)

Javascript/Typescript, HTML, Java and Python don't surprise me at all.
 
Joined
Aug 29, 2020
Messages
10,159
Location
Good old Europe
I just use MS Notes. It uses the same notion of books, chapters and pages, but names them differently. I also don't need a separate server and it is synced on all my devices automatically. I don't use the storage space for anything else, so the free version has more than enough room for notekeeping.

I've never really used it, it seems nice. And I think that their online web versions must be almost the same as the local app? I've tried the online 365 version of Outlook, Excel and Word a few months ago (because we were migrating the workstations to Linux) and I was really surprised.
 
Joined
Aug 29, 2020
Messages
10,159
Location
Good old Europe
From the perspective of using it, the online version and the app are the same. There are some very specific technical things, like migrating your Notes database to another person, which requires the app, but none of that stuff is needed in normal usage.
 
Joined
Aug 30, 2006
Messages
11,223
Back
Top Bottom