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
canis minor
May 4, 2011

I'm currently redoing code that was solely developed by tech lead that has left and am more and more surprised how culture of "let's add more poo poo on top of existing poo poo and never refactor" can result in code that doesn't really do anything.

I really want my next company to not be "hey, we've written this code, but we also took heavy drugs while doing this, so search product functionality is actually done in user class". I guess third time is the charm... although new place doesn't have any unit tests, so lol.

canis minor fucked around with this message at 12:48 on Jun 15, 2018

Adbot
ADBOT LOVES YOU

eth0.n
Jun 1, 2012


quote:

To avoid login errors, please do not use any of the following special characters in your password: % & + ¥ £ ¢ Also do not use bullet points or the Euro currency symbol.

Bonus points: it's a scrolling marquee. That isn't on the create password page:

nielsm
Jun 1, 2009



"You must use symbols in your password, but NO NOT THAT ONE!"

Ola
Jul 19, 2004

Jeez, just tell me the exact password phrase you want me to use.

Polio Vax Scene
Apr 5, 2009



Why are ' and ’ two very real things

canis minor
May 4, 2011

Polio Vax Scene posted:

Why are ' and ’ two very real things

Not only two! https://en.wikipedia.org/wiki/Quotation_mark#Unicode_code_point_table

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Polio Vax Scene posted:

Why are ' and ’ two very real things

Are you programming in MS Word? That poo poo almost never comes outside of MS products.

Polio Vax Scene
Apr 5, 2009



Some fancy mcfancypants entered their first name as Le'douche into their data entry (Not actually le'douche but you get the drift) and the data entry does not correct this
e: It is a Microsoft product. Not word though.

90s Rememberer
Nov 30, 2017

by R. Guyovich

eth0.n posted:




Bonus points: it's a scrolling marquee. That isn't on the create password page:



Kinda makes you wonder how seriously ADT takes security in the first place.

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:

Mooey Cow posted:

For instance, every local variable you use in an iterator function will/can be made into a member variable in a hidden class so it can preserve state between yields. I believe async/await does something similar. If you're careless or don't know about this, causing enormous allocations from what looks like fairly innocuous stuff is very easy.

While it's true that variables can be captured in a generated type, you'd also have to be capturing hundreds of variables before the class ends up in multi-kb territory. Which means that you have hundreds of variables in method scope to capture in the first place, which seems to be the real problem.

Also some of the genetrated types are structs, so instead of a variable on the stack, you end up with a generated struct on the stack with the variable in it, so there's not that much difference.

Your point about templates is true though. There is some tooling out there to generate code for that sort of stuff, but that's kind of a poo poo solution compared to templates.

However, I do wonder if C# is the right tool for your job if you frequently run into that sort of issue. Math heavy stuff has never really been one of C#'s strengths.

Pollyanna
Mar 5, 2005

Milk's on them.


What kind of data do you think a column named source_id would store? If you answered “an integer” or “a uuid”, you are wrong! It’s actually a big ol’ minimally structured string of arbitrary key-value data. :shepface:

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Polio Vax Scene posted:

Some fancy mcfancypants entered their first name as Le'douche into their data entry (Not actually le'douche but you get the drift) and the data entry does not correct this
e: It is a Microsoft product. Not word though.

What would need to get “corrected” about this?

hailthefish
Oct 24, 2010

Presumably it got stored as Le’douche and trying to do operations on Le'douche doesn't work, or entered as Le’douche but got stored as Le?douche or Le�douche or
code:
Le’douche
or whatever.


Or :thejoke: ?

hailthefish fucked around with this message at 18:27 on Jun 15, 2018

canis minor
May 4, 2011

Pollyanna posted:

What kind of data do you think a column named source_id would store? If you answered “an integer” or “a uuid”, you are wrong! It’s actually a big ol’ minimally structured string of arbitrary key-value data. :shepface:

This reminds me that some time ago I've discovered that basket_id actually contains a hash of the session current user has :v: (no problem there's an actual baskets table that has nothing to do with this field). Still, something better from today: a join on LocationSearches table and Searches table on varchar2 address field.

Pollyanna
Mar 5, 2005

Milk's on them.


Oh yeah, and as part of killing off our old Java monolith, I have to go through its codebase and extract hardcoded values and overridden methods that construct arbitrary maps n poo poo. :shepface:

I’m beginning to brainstorm easier ways to do that. I wonder if we can leverage the code that puts these blobs of data together, and have the monolith send the blob of data along with what it made that blob of data for to a service or something with a line of code after that method call? To kinda automate the poo poo I’d have to do otherwise. Does that even make sense?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Pollyanna posted:

What kind of data do you think a column named source_id would store? If you answered “an integer” or “a uuid”, you are wrong! It’s actually a big ol’ minimally structured string of arbitrary key-value data. :shepface:

There was a brief period of darkness where we were converting some numeric IDs into strings for transmission to the frontend code, which would then dutifully cast them back to numbers. Fixing that felt good.

