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
Aramoro
Jun 1, 2012




Finster Dexter posted:

terrible_programmer.txt

srsly that sums up my entire career, op

Sometimes I write something clever that's good but then I realise it's a clever solution to a problem caused by our insane legacy codebase.

Adbot
ADBOT LOVES YOU

CPColin
Sep 9, 2003

Big ol' smile.
my_entire_last_year_at_experts_exchange.txt

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang




:(

Corla Plankun
May 8, 2007

improve the lives of everyone
if i have a python object that needs to touch the database should it have its own connection or be passed one? neither one feels like it makes more sense

cinci zoo sniper
Mar 15, 2013




Corla Plankun posted:

if i have a python object that needs to touch the database should it have its own connection or be passed one? neither one feels like it makes more sense

pass i say, so you decouple connectivity from logic

Neslepaks
Sep 3, 2003

just kiss it goodbye and send it out on the enterprise bus

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

pass i say, so you decouple connectivity from logic

Yeah, makes it easier to test

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

cinci zoo sniper posted:

pass i say, so you decouple connectivity from logic

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

cinci zoo sniper posted:

pass i say, so you decouple connectivity from logic
Also connection overhead will absolutely screw you down the line.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

cinci zoo sniper posted:

pass i say, so you decouple connectivity from logic

Congrats you're a DI expert now

cinci zoo sniper
Mar 15, 2013




Janitor Prime posted:

Congrats you're a DI expert now

DI?

necrotic
Aug 2, 2005
I owe my brother big time for this!
dependency injection

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
Death Imitation

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Janitor Prime posted:

Congrats you're a DI expert now


precisely

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

ComradeCosmobot
Dec 4, 2004

USPOL July

cinci zoo sniper posted:

pass i say, so you decouple connectivity from logic

also if you don’t you’re gonna be asked to migrate database vendors next month and then you’re gonna be sorry you didn’t

of course if you do, you’ll never migrate vendors so... :shrug:

Soricidus
Oct 21, 2010
freedom-hating statist shill
ctps:
code:
    private static class ShutUpLeaveMeAloneYoureNotMyRealDad extends PrintStream
    {
        ShutUpLeaveMeAloneYoureNotMyRealDad(PrintStream out)
        {
            super(out);
        }

        @Override
        public void println(String x)
        {
            switch (x) {
            case "REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on":
            case "why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial":
            case "experiments, perform baseline and negative tests that provide experimental control, make sure":
            case "the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.":
            case "Do not assume the numbers tell you what you want them to tell.":
                break;
            default:
                super.println(x);
            }
        }
    }

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

who says inheritance is a bad idea

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

Soricidus posted:

ctps:
code:
    private static class ShutUpLeaveMeAloneYoureNotMyRealDad extends PrintStream
    {
        ShutUpLeaveMeAloneYoureNotMyRealDad(PrintStream out)
        {
            super(out);
        }

        @Override
        public void println(String x)
        {
            switch (x) {
            case "REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on":
            case "why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial":
            case "experiments, perform baseline and negative tests that provide experimental control, make sure":
            case "the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.":
            case "Do not assume the numbers tell you what you want them to tell.":
                break;
            default:
                super.println(x);
            }
        }
    }

Using this in production code just for kicks.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



lol

Workaday Wizard
Oct 23, 2009

by Pragmatica

Soricidus posted:

ctps:
code:
    private static class ShutUpLeaveMeAloneYoureNotMyRealDad extends PrintStream
    {
        ShutUpLeaveMeAloneYoureNotMyRealDad(PrintStream out)
        {
            super(out);
        }

        @Override
        public void println(String x)
        {
            switch (x) {
            case "REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on":
            case "why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial":
            case "experiments, perform baseline and negative tests that provide experimental control, make sure":
            case "the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.":
            case "Do not assume the numbers tell you what you want them to tell.":
                break;
            default:
                super.println(x);
            }
        }
    }

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Soricidus posted:

ctps:
code:
    private static class ShutUpLeaveMeAloneYoureNotMyRealDad extends PrintStream
    {
        ShutUpLeaveMeAloneYoureNotMyRealDad(PrintStream out)
        {
            super(out);
        }

        @Override
        public void println(String x)
        {
            switch (x) {
            case "REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on":
            case "why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial":
            case "experiments, perform baseline and negative tests that provide experimental control, make sure":
            case "the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.":
            case "Do not assume the numbers tell you what you want them to tell.":
                break;
            default:
                super.println(x);
            }
        }
    }


galenanorth
May 19, 2016

I was about to register my business with the city clerk when I read that I need a Home Occupation License with permission from my apartment manager, and I'm staying with my parents in a retirement home so I can't get that. I guess I'll get a "real job", save up some money, try again in a year, and hope the #3 competitor ScrapeHero in this type of business hasn't pulled too far ahead of me by then. The website is www.locatr.tk if anyone wants to take a look at what I've done so far

The Fool
Oct 16, 2003


just register in delaware or nevada or belize or something

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

omg becky.

omg.

gonadic io
Feb 16, 2011

>>=

galenanorth posted:

I was about to register my business with the city clerk when I read that I need a Home Occupation License with permission from my apartment manager, and I'm staying with my parents in a retirement home so I can't get that. I guess I'll get a "real job", save up some money, try again in a year, and hope the #3 competitor ScrapeHero in this type of business hasn't pulled too far ahead of me by then. The website is www.locatr.tk if anyone wants to take a look at what I've done so far

Not an .io domain, smdh

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

Not an .io domain, smdh

not even loca.tr

Doom Mathematic
Sep 2, 2008

Soricidus posted:

ctps:
code:
    private static class ShutUpLeaveMeAloneYoureNotMyRealDad extends PrintStream
    {
        ShutUpLeaveMeAloneYoureNotMyRealDad(PrintStream out)
        {
            super(out);
        }

        @Override
        public void println(String x)
        {
            switch (x) {
            case "REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on":
            case "why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial":
            case "experiments, perform baseline and negative tests that provide experimental control, make sure":
            case "the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.":
            case "Do not assume the numbers tell you what you want them to tell.":
                break;
            default:
                super.println(x);
            }
        }
    }


Dijkstracula posted:

who says inheritance is a bad idea

One time we were writing Python to interact with a HTTP API which, contrary to the spec, treated HTTP request header names case-sensitively. Something like, "USER_KEY: blah" would work, but "user_key: blah" would not. Unfortunately, Python's HTTP library helpfully flattens the case of headers before sending, so we would do something like set_header("USER_KEY", "blah") and it would get sent as "user_key: blah", so it was essentially impossible to get the API to work from Python. (Or to get the fools in charge of the API to fix it.)

In the end what we ended up doing was subclassing Python's string class and overriding the .lowercase() method so it didn't do anything, it just returned the unmodified string. set_header(CustomStringClass("USER_KEY"), "blah") worked.

Corla Plankun
May 8, 2007

improve the lives of everyone
thats amazing

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
obv the API devs are like "gently caress we can't make it case-insensitive or we break our clients that rely on being able to support HTTP_POOP and http_poop as different values"

Doom Mathematic
Sep 2, 2008
I agree with your implicit point that's always wise to assume good faith. People do the best work they can and are often dealing with other requirements which you can't see.

But, no, they were just hopelessly bad at their jobs and I don't think they could have fixed their own code if they tried. Another part of this same API had an issue where every now and then requests would stop returning content. Still 200 OK and the right XML wrapper, just the requested resource which was supposed to be inside that XML was missing. After we brought this up with them, they told us that, yes, this starts happening from time to time, and if it happens, we should contact them so they can restart the server.

CPColin
Sep 9, 2003

Big ol' smile.
code:
<g:set var="prefix" value="${'params.'}" />
Ah, yes, let's fire up the ol' string interpolation so we can interpolate…a string.

Corla Plankun
May 8, 2007

improve the lives of everyone
lmao

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



such power,,

Soricidus
Oct 21, 2010
freedom-hating statist shill
holy poo poo this code is so bad. i literally cut the runtime in half by just moving an expensive deserialization of a value that never actually changed out of an inner loop.

i'm not even going to do the "what idiot wrote this" joke because the punchline is just too obvious

signed, the worst programmer

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
Its not just peeps learning, its their sleep and caffeine deprivation state and selfconsciousness when writing. So it's never monotonic, how much your code gets better

Soricidus
Oct 21, 2010
freedom-hating statist shill
oh hey this bit's taking *scribbles on back of envelope* quadratic time when there's an obvious logarithmic time algorithm. it also inexplicably uses global variables to pass state into parameterless functions

I didn't write this part, i'm bad but goddamn there are limits

Soricidus
Oct 21, 2010
freedom-hating statist shill
"hmm, I need to store a mapping in which the keys are guaranteed always to be the integers from 0 to n, and I will always want to insert and access the values in that order too. I know, I’ll use a hash table"

— the fucker who wrote the code my profiler identified as the next bottleneck

Soricidus
Oct 21, 2010
freedom-hating statist shill
lol fixing those two things literally cuts the runtime in half again on typical inputs. well that was a productive hour

Adbot
ADBOT LOVES YOU

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Krankenstyle posted:

what the gently caress, latex?

new front page column?

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