Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
DrPossum
May 15, 2004

i am not a surgeon

gonadic io posted:

logstash has an issue where if you start it in a fresh docker container it can't start until it gathers enough entropy or some bullshit in practice this means a 15 min startup time

this has been happening for months and have i lifted a finger to fix it and save time? like gently caress, i like being all "pushed the button now time to stretch my legs"

Have it gather entropy by reading ur poasts

Adbot
ADBOT LOVES YOU

DrPossum
May 15, 2004

i am not a surgeon
hi everyone I've solved all our problems

code:
#!/usr/bin/python
  
import random, sys

message = ["just post", "yospos btch", "mylp", "shaggar was right", "don't quote stymie"]

justpost = True

while justpost:
    randmess = random.choice(message)
    sys.stdout.write( "".join(list(map( \
            lambda x: x.upper() if random.choice([True, False]) \
            else x.lower(), list(randmess) ))) + " ")

DrPossum
May 15, 2004

i am not a surgeon
A friend of mine took a cool course at Carnegie Mellon when he was an undergrad that was described to me as a prof would give you some binary each week and your job was to hunt down problems or fix things in gdb.

For new students I work with on programming projects, I tell them I don't give a poo poo if they don't have any presentable work done for any amount of time as long as they spent that time learning a debugger. This has paid off many, many times over

DrPossum
May 15, 2004

i am not a surgeon

uncurable mlady posted:

imo effective logging and metrics are almost more important than being able to use a debugger if you’re working with distributed systems.

:hai:

DrPossum
May 15, 2004

i am not a surgeon

floatman posted:

Don't get me wrong, my current job is great, except for the one main thing which is the codebase for it.
Designed by idiot hellfucker with a hard-on for databases, and the more and more I uncover, the more I realised for all the poo poo they laud aforementioned idiot for his databases, turns out his databases are just as loving bad as his software (lmao "custom" ORM overrides that cast every value of plang into a unicode string. This means all nulls become 0s when shoved into into columns, also casting ints into unicodes means database has to cast it back, row by row, to do comparisons.)

I'm just barely contained rage on most days.

pwnd

DrPossum
May 15, 2004

i am not a surgeon
hahaha I do non-functional programming am I rite?!

DrPossum
May 15, 2004

i am not a surgeon

Schadenboner posted:

fell asleep extremely worried I wasn’t going to ever wake up but unable to do anything about it.

This appeals to some people.

DrPossum
May 15, 2004

i am not a surgeon
:corsair: I took AP CS back when they used God's own language, Pascal.

DrPossum
May 15, 2004

i am not a surgeon

cinci zoo sniper posted:

i took pascal class too. it was called scientific computing and it was university physics curriculum in 2012 because my alma mater was so poor they couldn’t afford matlab

This makes me sad.

DrPossum
May 15, 2004

i am not a surgeon

Soricidus posted:

there is a fundamental law of software that states that the only documentation that ever turns out to be important is the documentation that didn't get written

write docs? congratulations on wasting time, idiot.
didn't write docs? now everything is on fire and it's your fault, idiot.

the moral of the story is that programming was a mistake

Working examples covering your obvious cases are a) often the most useful documentation b) used (but I guess not read so much as copy pasted)

DrPossum
May 15, 2004

i am not a surgeon
just post your poo poo to stackexchange nbd

DrPossum
May 15, 2004

i am not a surgeon

DrPossum
May 15, 2004

i am not a surgeon

Soricidus posted:

writing parsers is fun

lol

DrPossum
May 15, 2004

i am not a surgeon

Chalks posted:

Commit messages that link to the work item/ticket they were assigned is always useful no matter how terrible the developer. When ever you find insane code, you always want to know what they were trying to achieve when they did it.

So many times I've been looking at some huge obvious problem caused by some commit and thinking that the code is complete nonsense, but when I go to check the work item associated with it I suddenly understand what they were struggling with - and the fix I was just about to make would have re-broken the scenario they'd fixed.

Gonna emptyquote this

DrPossum
May 15, 2004

i am not a surgeon
Terrible programming thread:

Zlodo posted:

boss: ah. I see. can't you just not make bugs in the first place?

DrPossum
May 15, 2004

i am not a surgeon

the talent deficit posted:

all numbers in json are doubles

I use this as proof that there is no loving god

DrPossum
May 15, 2004

i am not a surgeon

Beamed posted:

is Midwestern guilt what midwesterners call catholic guilt when they move out of the midwest

