Programming

13384 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 2 years ago
MODERATORS
126
 
 

Source code

This is a very basic Lemmy feed viewer, written in Skew.

It doesn't support much as of yet, but it can view instance/community feeds:

/#/beehaw.org

/#/beehaw.org/c/technology

127
7
submitted 1 year ago* (last edited 1 year ago) by captsneeze@lemmy.one to c/programming
 
 

I hope this isn’t breaking any rules here. I’ve been struggling with a personal web project for the past week, and I’m hoping some smart people here could get me pointed in the right direction.

I’ve already posted a full explanation in another community here, with some informational comments.

Long story slightly shorter… trying to get a website that is great for scoring a tennis match, and making it work offline so I can have it run locally on an offline machine. For some reason that I can’t figure out, the js refuses to work as expected.

First, I thought there may have been a CORS issue. And, the js is checking the protocol and changing it from “file” to “http” (see comments in like above). I worked past this issue, but it's still not really working.

Now, I can see the first action of the “score” function is working (it logs to console), but nothing after that does anything at all, and I can’t figure it out!

Edit: A very kind person (what’s the lemmy equivalent for “redditor”?) offered some insight through a DM that got me on the right track! I won’t put all the details here because it could be considered borderline “unethical” if the wrong person was trying to follow my path. Thanks to that person and to the community! Ive learned a lot in the past weeks.

128
129
 
 

Why is it so in mobile development that 90% of projects does not have proper architecture, and when there is one, devs complain about it. I don't see it being a case for other technologies of development, only mobile. In mobile the project always has spaghetti code, barely any abstraction it is developed just to be finished as quickly as possible and that's it. And when there is clean architecture introduced, everyone complains. Why is it just a case in mobile development?

Just disclaimer: It is not like the architecture in project is completely new invention, it uses well known principles and approaches

130
 
 

How would you design a tool to specify deeply nested forms, basically a complex decision tree, eg for medical diagnosis or complex tax stuff etc, where future form elements can dependent on a previously specified one, but statically ie chosen from few option not generated via a function so that all options and branches are known without executing code. The form specification should just be declarative, data. What data structure would you use to represent that form (I think it would basically be a DAG)? What language would you write it in? How would you generate a graphical representation (eg converting to .dot)? How would you generate a fillable form from it?

131
16
submitted 1 year ago* (last edited 1 year ago) by dontblink@feddit.it to c/programming
 
 

I'm doing a JavaScript course, i got to know typescript and i definetely see it as a way better alternative and way of writing cleaner code in the usually messed up js.

Anyway it's not quite clear to me what i should do now, because i understand javascript to a decent level, but i woul love to use typescript in the future for my projects..

It's knowing javascript in depth better or should i opt into a new course that teaches typescript in depth, if so, do you have any resources (free, paid courses, free docs like MDN or javascript.info) to suggest me?

I'm following the "complete javascript course" from jonas schemdtman, that i got suggested from coding communities, on udemy, which is an 80 hours course that looks quite complete to me, it teaches about the js engine, its compilation style and its runtime too, not just the code, is there anything similar? My goal would be opting into typescript and really digging into it, really learning how it works on code level and behind the scenes.

132
 
 

C is an old language lacking many, many, many modern features. One of the features it does not lack is encapsulation and isolation.

133
7
Coroutines for Go (research.swtch.com)
submitted 1 year ago by Penguincoder to c/programming
 
 

This post is about why we need a coroutine package for Go, and what it would look like. But first, what are coroutines?

Every programmer today is familiar with function calls (subroutines): F calls G, which stops F and runs G. G does its work, potentially calling and waiting for other functions, and eventually returns. When G returns, G is gone and F continues running. In this pattern, only one function is running at a time, while its callers wait, all the way up the call stack.

134
135
10
LISP On The Atari 2600 (WIP) (forums.atariage.com)
submitted 1 year ago by thales08 to c/programming
136
137
138
139
140
 
 

Hello fellow programmers!

I have a website I am creating for a non-profit with multiple locations, and I want to know the best approach to take. The styling will be the same for all them, but the actual content should change depending on the location. I want to create the website in a way that is easy for someone who is not technical to update, even if it's only text, images, and links. Any thoughts would be helpful.

I would like to avoid libraries or frameworks, as I want a simple ftp server to reduce costs and complexity for everyone involved.

141
142
143
6
Lemmy Sampler (lemmy-sampler.pages.dev)
submitted 1 year ago by brie to c/programming
 
 

This is a small project I made to view random posts.

144
22
Crystal 1.9.0 is released! (crystal-lang.org)
submitted 1 year ago by kool_newt to c/programming
 
 

I learned about Crystal from somebody's Lemmy comment a couple weeks ago. Amazing and under rated language.

Their announcement is pretty lackluster tho lol.

145
 
 

Websites, mobile apps, desktop apps and mobile OSes are developed and updated using the desktop OSes, which I would call the 'master OS'. But who updates the 'master'? How do the devs upgrade Windows 10 to Windows 11 using Windows 10?

I have some experience in computing but software development for operating systems is completely mysterious for me. I have had this question ever since I learned about software development in general.

I saw Apple say how they use the Macs to build all of their other products and softwares, but they never answer how they build macOS itself. I understand how these companies could design an upgraded or a brand new computer by designing its new architecture as well as the circuitry and the components underneath with the help of a program like CAD. What I don't understand is how they upgrade their existing software they themselves work in, especially when it has completely new features the old one doesn't have. I feel like this is similar to a person performing a brain surgery on himself.

I would really appreciate if someone could ELI5 but only dumb it down enough for a person that understands how to really work with computers and knows the general theory of programming , like an amateur or the family IT guy.

146
14
Email is Dead (juliette.page)
submitted 1 year ago by juliette@pawb.social to c/programming
147
25
Bevy 0.11 is out! (bevyengine.org)
submitted 1 year ago by Lionir to c/programming
148
 
 

I signed in with my Google account. I was looking at the cookies kbin sets and the user token REMEMNERME is only set to last for one week.

Does this mean I have to religion after a week?

If not, how does kbin know to keep me logged in after the REMEMBERME cookie expires?

149
 
 

Some friends and I are trying to learn Haxe together by working on a simple game. We're all like pretty much total amateurs at this stuff. For collaborating I set us up a repo for it on Gitlab, and I've been trying to run the actual code through Gitpod, but I can't get it to work... Has anyone else done this successfully?

Just to focus on ONE error at a time, here's this: I get a workspace loaded up seemingly successfully, with Haxe installed. But when I try to run haxelib setup for all the requisite libraries, it asks me for an install directory, and I apparently do not have write privileges?

150
 
 

I bought a domain on OVH and since I expected little use of email on that domain, I made do with the "included" email. The one that uses roundcube 1.4 (from the last century) as webmail.

One day I get an email:

Votre boite mail a atteint 90% de l'espace maximum autorisé sur le serveur. (your mailbox is full)

"It must be a bug, I have 5gb of space and I have only a dozen mails in the box" - I say to myself

But instead all the mails sent to this mailbox bounce with the error "mailbox full".

Since the mails are of little importance, I delete everything and empty the trash, now it is empty, but incoming mails are rejected with "mailbox full"

I open a ticket, they don't believe it at first, but after sending screenshots of both the roundcube quota and their panel showing that the usage is zero, they restore my access.

After a couple days I again get the usual email in French "your box is full".

I reopen the ticket and they tell me that everything is normal and that it is the fault of my email client.

Now that i think about, I did some experiments with python to see if I could see the mails on the server, but I put read-only access, I don't think it's my fault...

Here is the code:

import imaplib
import email
from datetime import datetime, timedelta
from sendmail import SendMail
from connection import Connection

class GetMail:
    def __init__(self, connection):
        self.connection = connection

    def fetch_emails(self):
        # Connessione all'account IMAP
        imap = imaplib.IMAP4_SSL(self.connection.imap_server)
        imap.login(self.connection.username, self.connection.password)

        imap.select('INBOX', readonly=True)

        imap.search(None, 'ALL')

        email_ids = data[0].split()
        email_ids = email_ids[:quantemail]

        for email_id in email_ids:
            status, data = imap.fetch(email_id, '(BODY[HEADER.FIELDS (FROM SUBJECT)])')
            raw_email = data[0][1]
            print('Raw Email:\n', raw_email.decode('utf-8'), '\n')

        if email_ids:
            try:
                email_index = int(input("Inserisci l'indice dell'email da scaricare: "))
            except:
                email_index = -1

            if 1 <= email_index <= len(email_ids):
                email_id = email_ids[email_index - 1]
                status, data = imap.fetch(email_id, '(RFC822)')
                raw_email = data[0][1]

                email_message = email.message_from_bytes(raw_email)

                eml_filename = f"email_temp.eml"

                with open(eml_filename, 'wb') as eml_file:
                    eml_file.write(raw_email)

                print("Email scaricata:", eml_filename)
            else:
                print("Indice email non valido.")
        else:
            print("Nessuna email trovata.")

        imap.logout()

It seems strange to me that if I log in one day with this program, then a few days later the box shows as full even though it is not, and deleting messages does not restore access.

Maybe if you log in with "readonly=true", then the server has a bug where it puts the whole box read-only and can no longer receive mail?

view more: ‹ prev next ›