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
GROVER CURES HOUSE
Aug 26, 2007

Go on...

Janin posted:

isn't just putting in openssl/gnutls like a 10-line change? why did your team roll their own encryption?

This is the thread full of coding horrors. They rolled their own encryption because they knew this is where they were meant to be.

Adbot
ADBOT LOVES YOU

ozymandOS
Jun 9, 2004

Janin posted:

isn't just putting in openssl/gnutls like a 10-line change? why did your team roll their own encryption?

To be fair, our team didn't implement any encryption at all--the core security team owns all of the encryption implementation. We used an API described as secure that in fact did not turn out to be secure.

Interestingly, we do have a TLS implementation available. However none of our customers actually use it due to "performance concerns", and internal management is equally wary. This is despite realistic performance tests with our application that show around a ~0.2% performance degradation from turning on TLS.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

BP posted:

This is despite realistic performance tests with our application that show around a ~0.2% performance degradation from turning on TLS.

Of course, if it's already performing so poorly that 0.2% is the difference between "barely usable" and "unusable", then that makes sense. :v:

Scaevolus
Apr 16, 2007

BP posted:

Interestingly, we do have a TLS implementation available. However none of our customers actually use it due to "performance concerns", and internal management is equally wary. This is despite realistic performance tests with our application that show around a ~0.2% performance degradation from turning on TLS.

How much of a performance hit is the homebrew "encryption"?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
And who is so hypocritical that they're concerned about secure communications but consider a 0.2% performance hit unreasonable?

Zhentar
Sep 28, 2003

Brilliant Master Genius

pokeyman posted:

And who is so hypocritical that they're concerned about secure communications but consider a 0.2% performance hit unreasonable?

They've probably been trained not to trust performance testing thanks to horribly inaccurate results from tests run by the same kind of people who think that stuff counts as encryption.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
modifying some random java image scaling library, and in the DimensionConstrain class I find:
code:
    /**
     * Will always return a dimension with positive width and height;
     * @param dimension of the unscaled image
     * @return the dimension of the scaled image
     */
    public Dimension getDimension(Dimension dimension){
        return dimension;
    }
oh come the gently caress on

At least one of the resize algos was completely worthless, too.

that awful man
Feb 18, 2007

YOSPOS, bitch

Aleksei Vasiliev posted:

modifying some random java image scaling library, and in the DimensionConstrain class I find:
code:
    /**
     * Will always return a dimension with positive width and height;
     * @param dimension of the unscaled image
     * @return the dimension of the scaled image
     */
    public Dimension getDimension(Dimension dimension){
        return dimension;
    }

Ah, the "Identity Crisis" pattern.

it is
Aug 19, 2011

by Smythe
I don't see what's wrong with it.

it is
Aug 19, 2011

by Smythe

it is posted:

I don't see what's wrong with it.

That makes 2 of us. It's fine.

McGlockenshire
Dec 16, 2005

GOLLOCKS!
The function does none of the things that the docblock says it should. All it does is return the passed argument unmodified, an effective no-op. This would break poo poo horribly if you trusted the docs.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

it is posted:

I don't see what's wrong with it.

it is posted:

That makes 2 of us. It's fine.

Are you having an identity crisis too?

PalmTreeFun
Apr 25, 2010

*toot*

Suspicious Dish posted:

Are you having an identity crisis too?

That's the joke. :ssh:

Contra Duck
Nov 4, 2004

#1 DAD

Zhentar posted:

They've probably been trained not to trust performance testing thanks to horribly inaccurate results from tests run by the same kind of people who think that stuff counts as encryption.

My performance testing story: A client was once very upset that our new release was performing 20% slower in their performance tests. After about two weeks it came out that they had tried to run the test at the same time and on the same machines as another system's performance test.

The Gripper
Sep 14, 2004
i am winner

Contra Duck posted:

My performance testing story: A client was once very upset that our new release was performing 20% slower in their performance tests. After about two weeks it came out that they had tried to run the test at the same time and on the same machines as another system's performance test.
We rewrote a significant amount of code for a client (at a significant cost to the client) because they were reporting that it wasn't performing well enough to meet their demand. We tested the new code on our test machines, performance was 20% better (than our test machines running the original code), sent it off to them and got an angry conference call saying our new code was even slower than the original.

Turns out they had scheduled the performance test once a month on their server, as a scheduled task (which was fine, it was designed that way) - except they'd added one scheduled task for each manager that needed a copy of the report. So it was running 4x simultaneously, and when they tested the new code they added a fifth scheduled task to run alongside them.

Fixing up their scheduled task mistake provided something like a 2000x performance increase [for their performance tests], and it turned out the system was fast enough already and it was only the managers seeing bad numbers on the performance test that made them want to rewrite.

Performance testing should be done by people that understand the system, and how performance testing should work!

[fake edit; the cost to rewrite the system to be faster for no reason was >$400k, and took 7 months]

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

The Gripper posted:

:words:

That's awesome. My best story doesn't even hold a candle to that one; management was reporting that a feature was "too slow" (without any metrics defining what constituted acceptable performance, of course). We requested metrics and received some that actually were reasonable.

We tested the feature, and it performed well within the metrics provided. When told that, management insisted it was unacceptably slow and that we "do something".

Ultimately, we just said "okay, we made some tweaks that may have improved performance" (without any numbers, of course), and suddenly it was performing great! We were all commended for doing such good work. Yay!

That kind of bullshit is one of a million reasons I'm glad I don't work there anymore.

ephphatha
Dec 18, 2009




Ithaqua posted:

Ultimately, we just said "okay, we made some tweaks that may have improved performance" (without any numbers, of course), and suddenly it was performing great! We were all commended for doing such good work. Yay!

How much did you charge them for your time?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Ephphatha posted:

How much did you charge them for your time?

Nothing, since we were salaried employees. They just didn't get another feature/bug fix in that sprint because they allocated time to a nonexistent problem.

zero knowledge
Apr 27, 2008

The Gripper posted:

Performance testing should be done by people that understand the system, and how performance testing should work!


"People who understand the system" usually means "people who worked on the system and will game the performance measurements to make the system look good". I'd say that for measuring performance, or correctness, or whatever, you want people who have no idea how the system works, but rather understand what the system is meant to do.

I can't argue with the latter portion of your statement, though.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Here's an entertaining one: Assigning values inside an array (yes I know that PHP + Stack Overflow is the lowest of low-hanging fruit).

Optimus Prime Ribs
Jul 25, 2007

Hammerite posted:

Here's an entertaining one: Assigning values inside an array (yes I know that PHP + Stack Overflow is the lowest of low-hanging fruit).

I've never seen that goofy "more than one dollar sign" poo poo in PHP before, but just what the hell is it supposed to do?
Like, this makes no sense:

http://codepad.org/tMhOK1dO
http://codepad.org/3xDgPwrA
http://codepad.org/1IxeJDDO

:psyduck:

Look Around You
Jan 19, 2009

Optimus Prime Ribs posted:

I've never seen that goofy "more than one dollar sign" poo poo in PHP before, but just what the hell is it supposed to do?
Like, this makes no sense:

http://codepad.org/tMhOK1dO
http://codepad.org/3xDgPwrA
http://codepad.org/1IxeJDDO

:psyduck:

Apparently they are "variable variables":

PHP docs posted:

Variable variables

Sometimes it is convenient to be able to have variable variable names. That is, a variable name which can be set and used dynamically. A normal variable is set with a statement such as:

php:
<?
$a = 'hello';
?>
A variable variable takes the value of a variable and treats that as the name of a variable. In the above example, hello, can be used as the name of a variable by using two dollar signs. i.e.

php:
<?
$$a = 'world';
?>
At this point two variables have been defined and stored in the PHP symbol tree: $a with contents "hello" and $hello with contents "world". Therefore, this statement:

php:
<?
echo "$a ${$a}";
?>
produces the exact same output as:

php:
<?
echo "$a $hello";
?>
i.e. they both produce: hello world.

Optimus Prime Ribs
Jul 25, 2007

Look Around You posted:

Apparently they are "variable variables":

Ah, that makes sense. I just had the perfect storm of variable names for extra confusion.
Not surprising at all that this feature exists in PHP though.

Hammerite
Mar 9, 2007

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

Optimus Prime Ribs posted:

I've never seen that goofy "more than one dollar sign" poo poo in PHP before, but just what the hell is it supposed to do?

It lets you refer to a variable whose name is determined by the contents of another variable. I do not know of a use case that is not better dealt with by using PHP's built-in associative arrays.

Vintersorg
Mar 3, 2004

President of
the Brendan Fraser
Fan Club



That just makes my head hurt, jesus.

tef
May 30, 2004

-> some l-system crap ->
Mircscript does a similar thing. It is how you get arrays :v:

Personally i'm more curious at keys in array() statements being treated as bare words

Munkeymon
Aug 14, 2003

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



You want to make those poor programmers type out all those quotes? No, much better to just treat any unknown character sequence as a string. - PHP

Hammerite
Mar 9, 2007

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

tef posted:

Mircscript does a similar thing. It is how you get arrays :v:

Personally i'm more curious at keys in array() statements being treated as bare words

I'm not sure what you mean by "keys being treated as bare words", can you explain?

Although I did find in trying to work out what you meant that this works (and has the obvious effect), which I wasn't expecting:

code:
<?php

$x = array(t => 4);

var_dump($x);

?>
But on thinking about it, it is consistent with PHP's treatment of unknown bare words in other contexts, so I'm not sure why I was surprised.

Carthag Tuek
Oct 15, 2005

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



You can do the same thing in perl if you don't use strict;, and it's a really bad idea that makes code unmaintainable.

code:
[ carthag@mbp.local:~ ]$ perl
use Data::Dumper;

$a = { a => b, "b" => 2, 3 => "c" };

print Dumper \$a;
^D
$VAR1 = \{
            'a' => 'b',
            '3' => 'c',
            'b' => 2
          };

Carthag Tuek fucked around with this message at 23:59 on Feb 13, 2012

Opinion Haver
Apr 9, 2007

Coffeescript does this too, but only in dict keys. At least there it makes sense since in objects (Javascript's dict equivalent) the keys can only be strings.

Optimus Prime Ribs
Jul 25, 2007

Hammerite posted:

But on thinking about it, it is consistent with PHP's treatment of unknown bare words in other contexts, so I'm not sure why I was surprised.

Every time I learn a new horror regarding PHP I am amazed for a few seconds and then remember that it's PHP.

npe
Oct 15, 2004

Carthag posted:

You can do the same thing in perl if you don't use strict;, and it's a really bad idea that makes code unmaintainable.

code:
[ [email]carthag@mbp.loca[/email]l:~ ]$ perl
use Data::Dumper;

$a = { a => b, "b" => 2, 3 => "c" };

print Dumper \$a;
^D
$VAR1 = \{
            'a' => 'b',
            '3' => 'c',
            'b' => 2
          };

With use strict your code fails due to the "b" in your values, but that's hardly fair because the discussion was barewords in keys, and this indeed works just fine with strict:

code:
use strict;
use Data::Dumper;

$a = { a => "b", "b" => 2, 3 => "c" };

print Dumper \$a;
In fact, this paradigm is pretty idiomatic perl when used as object properties, in the form of $self->{foo}.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Oh, the rabbit hole goes much deeper than that.

First, an old PHP feature: bare strings. In PHP, $foo = hello; is equivalent to $foo = "hello";, even though this triggers a warning in newer versions of PHP.

$foo is really shorthand for ${foo}, which is really shorthand for ${"foo"}. The thing inside the braces can be any arbitrary PHP expression, so $$foo is shorthand for ${${"foo"}}.

You can even do this:

php:
<?php
$wow_php_is_dumb "what did you expect?";

$language "php";
echo ${wow_ $language _is_dumb};

Try it at home!

You can do:

php:
<?php
$wow_php_is_dumb_times_100 "are you not getting it yet?";

$language "php";
echo ${wow_ $language _is_dumb_times_ (10*10)};

Link!

Now, remember.... any PHP expression.

Go ahead and digest this. I'll wait.

tef
May 30, 2004

-> some l-system crap ->

Hammerite posted:

I'm not sure what you mean by "keys being treated as bare words", can you explain?

I misread the php snippet

leterip
Aug 25, 2004
I like to think of php variables as one big name mangling (for local variables!) hash map and $ is the accessor method. I'm not sure if that makes it more or less of a horror. At this point the value could overflow at any time anyway.

Look Around You
Jan 19, 2009

Suspicious Dish posted:

Oh, the rabbit hole goes much deeper than that.

First, an old PHP feature: bare strings. In PHP, $foo = hello; is equivalent to $foo = "hello";, even though this triggers a warning in newer versions of PHP.

$foo is really shorthand for ${foo}, which is really shorthand for ${"foo"}. The thing inside the braces can be any arbitrary PHP expression, so $$foo is shorthand for ${${"foo"}}.

You can even do this:

php:
<?php
$wow_php_is_dumb "what did you expect?";

$language "php";
echo ${wow_ $language _is_dumb};

Try it at home!

You can do:

php:
<?php
$wow_php_is_dumb_times_100 "are you not getting it yet?";

$language "php";
echo ${wow_ $language _is_dumb_times_ (10*10)};

Link!

Now, remember.... any PHP expression.

Go ahead and digest this. I'll wait.

:stare:

Jesus christ what the gently caress. Why do people still use this garbage?

PalmTreeFun
Apr 25, 2010

*toot*

Look Around You posted:

:stare:

Jesus christ what the gently caress. Why do people still use this garbage?

Because internet forums or something, I don't know. Is there anything other than PHP and/or SQL for that? I know almost nothing about web development.

Haystack
Jan 23, 2005





Look Around You posted:

:stare:

Jesus christ what the gently caress. Why do people still use this garbage?

LAMP stacks made it really, really easy for beginners and non-technical people to start web programming, and it kind of built inertia from there.

PalmTreeFun
Apr 25, 2010

*toot*

Haystack posted:

LAMP stacks made it really, really easy for beginners and non-technical people to start web programming, and it kind of built inertia from there.

Built for non-programmers, by non-programmers. :haw:

Adbot
ADBOT LOVES YOU

Look Around You
Jan 19, 2009

Haystack posted:

LAMP stacks made it really, really easy for beginners and non-technical people to start web programming, and it kind of built inertia from there.

Yeah but at some point you'd think people would realize just how loving terrible PHP is all around, as a language and with it's libraries...

Who am I kidding people are loving retarded and would rather straight up cut and paste things and cobble together piles of poo poo than put any effort in at all.

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