pmuch

DrPossum
May 15, 2004

i am not a surgeon

Ciaphas posted:

c tp s: just discovered that this compiles fine in the project i'm bugfixing atm
C++ code:
void f()
{
  for (int i = 0; i < 3; ++i) {}
  cout << i << endl; // i == 3; same i, its scoped to the whole fn
  for (i = 0; i < 10; ++i) {} // ditto
}

code:
[drpossum@ash temp]$ cat fuckup.cpp 
#include <iostream>

using namespace std;

void f()
{
  for (int i = 0; i < 3; ++i) {}
  cout << i << endl; // i == 3; same i, its scoped to the whole fn
  for (i = 0; i < 10; ++i) {} // ditto
}

int main(){
    f();
    return 0;
}

[drpossum@ash temp]$ g++ -fno-for-scope -o fuckup fuckup.cpp
cc1plus: warning: ‘-fno-for-scope’ is deprecated [-Wdeprecated]

[drpossum@ash temp]$ ./fuckup 
3

man gcc posted:

-fno-for-scope
If -ffor-scope is specified, the scope of variables declared in a for-init-statement is limited to
the "for" loop itself, as specified by the C++ standard. If -fno-for-scope is specified, the
scope of variables declared in a for-init-statement extends to the end of the enclosing scope, as
was the case in old versions of G++, and other (traditional) implementations of C++.


This option is deprecated and the associated non-standard functionality will be removed.

DrPossum fucked around with this message at 13:27 on Jun 29, 2019

DrPossum
May 15, 2004

i am not a surgeon

Achmed Jones posted:

stop working

DrPossum
May 15, 2004

i am not a surgeon

NihilCredo posted:

var guid = new System.Guid()

whoops

Had to look this up, but I guess the right way is NewGuid() which will initialize with a random value rather than this which gives you 0?

DrPossum
May 15, 2004

i am not a surgeon
code:
[datposs@mist hellyeah]$ cat .gitignore 
*
[datposs@mist hellyeah]$ 

DrPossum
May 15, 2004

i am not a surgeon

gonadic io posted:

This could only be more terrible if you're a physics student. I swear they always had the absolute worst code

E: also if you used notepad++

As a former physicist this is 100% true. I had one kid who I couldn't convince to a) not use five-level deep nested loops and b) use indentation formatting said loops. Just start each line at the first possible position of each line, top to bottom, always and forever.

DrPossum
May 15, 2004

i am not a surgeon

Arcsech posted:

uncle bob isn’t “kind of a tool”

uncle bob is an enormous tool

re: dynamic typing: I’ve been messing with Common Lisp lately and it is the best environment for exploratory programming I’ve ever used. it’s really neat for messing around and dynamic typing is a big part of that

but for a system that requires 1) more than a couple people working on it and/or 2) actual maintenance, yes, please god give me static types (as long as the type system is even half decent, a c/go-like type system is worse than dynamic)

uncle bob says try clojure

DrPossum
May 15, 2004

i am not a surgeon

Plorkyeran posted:

clean code is not worth reading. the good advice in it is mostly banally obvious or uphelpful, and there's a lot of not so good advice scattered in there. it's not actively awful like clean architecture is, but if it's never occurred to you that functions with too many arguments is a bad thing, you also probably aren't going realize that his proposed fix of moving things to member variables might not be making things any better.



but you would miss the book-of-vile-darkness-quality art

DrPossum
May 15, 2004

i am not a surgeon

gonadic io posted:

Maybe it's just my sleep deprivation but I can't actually see the bug

E: gently caress just spotted it, uint < 0. That's a warning in Rust

missed that. I just figured it was the 20 min unmitigated spin lock

DrPossum
May 15, 2004

i am not a surgeon

Asleep Style posted:

I DECLARE TECHNICAL BANKRUPTCY

new thread title please

DrPossum
May 15, 2004

i am not a surgeon
code:
[drpossum@foodcan ~]$ units
You have: 1 Gbit/s
You want: MB/s
	* 125
:thunk:

edit

code:
You have: 1 Gibit/s
You want: Mibyte/s
	* 128
I don't know how to pronounce these to differentiate them

DrPossum fucked around with this message at 00:42 on Dec 21, 2019

DrPossum
May 15, 2004

i am not a surgeon
The one of the many terrible things about js is also getting answers to your questions but everything changes so much it's out of date and wrong so it's an extra layer of shitdiving when you're trying to get your head above the poo poo

