einval

u/einval@lemmy.einval.net
19 posts · 17 comments

Recent posts

Recent comments

I can't think of any one truly terrible episode I secretly enjoyed. I hate all of the episodes that were laser focused on Wesley Crusher, boy genius. If I had to pick a best of the worst from that pool I'd go with "The Game". 😀

I haven't had that happen to me yet, but it sounds annoying as hell. The "undetermined" language shouldn't exist. That needs be a silent default. The user should be able select their primary language with a drop-down menu. The combo box would still exist but it'd be completely optional.

In your case it'd be nice if the "Select Language" drop-down was automatically set to the community's default language. And maybe put a little red icon next to it when your language settings are incompatible.

What I use on Linux:

  1. Vim
  2. GNU Make
  3. NASM (nasm.us)

NASM uses Intel assembly syntax. If you want to learn and use AT&T syntax you can use GNU Assembler (as) provided by the bintutils package instead.

How I use it:

Create a project

mkdir hello_world
cd hello_world
touch Makefile hello_world.asm

Write a Makefile

Note the indents below are supposed to be TAB characters, not spaces.

Makefile

all: hello_world

hello_world.o: hello_world.asm
        nasm -o $@ -f elf32 -g $<

hello_world: hello_world.o
        ld -m elf_i386 -g -o $@ $<

.PHONY: clean
clean:
        rm -f hello_world *.o

Write a program

hello_world.asm

; Assemble as a 32-bit program
bits 32

; Constants
SYS_EXIT  equ 1         ; Kernel system call: exit()
SYS_WRITE equ 4         ; Kernel system call: write()
FD_STDOUT equ 1         ; System file descriptor to write to
EXIT_SUCCESS equ 0

; Variable storage
section .data
        msg:            db "hello world from ", 0
        msg_len:        equ $-msg
        linefeed:       db 0xa ; '\n'
        linefeed_len:   equ $-linefeed

; Program storage
section .text
global _start

_start:
        ; Set up stack frame
        push ebp
        mov ebp, esp

        ; Set base pointer to argv[0]
        add ebp, 8

        ; Write "hello world from " message to stdout
        mov eax, SYS_WRITE
        mov ebx, FD_STDOUT
        mov ecx, msg
        mov edx, msg_len
        int 80h

        ; Get length of argv[0]
        push dword [ebp]
        call strlen
        mov edx, eax

        ; Write the program execution path to stdout
        mov eax, SYS_WRITE
        mov ebx, FD_STDOUT
        mov ecx, [ebp]
        ; edx length already set
        int 80h

        ; Write new line character
        mov eax, SYS_WRITE
        mov ebx, FD_STDOUT
        mov ecx, linefeed
        mov edx, linefeed_len
        int 80h

        ; End of stack frame
        pop ebp

        ; End program
        mov eax, SYS_EXIT
        mov ebx, EXIT_SUCCESS
        int 80h

strlen:
        ; Set up stack frame
        push ebp
        mov ebp, esp

        ; Set base pointer to the first argument on the stack
        ; strlen(buffer);
        ;        ^
        add ebp, 8

        ; Save registers we plan to write to
        push ecx
        push esi

        ; Clear string direction flag
        ; (i.e. lodsb will *increment* esi)
        cld

        ; Zero counter
        xor ecx, ecx

        ; Load address of buffer into the "source index" register
        mov esi, [ebp]
        .loop:
                ; Read byte from esi
                ; Store byte in eax
                lodsb

                ; Loop until string NUL terminator
                cmp eax, 0
                je .return
                ; else: Increment counter and continue
                inc ecx
                jmp .loop

        .return:
                ; Return string length in eax
                mov eax, ecx

                ; Restore written registers
                pop esi
                pop ecx

                ; End stack frame
                pop ebp

                ; Pop stack argument
                ; 32-bit word is 4 bytes. We had one argument.
                ret 4 * 1

Compile and run

$ make
nasm -o hello_world.o -f elf32 -g hello_world.asm
ld -m elf_i386 -g -o hello_world hello_world.o
$ ./hello_world 
hello world from ./hello_world

Adding a debug target to the makefile

Want to fire up your debugger immediately and break on the main entrypoint? No problem.

Makefile

gdb: hello_world
    gdb -tui -ex 'b _start' -ex 'run' --args $<

Now you can clean the project, rebuild, and start a debugging session with one command...

$ make clean gdb
rm -f hello_world *.o
nasm -o hello_world.o -f elf32 -g hello_world.asm
ld -m elf_i386 -g -o hello_world hello_world.o
gdb -tui -ex 'b _start' -ex 'run' --args hello_world
# You're debugging the program in GDB now. Poof.

Yeah, I think the story and voice acting saved this game from the fiery demise it rightfully deserved at launch. I wouldn't classify it as a timeless masterpiece but it does stick with you long after it ends. It'll be a few more years before it fades away or gets replaced by something else. You still have time. 🙂

on Bug in UI · c/general · 1 pts · 3y

It's a manual process. In theory an upgrade should be as easy as updating the image tags for Lemmy and Lemmy UI in the docker-compose.yml file, then taking everything down and praying it starts back up again.

I'm not sure how they're going to go about telling everyone they need to upgrade. Or I guess I'll wake up to an unfederated/dead instance with a massive error log at some point. 😂

on Bug in UI · c/general · 2 pts · 3y

Oh yeah, I've seen this too but only when I have multiple Lemmy instances open. When I posted "Death by user count" it told me I posted it to lemmy.einval.net through lemmy.ml's instance. I had to shift+ctrl+r to get it to show the correct pathway. Its definitely weird that session data is leaking around between logins. You'd think each cookie/session/socket would be totally unique.

I saw they've been working on ditching websockets in favor of a pure REST API. Hopefully this will stop when they release v18.0.

on C# resources · c/general · 1 pts · 3y

Thanks! I saw nuget in my search results last night and didn't think to click on it. I've added it to the sidebar. Would you like to moderate the !csharp_programming community?

Yeah I really really wish the search feature was more robust. I'd love to see a !name or even name query immediately poll a cache of community names derived from all of the federated instances and show an auto-completed list. This feature appears to exist in the post editor, but nowhere else.

Thanks for making this list.

Unfortunately it doesn't look like tags, labels, or any other form of categorization exists: https://github.com/LemmyNet/lemmy/issues/2946

When you create a community you define an immutable "Name" (the !name@[...]) and a "Display Name" like:

  • Name: pc_gaming
  • Display Name: PC Gaming

I'm not sure I'd want to see free-form communities mimicking Reddit 1:1 here though. "TheWeeklyRoll" at a glance might be about drugs, Dungeons & Dragons (heh -- it is!), gambling, or bread. If only it was possible to set a short description separate from the sidebar that showed up in search results.

!theweeklyroll@lemmy.einval.net - 10 subscribers - A Dungeons and Dragons themed web comic

I'd be totally fine with comic_[name] or comics_[author]. With that said it seems namespacing with underscores might be the only way to let people know what they're looking at.

Video Content

  • media_[service]_[channel]

Where service might be peertube (pt), youtube (yt), odysee (od), dailymotion (dm), etc

Tabletop Gaming

  • tabletop_gaming (generic chat)
  • tabletop_gaming_[genre]

PC Gaming

  • pc_gaming (generic chat)
  • pc_gaming_[operating_system]

Retro Gaming

  • retro_gaming (generic chat)
  • retro_gaming_[device]

Software

  • software_[product]

Programming (low-level)

  • programming_[lang]

Development (high-level)

  • devel_[topic]

Where topic might be a framework or library. But I think posting "Where can I find a good Tk tutorial?" to !programming_python or "How do I decompress a file with libz?" in !programming_c is perfectly fine. In the worst case the person can just cross-post to devel_[whatever-seems-right].

This scheme isn't perfect either. Some people might consider "ffxiv" worthy of its own namespace. Otherwise it'd end up with ridiculously long name like pc_gaming_ffxiv_{guides,clans,lore,...} instead of simply ffxiv_{help,clans,lore,...}. I'll have to sleep on it.

I want to keep this instance on-topic as much as possible though. That is to say that even if I like/enjoy something... If it doesn't fit the theme of the landing page's side bar it probably won't exist here as a local community.

Yes. You can use an existing SMTP server (gmail [legacy app mode], yahoo, microsoft, etc). One thing to keep in mind -- if you decide to go that route don't use your personal account because the address might be exposed in the mail headers. Create a dedicated account and use that instead.

lemmy.hjson

email: {
    smtp_server: "smtp.example.tld:[port]" # port 25, port 587, etc
    smtp_login: "username"
    smtp_password: "password"
    smtp_from_address: "noreply@example.tld" # or account_just_created@example.tld
    tls_type: "tls" # or starttls
}