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
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
`For-case` wins the lifetime achievement award here, I think

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

MEAT TREAT posted:

Who is Duff and what is his enigma?

http://en.wikipedia.org/wiki/Duff's_device

e: fixed url brokenness

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

Zombywuf posted:

Really? Can't say I've seen evidence of this.


Prolog on the other hand...

:laugh::lol::laugh:

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
Really the thing that causes more freeze-ups than anything else in modern C++ is the deluge of a hundred lines (of which three may be informative) that occurs when you gently caress up in a way related to templates.

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
__really_fucking_inline_i_mean_it_this_time_mister()

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

Kharya posted:

Oh variable naming. It's an art in and of itself:
php:
<?
$the_ID = $_GET['ID']*1;
$kill_me_now = get_magic_quotes_gpc();
...
...
...
mysql_query("UPDATE `users_table`
SET `name`='".mysql_escape_string(($kill_me_now?stripslashes($name):$name))."'
WHERE `ID`=".$the_ID);
?>
This is required for us because we switch between our development server running php 5.2.6 with magic quotes off and our live server running php 4.2.0 with magic quotes on.

php 4.2.0 seems oddly appropriate for this code:ironicat:

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

Kharya posted:

Also, gently caress prepared statements.
They're slower when you just want to call it once in a request.
Security worries are moot if the input is sanitized properly.
We're running mysql 4.0 on the evil server because we don't want do accidentally erase everything by upgrading to 4.1.

Basically it comes down to, "If it ain't broke, don't fix it."

Except it is broke, and your input is not sanitized properly. You're using mysql_escape_string as your sanitization function. mysql_escape_string is broken and insecure. And you can't even use mysql_real_escape_string without upgrading to PHP >= 4.3.0 . Your poo poo be fuk'd.

e: also what Lysidas said

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
Btw mysql_real_escape_string has a long history of vulnerabilities (as does every function ever coded by MySQL AB, funny that...), and the PHP folks are nuts for using a really loving thin wrapper over it generally

If you are going to code a database-backed php app just use parameterized queries like every other language/framework out there

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

Victor posted:

How do I parameterize on the table from which I am selecting, using this wonderful parameterized functionality like every other language/framework out there?

http://tinyurl.com/7ex6d8

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

PnP Bios posted:

Ah, my mistake. It shouldn't matter what version of mysql you are using. The mysqli module is does roughly the same thing, just faster and more secure.

http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html, the first loving Google result for 'mysql prepared statements' posted:

Server-side prepared statements are an exciting new feature in MySQL 4.1. In this article, I will explain what, why, when, and how to use prepared statements.

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

Smackbilly posted:


The best part of reinventing the wheel: you can make it a triangle!

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

Zakalwe posted:


Did you ever get your drat Anschuetz working

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

Flobbster posted:

:words:

This is all well and good, did anyone submit a bug

I mean, the Compiz dev is a senior in high school iirc, he could use all the help he can get :kiddo:

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

julyJones posted:

There are so many caveats with iterators, for example, I find it easier with most types of data to just stick with vector and traverse using integers.
Does that make me a hopeless knuckle-dragger? ;)

When you start using more complex container types you will be very very glad iterators exist.

Also, C++0x is introducing the following foreach syntax
code:
vector<int> v;
for (auto i: v){
   ...
}
Here also note the use of 'auto' for compile-time type inference, which really comes into its own in situations like
code:
map<string, const some_weird_fucken_type<did_i_mention_its_a_container_too_have_fun_gettingthe_right_iterator>> m;
for (auto i: m){
    ...
}

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

TSDK posted:

I've started seeing this rather sub-optimal anti-pattern in a few places recently:
code:
if ( stricmp( "SOME_STRING_1", p_string ) == 0 )
{
    // Do stuff
}
if ( stricmp( "SOME_STRING_2", p_string ) == 0 )
{
    // Do stuff
}
if ( stricmp( "SOME_STRING_3", p_string ) == 0 )
{
    // Do stuff
}
if ( stricmp( "SOME_STRING_4", p_string ) == 0 )
{
    // Do stuff
}
etc...
Because, y'know, we've got nothing better to do with that CPU time other than carry on testing strings after we've already had a positive match.