(This was more of a project management horror than a coding horror, though; give people more than six weeks to do major software development)

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:
One of our applications puts items in a database table for later processing, so basically a queue. A separate scheduled task then calls a wcf service to retrieve the items, batched per 7 items (why 7? who the gently caress knows). After processing an item the task makes another call to the same wcf service to remove the item from the queue. Relatively straightforward stuff.

The stupid thing is that the id for the item is a guid. Which is stored as a char(38) in the db. And is exposed as a string by the wcf service. But the call to dequeue the item takes a guid, so the client has to parse the string it got from the server to a guid in order to pass it back to the same server. Which in turn obviously turns it back to a string when it goes to the db :downs:

Hammerite
Mar 9, 2007

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

dwazegek posted:

One of our applications puts items in a database table for later processing, so basically a queue. A separate scheduled task then calls a wcf service to retrieve the items, batched per 7 items (why 7? who the gently caress knows). After processing an item the task makes another call to the same wcf service to remove the item from the queue. Relatively straightforward stuff.

The stupid thing is that the id for the item is a guid. Which is stored as a char(38) in the db. And is exposed as a string by the wcf service. But the call to dequeue the item takes a guid, so the client has to parse the string it got from the server to a guid in order to pass it back to the same server. Which in turn obviously turns it back to a string when it goes to the db :downs:

Who cares? unless it's actually the bottleneck in your application, which doesn't sound likely

fritz
Jul 26, 2003

Polio Vax Scene posted:

Some fancy mcfancypants entered their first name as Le'douche into their data entry (Not actually le'douche but you get the drift) and the data entry does not correct this
e: It is a Microsoft product. Not word though.

https://www.youtube.com/watch?v=YPOCIlvAsP8

reversefungi
Nov 27, 2003

Master of the high hat!

hailthefish posted:

Presumably it got stored as Le’douche and trying to do operations on Le'douche doesn't work, or entered as Le’douche but got stored as Le?douche or Le�douche or
code:
Le’douche
or whatever.


Or :thejoke: ?

This is probably Windows 1252 encoding. Had an issue related with this that drove me mad the other day trying to figure it out.

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:

Hammerite posted:

Who cares? unless it's actually the bottleneck in your application, which doesn't sound likely

You don't think that it's an issue that a web service exposes an id as a string, but requires the client to post that same id back as a guid? Or that the id could have just been a guid throughout the application, which would have resulted in better performance, and, more importantly, less potential for bugs? Sure, it's not the worst coding horror in the world, but still...

Hammerite
Mar 9, 2007

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

dwazegek posted:

You don't think that it's an issue that a web service exposes an id as a string, but requires the client to post that same id back as a guid? Or that the id could have just been a guid throughout the application, which would have resulted in better performance, and, more importantly, less potential for bugs? Sure, it's not the worst coding horror in the world, but still...

I missed that the id is exposed as different types on the same interface, yeah that's a bit ugly. But still, if that's the biggest wart on the application then you're doing ok.

CPColin
Sep 9, 2003

Big ol' smile.
code:
entry.inTime = xml.InPunch?.Punch?.'@Time'?.getAt(0)
Huh, that getAt() call looks weird, but maybe Groovy's XML support does weird things and this is how you get the Time attribute of the first Punch element, in case there's more than one? Whatever, time to cover this super-old code with a test before I change anything:

code:
assertEquals("12:30", entry.inTime)

 junit.framework.ComparisonFailure: expected:<12:30> but was:<1>
God loving drat it.

Edit: Oh gently caress, Groovy's XML support returns attribute values as lists:

http://grails.asia/groovy-xmlparser-examples-for-parsing-xml

So the previous developer did need those getAt() calls after all and my stupid test has to wrap that value in a list for no reason! Never mind that well-formed XML disallows multiple attributes with the same name in the same element!

Now I need to use actual XML as my mock data, because this is getting stupid.

CPColin fucked around with this message at 23:00 on Jun 15, 2018

necrotic
Aug 2, 2005
I owe my brother big time for this!
You should've been using real xml for the mock data from the start.

CPColin
Sep 9, 2003

Big ol' smile.
Yep. Groovy's dynamic typing is letting me get away with getting sloppy.

Absurd Alhazred
Mar 27, 2010

by Athanatos

Janitor Prime posted:

Are you programming in MS Word? That poo poo almost never comes outside of MS products.

TeX wants you to distinguish starting from ending quotes, and from double quotes. So you don't write "this", you write ``this''.

Eggnogium
Jun 1, 2010

Never give an inch! Hnnnghhhhhh!

dwazegek posted:

You don't think that it's an issue that a web service exposes an id as a string, but requires the client to post that same id back as a guid? Or that the id could have just been a guid throughout the application, which would have resulted in better performance, and, more importantly, less potential for bugs? Sure, it's not the worst coding horror in the world, but still...

Assuming a message protocol is SOAP or some other text-based protocol then it’s being converted to and from a string to cross the wire anyway, so probably not any real performance loss. Mildly annoying that you have to convert in your own code instead of letting WCF do it for you.

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer

Eggnogium posted:

Assuming a message protocol is SOAP or some other text-based protocol then it’s being converted to and from a string to cross the wire anyway, so probably not any real performance loss. Mildly annoying that you have to convert in your own code instead of letting WCF do it for you.

You can easily do binary encoding over TCP with WCF, so this may not be a good assumption, but even in that case the loss of type safety is probably a bigger issue than performance.

ToxicFrog
Apr 26, 2008


Having a weird issue with some Discord client software, I eventually tracked the problem down to this initialization code (pared down a bit):

code:
for (const channel in server.channels) {
  this.channels[channel.name] = channel;
}
Discord channel names are not guaranteed to be unique. channel.id is the unique key. If the server has multiple channels with identical names, only the last one in server.channels makes it into this.channels. It's unpredictable from connection to connection which order they're iterated in, so this doesn't even give you consistently wrong results.

brap
Aug 23, 2004

Grimey Drawer
Hell, for-in doesn't even give you consistent iteration order, does it?

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

brap posted:

Hell, for-in doesn't even give you consistent iteration order, does it?

in js, for in returns properties in the order they were defined - which is consistent, but arbitrary.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

dwazegek posted:

You don't think that it's an issue that a web service exposes an id as a string, but requires the client to post that same id back as a guid? Or that the id could have just been a guid throughout the application, which would have resulted in better performance, and, more importantly, less potential for bugs? Sure, it's not the worst coding horror in the world, but still...

It's untidy and I certainly wouldn't design something that way, but I don't think it's likely to increase bugs as you said. If it was the other way around (input expected a string that it subsequently assumes to be a guid) then I could see potential bugs arising from that for sure.

TheresaJayne
Jul 1, 2011
My latest one, setting up my old iphone as a company phone,
they force you to have a 6 digit pin unlock code,
The rules are as follows

You cannot have repeating digits (11 or even 123451 )
You cannot have 2 adjacent numbers (129874 is not allowed as 12 and 98 and 87 are adjacent)

Loezi
Dec 18, 2012

Never buy the cheap stuff

TheresaJayne posted:

My latest one, setting up my old iphone as a company phone,
they force you to have a 6 digit pin unlock code,
The rules are as follows

You cannot have repeating digits (11 or even 123451 )
You cannot have 2 adjacent numbers (129874 is not allowed as 12 and 98 and 87 are adjacent)

If my quick calculations are correct then that leaves about 12% of the 6-digit pins as valid. Nice going.

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer

Loezi posted:

If my quick calculations are correct then that leaves about 12% of the 6-digit pins as valid. Nice going.

I'm getting 4.6%.

Python code:
def has_repeats(n):
  seen = set()
  for c in n:
    if c in seen:
      return True
    seen.add(c)
  return False

def are_consecutive(c1, c2):
  n1, n2 = int(c1), int(c2)
  return n1 - n2 == 1 or n2 - n1 == 1

def has_consecutives(n):
  for c1, c2 in zip(n, n[1:]):
    if are_consecutive(c1, c2):
      return True
  return False

def is_valid(n):
  return not has_repeats(n) and not has_consecutives(n)

numbers = list(range(0, 1000000))
valid = list(filter(is_valid, map(lambda n: '{0:06d}'.format(n), numbers)))
print(len(valid) / len(numbers))
All valid codes: https://pastebin.com/ivx1692s

Some assumptions:
1. Codes may start with 0.
2. 0 and 9 are not considered adjacent.

Loezi
Dec 18, 2012

Never buy the cheap stuff

LOOK I AM A TURTLE posted:

I'm getting 4.6%.

Yeah, looking at it again, this seems correct.

Vanadium
Jan 8, 2005

I mean, that still leaves more choices than industry standard four digit pin codes.

TheresaJayne
Jul 1, 2011

Vanadium posted:

I mean, that still leaves more choices than industry standard four digit pin codes.

But a lot of people use patterns on the Keypad like a T L P O etc. so most patterns are not allowed anything going across the pad is not allowed and in some cases up down as well 0147 is not valid

Ola
Jul 19, 2004

LOOK I AM A TURTLE posted:

I'm getting 4.6%.


This means 6 and 7 are considered adjacent, but they're not adjacent on the numpad. And perhaps vertical adjacency is invalid as well.

Adbot
ADBOT LOVES YOU

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer

Ola posted:

This means 6 and 7 are considered adjacent, but they're not adjacent on the numpad. And perhaps vertical adjacency is invalid as well.

Nice, this lets us get rid of even more entropy. I'll assume we have this keypad layout:
pre:
1 2 3
4 5 6
7 8 9
  0
With horizontal and vertical adjacency both disallowed we can now discard sequences with 12, 14, 21, 23, 25, 32, 36, etc. On average each digit is now adjacent to 2.5 other digits. This brings the number of permitted codes down to 2.66%.

But why stop here? We should obviously block direct diagonal adjacency as well. If we include diagonal adjacency we can almost completely eliminate the digit 5 from the list of valid codes, as it would then only be able to occur at the beginning or end of the code, and only next to a 0. If e.g. 15 and 07 are also considered adjacent we can bring the number of possible codes down to 0.52%.

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