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
Coffee Mugshot
Jun 26, 2010

by Lowtax
That test isn't bad because of its horrible notion of object equality

Adbot
ADBOT LOVES YOU

Rebus
Jan 18, 2006

Meanwhile, somewhere in Grove, work begins on next season's Williams F1 car...


code:
QFile file(sourcePath).copy(targetPath);
Users complain that modifying the file at sourcePath doesn't overwrite file at targetPath.

The fix checked in?
code:
QFile file(sourcePath);
file.remove();
file.copy(targetPath);
:downs:

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Rebus posted:

code:
QFile file(sourcePath).copy(targetPath);
Users complain that modifying the file at sourcePath doesn't overwrite file at targetPath.

The fix checked in?
code:
QFile file(sourcePath);
file.remove();
file.copy(targetPath);
:downs:
Well, it's certainly modifying *something*.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Colleague reinstalled Windows on his work computer today. He reports that he had to restart the machine zero times in the course of installing the operating system, and four times in the course of installing Oracle.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Hammerite posted:

Colleague reinstalled Windows on his work computer today. He reports that he had to restart the machine zero times in the course of installing the operating system, and four times in the course of installing Oracle.

Installation wizards suck and the windows ecosystem should have left them behind years ago.

If you have a ton of critical options to pick, ship a drat settings file so you only need
to configure them once and can save that file with your documentation.

And if you don't (which is usually the case), just install with defaults and let me change things later.

It's particularity hilarious in that regard to compare installing sql server on windows (el camino de loving santiago) and calling up the sql server docker image (hit enter, done).

I unironically enjoy abusing docker as a glorified, overgrown app store for services.
Docker tagline: "because it's not on chocolatey and I have 300Mb to waste".

edit: wrong thread. added caps and punctuation

NihilCredo fucked around with this message at 18:59 on Aug 2, 2017

canis minor
May 4, 2011

Rubellavator posted:

Today I broke a jasmine test that looked like this:

code:
controller.js

vm.foo = 
{ 
	p1: "stuff",
	p2: "things",
	bar: function (params) { //do stuff }
}

controller-spec.js

var foo = 
{
	p1: "stuff",
	p2: "things",
	bar: function (params) { //do stuff } 
}

expect(vm.foo).toEqual(foo);

Fun fact - comments are part of code in JS!

quote:

> (function(){ /* fffff */ }).toString();
< "function (){ /* fffff */ }"

(I guess you were highlighting that and not the comments that produce a syntax error :v:)

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

canis minor posted:

Fun fact - comments are part of code in JS!

That's implementation dependent! Though I imagine most implementations at this point just return the source text unmodified.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

NihilCredo posted:

Installation wizards suck and the windows ecosystem should have left them behind years ago.

I don't know about that, but the Oracle one sucks because they decided to make their own and did a poo poo job of it.

The last time I installed MySQL they had made their own special snowflake installer for that too, and it was totally hopeless because it completely failed to set the services up correctly. This was several years ago mind you so I don't know if it's still a mess (but it probably is).

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Hammerite posted:

I don't know about that, but the Oracle one sucks because they decided to make their own and did a poo poo job of it.

Commit Status: Rejected

Reviewer Comments: You've got an extraneous 'and did a poo poo job of it' in this post. Keep it DRY.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

NihilCredo posted:

I unironically enjoy abusing docker as a glorified, overgrown app store for services.
Docker tagline: "because it's not on chocolatey and I have 300Mb to waste".

Pretty crappy app store with no quality control.

smackfu
Jun 7, 2004

Trying to integrate ten different web services into a dashboard reveals so many coding horrors.

One wants you to pass your token as a request header, another wants it as the username, a third doesn't have any tokens and needs your real username and password. At least none of them are Oauth so far.

One service literally says that the best way to find the ID value you need to pass is to log in to the web ui and copy it. And their "list all items" API call takes 20 seconds to return. You want the current item only? Good luck with that.

Not to mention that another service has a perfectly fine REST API that they use internally but it's not public for *reasons*. Well, not quite fine, it doesn't actually respect the end date you pass, but I can work around that.

At the end of the day, it will look pretty though.

Pollyanna
Mar 5, 2005

Milk's on them.


Dashboards came into vogue a while ago, and I always felt like they were kind of a fad. Surprised they're still a big thing.

smackfu
Jun 7, 2004

Pollyanna posted:

Dashboards came into vogue a while ago, and I always felt like they were kind of a fad. Surprised they're still a big thing.

Big corporations are like 2-4 years behind at any given time.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Edison was a dick posted:

Pretty crappy app store with no quality control.

So exactly like every app store ever? :v:

Cancelbot
Nov 22, 2006

Canceling spam since 1928

It's me, I'm the horror.

So we have this really expensive catalogue/index system which runs on Java, which runs a specific JDBC driver, which is also not MS-SQL cluster availability group aware. So instead of getting the primary SQL node address when it connects to build its catalogue; it'll get any one of 4 "random" IP addresses during the many thousands of operations it does, which could be the primary node, a read-only node, or the cold disconnected node. This makes Java have the mother of all hissy fits when nothing is making sense in terms of addressing or even connectivity. To make it aware would cost us thousands in consultancy time.

Well, the .NET SQL client is cluster aware. So I've coded a tiny DNS proxy which forwards all non SQL address requests to our normal primary DNS servers, but if it's a magic SQL one it'll ask the .NET client to connect to the same cluster availability group and give back the primary nodes IP address, and cache it for a little bit to not hammer SQL thousands of time to get cluster state. We then override the catalogue machines primary DNS server to this tiny DNS server.

Result: We have fixed the expensive catalogue system using about 8 lines of C# and made it failover tolerant, and all it cost was my sanity.

Hughlander
May 11, 2005

[quote="“Cancelbot”" post="“475027504”"]
It’s me, I’m the horror.

So we have this really expensive catalogue/index system which runs on Java, which runs a specific JDBC driver, which is also not MS-SQL cluster availability group aware. So instead of getting the primary SQL node address when it connects to build its catalogue; it’ll get any one of 4 “random” IP addresses during the many thousands of operations it does, which could be the primary node, a read-only node, or the cold disconnected node. This makes Java have the mother of all hissy fits when nothing is making sense in terms of addressing or even connectivity. To make it aware would cost us thousands in consultancy time.

Well, the .NET SQL client is cluster aware. So I’ve coded a tiny DNS proxy which forwards all non SQL address requests to our normal primary DNS servers, but if it’s a magic SQL one it’ll ask the .NET client to connect to the same cluster availability group and give back the primary nodes IP address, and cache it for a little bit to not hammer SQL thousands of time to get cluster state. We then override the catalogue machines primary DNS server to this tiny DNS server.

Result: We have fixed the expensive catalogue system using about 8 lines of C# and made it failover tolerant, and all it cost was my sanity.
[/quote]

This reminds me of what someone else did, I think it was AirBNB where they put HA-Proxy on all their nodes and the app server would just talk localhost:MSSQL port. A separate app would monitor the connections needed, update the haproxy conf file and have it restart when changes were made. We were considering that before we just swapped to using a different JDBC driver that supported clustering and let’s us check if it’s read only or not.

Cancelbot
Nov 22, 2006

Canceling spam since 1928

That sounds like Consul but with extra steps (for those who are curious: https://www.consul.io/) which acts as your DNS server through localhost and keeps everything up to date when a service goes "I'm over here now!"

I'm hoping to get everyone on-board with Consul once this mess is over to make more sense of our scattered services and configurations.

Ranzear
Jul 25, 2013

I once spent two hours troubleshooting broken https because I'd forgotten I set up Haproxy to terminate SSL for both nginx and my node websockets and was reloading/restarting only nginx after a certificate renew.

It's still my favorite service.

Hughlander
May 11, 2005

Cancelbot posted:

That sounds like Consul but with extra steps (for those who are curious: https://www.consul.io/) which acts as your DNS server through localhost and keeps everything up to date when a service goes "I'm over here now!"

I'm hoping to get everyone on-board with Consul once this mess is over to make more sense of our scattered services and configurations.

The AirBNB one I mentioned is explained at https://medium.com/airbnb-engineering/smartstack-service-discovery-in-the-cloud-4b8a080de619 which even talks about why they rejected DNS.

Absurd Alhazred
Mar 27, 2010

by Athanatos
https://twitter.com/cabel/status/893572174153367552

Sedro
Dec 31, 2008

When you take form validation literally

Absurd Alhazred
Mar 27, 2010

by Athanatos

Sedro posted:

When you take form validation literally

Ironically, their response is full of typos.

RandomBlue
Dec 30, 2012

hay guys!


Biscuit Hider
I just realized... I'm gettin' too old for this poo poo.

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)

Ok so did someone also review it to put the X and the circle in? No way no loving way

I swear the machines have already won.

dougdrums fucked around with this message at 17:08 on Aug 5, 2017

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.
Gotta keep parking officers employed in this crazy app future.

Cancelbot
Nov 22, 2006

Canceling spam since 1928

Hughlander posted:

The AirBNB one I mentioned is explained at https://medium.com/airbnb-engineering/smartstack-service-discovery-in-the-cloud-4b8a080de619 which even talks about why they rejected DNS.

Interesting, Consul is "cacheless" in its DNS implementation but wouldn't fix the problems described with others caching responses. You do get the localhost HTTP endpoint as for address resolution but there's much more friction to that where I work :v:

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.
So the Unity3D documentation has a little dropdown menu on the top-right corner to let you easily swap between different versions of the API. But for a little dropdown menu it sure takes a while to load, how complicated could it really be:


Oh.

code:
function versionSearchIncremental(currentVersion, searchDirection, maxVersion, finalCallback){
    currentVersion.minor += searchDirection;
    clampVersionNumber(currentVersion);
    var targetURL = getTargetUrlFromVersion(currentVersion.major, currentVersion.minor, currentVersion.page);
    //attempt ajax request
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState == 4) {
            this.responseText = "";
            if(this.status != 404){
                var version = getVersionFromURL(this.responseURL);
                //bypass url
                version.major = currentVersion.major;
                version.minor = currentVersion.minor;
                if(version.major > 5)
                    version.major += 2011;
                //ajax was successful
                var newobj = {
                    versionURL: this.responseURL,
                    versionName: version.major + "." + version.minor,
                    major: version.major,
                    minor: version.minor
                };
                addOtherVersionsItem(newobj);
            }
            else{
                failedSearches += 1;
                if(failedSearches == maxVersionSearchFails){
                    failedSearches = 0;
                    finalCallback();
                    return;
                }
            }
 
            if(currentVersion.major != maxVersion.major || currentVersion.minor != maxVersion.minor)
                versionSearchIncremental(currentVersion, searchDirection, maxVersion, finalCallback);
            else
                finalCallback();
        }
    };
    xhttp.open("HEAD", targetURL, true);
    xhttp.send();
}
Oh.

Full horror here: https://pastebin.com/dxnjb8HP

(bonus: can you spot when Unity switched to yearly versioning?)

Pollyanna
Mar 5, 2005

Milk's on them.


SupSuper posted:

So the Unity3D documentation has a little dropdown menu on the top-right corner to let you easily swap between different versions of the API. But for a little dropdown menu it sure takes a while to load, how complicated could it really be:


Oh.

code:
function versionSearchIncremental(currentVersion, searchDirection, maxVersion, finalCallback){
    currentVersion.minor += searchDirection;
    clampVersionNumber(currentVersion);
    var targetURL = getTargetUrlFromVersion(currentVersion.major, currentVersion.minor, currentVersion.page);
    //attempt ajax request
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState == 4) {
            this.responseText = "";
            if(this.status != 404){
                var version = getVersionFromURL(this.responseURL);
                //bypass url
                version.major = currentVersion.major;
                version.minor = currentVersion.minor;
                if(version.major > 5)
                    version.major += 2011;
                //ajax was successful
                var newobj = {
                    versionURL: this.responseURL,
                    versionName: version.major + "." + version.minor,
                    major: version.major,
                    minor: version.minor
                };
                addOtherVersionsItem(newobj);
            }
            else{
                failedSearches += 1;
                if(failedSearches == maxVersionSearchFails){
                    failedSearches = 0;
                    finalCallback();
                    return;
                }
            }
 
            if(currentVersion.major != maxVersion.major || currentVersion.minor != maxVersion.minor)
                versionSearchIncremental(currentVersion, searchDirection, maxVersion, finalCallback);
            else
                finalCallback();
        }
    };
    xhttp.open("HEAD", targetURL, true);
    xhttp.send();
}
Oh.