How many strings are you testing against by the way

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
Just so you know your compiler probably has <tr1/unordered_set> (not that it's necessary here)

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

Avenging Dentist posted:

I've seen worse things. Hell, I've written worse things (though I usually at least have the awareness to apologize for it in comments).

code:
C    S X=X1 Q:'X  D H S %H=%H+X2 D YMD S:$P(X1,".",2) X=X_"."_$P(X1,".",2) K X1,X2 Q
S    S %=%#60/100+(%#3600\60)/100+(%\3600)/100 Q
     ;
:laugh:

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

Otto Skorzeny posted:

Just so you know your compiler probably has <tr1/unordered_set> (not that it's necessary here)

As of gcc 4.3 unordered_set and friends are in the main include folder and under namespace std :themoreyouknow:

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

Wheany posted:

Short loop variables can be descriptive, though. For example using y and x instead of, say, the traditional i and j...

Of course variable names such as theXCoordinate are dumb as hell.

Meh, any programmer should have taken at least one statics course and thus grok i, j and k

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

Avenging Dentist posted:

hats

Yesssssssssssssssssssssssss this whas the best part of intro to engineering analysis

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
Behead those who say K&R is a violent religion

click

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

Flobbster posted:

:words:

Singletons are almost always pointless, and trying to shoehorn whatever problem you have into a GoF pattern is retarded

If patterns have any utility at all, it is not as glorified cookbook recipes

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

Janin posted:

Non-const references are insanely dangerous because they allow arbitrary unchecked modification of local variables without any accompanying indication at the callsite. To have even a basic understanding of how reference-using code works, a reader must memorize the type signatures of every function and method called (and, if one uses a reference parameter, everything *they* call). At least in C and C# there are sigils to tell the reader "WARNING: this call might do anything to the parameter!".

If you don't know what a function does you probably shouldn't use that function

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

Janin posted:

you try tracking down the source of an irregular once-per-day crash by talking to a receptionist over the telephone

What do references have to do with this

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
Sure there's a reason, to get you to complain to Sun or Oracle or the Java Community Process or whoever to get some type inference up in this bitch






























Also as some salt against making AbstractFactoryVisitorBridgeMementoSingletons

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

tef posted:

this for new cobol title

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

Lexical Unit posted:

Found this in a Perl script today
code:
if (false) { ... }
Of course there was no use::strict in the file.

I should hope there wasn't

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
This* is why warnings and strict should have defaulted to on since like 1995


*among many other things

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
two great tastes that taste great together :laugh:

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

Zakalwe posted:

From the Bullet SDK User Manual

[mp3-yakety_sax]

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
Not a horror, but
code:
#ifdef CONFIG_VIDEO_RETAIN
    ...
static void save_screen(void)
{
    ...
}

static void restore_screen(void)
{
    ...
}
#else
#define save_screen()           ((void)0)
#define restore_screen()        ((void)0)
#endif
(from linux/arch/x86/boot/video.c)

We had a fun time in the channel kicking around why Linus might have chosen the ((void)0) construct.

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
Not everybody itc knew that:monocle::pirate:

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

Dijkstracula posted:

To say nothing of that ridiculous switch statement could be removed (edit: or at least simplified) if the author had known about fls()

Did he specify he was on a BSD? ffs(3) and its extensions are in POSIX.1-2001, but fls(3) and friends are BSD-specific from what I can tell.

e: more than BSD-specific, fls(3) first appeared in FreeBSD 5.3 circa November 2004

Blotto Skorzany fucked around with this message at 02:26 on Jul 8, 2009

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

Zombywuf posted:

I don't think you understand the gravity of the situation.
Oh, I think I do.

code:
print eval '"'.


                                      ('{'^"\[").(
           ('{')^                   '[').('{'^'[').
        ('{'^'[').                ('{'^'[').('{'^'['
 ).('{'^'['  ).('{'              ^'[').('{'^'[').('{'
^'[').('{'^'[').('{'            ^'[').'_'.('{'^"\[").(
'{'^'[').('{'^"\[").(          '{'^'[').('{'^'[').('{'
  ^'[').('{'^('[')).(        '{'^'[').('{'^'[').('_').(
       '{'^'[').('{'^      '[').('{'^'[').('{'^'[').('{'
      ^'[').'_'.('{'     ^'[').'_'.('{'^'[').('{'^"\[").(
     '{'^'[').("\{"^   '[').('{'^'[').'_'.('{'^'[')."\_".(
    '{'^'[').("\{"^   '[').('{'^'[').('{'^'[').('{'^('[')).(
    '{'^'[').("\{"^  '[').('{'^'[').('{'^'[').('{'^'[').('{'^
    '[').('{'^'[')  .('{'^'[').('{'^'[').('{'^'[').('{'^'[').
    ('{'^'[').('{'  ^'[').('{'^'[').('{'^'[').('{'^'[').("\{"^
    '[').('!'^'+').('{'^'[').('{'^'[').'_'.'_'.'_'.('{'^'[').(
    '{'^'[').'_'.'_'.('{'^'[').'_'.'|'.('{'^'[').'|'.'_'.("\{"^
     '[').('{'^'[').('{'^'[').'_'.'_'.'_'.'|'.('{'^'[').'|'.'_'
     .'_'.('{'^'[').'('.'_'.')'.('{'^'[').'|'.'_'.('{'^'[').('{'
      ^'[').'|'.('{'^'[').'('.'_'.')'.'_'.('{'^'[').'_'.'_'.('{'^
       '[').'_'.'_'.'_'.('{'^'[').('{'^'[').('{'^'[').'_'.'_'.'_'
        .('{'^'[').'_'.('{'^'[').('{'^'[').('{'^'[').'_'.('{' ^((
         '['))).('!'^'+').('{'^'[').'/'.('{'^'[').'_'.("\{"^  '['
          ).'\\'.'\\'.'/'.('{'^'[').'_'.'`'.(('{')^ '[').'|'  .+(
            '{'^'[').'_'.'_'.'|'.('{'^'[').('/').(  '{'^'['   ).+
             "\_". '_'.'|'.('{'^'[')."'".'_'.('{'   ^"\[").   (((
                   '\\'))).'\\'.'|'.('{'^('[')).    ('|').(   '{'
                   ^('[')).    '_'.('_'). "\|".(     ('{')^   ((
                   '['))).     '|'.('{'   ^'[').     "\|".(  ((
                   "\{"))^     '[').'|'   .('{'       ^'[')  .
                   ("'").      '_'.('{'   ^'['         ).((
                   '`')).     ('{'^'[')   .'_'         .''.
                    ('{'^     '[').''.    '\\'         .''.
                    '\\'.     (('{')^     '[')         .'/'
                    .''.     ("\{"^       '[')         .'_'
                    .''.     (((          '{')         )^((
                    '[')      )).         (((          (((
                    (((        (((       (((           (((
                    (((         (((     (((            (((
                    (((          (((   (((              ((
                    ((             '\\'))               ))
                    ))              )))))               ))
                    ))             ))))))))             ))
                   )))            )))) )))))            ))
                  )))           ).'\\'  .''.           (((
                 '{')         )^"\[").   '|'          .''.
               ("\{"^                                "\[").
             '|'.('{'                               ^"\[").
                                      '|'.('!'^'+'
           ).'|'.                   ('{'^'[').('{'^
        '[')."\_".                '_'.'/'.('{'^'[').
 '('.('_').  "\|".(              '{'^'[').'|'.(('{')^
'[').'|'.'_'.(('{')^            '[').('{'^'[').('\\').
'\\'.'_'.'_'.('{'^'['          ).'\\'.'\\'.('{'^"\[").
  '|'.('{'^'[').'|'.(        '{'^'[').'|'.('{'^'[').'|'
       .('{'^'[').'|'      .'_'.('{'^'[').('{'^'[').'|'.
      ('{'^'[').'|'.     ('{'^'[').'|'.('{'^'[').'|'.('{'
     ^'[').'|'.('{'^   '[').'|'.('{'^'[').'|'.('{'^('[')).
    '|'.('{'^'[').(   '{'^'[').'_'.'_'.'/'.('{'^'[').'|'.'_'
    .'|'.('{'^'[').  '|'.('!'^'+').('{'^'[').'\\'.'\\'.('_').
    '_'.'_'.('|').  '\\'.'\\'.'_'.'_'.','.'_'."\|".'\\'.'\\'.
    '_'.'_'."\|".(  '{'^'[').'|'.'_'.'_'.'_'.'/'.'_'.'|'.('{'^
    '[').'|'.'_'.'|'.'_'.'|'.'\\'.'\\'.'_'.'_'.'|'.('{'^"\[").
    '|'.'_'.'|'.'_'.'|'.'_'.'|'.('{'^'[').'|'.'_'.'|'.('{'^'[')
     .'|'.'_'.'|'.'\\'.'\\'.'_'.'_'.'_'.'|'.'\\'.'\\'.'_'."\_".
     ','.('{'^'[').'|'.('!'^'+').('{'^'[').('{'^'[').('{'^'[').(
      '{'^'[').('{'^'[').('{'^'[').('{'^'[').('{'^'[').('{'^'[').
       ('{'^'[').('{'^'[').('{'^'[').('{'^'[').('{'^'[').('{'^'['
        ).('{'^'[').('{'^'[').('{'^'[').('{'^'[').('{'^'[').( '{'
         ^'[').('{'^'[').('{'^'[').('{'^'[').('{'^'[').('{'^  '['
          ).('{'^'[').('{'^'[').('{'^'[').('{'^'[') .(('{')^  '['
            ).('{'^'[').('{'^'[').('{'^'[').("\{"^  "\[").(   '{'
             ^'[') .('{'^'[').('{'^'[').('{'^'[')   .("\{"^   '['
                   ).('{'^'[').('{'^'[').(('{')^    "\[").(   '{'
                   ^"\[").(    '{'^'[').( ('{')^     '[').(   ((
                   "\{"))^     ('[')).(   ('{')^     '[').(  ((
                   "\{"))^     ('[')).(   "\{"^       '[').  (
                   ('{')^      ('[')).(   '{'^         '[')
                   .('{'^     '[').('{'   ^'['         ).+(
                    "\{"^     '[').'|'    .'_'         .'_'
                    .'_'.     ('/').(     '{'^         '[')
                    .''.     ("\!"^       '+')         .'"'
                    ;$:=     '.'          ^'~'         ;$~=
                    '@'|      '('         ;$^          =((
                    ')'        ))^       '['           ;$/
                    =((         '`'     ))|            '.'
                    ;$,          =((   '('              ))
                    ^+             '}';$\               =(
                    ((              '`'))               )|
                    ((             '!'));$:             =(
                   ')'            )^(( '}'))            ;(
                  $~)           ="\*"|  '`';           $^=
                 '+'^         "\_";$/=   '&'          |'@'
               ;($,)=                                ('[')&
             "\~";$\=                               ','^'|'
                                                                     

click

Blotto Skorzany fucked around with this message at 23:47 on Jul 9, 2009

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

tripwire posted:

Did you write this yourself or just copy+paste it from somewhere? I'm curious how it was made... I only understand perl a tiny bit, but it seems like it would have had to be generated by another program. How/why does the program work, and how would you go about writing a program to generate it?

There's a cpan module for everything, and several for most things; the one I used was Acme::EyeDrops


e: Did you really think there was a place on the internet where I could have copy+pasted an obfuscated/beautified perl program that outputs 'eat poo poo limeys' in block letters?

Blotto Skorzany fucked around with this message at 14:56 on Jul 10, 2009

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
Anyways the way the thing works is by making a regex that matches the code you want to execute then eval'ing it; since perl regexes can execute perl code there are ways to do this without calling 'eval' but whatever

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
C'mon guys, plenty of people make lovely first posts, our job is to educate them so they don't end up like Victor or Chain Chomp

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

Scaevolus posted:

What's wrong with it?

Does k*sin(x) = sin(k*x) for 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
Yeah, on a second look I read the parens wrong

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
This is why macros are bad, they kick sand in everyone's vaginas and :regd07: happens

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