General Programming Discussion

8556 readers
20 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 6 years ago
MODERATORS
1
 
 

For a school project I need to make a simple python program. I need ideas so if you have something that you want made for you then please post it here. I'll release it here under a gnu general public license once I've finished.

2
 
 

What called my attention is that assessments of AI are becoming polarized and somewhat a matter of belief.

Some people firmly believe LLMs are helpful. But programming is a logical task and LLMs can't think - only generate statistically plausible patterns.

The author of the article explains that this creates the same psychological hazards like astrology or tarot cards, psychological traps that have been exploited by psychics for centuries - and even very intelligent people can fall prey to these.

Finally what should cause alarm is that on top that LLMs can't think, but people behave as if they do, there is no objective scientifically sound examination whether AI models can create any working software faster. Given that there are multi-billion dollar investments, and there was more than enough time to carry through controlled experiments, this should raise loud alarm bells.

3
 
 

Vcc - the Vulkan Clang Compiler, is a proof-of-concept C and C++ compiler for Vulkan leveraging Clang as a front-end, and Shady our own research IR and compiler. Unlike other shading languages, Vcc aims to stick closely to standard C/C++ languages and merely adds a few new intrinsics to cover GPU features. Vcc is similar to CUDA or Metal in this regard, and aims to bring the advantages of standard host languages to Vulkan shaders.

Key Features

Vcc supports advanced C/C++ features usually left out of shading languages such as HLSL or GLSL, in particular raising the bar when it comes to pointer support and control-flow:

  • Unrestricted pointers
    • Arithmetic is legal, they can be bitcasted to and from integers
  • Generic pointers
    • Generic pointers do not have an address space in their type, rather they carry the address space as a tag in the upper bits.
  • True function calls
    • Including recursion, a stack is implemented to handle this in the general case
  • Function pointers
    • Lets you write code in a functional style on the GPU without limitations
  • Arbitrary goto statements - code does not need to be strictly structured !

Many of these capabilities are present in compute APIs, but are not supported in most graphics APIs such as DirectX or Vulkan. We aim to address this gap by proving these features can and should be implemented. More on why we think that’s important.

4
5
6
 
 

As, programmers what is the project that you made that made you learn the most and also added the most value to your resume?

@technology
@programming

#technology #programming

7
8
9
10
11
12
 
 

Hi everyone, I recently launched Flogo, a visual programming app that lets you build and simulate flowcharts with real logic execution. It’s designed for both students and developers, and supports things like:

Conditional blocks (if, for, while, dowhile)

Real-time simulation (console or navigation mode)

Dynamic input

Plotting graphs (plot() function)

Complex numbers, matrices, and over 100 built-in functions

Free, no ads, available for iOS & Android

If you're into visual coding, algorithm design, or teaching programming, give it a try! Feedback is welcome.

Links:

Android: https://play.google.com/store/apps/details?id=com.flogo.myapp

iOS: https://apps.apple.com/it/app/flogo/id6744535672

Thanks!

13
 
 
14
15
16
 
 

cross-posted from: https://lemmy.ml/post/29133545

Like every major GCC release, this version will bring many additions, improvements, bug fixes, and new features. GCC 15 is already the system compiler in Fedora 42. Red Hat Enterprise Linux (RHEL) users will get GCC 15 in the Red Hat GCC Toolset. It's also possible to try GCC 15 on Compiler Explorer and similar pages.

This article describes only new features implemented in the C++ front end; it does not discuss developments in the C++ language itself.

The default dialect in GCC 15 is still -std=gnu++17. You can use the -std=c++23 or -std=gnu++23 command-line options to enable C++23 features, and similarly for C++26 and others.

17
 
 

The GCC developers are pleased to announce the release of GCC 15.1.

The C frontend now defaults to the GNU C23 dialect. Some code needs porting for this. Some remaining C23 features have been implemented, as well as some new C2Y features.

The C++ frontend now implements several further C++26 features, some missing C++23 bits, and defect report resolutions. The libstdc++ library now notably experimentally supports std and std.compat modules, more algorithms usable in constexpr functions, flat maps and sets, and std::format support for containers and other ranges.

GCC now implements the Clang [[clang::musttail]] and [[clang::flag_enum]] attributes and their GNU counterparts with the same meaning for the C family language frontends. Support for new counted_by and nonnull_if_nonzero attributes has been added too.

The Fortran frontend has experimental support for unsigned integers.

GCC 15.1 has new COBOL frontend, so far supported only on a few 64-bit targets.

OpenMP support now includes metadirectives, tile and unroll constructs, interop construct and dispatch construct.

The vectorizer can now vectorize loops with early exits when array or buffer sizes aren't statically known. At -O2 can now vectorize some cheaply vectorizable loops with unknown tripcount.

Some code that compiled successfully with older GCC versions might require source changes, see Porting to GCC 15 for details.

For details see GCC 15 Release Series Changes, New Features, and Fixes).

18
 
 

I'm currently job hunting and looking for a platform to prep for interviews.

Leetcode is nice but it locks hard problems behind a paywall that I honestly can't afford right now.

I mean I can still read the problem from https://leetcode.ca/, but it's hard to test it against a good set of test cases.

Please share alternative portals with a decent hard problem collection with testcases

19
20
21
 
 