DrPossum
May 15, 2004

i am not a surgeon

Plorkyeran posted:

posix says that filenames are just arbitrary strings of bytes as a garbage way of "supporting" systems that predate utf-8 and also don't store what encoding the filenames are encoded with anywhere. for some reason this makes linux users think that they actually should create files with names that are just arbitrary bytes and not utf-8.

What is a file? [flings his wine glass aside] A miserable little string of bytes!

DrPossum
May 15, 2004

i am not a surgeon
i wrote a code today and it was terrible and im terrible and im going to do more tomrorow

DrPossum
May 15, 2004

i am not a surgeon
developers can have a little class inheritance as a treat

DrPossum
May 15, 2004

i am not a surgeon

abigserve posted:

It's quick and it's easy and it's nice to read

unlike you're posting

DrPossum
May 15, 2004

i am not a surgeon

taqueso posted:

code is art comments are art

sometimes the man squashes art

I have given up commenting and delete them as responsibly as I can. If you can't read what's going on someone done hosed up

DrPossum
May 15, 2004

i am not a surgeon

Finster Dexter posted:

terrible programming: Lower your expectations. Significantly.

DrPossum
May 15, 2004

i am not a surgeon

NihilCredo posted:

because go doesn't support nullable primitives, so if you load a null column into an int field it cannot be set to nil

the "solution" provided by the official package is a bunch of structs with a 'Valid' bool flag you have to manually check. gophers look at the work involved and say 'gently caress it, i don't need a zero / undefined distinction anyway. simplicity!'

basically

go is a language designed for babby programmers to have maximum value extracted from them by google in big, already-defined google products

DrPossum
May 15, 2004

i am not a surgeon

ahhhhhhh yissssss

this is what I come here for

DrPossum
May 15, 2004

i am not a surgeon

Krankenstyle posted:

hmm this window doesnt show either, likely because im stupid

code:

to compile:
clang test_sdl.cpp -lSDL2

add

code:
        SDL_UpdateWindowSurface(window);
after your SDL_FillRect. That did it for me.

edit:

DrPossum fucked around with this message at 10:02 on Mar 20, 2020

DrPossum
May 15, 2004

i am not a surgeon

Krankenstyle posted:

Weird, it doesnt for me

could you post the entire code? :)

I did this in Windows 10. ymmv

code:
#include <SDL2/SDL.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
    Uint32 flags = SDL_WINDOW_OPENGL;
    SDL_Window *window = SDL_CreateWindow("Progress", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 100,
                                          20, flags);

    int total = 5;
    for (int step = 0; step <= total; step++) {
        printf("Iteration: %d\n", step);

        double fraction = ((double) step) / ((double) total);

        SDL_Surface *surface = SDL_GetWindowSurface((SDL_Window *) window);

        SDL_Rect bar;
        bar.x = 0;
        bar.y = 0;
        bar.w = 100 * fraction;
        bar.h = 20;

        Uint32 color = SDL_MapRGB(surface->format, 255, 0, 0);

        SDL_FillRect(surface, &bar, color);
        SDL_UpdateWindowSurface(window);
        SDL_GL_SwapWindow((SDL_Window *)window);

        SDL_Delay(1000);
    }

    SDL_DestroyWindow((SDL_Window *) window);

    return 0;
}

DrPossum
May 15, 2004

i am not a surgeon

Krankenstyle posted:

this possum I'll try in a bit, kinda at work lol

Try dropping all the lines with GL stuff just to get it running, too. It still worked for me. There's more overhead I've had to do in the past like setting up contexts and stuff, so there might be something missing for your environment.

You'll also get better results with

code:
        Uint32 color = SDL_MapRGB(surface->format, 87, 255, 87);

Adbot
ADBOT LOVES YOU

DrPossum
May 15, 2004

i am not a surgeon

Zlodo posted:

maybe it can work in windows without implementing the event loop but not in linux


Krankenstyle posted:

yes you normally call it with like &event of type SDL_Event

but i dont care, i just want the window to show up so the user can see that its working on the thing they requested and that that is the reason for the unresponsiveness

worked in linux without modification

code:
[xxx@xxx ~]$ uname -a
Linux xxx 5.5.10-arch1-1 #1 SMP PREEMPT Wed, 18 Mar 2020 08:40:35 +0000 x86_64 GNU/Linux

[xxx@xxx ~]$ sdl2-config --version
2.0.12


excuse my 4k monitor

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply