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
Munkeymon
Aug 14, 2003

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



dwazegek posted:

What does it return if S1.length() == S2.length()?

On a somewhat similar note, I found this yesterday:
C# code:
private bool nullableDecimalEquals(decimal? d1, decimal? d2)
{
  if (d1 == null && d2 == null)
    return true;
  if (d1 == null)
    return false;
  if (d2 == null)
    return false;
  return d1.Value == d2.Value ? true : false;  
}
In case you're not familiar with .NET nullables, this gives the exact same results as the default equality comparer; I guess writing d1 == d2 was too easy.

At my very first job right out of college one of the other devs decided that he needed to create a new list type by extending List<Something>, IIRC. I forget the name, so lets call it NewList. Well, I wanted to insert a Something into the list and what comes up in the function list but Insert() and NewInsert(). Same for every other normal interface method. What do NewMethodName do? base.MethodName of course. He saw nothing wrong with this.

Adbot
ADBOT LOVES YOU

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost

Munkeymon posted:

asd, qwe zxc, lkj, poi are my go-tos in order of frequency.

After foo, bar, baz, I move on to bort and blarg. Basically alliterate on "b" words.

Karate Bastard
Jul 31, 2007

Soiled Meat

hackbunny posted:

Now that I'm older and lazier, it's just a, aa, aaa...

Consider yourself blessed that's the first thing that comes into your head. For me it starts with aaaaaa, aaaaaaa, aaaaaaaa... it's a son of a bitch to work with, but it's nice if you're the kind of person that types out loud.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

dwazegek posted:

C# code:
resultset.All(x => { x.StatusName = getCusTomPriceStateNameByCode(x.CustomPricingStateEnum); return true; });

That is a beautiful misunderstanding and abuse of All. I love it.

raminasi
Jan 25, 2005

a last drink with no ice
C code:
typedef struct {
	char  *funame;			/* function name */
	int  flags;			/* type flags */
#ifdef FUN_ARGLIST
	int  (*funp)(FUN_ARGLIST);	/* pointer to function */
#else
	int  (*funp)();			/* pointer to function */
#endif
}  FUN;
Cute, huh? Let's make ourselves some sort of flagged function pointer thing with a compile-time variable argument list, because I guess defining specific types for each actual pointer type we want to call is too much typing. And honestly, I'm willing to admit that there's some use case here that I'm not seeing.

Except that FUN_ARGLIST is never actually defined anywhere, as far as I can tell. But don't think that means that no function pointers assigned to fun_p have parameters. Sometimes they do, but C, of course, assumes that function pointers with no declared argument list are basically whatever you want them to be at the call site. There's a warning, sure, but hey, the programmer probably knows what they're doing.

I discovered this when I flipped the "force compilation as C++" switch, because C++, while allowing you to do all sorts of other stupid poo poo, doesn't allow this.

raminasi fucked around with this message at 00:37 on Nov 8, 2014

Deus Rex
Mar 5, 2005

substitute posted:

I just wrote a small function yesterday that returns $rear end. I'm leaving it. :colbert:

Rust has a trait which you can find by searching for "rear end lice".

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
In driver code, I saw static int ass_index = 0; and had to laugh.

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


Xenoveritas posted:

Well, I'm not going to post any actual code, instead I'll just say:
  • Single 3,000 line Java file
  • Which contains seven classes
  • In the default (empty) package
  • 150MB of dependencies, the bulk (135MB) of which appear to be data files for a single dependency
  • Sole public interface appears to be public static void main(String[])
  • But every method is public anyway
  • Except for constructors, which are all package access
  • Rather than throwing exceptions, all error handling is done using System.exit(1)
  • Conceptually this code is supposed to be made available as a web service...

I've been looking at bits of a system at work that was widely suspected to be a clusterfuck and this sounds kind if similar. Just looking at the database it has :

* all tables have varchar guids as their identifier that are not actually set as a key and are also not indexed, in fact there is no indexing anywhere.

* no table has any referential integrity to any other, columns that are actually fks don't actually link to the foreign table

* has system workflows (basically all it does) defined by having a table of stages that refer to "forward steps" which include decisions these decisions are either "methods" or literally JavaScript stored as text

* the methods refer (no keying of course, it's all varchar names) to a table of java classes and methods which appears to reference some sort of web serv ice call made from gently caress knows where

* the system home page html is stored as a string in the db

* There are no stored procedures but there is a table that contains sql strings with placeholder values like "###variable###" that are presumably being executed following string manipulation in JavaScript

* said sql contains about 7 nested case statements on an output instead of using an else so probably had all sorts of consistency issues.

And this is after literally just half an hour looking at it.

Edit: bullets don't work on the Awful app I guess.

Powerful Two-Hander fucked around with this message at 17:00 on Nov 8, 2014

bpower
Feb 19, 2011

Powerful Two-Hander posted:

I've been looking at bits of a system at work that was widely suspected to be a clusterfuck and this sounds kind if similar. Just looking at the database it has :

* all tables have varchar guids that are not set as a key and are also not indexed
[*]no table has any referential integrity to any other, columns that are actually fks don't actually link to the foreign table
[*] has system workflows (basically all it does) defined by having a table of stages that refer to "forward steps" which include decisions these decisions are either "methods" or literally JavaScript stored as text
[*] the methods refer (no keying of course, it's all varchar names) to a table of java classes and methods which appears to reference some sort of web serv ice call made from gently caress knows where
[*] the system home page html is stored as a string in the db
[*] there are no stored procedures but there is a table that contains sql strings with placeholder values like "###variable###" that are presumably being executed following string manipulation in JavaScript

[*] said sql contains about 7 nested case statements on an output instead of using an else so probably had all sorts of consistency issues.

And this is after literally just half an hour looking at it.

Jesus Christ. Why?

Xenoveritas
May 9, 2010
Dinosaur Gum

Powerful Two-Hander posted:

* no table has any referential integrity to any other, columns that are actually fks don't actually link to the foreign table

On a completely different project, there's a query that contains something along the lines of:

SELECT * FROM left INNER JOIN right ON left.id = REPLACE(right.id, '-suffix', '')

I'm not entirely sure who's to blame for the right table having a suffix added to the string keys, but it's there in the views we have access to in this database created by third-party software.

QuarkJets
Sep 8, 2008

Someone decided that their MySQL tables were going to be all varchars, even the row ID (which isn't set as unique or a primary key or anything, it's just a column called "id" of type varchar)

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


bpower posted:

Jesus Christ. Why?

It's an exciting combination of an offshore (but not outsourced) team, local management viewing their own personal empires as more important than quality products and a team lead who says yes to every end user request.

Someone also seems to have fallen into the "workflow tools are easy, I bet I could write my own custom framework and make it ~~~ super configurable ~~~.

This whole application is a goldmine of horrors so I'm sure there will be more to come.

Edit: a recurring theme with offshore teams seems to be gently caress all idea about how to create a decent database schema. The other day I had to help a team solve a temp db timeout that turned out to be that there was a 10 million row table with no clustered index trying to do an enourmous in memory sort.

Powerful Two-Hander fucked around with this message at 00:40 on Nov 9, 2014

My Rhythmic Crotch
Jan 13, 2011

^ That sounds very similar to our legacy web app (thankfully used internally only):
- varchar ids
- no integrity, no foreign keys
- data broken/scattered into multiple tables. For example there might be two tables to store authors: one table for authors of magazines, one table for authors of books.

The legacy web app is a java servlet that executes whatever sql script you feed it via URL parameter. Something like https://server/servlet.jsp?script=doody.sql. Whatever the sql script returns is piped right out to the browser. So most html, css, and javascript is stored in PL/Perl scripts. Due to all the escape characters, temporary table shenanigans and other fuckery, the scripts are very difficult to maintain and understand. When I first started here, engineers were injecting sql or scraping to get the data that they needed out of the system.

Another system I got voluntold to support is something I call BPP - Babby's Python Playground:
- We build widgets and BPP is supposed to be a dead-nuts-simple system for widget testing. Technicians are supposed to be able to read, understand and debug the test scripts, so everything needs to be simple.
- Instead, BPP is nothing but lambdas, generators, obfuscation and other design patterns (like getters/setters) that don't have any place in Python IMO.
- The guy who made BPP apparently did most, if not all, testing in production judging by VCS comments.

The guy who made BPP got himself kicked off if and is really salty about it. He could still be working on it if only he wasn't such a giant pecker to literally every person he has to interface with. Ugh.

bpower
Feb 19, 2011
This is helping.

Anotherone.

They wanted to get some fairly simple grouped data from the db and display it in a jqplot graph.

So...

For each db table Select * all the data needed into a DataTables, one per db table.

2000 lines grouping and summing the data into an 10 x 4 array of doubles.

Pass data to an unsecured Web Service that you've created especially for the task.
.
.
.
In nonsense.aspx set data source url of your jqplot to the web service.

tl:dr

He created a web service because they didn't know how to get data into a graph. Said Webservice is unsecured and has exposed methods like deleteX, updateY, getExtremlyPrivateFinancialDataForClient.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Xenoveritas posted:

One more.

Java code:
public static boolean StringLexicographicallyGreaterThan(String S1, String S2) {
    // Returns true if S1 is lexicographically greater than S2 where the codepoint of each character is compared.
    // Returns false otherwise
So, uh, wait, how is this different than S1.compareTo(S2) > 0?

Java code:
    if (S1.length() > S2.length())
        return true;
    if (S1.length() < S2.length())
        return false;
Oh. I see.

This is the quasi-lexicographic order, and it has its uses. Its main advantage is that it's substantially faster than ordinary lexicographic order, since it usually doesn't even need to look at the actual character data. Its main disadvantage is that it can't be made Unicode-correct, but sometimes that's okay — maybe you actually want to distinguish different encodings, or maybe you only need a best-effort comparison.

For example, if you were writing a serialization library, you might add an optimization to avoid serializing the same string multiple times, but you'd be really sensitive to the speed of that check. Occasionally serializing multiple versions of the same canonically-equivalent string might be an acceptable tradeoff if it means getting better throughput. And a client could even make a pretty compelling argument that anything else is incorrect, and that serialization should not change the encoding of the string.

Xenoveritas
May 9, 2010
Dinosaur Gum
For all I know the behavior is correct, but that's hardly the point: the comment and method name flat-out lie about what it actually does. Maybe it is supposed to do that, I have absolutely no clue.

And it does actually do a lexicographical compare after the length checks. Which, again, may actually be correct, it's entirely possible the author wanted to sort first by string length and then by lexicographical order. But the method names and comments suggest he didn't. And if he really did want a lexicographical compare, that's part of the standard library.

TheresaJayne
Jul 1, 2011
On a fairly close link, we have been talking about variable names,

What about server names?

I used to run servers from home
Piper, Phoebe, Paige (guess which one was the web server)

Then i had machines called
Tokyo and Osaka

Now my current desktop machines are called
Winterfell, Braavos, Astapor

funiliy enough at a previous place we had servers called
Huey Duey and Louis (the 3 test servers)

and i have seen servers called Lundy, Dogger, Rockall, Thames, Dover etc. plus they had Gatwick, Heathrow, stanstead
they were British Telecom Air Traffic control servers back in the late 80s
named after the Shipping forecast areas around the UK

qntm
Jun 17, 2009
I just use chemical elements. There's an RFC about this.

TheresaJayne
Jul 1, 2011
there is anotehr RFC that i prefer

https://www.ietf.org/rfc/rfc2100.txt

The naming of hosts

substitute
Aug 30, 2003

you for my mum
I worked at a small place that used names of The Muppets. I think Kermit was the web server, Beaker was the db server, the dev machines were all characters, etc.

Hughlander
May 11, 2005

Bands I'm listening to at the time of naming. Going from Gwar, yngwiemalmsteen, and Manowar to fun, Adele, and Lords is probably the horror

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

Hughlander posted:

yngwiemalmsteen

That's gotta be a fun one.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I use fruit for all my naming needs.

http://namingschemes.com/Fruit

Carthag Tuek
Oct 15, 2005

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



Suspicious Dish posted:

I use fruit for all my naming needs.

http://namingschemes.com/Fruit

Prefer http://namingschemes.com/Cigarette_Ingredients

Illusive Fuck Man
Jul 5, 2004
RIP John McCain feel better xoxo 💋 ðŸ™Â
Taco Defender
I'm using http://namingschemes.com/Transformers at my current job

Sereri
Sep 30, 2008

awwwrigami

The servers at work have X-men names like Cyclops and Iceman. I think they're supposed to be renamed to something more serious soon though . Bye, Storm.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
At one of my old jobs all the machines were given names inspired by Greek and Roman mythology. After my first few days of working on Pan I was assigned my own new workstation named Lupa.

wikipedia posted:

Lupa (Latin for “she-wolf”; plural: Lupae) can refer to:

- a female wolf (Canis lupus)
- the wolf in the story of Romulus and Remus
- a slang word for prostitute in ancient Rome; see Lupanar (Pompeii)

Hunh.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
I see a lot of auto-generated "secure" names, so you'll have servers like 'GXLMD1391O01'.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Sereri posted:

I think they're supposed to be renamed to something more serious soon though . Bye, Storm.

Whoever mandated that is a poor excuse for a human being.

They're probably the same people who came up with ...


Ithaqua posted:

I see a lot of auto-generated "secure" names, so you'll have servers like 'GXLMD1391O01'.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Thermopyle posted:

Whoever mandated that is a poor excuse for a human being.

They're probably the same people who came up with ...

It's terrible, but it's very common in larger organizations.

They also tend to have auto-generated user accounts, so logins are things like "DOMAIN\XHMN321QR3"

omeg
Sep 3, 2012

I loving hate Windows security API. So many ways to get poo poo wrong.

Xenoveritas
May 9, 2010
Dinosaur Gum

Xenoveritas posted:

One more.

Java code:
public static boolean StringLexicographicallyGreaterThan(String S1, String S2) {
    // Returns true if S1 is lexicographically greater than S2 where the codepoint of each character is compared.
    // Returns false otherwise
So, uh, wait, how is this different than S1.compareTo(S2) > 0?

Java code:
    if (S1.length() > S2.length())
        return true;
    if (S1.length() < S2.length())
        return false;
Oh. I see.

gently caress, I'm wrong about what it does if the lengths are equal. If the lengths are equal, it then goes through the string characters backwards and checks each character's lexicographical orders.

Java code:
    for (int i=(S1.length()-1);i>=0;i--){
        if (S1.codePointAt(i) > S2.codePointAt(i))
            return true;
        if (S1.codePointAt(1) < S2.codePointAt(i))
            return true;
    }
    return false;
Edit: God drat it, I still read it wrong. It returns true if any character is different anywhere in the second string. What is this even doing?!

Edit 2: Oh, another transcription error on my behalf, that second comparison isn't S1.codePointAt(i), it's S1.codePointAt(1).

Xenoveritas fucked around with this message at 19:41 on Nov 10, 2014

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

For server names that I control it's always been Alpha, Beta, Delta, etc etc. in the order they were created. When I worked at Telus (big regional telco) Windows servers were named random string bits and Unix servers were named whatever the suspendered neckbeard felt like. Eventually an alpha-neckbeard wrestled control and changed all the names to DEMONXXX where XXX was a random number. >HIS< server of course, was DEMON001. It was also the server that hosted and processed all of the x.y.binaries newsgroups; I swear the only reason that telco did newsgroups was because that guy wanted to get his porn on.

EAT THE EGGS RICOLA
May 29, 2008

Suspicious Dish posted:

I use fruit for all my naming needs.

http://namingschemes.com/Fruit

kill everyone that contributed to this wiki

Soricidus
Oct 21, 2010
freedom-hating statist shill

Xenoveritas posted:

gently caress, I'm wrong about what it does if the lengths are equal. If the lengths are equal, it then goes through the string characters backwards and checks each character's lexicographical orders.

Java code:
    for (int i=(S1.length()-1);i>=0;i--){
        if (S1.codePointAt(i) > S2.codePointAt(i))
            return true;
        if (S1.codePointAt(1) < S2.codePointAt(i))
            return true;
    }
    return false;
Edit: God drat it, I still read it wrong. It returns true if any character is different anywhere in the second string. What is this even doing?!

Edit 2: Oh, another transcription error on my behalf, that second comparison isn't S1.codePointAt(i), it's S1.codePointAt(1).
This gets better and better!

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

EAT THE EGGS RICOLA posted:

kill everyone that contributed to this wiki

How else would we get a list of 112 slang terms for vagina?

Space Kablooey
May 6, 2009


EAT THE EGGS RICOLA posted:

kill everyone that contributed to this wiki

idk, the Asterix one is pretty great.

Chill Callahan
Nov 14, 2012

Scaramouche posted:

For server names that I control it's always been Alpha, Beta, Delta, etc etc. in the order they were created. When I worked at Telus (big regional telco) Windows servers were named random string bits and Unix servers were named whatever the suspendered neckbeard felt like. Eventually an alpha-neckbeard wrestled control and changed all the names to DEMONXXX where XXX was a random number. >HIS< server of course, was DEMON001. It was also the server that hosted and processed all of the x.y.binaries newsgroups; I swear the only reason that telco did newsgroups was because that guy wanted to get his porn on.

Who was DEMON666 though

fritz
Jul 26, 2003

Scaramouche posted:

For server names that I control it's always been Alpha, Beta, Delta, etc etc. in the order they were created. When I worked at Telus (big regional telco) Windows servers were named random string bits and Unix servers were named whatever the suspendered neckbeard felt like. Eventually an alpha-neckbeard wrestled control and changed all the names to DEMONXXX where XXX was a random number. >HIS< server of course, was DEMON001. It was also the server that hosted and processed all of the x.y.binaries newsgroups; I swear the only reason that telco did newsgroups was because that guy wanted to get his porn on.

Wasn't Demon an old isp / shell provider from way back when? I think I remember lots of people with "demon.co.uk" addresses on usenet.

Adbot
ADBOT LOVES YOU

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
There was a time when half the TFC servers out there were hosted at demon.co.uk

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