Full horror here: https://pastebin.com/dxnjb8HP

(bonus: can you spot when Unity switched to yearly versioning?)

The function even mutates one of the objects passed into it. :gonk:

QuarkJets
Sep 8, 2008

dougdrums posted:

Ok so did someone also review it to put the X and the circle in? No way no loving way

I swear the machines have already won.

I think the system isn't complex enough to identify what the problem is. It probably just catches an exception and then lets the humans figure out what the actual problem was. It's not printing the fliers or anything, someone sitting in an office somewhere just has a big box full of those

lovely but yeah, it wasn't designed to be smart enough to identify what the problem is

hailthefish
Oct 24, 2010

QuarkJets posted:

I think the system isn't complex enough to identify what the problem is. It probably just catches an exception and then lets the humans figure out what the actual problem was. It's not printing the fliers or anything, someone sitting in an office somewhere just has a big box full of those

lovely but yeah, it wasn't designed to be smart enough to identify what the problem is

Just something about an automated system that can't do really simple input validation so that they have to have meter maids ride around in their little metermaidmobiles with a box of windshield fliers to notify the driver of the error is... very backwards, I guess.

QuarkJets
Sep 8, 2008

I think that system still needs meter maids regardless, it just lets you pay digitally

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Sounds like that kitty needs to be put down

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Hammerite posted:

Sounds like that kitty needs to be put down
/


:golfclap:

ChaosArgate
Oct 10, 2012

Why does everyone think I'm going to get in trouble?

Today I started cleaning up a page that queries our db a few times and generates an HTML table with the results of that. This page queries the db per table cell. :cripes:

lifg
Dec 4, 2000
<this tag left blank>
Muldoon

ChaosArgate posted:

Today I started cleaning up a page that queries our db a few times and generates an HTML table with the results of that. This page queries the db per table cell. :cripes:

Is there an ORM behind this hilarity?

ChaosArgate
Oct 10, 2012

Why does everyone think I'm going to get in trouble?

lifg posted:

Is there an ORM behind this hilarity?

No, each cell was basically doing a count on a table where an ID matched. I cut that fucker down to one query, with a subquery for 6 of the columns.

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost
It's amazing how much consulting work for fixing bad webapps comes down to just two things: fixing bad database queries / caching and fixing database indexes (or lack thereof). Modern computers are just so stinkin' fast now and every other person is on a broadband connection even on mobile that what would have been unusable 10+ years ago is pretty standard now basically. Every other enterprise LOB application I've seen doesn't even have a cache server / daemon so everything is stateful to death and makes deployments extremely disruptive because user sessions will become invalidated by going through another frontend. Meanwhile, users will report pages taking 30s+ to load all the time while some poor SQL server is doing table scans for absolutely no good reason whenever someone logs in.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

lifg posted:

Is there an ORM behind this hilarity?

That's stupidly easy to do by accident in ORM. Forget a .select_related() in django? Hello 1500 DB hits per page. It's non-obvious on trivial test data either, since it will return so fast anyway. I make a point of examining the SQL per page/view/API hit to make sure it's not doing anything dumb.


Coding horror:
System calls are expensive, and you don't want a billion of them, so we get ioctl() fuckery.
Libcurl doesn't understand why, but cargo-cults it. Welcome to curl_*_setopt(), where everything is a void * behind a macro because gently caress you c++ users and your "templates".

Why would you go out of your way to bypass typechecking? There's like a hundred billion enums there, and dozens of them are related so they'd be a single call -

CURL_EASY_WRITEFUNCTION, CURL_EASY_WRITEDATA go together, as do
CURL_EASY_NOPROGRESS=0, CURL_EASY_PROGRESSFUNCTION, CURL_EASY_PROGRESSDATA

That loving dispatch must be insane, and there's one for every Curl type. At some point you say "Goddamn, this was a loving mistake. Ok, making every setopt function it's own thing, the dispatcher casts & calls the right thing and is now depreciated so please stop using it."

I'd use one of the already written c++ wrappers for it but I haven't found one that plays nice with "give me the socket FDs so I can use them in the existing event loop."

Is there a less insane C/C++ http library that plays nice with modern TLS, does async DNS and supports using your native event loop to watch it's sockets?

Jewel
May 2, 2009

Perl 6 is a nightmare :shittypop: :shittypop: :shittypop:

https://docs.perl6.org/language/unicode_texas.html





Adbot
ADBOT LOVES YOU

Nippashish
Nov 2, 2005

Let me see you dance!

Perl 6 posted:

The following Unicode symbols can be used in Perl 6 without needing to load any additional modules. Some of them have "Texas equivalents" which can be typed with ASCII-only characters. These variants are often composed of more characters than the Unicode versions and so they look bigger; hence the name "Texas" because everything is bigger in Texas

I'm pretty sure Perl is entirely designed around being maximally clever.

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