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
qntm
Jun 17, 2009

Aleksei Vasiliev posted:

The site is also a horror itself: http://phpsadness.com/?page=sad/18
Well, yeah. What the gently caress did you think static variables were for?

Possibly the author is expecting static variables to be bound to the class itself in some way, like you see in Java?

Adbot
ADBOT LOVES YOU

fritz
Jul 26, 2003

daft punk railroad posted:


I like this one:

See also gcc's -Wall

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

Plorkyeran posted:

Anyone who actually uses string.Empty deserves it.
why does it matter, they're both the same

pseudorandom name
May 6, 2007

fritz posted:

See also gcc's -Wall

-Wall is "all generally useful warnings", not "all warnings"

I suppose you could try submitting a patch changing it to -Wall-generally-useful. Good luck with that.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
My favourite piece of PHP stupidness is displayed at http://www.php.net/manual/en/function.ctype-digit.php

code:
bool ctype_digit ( string $text )

Checks if all of the characters in the provided string, text, are numerical.
code:
Changelog

Version Description
5.1.0   Before PHP 5.1.0, this function returned TRUE when text was an empty string. 
"Before PHP 5.1.0, this function's behaviour was the documented behaviour, so we changed it"

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
http://stackoverflow.com/questions/6163683/cycles-in-family-tree-software

quote:

I am developer of Family tree software (written in C++ and Qt). I had no problems till one of my customers mailed me a bug report. The problem is that he has two children with his own daughter. And he can't use my software because of errors. Those errors are result of my various assertions and invariants about family graph being processed (for example after walking a cycle the program states that X can't be both father and grandfather of Y). How should I resolve those errors, without removing all data assertions?

Masterful troll, or all kinds of horror at once?

NotShadowStar
Sep 20, 2000
In my time in human genetics I gave up on validating degree of relations, because there would always be some manner of hosed up breeding that blew up the whole thing. Usually these came from middle eastern populations where in the desert areas families still did arranged marriages. Though they were usually fascinating to study because there was no cases of what we were studying in the population before, there was some hosed up marriage loop and every person after that was affected.

tl;dr when dealing with families don't assume anything because people can and do gently caress everybody.

GROVER CURES HOUSE
Aug 26, 2007

Go on...

NotShadowStar posted:

tl;dr when dealing with families don't assume anything because people can and do gently caress everybody.

see: all of Europe's royalty.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Orzo posted:

why does it matter, they're both the same
using more characters to do the same thing when the shorter version is not in any way unclear is dumb

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
SimpleXML weirdness in PHP

Short explanation: the value of a SimpleXML object always resolves to false.

php:
<?
$x = simplexml_load_string('<a><b>test</b></a>'); /* A valid object */
if ($x)           { /* true */ }
if (!$x)          { /* false */ }
if ($x === false) { /* false */ }
if ($x == false)  { /* loving TRUE */ }
?>
I'm still not sure why anyone would think this behavior is correct or even desirable.

tef
May 30, 2004

-> some l-system crap ->

NotShadowStar posted:

Holy poo poo they are literally using goto: in the C code of PHP

http://phpsadness.com/?page=sad/36

yes. this happens. frequently.

1337JiveTurkey
Feb 17, 2005

Hammerite posted:

http://stackoverflow.com/questions/6163683/cycles-in-family-tree-software


Masterful troll, or all kinds of horror at once?

The problem is really just a data error and can easily be solved by simply killing everyone involved and removing their memories from the annals of history.

fritz
Jul 26, 2003

pseudorandom name posted:

-Wall is "all generally useful warnings", not "all warnings"

I suppose you could try submitting a patch changing it to -Wall-generally-useful. Good luck with that.

So it's a valid point that in a PHP context 'all' does not mean 'all' but it is not valid to observe that in a gcc context 'all' does not mean 'all'?

Impotence
Nov 8, 2010
Lipstick Apathy
To be fair, gcc has it described as

-Wall Emits all generally useful warnings that gcc can provide. Specific warnings can
also be flagged using -Wwarning, where warning is replaced by a string
identifying an item for which you want to list warnings.



while php has it as


// Report all PHP errors (see changelog)
error_reporting(E_ALL);

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
php has E_ACTUALLY_ALL

mysql has mysql_real_escape_string

gcc has -W/all/arning/tf

and the rest of us has neckbeards making excuses for why it's turtles all the way down

GROVER CURES HOUSE
Aug 26, 2007

Go on...

DaTroof posted:

php has E_ACTUALLY_ALL

mysql has mysql_real_escape_string

gcc has -W/all/arning/tf

and the rest of us has neckbeards making excuses for why it's turtles all the way down

i declare this the clang own zone

NotShadowStar
Sep 20, 2000
To show that horrors happen anywhere, affecting thousands of people from someone who didn't think properly, written from very smart people who just didn't think at the time. Anyone can do it.

When you read in a file in Ruby, the mechanism keeps track of what files have been loaded so it doesn't load and evaluate the same file twice. Standard stuff. When the language changed from 1.8 to 1.9 lots of stuff was rewritten, one of these was checking if the file has already been loaded. As it is written in 1.9

code:
def require(file)
  $loaded.each do |x|
    return false if x == file
  end
  load(file)
  $loaded << file
end
That's obviously very, very bad if you're loading thousands of files, not unheard of in large web projects. You're going to get a linear growth for each file loaded. A simple change fixes it, instead of iterating and doing a comparison over a whole array, just use a hash lookup so you're now doing one operation instead of thousands

code:
def require(file)
  return false if $loaded[file] 
  load(file)
  $loaded[file] = true
end
Ruby 1.9 has lots of other problems with file I/O, but just this simple thing dropped loading huge projects from 30s to about 10s.

pseudorandom name
May 6, 2007

Broken Knees Club posted:

i declare this the clang own zone

clang also has -Wall

Pollyzoid
Nov 2, 2010

GRUUAGH you say?
The Ruby require thing is from http://rhnh.net/2011/05/28/speeding-up-rails-startup-time
It has fancy graphs and stuff :shobon:

OddObserver
Apr 3, 2009

Pollyzoid posted:

The Ruby require thing is from http://rhnh.net/2011/05/28/speeding-up-rails-startup-time
It has fancy graphs and stuff :shobon:

... And that, kids, is why you learn about big O...

GROVER CURES HOUSE
Aug 26, 2007

Go on...

pseudorandom name posted:

clang also has -Wall

But Clang doesn't vomit text at you, the errors are actually useful!

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!



StackOverflow posted:

closed as too localized

This question is unlikely to ever help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet.

We can learn from their optimism.

Chairman Steve
Mar 9, 2007
Whiter than sour cream

DaTroof posted:

mysql has mysql_real_escape_string

Isn't this part of PHP's API for interacting with MySQL, and not inherently part of MySQL itself?

Oh, PHP, a language that lets you define when you really mean it.

1337JiveTurkey
Feb 17, 2005

Doc Hawkins posted:

We can learn from their optimism.
Or this could just be implementing part two of my advice.

ymgve
Jan 2, 2004


:dukedog:
Offensive Clock

Doc Hawkins posted:

We can learn from their optimism.

I think everyone involved in genealogy software should be aware of situations like these and handle them properly. For a lot of royals in the past (and nonroyals, of course), families were not really in trees. More like rotten stumps.

Impotence
Nov 8, 2010
Lipstick Apathy

Chairman Steve posted:

Isn't this part of PHP's API for interacting with MySQL, and not inherently part of MySQL itself?

Oh, PHP, a language that lets you define when you really mean it.

PHp's API for interacting with mysql should bloody well be prepare, execute, fetch

Not real escape string

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

Chairman Steve posted:

Isn't this part of PHP's API for interacting with MySQL, and not inherently part of MySQL itself?

Oh, PHP, a language that lets you define when you really mean it.

Not exactly, although there are two ways to look at it

The mysql_escape_string and mysql_real_escape_string functions are indeed artifacts of mysql's C api; the question then becomes, why the hell is the default binding in a dynamic language such a thin wrapper around the C api that this sort of horseshit is exposed? One might reasonably say, "loving Perl did better than this in the Year of our Lord Nineteen Hundred and Ninety Four with DBI, and that wasn't tied to one database to boot, how is PHP such a shitshow now?" The answer to both is, "PHP".

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Chairman Steve posted:

Isn't this part of PHP's API for interacting with MySQL, and not inherently part of MySQL itself?

Oh, PHP, a language that lets you define when you really mean it.

The mysql_real_escape_string() function is part of the MySQL C API. The original PHP API for MySQL was just a bunch of wrappers around C functions. It's a double horror.

Edit: Otto said it better.

DaTroof fucked around with this message at 06:19 on May 30, 2011

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Otto Skorzeny posted:

the question then becomes, why the hell is the default binding in a dynamic language such a thin wrapper around the C api that this sort of horseshit is exposed?

Hilariously, php-internals uses the thin-wrapper-over-a-library thing as an example of an outstanding design.

Zombywuf
Mar 29, 2008

Doc Hawkins posted:

We can learn from their optimism.

Cultural imperialism sure makes software design a lot easier.

Chairman Steve
Mar 9, 2007
Whiter than sour cream

Otto Skorzeny posted:

The mysql_escape_string and mysql_real_escape_string functions are indeed artifacts of mysql's C api...

And I learned something new today!

Computer viking
May 30, 2011
Now with less breakage.

ymgve posted:

I think everyone involved in genealogy software should be aware of situations like these and handle them properly. For a lot of royals in the past (and nonroyals, of course), families were not really in trees. More like rotten stumps.

Not just royals - some people manage to trace their way several hundred years back, and if one fork of that comes from some small island or isolated valley in a corner of Europe, you're bound to get some overlaps and cross-connections.

On a very related note, I just read about some interesting modelling of common ancestry: If you have population of size N, where the number of people is constant and there are no immigrants, you have to go back roughly log2(N) generations to find the first person who is an ancestor of everyone currently alive in that population. For e.g. N=4000, that's ~12 generations, or 200-300 years. (It's not quite as bad as it sounds, since it's entirely possible for not a single gene variant from that person to exist in the current population.)

I also like how there's a name and wikipedia article for "how reproduction between two individuals who knowingly or unknowingly share an ancestor causes the number of distinct ancestors in the family tree of their offspring to be smaller than it could otherwise be".

NotShadowStar
Sep 20, 2000
Whenever I get into a PHP debate with PHP supporters (they exist), I ask them if they'd write a web app in a C core with a template language. Of course the answer is 'hell no' because of how absolutely dangerous that is.

Then I show them how most of the PHP functions are 1-1 just wrappers to a C API library, and PHP is pretty much exactly a template language in front of a C core. Invariably the conversation gets hilarious how much they backpedal after that.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Zombywuf posted:

Cultural imperialism sure makes software design a lot easier.

Heh. For a second, I thought you were talking about the incest.

It seems reasonable to want to keep the site's content useful for as many people (specifically, the anglophone internet-enabled-computer-havers that use the site) as they can. Most people won't need to know what the best tech conferences in New York are.

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

Doc Hawkins posted:

Heh. For a second, I thought you were talking about the incest.

I did too :ohdear:

Zombywuf
Mar 29, 2008

Doc Hawkins posted:

Heh. For a second, I thought you were talking about the incest.

It seems reasonable to want to keep the site's content useful for as many people (specifically, the anglophone internet-enabled-computer-havers that use the site) as they can. Most people won't need to know what the best tech conferences in New York are.

The guy asking the question's name is Partick Höse. Make of that what you will.

Also, I was talking about incest. How dare you deny genealogy software to our European royalty?

Zombywuf fucked around with this message at 11:30 on May 31, 2011

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Wheany posted:

code:
var ref = arr[0]; 
var value = ref;	
value = eval(value);
What?

Actually, it's

code:
var ref = arr[0]; 
var value = ref;	
value = eval(value);
if(typeof(value == 'function'){
    value = value();
}
if(typeof(value) == 'number' && typeof(outerObject.otherArr) == 'array' ){
    value = outerObject.otherArr[value]
}
What is the value of 'value'? It could be literally anything at this poi:suicide:

lamentable dustman
Apr 13, 2007

ðŸÂ†ðŸÂ†ðŸÂ†

http://www.google.com/search?&q=site:pastebin.com+mysql_connect+-localhost

Hammerite
Mar 9, 2007

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

quote:

@Chelle: use mysql_real_escape_string() on the value of $id: $sql = "select functionName(" . mysql_real_escape_string($id, $link) . ")" and then use $sql in mysql_query()

:byodood:

Adbot
ADBOT LOVES YOU

Impotence
Nov 8, 2010
Lipstick Apathy
Today I saw a MySQL database for an old internal webapp. It has one column that contains base64-encoded XML for data.

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