I work at Red Hat on GCC, the GNU Compiler Collection. I spent most of the past year working on how GCC emits diagnostics (errors and warnings) in the hope of making it easier to use. Let's take a look at 6 improvements to look forward to in the upcoming GCC 15.

  1. Prettier execution paths
  2. A new look for C++ template errors
  3. Machine-readable diagnostics
  4. An easier transition to C23
  5. A revamped color scheme
  6. libgdiagnostics
22
 
 

Most open source projects are important alternatives to escape pilitical and commercial control/limitations/censorship existant in commercial products, driven by commercial interests. With the current situation all US-based companies are even more subject to political pressure.

An embargo by the US towards any country/entity would mean US companies have to shut down their services for that entity.

As many open source projects seem to be hosted on github (M$), could they be blocked nearly instantly? Thus giving the pumpkin the power to sabotage alternatives to US controlled tools?

(Hope I‘m not in the wrong community to bring this up. Hints to better suited places are welcome.)

23
24
 
 

Qt 6.9 is here! This release brings exciting innovations, enhanced graphics performance, and new platform capabilities to help you build exceptional applications.

Highlighted improvements in Qt 6.9 include:

  • Qt Graphs: Interactive 2D panning, zooming, and dynamic 3D graph injection. Printing support now available!
  • Qt Quick: GPU-accelerated SVG animations and Variable Rate Shading for improved graphics performance.
  • Qt Quick Controls: New context menu support enhances desktop integration and user experience.
  • XR Enhancements: Haptic feedback added for creating richter immersive virtual interactions.
25
 
 

I got some mp3s with cyrillic id3 tags that didn't decode properly on my machine. I decided to ask DeepSeek to write a script to fix that, and it just worked on the first try. Around a 100 lines of code.

here it is:

npm install iconv-lite node-id3
const iconv = require('iconv-lite');
const NodeID3 = require('node-id3');
const fs = require('fs').promises;

async function decodeMP3Tags(filePath) {
    try {
        // Read both ID3v2 and ID3v1.1 tags
        const tags = {
            v2: NodeID3.read(filePath),
            v1: await readID3v1(filePath)
        };

        // Merge tags with priority to ID3v2
        const mergedTags = {
            title: tags.v2.title || tags.v1?.title,
            artist: tags.v2.artist || tags.v1?.artist,
            album: tags.v2.album || tags.v1?.album,
            year: tags.v2.year || tags.v1?.year,
            comment: tags.v2.comment?.text || tags.v1?.comment,
            trackNumber: tags.v2.trackNumber || tags.v1?.track
        };

        // Decode all fields
        const decodedTags = {};
        for (const [field, value] of Object.entries(mergedTags)) {
            if (value) decodedTags[field] = decodeCyrillic(value);
        }

        // Write back as ID3v2.4 tags with UTF-8 encoding
        NodeID3.update(decodedTags, filePath);

        // Remove ID3v1.1 tags if present
        await removeID3v1(filePath);

        console.log('Successfully updated tags:', decodedTags);
    } catch (error) {
        console.error('Error processing file:', error);
    }
}

// ID3v1.1 Reader (128 bytes at end of file)
async function readID3v1(filePath) {
    try {
        const buffer = Buffer.alloc(128);
        const handle = await fs.open(filePath, 'r');
        const stats = await handle.stat();

        if (stats.size < 128) return null;
        await handle.read(buffer, 0, 128, stats.size - 128);
        await handle.close();

        if (buffer.toString('ascii', 0, 3) !== 'TAG') return null;

        return {
            title: buffer.toString('binary', 3, 33),
            artist: buffer.toString('binary', 33, 63),
            album: buffer.toString('binary', 63, 93),
            year: buffer.toString('binary', 93, 97),
            comment: buffer.toString('binary', 97, 127),
            track: buffer[125]
        };
    } catch (e) {
        return null;
    }
}

// ID3v1.1 Remover
async function removeID3v1(filePath) {
    try {
        const handle = await fs.open(filePath, 'r+');
        const stats = await handle.stat();

        if (stats.size < 128) return;
        const endBuffer = Buffer.alloc(128);
        await handle.read(endBuffer, 0, 128, stats.size - 128);

        if (endBuffer.toString('ascii', 0, 3) === 'TAG') {
            await handle.truncate(stats.size - 128);
        }
        await handle.close();
    } catch (e) {
        console.error('Error removing ID3v1:', e);
    }
}

// Cyrillic decoding (same as previous)
function decodeCyrillic(text) {
    const bytes = Buffer.from(text, 'latin1');
    const encodings = ['windows-1251', 'koi8-r', 'iso-8859-5', 'cp866'];
    let best = { decoded: text, count: 0 };

    for (const encoding of encodings) {
        try {
            const decoded = iconv.decode(bytes, encoding);
            const count = [...decoded].filter(c => {
                const cp = c.codePointAt(0);
                return (cp >= 0x0400 && cp <= 0x04FF) || (cp >= 0x0500 && cp <= 0x052F);
            }).length;

            if (count > best.count) best = { decoded, count };
        } catch (e) {}
    }
    return best.decoded;
}

// Usage
const filePath = process.argv[2];
if (!filePath) {
    console.log('Usage: node decode-mp3.js path/to/file.mp3');
    process.exit(1);
}

decodeMP3Tags(filePath);
view more: next ›