26
13

Hello! I'll try to explain what I'm looking for: I sometimes have to write simple web pages (not just text, also buttons and video players and so on), but I really really hate writing html code. What I'm used to is QML, which I like a lot, because of the ease of placing objects exactly where I need using the anchors and the Layout objects. What I'm looking for is a language or something with a similar syntax, that can then be "built" to plain HTML/CSS/JS. Is there something like this? I know I can compile Qt/QML for webassembly, but I'm having huge amounts of problems, and also I'd like to have the possibility to have a plain HTML result, not necessary bind to the server side.

thanks in advance!!

27
4

cross-posted from: https://lemmy.ca/post/15730457

I've written a basic media player using Python, PyGTK, and GStreamer. However, I've found a bug that I'm having trouble finding a fix to.

In this program, opening a video launches a second window, in which the video is played back. If I close said window, however, the control window freezes and I get the following error:

gst-resource-error-quark: Output window was closed (3) ../sys/xvimage/xvimagesink.c(586): gst_xv_image_sink_handle_xevents (): /GstPlayBin:player/GstPlaySink:playsink/GstBin:vbin/GstXvImageSink:xvimagesink0

The source code can be found here.

Does anybody have any idea how to fix this? Or is this perhaps a bug in one of the libraries?

28
26

Subverting Betteridge's law of headlines. Yes.

29
24
submitted 6 months ago* (last edited 6 months ago) by hydroptic@sopuli.xyz to c/programming@beehaw.org

Not mine.

"Part 1" is this, it's also linked to in the body.

I really wonder what happened:

Update (21 August 2023): I did continue my investigation, but I have decided not to publish the results. Please do not continue to email me about this.

30
6
submitted 7 months ago* (last edited 7 months ago) by friendly_ghost@beehaw.org to c/programming@beehaw.org

I'm digging into the world of #FOSS #opensource and would like to help with existing projects. My programming chops are not sharp yet, but I'm a detail-oriented communicator who knows a bit about user testing.

How do I find projects on GitHub, GitLab, or other sites that need this kind of help? The machines I would be testing on are a potato desktop running Pop_OS Linux and an Android phone. Thanks in advance!

31
17
submitted 7 months ago by schmudde@beehaw.org to c/programming@beehaw.org
32
7
submitted 7 months ago* (last edited 7 months ago) by brie@beehaw.org to c/programming@beehaw.org

Edit 2024-01-26: I ended up feature creeping it a bit. It can now be used as a less input filter, and asciinema-esque recording playback.

Original post:

A less bad name TBD.

This is a little program I made to convert script captures into properly laid out text. A lot of the behaviour still isn't quite right, but I'm pretty happy with it as a proof-of-concept.

33
15
submitted 7 months ago by mozz@mbin.grits.dev to c/programming@beehaw.org

So. I was working with this code:

public function front(?string $sortBy,
        ?string $time,
        ?string $type,
        ?string $filter,
        string $federation,
        Request $request): Response
    {
        $user = $this->getUser();

        if (!$user)
        {
            $filter = 'all';
        }

        $criteria = new EntryPageView($this->getPageNb($request));
        $criteria->showSortOption($criteria->resolveSort($sortBy))    

... and so on; the function continues. VSCode told me there was a syntax error on the close brace on the if statement. I stared at it for a while, then pasted the code into GPT (not Copilot). Here's the conversation we had about it:


Me

What's the syntax error here?

(and I pasted the code)

GPT

The syntax error in your PHP function public function front seems to be due to the incorrect placement of the closing curly brace for the if statement. It appears that the if statement is not properly closed before the $criteria initialization begins. The corrected code should look like this:

public function front(?string $sortBy, ?string $time, ?string $type, ?string $filter, string $federation, Request $request): Response
{
    $user = $this->getUser();

    if (!$user) {
        $filter = 'all';
    } // Closing brace for the if statement

    $criteria = new EntryPageView($this->getPageNb($request));
    $criteria->showSortOption($criteria->resolveSort($sortBy));
    // ... rest of your function code ...
}

Ensure that each statement and block is properly closed and followed correctly by the next statement. This corrected structure should resolve the syntax error you are encountering.

Me

I don't get it. I put a closing curly brace right after the statement in mine... what am I missing?

GPT

I apologize for the confusion. Upon re-examining your code, it seems the placement of the curly brace is correct. If you're still encountering a syntax error, it may not be related to the if statement structure.

Let's look at other possible issues:


... and so on. Pasting GPT's recommended if-statement block, including the curly brace that was already there, fixed the error. I have since re-pasted the same thing I initially gave to GPT to VSCode, and it all works now, and asking the exact same question of GPT again now leads to random guesses which have nothing to do with the cursed curly brace that was previously causing problems for both VSCode and GPT.

I have given up and moved on at this point, content to say vaguely that maybe the unusual brace style, or pasting the incomplete function without semicolon or final close brace, managed to coincidentally confuse GPT on exactly the same line where VSCode had gotten confused for unexplained reasons. But the whole thing still has this Twilight-Zone oddness to me.

34
31

Text description (for those with screenreaders):

A portion of a prime number checker written in the Rust programming language, where the first few lines are written correctly including the first if statement in the program. However, the following if statements are written using Python syntax instead of Rust, as the author slipped back into his native tongue.

35
21
submitted 8 months ago* (last edited 8 months ago) by friendly_ghost@beehaw.org to c/programming@beehaw.org

EDIT: Thanks y'all! I got this working by installing mutt and configuring it with my Gmail info. Please note the warning from u/jherazob below--if this were something mission critical I would not want to rely on this solution.

================

Noob question incoming, thanks in advance for any help with this!

I have a specific use case in which I want to send an automated email or text to myself once a day (the message is different each time--otherwise I would just set an alarm, lol!). I'm running Pop_OS on an old desktop computer. Where I'm stuck is getting an email to successfully send from the command line. I'm looking for easy-to-follow instructions that would help me do that, and none of the articles or videos I've come across thus far have helped.

I'm aware of Twilio and other services that send SMS messages, but I'm looking for something free. Especially since I only need to text one person (myself), and infrequently at that.

Below is my attempt to send an email with the telnet command. Nothing ever came through...

XXXXXXXX@pop-os:~$ telnet localhost smtp
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 pop-os ESMTP Exim 4.95 Ubuntu Sun, 07 Jan 2024 15:12:28 -0500
HELO gmail.com
250 pop-os Hello localhost [::1]
mail from: XXXXXXXX@gmail.com
250 OK
rcpt to: XXXXXXXX@gmail.com
250 Accepted
data
354 Enter message, ending with "." on a line by itself
Subject: Test
Body: Is this working?
.
250 OK id=1rMZW4-0002dj-Uy
quit
36
23

cross-posted from: https://programming.dev/post/8121843

~n (@nblr@chaos.social) writes:

This is fine...

"We observed that participants who had access to the AI assistant were more likely to introduce security vulnerabilities for the majority of programming tasks, yet were also more likely to rate their insecure answers as secure compared to those in our control group."

[Do Users Write More Insecure Code with AI Assistants?](https://arxiv.org/abs/2211.03622?

37
7

Deploy Golang applications to a Raspberry PI

38
16
submitted 9 months ago* (last edited 9 months ago) by ericjmorey@programming.dev to c/programming@beehaw.org

cross-posted from: https://lemmy.world/post/9117180

If you're writing Advent of Code solutions in Rust, then I've written a crate that can fetch the user input data directly from the main website.

Long story short, you provide it a login token copied from your browser cookies, and it can fetch the input data by year and day. Inputs are cached locally, so it'll only download it once for a given problem. This was heavily inspired by the PyPi advent-of-code-data package.

Unlike other AoC-centric Rust crates, that's all it does. The other crates I've seen all want the code structured in a specific way to add timing benchmarks, unit testing, and other features. I wanted something lightweight where you just call a function to get the input; no more and no less.

To use the crate:

  • Follow the AoCD instructions to set the AOC_SESSION environment variable.
    This key is used for authentication and should not be shared with anyone.
  • Add the aocfetch crate to your Cargo.toml [dependencies] section:
    aocfetch = { git = "https://github.com/ooterness/AdventOfCode.git" }
  • Import the crate and call aocfetch::get_data(year, day) to fetch your input data.

An example:

use aocfetch;

fn main() {
    let input = aocfetch::get_data(2023, 1).unwrap();
    println!("My input data: {}", input);
    println!("Part 1 solution: 42");    // TODO
    println!("Part 2 solution: 42");    // TODO
}

If this goes well I will submit it to crates.io, but I wanted to open this up for beta-testing first.

39
1
submitted 9 months ago by Aatube@kbin.social to c/programming@beehaw.org
40
97
submitted 9 months ago* (last edited 9 months ago) by ericjmorey@programming.dev to c/programming@beehaw.org

cross-posted from: https://programming.dev/post/6660679

It's about asking, "how does this algorithm behave when the number of elements is significantly large compared to when the number of elements is orders of magnitude larger?"

Big O notation is useless for smaller sets of data. Sometimes it's worse than useless, it's misguiding. This is because Big O is only an estimate of asymptotic behavior. An algorithm that is O(n^2) can be faster than one that's O(n log n) for smaller sets of data (which contradicts the table below) if the O(n log n) algorithm has significant computational overhead and doesn't start behaving as estimated by its Big O classification until after that overhead is consumed.

#computerscience

Image Alt Text:

"A graph of Big O notation time complexity functions with Number of Elements on the x-axis and Operations(Time) on the y-axis.

Lines on the graph represent Big O functions which are are overplayed onto color coded regions where colors represent quality from Excellent to Horrible

Functions on the graph:
O(1): constant - Excellent/Best - Green
O(log n): logarithmic - Good/Excellent - Green
O(n): linear time - Fair - Yellow
O(n * log n): log linear - Bad - Orange
O(n^2): quadratic - Horrible - Red
O(n^3): cubic - Horrible (Not shown)
O(2^n): exponential - Horrible - Red
O(n!): factorial - Horrible/Worst - Red"

Source

41
20

Preamble: I'm sure there's a better community to ask this question, comment below if you're aware of it.

Okay, for background I'm a bootcamp student, I'm still learning, but I'm almost done. I've been tweaking my LinkedIn as I go, trying to be more attractive for recruiters in the future. Well, last week I was contacted by a recruiter, and asked if I was interested in job opportunities. I did some brief research, and it looks like an actual company on Glassdoor. Anyway, I sent over my resume, and was on a call for maybe 5 minutes. We talk for a bit, and she asked me how I am in interviews and my experience. I tell her that I've been "technically" freelance, but I haven't done anything because of starting cost, but she seemed to ignore that concern. Towards the end of the call I asked her if this would be with her company, and she said yes, and then I said bye.

Now, the problem is that this company is specifically for interview prep, and helping students get hired at other companies. While she said I'd be with her company, I'm concerned that I'm trying to be sold something here. The company is called GigaMe, and there is barely anything online about them.

So, my overall question would be, "what would you do?" Or, what should I expect? I don't think i should get my hopes up, but any advice would help.

42
16
submitted 9 months ago by t_378@lemmy.one to c/programming@beehaw.org

A friend of mine is interested in the "sovereign artist" model, which basically means that you self publish and self release your own work on your own website, as opposed to using a publishing house or art gallery.

It's powerful because it gives everyone a platform to share "niche" art, but as a consumer, it can be difficult to find and "curate" high quality, interesting works of art. Is there a rating/voting system that exists that is resitant to internet vote tampering?

I'm talking about how 10 years ago, Amazon reviews were pretty helpful. But now they've been swarmed with paid and bot written reviews. Same with Slickdeals and many others.

I'd want a voting system that incorporates some ideas:

  • it would prevent one person from making multiple fake accounts
  • reviews wouldn't be suppressed or promoted by paid algorithims
  • the algorithm WOULD help connect people to items they are interested in. But maybe the workings of it would be open source, so it can be audited for bad acting.

Does a project like this exist somewhere? Rather than host that project in one place, it could be powerful to defederate and prevent the temptation to manipulate algorithms.

43
27
submitted 9 months ago* (last edited 9 months ago) by drailin@kbin.social to c/programming@beehaw.org

Hey there everyone, I am back with v1.1 of my Latex Template for making D&D Item Cards. I received one major point of feedback from multiple people in the fediverse: make an option for fixing the card dimensions for easier printing and distribution/storage at the table. So that is exactly what I did!

Now you can choose the (admitedly more user-friendly) option of letting the card length vary for digital distribution, or you can fix the card aspect ratio. The item art background and text backgrounds can also now be changed, and a number of options have been included for item art backgrounds, but you can use whatever images you want.

Example Cards

The fixed-size cards are 5:7 by default, the same as playing cards. They include a front and back side for longer item descriptions, but you will have to edit the text more carefully and decide where to split between front/back content.

For the printable card item art, I highly recommend using a PNG with a transparent background and modifying tcolorbox interior style to set your background. Ensure your backgound art is close to 7:5 for best results. You can also load your image as the background art if you'd like instead, again, making sure it is in 7:5.

44
8

cross-posted from: https://programming.dev/post/6470590

This looks like a great starting point for people with little to no experience with programming to learn to program using Python.

Everything taught by futurecoder.io can be used locally on your own computer. But futurecoder.io doesn't show you how to install Python on your machine but you can fill in that gap with the information provided @ https://wiki.python.org/moin/BeginnersGuide/Download

Other resources are provided on the python.org Beginners Guide if needed.

45
14
submitted 9 months ago by drailin@kbin.social to c/programming@beehaw.org

Hey there programmers, I know this is a more markup/typesetting deal, but I thought there might be people who are interested. After being dissapointed with many of the options out there for making ttrpg item cards, I made a LaTeX template for that exact purpose. I wanted it to be relatively easy to use, generate clean images, and be (semi) form fillable. The cards scale in height with the quantity of text given and image size, so users don't need to finagle with the box dimensions too much, and all card sections (generated by custom commands) can either be commented out or toggled off if they aren't relevant to the item.

If there are any people familiar with TeX who have thoughts or constructive criticism, I would love to get some more eyes on this. I have already posted this in the relavant ttrpg areas, but I am hoping people here might have more technical critiques. I have already gotten feedback that a setting for fixed dimensions would be smart in case players want to get card sleeves or a card binder, and want to make a back side for longer item descriptions, which I will work into V2.

Here is an example of a completed card with all the trimmings: Staff of the Jackal Lord

Thanks to anyone who takes the time to check it out, and if anyone uses it, please let me know what you think!

46
5

Hi. Is there some fully FOSS version of Intellij IDEA CE? Because the official download includes some proprietary bits.

47
14
48
39

I accidentally discovered that both "cd ..." and "..." work, and moreover, I can add more dots to go back further! I'm using zsh on iTerm2 on macOS. I'm pretty sure this isn't a cd feature. Is this specific to zsh or iTerm2? Are there other cool features I just never knew existed??

I'm so excited about an extra dot right now.

49
13
Everyday Use of GNU Guix (www.youtube.com)
submitted 10 months ago by mrh@mander.xyz to c/programming@beehaw.org
50
13
submitted 10 months ago* (last edited 10 months ago) by potterman28wxcv@beehaw.org to c/programming@beehaw.org

Cross-posting this here as I saw some misconceptions about Rust language

I think that blog describes well the pros of using a strongly-typed language like Rust is. You may fight the compiler and get slower build times but you get less bugs because of the restrictions the language imposes you.

The biggest con of Rust is that it requires learning to be used, even for someone who has already programmed before. It's not like Python or Ruby where you can just dive in a code base and learn on the go. You really need to read the Rust book (or skim through it) to get through the notions. So it has a higher entry level, with all the misunderstandings that come with it.

view more: ‹ prev next ›

Programming

13097 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS