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
w00tz0r
Aug 10, 2006

I'm just so god damn happy.

Dicky B posted:

Who won?

That was the tail end of the argument. After he said that, I basically gave up and went to make fun of him on the internet.

Adbot
ADBOT LOVES YOU

SlightlyMadman
Jan 14, 2005

w00tz0r posted:

That was the tail end of the argument. After he said that, I basically gave up and went to make fun of him on the internet.

Feel free to tell him that the internet thinks he's a complete loving idiot.

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

w00tz0r posted:

That was my lead. I had a shouting match with him that lasted at least half an hour.

edit: basically, if anyone's leaving the company over that, it's me.

If that's the lead I feel sorry for your project.

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

w00tz0r posted:

"Forward compatibility is easy, all Microsoft products are completely forward compatible. I can write a program on Windows Vista and have it run on Windows 95. The only thing that broke forwards compatibility is UAC."

:allears:

w00tz0r
Aug 10, 2006

I'm just so god damn happy.

OriginalPseudonym posted:

If that's the lead I feel sorry for your project.

gently caress the project, I feel sorry for me.

Opinion Haver
Apr 9, 2007

How do you do nested comments in your RDBMS? By storing the nesting in the ID!

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

yaoi prophet posted:

How do you do nested comments in your RDBMS? By storing the nesting in the ID!

what the gently caress

No seriously, who thinks this is a good idea?

ToxicFrog
Apr 26, 2008


SlightlyMadman posted:

To make this better, be sure you call that function in other parts of the code to determine the units age for completely unrelated reasons, and then later end up changing the warranty eligibility to be based on something completely different, but retain the original function name.

$5 says that's already happened and he just hasn't realized it yet. :ohdear:

A A 2 3 5 8 K
Nov 24, 2003
Illiteracy... what does that word even mean?
http://ultrose.com/

A minimal blog script with 1500 lines of PHP, HTML, and Javascript in a single file. And that's a selling point.

It's like Matt's Script Archive for the 21st century.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
code:
if(stripos($theme, "random") !== false)
{
        //crude method to "seed" the random.
        //don't want all our blogs to show the same "random" theme each day, do we?
    $titlehashhex = md5($title);
        //chop it down a bit to ease memory/logic.
    $titlehashhex = substr($titlehashhex, 0, floor(strlen($titlehashhex) / 3));
    $themeseed = (hexdec($titlehashhex));


    $choosetheme = abs(($themeseed + date('j')) % (count($themes)));

    $theme = $themes[$choosetheme];
}

Opinion Haver
Apr 9, 2007

You know what I always thought my blog needed? Completely randomized theming.

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum
So I'm working inside of a PHP framework that my boss decided would be a good idea to slap on our site. Somehow he found some PHP framework on GitHub that's *possibly* used by the person who dev'd it, and probably not even him.

So on that note, today I learned that the difference between
code:
 class Something {
  public static function DoThat(){}
}
and

code:
 class Something {
  public function DoThat(){}
}
Is that you can call the second one as Something::DoThat() and it will work completely properly, it just has $this set to null. I don't really want to get into how, exactly, I found that out.

:suicide:

McGlockenshire
Dec 16, 2005

GOLLOCKS!
Any reasonably modern version of PHP will complain loudly when you call a non-static method statically. If you got no complaints from PHP, your error reporting level isn't high enough for sane development.

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

McGlockenshire posted:

Any reasonably modern version of PHP will complain loudly when you call a non-static method statically. If you got no complaints from PHP, your error reporting level isn't high enough for sane development.

Given aforementioned framework, it wouldn't surprise me at all if one of his self-rolled library classes had a big "error_reporting(0);" at the top, possibly a couple of times so that "it actually takes".

Also, this is in their hand-rolled error logging class.

darthbob88
Oct 13, 2011

YOSPOS

yaoi prophet posted:

You know what I always thought my blog needed? Completely randomized theming.

And not just randomized, but really randomized. Credit where it's due, though, I would never have thought of using the first third of the MD5 hash of the title, plus the day of the month, modulo the number of themes available, to randomly select a given theme. Would
code:
$theme = $themes[rand(0, count($themes)]
not do the job, or am I foolish to think a PRNG could do the job quicker and possibly better?

moynar
Apr 15, 2006
Hello!
Man, it seems like some of you guys have some really horrible jobs.

darthbob88 posted:

And not just randomized, but really randomized. Credit where it's due, though, I would never have thought of using the first third of the MD5 hash of the title, plus the day of the month, modulo the number of themes available, to randomly select a given theme. Would
code:
$theme = $themes[rand(0, count($themes)]
not do the job, or am I foolish to think a PRNG could do the job quicker and possibly better?

Everybody's using rand for their random numbers, this would of course lead to every blog having the same randomness. Better to write your own rng! :v:

Opinion Haver
Apr 9, 2007

OriginalPseudonym posted:

what the gently caress

No seriously, who thinks this is a good idea?

One of the larger art sharing sites on the internet.


vvv I got it in a namechange :v:. If people are absolutely dying to know I'll post the name.

Opinion Haver fucked around with this message at 09:00 on Oct 20, 2011

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

yaoi prophet posted:

One of the larger art sharing sites on the internet.

It's not the one that I...

...one second.

*checks*

Okay, it's not the one I'm working on. Mine is just the one with the 15,000 post variable setting. :v:

Edit: Although your name makes me wonder.

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

w00tz0r posted:

"Forward compatibility is easy, all Microsoft products are completely forward compatible. I can write a program on Windows Vista and have it run on Windows 95. The only thing that broke forwards compatibility is UAC."
If I'm not mistaken this is true for VB6 :3:

Zombywuf
Mar 29, 2008

yaoi prophet posted:

How do you do nested comments in your RDBMS? By storing the nesting in the ID!

T-SQL has a hierarchy ID type designed to do exactly this. It's good for subtree selection and insertion, if a little tricky to work with.

Bonfire Lit
Jul 9, 2008

If you're one of the sinners who caused this please unfriend me now.

darthbob88 posted:

Would
code:
$theme = $themes[rand(0, count($themes)]
not do the job
That would use a a random theme every time you reload the page, instead of cycling it once per day.

TasteMyHouse
Dec 21, 2006
code:

// globalVariable.cpp: implementation of the globalVariable class.

//

//////////////////////////////////////////////////////////////////////



#include "stdafx.h"

#include "svtypes.h"

#include "globalVariable.h"



//////////////////////////////////////////////////////////////////////

// Construction/Destruction

//////////////////////////////////////////////////////////////////////

int BSFile;

int YUVFile;



int  DecodeFrameNum, totalFrameNumToDecode = 2147483647;

int decodeOrderOutput, rangeMap, outputFullSize, decodeSkipFrame;

int summaryOnly;

int MSencoder;

int CHECKBS, decodeSpecialStream;





int vop_time[4], time_base[4];

unsigned char **reconFrameY[4];

unsigned char **reconFrameU[4], **reconFrameV[4];

int outIndex;



int bufferIndexPrev[4] = {1, 0, 2, 3};

int bufferIndex[4] = {1, 0, 2, 3};
what

This is the entire file.

TasteMyHouse fucked around with this message at 17:56 on Oct 20, 2011

Polidoro
Jan 5, 2011


Huevo se dice argidia. Argidia!
What's in globalVariable.h?

Scaevolus
Apr 16, 2007

Regarding Python's def fun(a, b,) thing, function arguments are not the same thing as tuples.

From the official grammar.
code:
funcdef: 'def' NAME parameters ':' suite
parameters: '(' [varargslist] ')'
varargslist: ((fpdef ['=' test] ',')*
              ('*' NAME [',' '**' NAME] | '**' NAME) |
              fpdef ['=' test] (',' fpdef ['=' test])* [','])
fpdef: NAME | '(' fplist ')'
def fun(*a,) is a syntax error since the only parameter that could come after it is **b, which isn't that necessary. def fun(**b,) is also a syntax error, since nothing could come after it.

TasteMyHouse
Dec 21, 2006

Polidoro posted:

What's in globalVariable.h?

a bunch of nonsense like structs filled with 2d arrays filled with magic numbers -- it's long and I don't want to spend the time anonymizing it.

Zombywuf
Mar 29, 2008

TasteMyHouse posted:

what

This is the entire file.

So this is what Dada code looks like.

TasteMyHouse
Dec 21, 2006
I'm having a lot of fun with this codebase. Did you know that in VC6 you could assign a const char * to a char *?

tractor fanatic
Sep 9, 2005

Pillbug

TasteMyHouse posted:

I'm having a lot of fun with this codebase. Did you know that in VC6 you could assign a const char * to a char *?

I think that's legal C++, because of some weird rules regarding const correctness and strings. Codepad says this

code:
char * what = "hello";
is just a warning.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
String literals were originally non-const (because const didn't exist), so there is sort of a lot of code written that tries to assign string literals to char * variables.

TasteMyHouse
Dec 21, 2006
Sorry, I should've been more clear. This is what the code I was looking at did:

code:

void foo(const char * str)
{
   char * lmao = strchr(str,'/');
   *lmao=0;
   //do something here
   *lmao='/';
}

e1:wait, what, codepad accepts this? why? strchr takes a const char * and returns a const char *... codepad doesn't accept this:

code:


void foo(const char * str)
{
   char * lmao = str;
   *lmao=0;
   //do something here
   *lmao='/';
}

now I'm confused. what's the difference between the two assignments?

e2: ah, GNU strchr always returns a char *, not a const char *. is this standard? Now I don't know who to trust

TasteMyHouse fucked around with this message at 22:17 on Oct 20, 2011

ToxicFrog
Apr 26, 2008


TasteMyHouse posted:

e2: ah, GNU strchr always returns a char *, not a const char *. is this standard? Now I don't know who to trust

POSIX and the C99 standard both specify that strchr has signature char * strchr(const char *, int). So GNU strchr is conformant in this case.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

tractor fanatic posted:

I think that's legal C++, because of some weird rules regarding const correctness and strings. Codepad says this

code:
char * what = "hello";
is just a warning.

For backward compatibility, C++03 has a deprecated implicit conversion which discards the const when the source is a string literal. C++11 removes this.

The strchr signature is a wart that is basically required by a lack of expressivity in the C type system.

TasteMyHouse
Dec 21, 2006
I think we can agree that what they did there was really bad right? I was kind of pissed at it

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Yes. Modifying a const something, even if you change it back before the end of the method, is pretty bad.

Someone could be looking at it on another thread, or the thing you're given could be in non-writable memory for all you know.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

TasteMyHouse posted:

I think we can agree that what they did there was really bad right? I was kind of pissed at it

There is a camp that claims that modifying const objects should be okay as long as you put them back the way you found them. It's not completely irrational, but it's obviously something to be very careful about, and it's still not a great idea.

mjau
Aug 8, 2008

rjmccall posted:

There is a camp that claims that modifying const objects should be okay as long as you put them back the way you found them. It's not completely irrational, but it's obviously something to be very careful about, and it's still not a great idea.
It's a great way to have your program segfault when it tries to write to read-only memory.

Optimus Prime Ribs
Jul 25, 2007

rjmccall posted:

There is a camp that claims that modifying const objects should be okay as long as you put them back the way you found them. It's not completely irrational, but it's obviously something to be very careful about, and it's still not a great idea.

Why would someone make something const if the value isn't constant?
What purpose could that possibly serve?

Seems pretty stupid to me.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Optimus Prime Ribs posted:

Why would someone make something const if the value isn't constant?
What purpose could that possibly serve?

Seems pretty stupid to me.

That is, I think, rjmccall's point about the alternative interpretation of const: instead of saying "you can't/I won't touch this", you're saying "make sure I can't tell the difference when you're done with this" (return value) or "I'll make sure this looks the same when I'm done" (parameter). So it appears constant to outside observers, but isn't required to be the exact same bits in the exact same location.

And yeah, it sounds kinda stupid to me too. But I can see the distinction.

ozymandOS
Jun 9, 2004

Optimus Prime Ribs posted:

Why would someone make something const if the value isn't constant?
What purpose could that possibly serve?

Seems pretty stupid to me.

It would allow you to modify the memory storing the object, as long as you can reverse the changes, rather than making a copy of the memory and mutating the copy. This could lead to some memory savings in some cases.

Of course, this isn't the meaning of the const keyword and using it as such could lead to problems in certain situations (multithreaded/read-only memory).

Adbot
ADBOT LOVES YOU

pseudorandom name
May 6, 2007

Don't forget that string literals used to be writable.

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