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
Munkeymon
Aug 14, 2003

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



Ugg boots posted:

I really hope you're joking/trolling here.

I should have specified that it's not totally unreasonable for a one-man operation.

Adbot
ADBOT LOVES YOU

Toady
Jan 12, 2009

Munkeymon posted:

I should have specified that it's not totally unreasonable for a one-man operation.

It seems kind of weird and arbitrary, but that's me.

Surface
May 5, 2007
<3 boomstick
Sorry to quote a huge block from page 150, but this made my day.

If you skipped that page go back and read it... not that this entire thread isn't full of jems.

Dicky B posted:

That is truly tragic.
code:
			While (ctr > 0) 
				Select Case (ctr) 
				    Case 100 : BackgroundWorker100.RunWorkerAsync() 
				    Case 99 : BackgroundWorker99.RunWorkerAsync() 
				    Case 98 : BackgroundWorker98.RunWorkerAsync() 
				    Case 97 : BackgroundWorker97.RunWorkerAsync() 
				    Case 96 : BackgroundWorker96.RunWorkerAsync() 
				    Case 95 : BackgroundWorker95.RunWorkerAsync() 
				    Case 94 : BackgroundWorker94.RunWorkerAsync() 
				    Case 93 : BackgroundWorker93.RunWorkerAsync() 
				    Case 92 : BackgroundWorker92.RunWorkerAsync() 
				    Case 91 : BackgroundWorker91.RunWorkerAsync() 
				    Case 90 : BackgroundWorker90.RunWorkerAsync() 
				    Case 89 : BackgroundWorker89.RunWorkerAsync() 
				    Case 88 : BackgroundWorker88.RunWorkerAsync() 
				    Case 87 : BackgroundWorker87.RunWorkerAsync() 
				    Case 86 : BackgroundWorker86.RunWorkerAsync() 
				    Case 85 : BackgroundWorker85.RunWorkerAsync() 
				    Case 84 : BackgroundWorker84.RunWorkerAsync() 
				    Case 83 : BackgroundWorker83.RunWorkerAsync() 
				    Case 82 : BackgroundWorker82.RunWorkerAsync() 
				    Case 81 : BackgroundWorker81.RunWorkerAsync() 
				    Case 80 : BackgroundWorker80.RunWorkerAsync() 
				    Case 79 : BackgroundWorker79.RunWorkerAsync() 
				    Case 78 : BackgroundWorker78.RunWorkerAsync() 
				    Case 77 : BackgroundWorker77.RunWorkerAsync() 
				    Case 76 : BackgroundWorker76.RunWorkerAsync() 
				    Case 75 : BackgroundWorker75.RunWorkerAsync() 
 _____     		            Case 74 : BackgroundWorker74.RunWorkerAsync() 
 \ U \__      _____                 Case 73 : BackgroundWorker73.RunWorkerAsync() 
  \   \/_______\___\_____________   Case 72 : BackgroundWorker72.RunWorkerAsync() 
  < /_/   .....................  `-.Case 71 : BackgroundWorker71.RunWorkerAsync() 
   `-----------,----,--------------'Case 70 : BackgroundWorker70.RunWorkerAsync() 
             _/____/		    Case 69 : BackgroundWorker69.RunWorkerAsync() 
				    Case 68 : BackgroundWorker68.RunWorkerAsync() 
				    Case 67 : BackgroundWorker67.RunWorkerAsync() 
				    Case 66 : BackgroundWorker66.RunWorkerAsync() 
				    Case 65 : BackgroundWorker65.RunWorkerAsync() 
				    Case 64 : BackgroundWorker64.RunWorkerAsync() 
				    Case 63 : BackgroundWorker63.RunWorkerAsync() 
				    Case 62 : BackgroundWorker62.RunWorkerAsync() 
				    Case 61 : BackgroundWorker61.RunWorkerAsync() 
				    Case 60 : BackgroundWorker60.RunWorkerAsync() 
				    Case 59 : BackgroundWorker59.RunWorkerAsync() 
				    Case 58 : BackgroundWorker58.RunWorkerAsync() 
				    Case 57 : BackgroundWorker57.RunWorkerAsync() 
				    Case 56 : BackgroundWorker56.RunWorkerAsync() 
				    Case 55 : BackgroundWorker55.RunWorkerAsync() 
				    Case 54 : BackgroundWorker54.RunWorkerAsync() 
				    Case 53 : BackgroundWorker53.RunWorkerAsync() 
				    Case 52 : BackgroundWorker52.RunWorkerAsync() 
				    Case 51 : BackgroundWorker51.RunWorkerAsync() 
				    Case 50 : BackgroundWorker50.RunWorkerAsync() 
				    Case 49 : BackgroundWorker49.RunWorkerAsync() 
				    Case 48 : BackgroundWorker48.RunWorkerAsync() 
				    Case 47 : BackgroundWorker47.RunWorkerAsync() 
				    Case 46 : BackgroundWorker46.RunWorkerAsync() 
				    Case 45 : BackgroundWorker45.RunWorkerAsync() 
				    Case 44 : BackgroundWorker44.RunWorkerAsync() 
				    Case 43 : BackgroundWorker43.RunWorkerAsync() 
				    Case 42 : BackgroundWorker42.RunWorkerAsync() 
				    Case 41 : BackgroundWorker41.RunWorkerAsync() 
				    Case 40 : BackgroundWorker40.RunWorkerAsync() 
				    Case 39 : BackgroundWorker39.RunWorkerAsync() 
				    Case 38 : BackgroundWorker38.RunWorkerAsync() 
				    Case 37 : BackgroundWorker37.RunWorkerAsync() 
				    Case 36 : BackgroundWorker36.RunWorkerAsync() 
				    Case 35 : BackgroundWorker35.RunWorkerAsync() 
				    Case 34 : BackgroundWorker34.RunWorkerAsync() 
				    Case 33 : BackgroundWorker33.RunWorkerAsync() 
				    Case 32 : BackgroundWorker32.RunWorkerAsync() 
				    Case 31 : BackgroundWorker31.RunWorkerAsync() 
				    Case 30 : BackgroundWorker30.RunWorkerAsync() 
				    Case 29 : BackgroundWorker29.RunWorkerAsync() 
				    Case 28 : BackgroundWorker28.RunWorkerAsync() 
				    Case 27 : BackgroundWorker27.RunWorkerAsync() 
				    Case 26 : BackgroundWorker26.RunWorkerAsync() 
				    Case 25 : BackgroundWorker25.RunWorkerAsync() 
				    Case 24 : BackgroundWorker24.RunWorkerAsync() 
				    Case 23 : BackgroundWorker23.RunWorkerAsync() 
				    Case 22 : BackgroundWorker22.RunWorkerAsync() 
				    Case 21 : BackgroundWorker21.RunWorkerAsync() 
				    Case 20 : BackgroundWorker20.RunWorkerAsync() 
				    Case 19 : BackgroundWorker19.RunWorkerAsync() 
				    Case 18 : BackgroundWorker18.RunWorkerAsync() 
				    Case 17 : BackgroundWorker17.RunWorkerAsync() 
				    Case 16 : BackgroundWorker16.RunWorkerAsync() 
				    Case 15 : BackgroundWorker15.RunWorkerAsync() 
				    Case 14 : BackgroundWorker14.RunWorkerAsync() 
				    Case 13 : BackgroundWorker13.RunWorkerAsync() 
				    Case 12 : BackgroundWorker12.RunWorkerAsync() 
				    Case 11 : BackgroundWorker11.RunWorkerAsync() 
				    Case 10 : BackgroundWorker10.RunWorkerAsync() 
				    Case 9 : BackgroundWorker9.RunWorkerAsync() 
				    Case 8 : BackgroundWorker8.RunWorkerAsync() 
				    Case 7 : BackgroundWorker7.RunWorkerAsync() 
				    Case 6 : BackgroundWorker6.RunWorkerAsync() 
				    Case 5 : BackgroundWorker5.RunWorkerAsync() 
				    Case 4 : BackgroundWorker4.RunWorkerAsync() 
				    Case 3 : BackgroundWorker3.RunWorkerAsync() 
				    Case 2 : BackgroundWorker2.RunWorkerAsync() 
				    Case 1 : BackgroundWorker1.RunWorkerAsync() 
				End Select 
				ctr -= 1 
			End While 
:911:

Munkeymon
Aug 14, 2003

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



I thought you guys might enjoy something I wrote a few years ago that I just remembered:
code:
IterateAndDoSomething(list, direction){
  for(i = (direction ? list.length : 0); (direction ? (i > -1) : (i < list.length)); (direction ? --i : ++i)){
    direction ? something(list[i]) : someOtherThing(list[i]);
  }
}
I don't remember what it was doing exactly, but I remember it was in C# (framework 2.0) and the lead dev approved of it because it was 'more concise' than two loops and an if statement (or something to that effect).

raminasi
Jan 25, 2005

a last drink with no ice

Munkeymon posted:

I thought you guys might enjoy something I wrote a few years ago that I just remembered:
code:
IterateAndDoSomething(list, direction){
  for(i = (direction ? list.length : 0); (direction ? (i > -1) : (i < list.length)); (direction ? --i : ++i)){
    direction ? something(list[i]) : someOtherThing(list[i]);
  }
}
I don't remember what it was doing exactly, but I remember it was in C# (framework 2.0) and the lead dev approved of it because it was 'more concise' than two loops and an if statement (or something to that effect).

Maybe I'm the real horror here, but I think I agree with the lead dev on this one.

Hammerite
Mar 9, 2007

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

GrumpyDoctor posted:

Maybe I'm the real horror here, but I think I agree with the lead dev on this one.

Agree that it's more concise, or that it's better? (It is one of those things, but not the other.)

Plorkyeran
Mar 22, 2007

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

Hammerite posted:

Agree that it's more concise, or that it's better? (It is one of those things, but not the other.)
It's not really either. It isn't really any more concise this:
code:
IterateAndDoSomething(list, direction){
  if (direction)
    for(i = 0; i < list.length; ++i) something(list[i]);
  else
    for(i = list.length; i < 0; --i) someOtherThing(list[i]);
}
(Not using braces here is a bit of a horror but nowhere at much as what it's replacing)

Kelson
Jan 23, 2005

Plorkyeran posted:

It's not really either. It isn't really any more concise this:
code:
IterateAndDoSomething(list, direction){
  if (direction)
    for(i = 0; i < list.length; ++i) something(list[i]);
  else
    for(i = list.length; /* WHERE */ i < 0 /* AM I */; --i) someOtherThing(list[i]);
}
(Not using braces here is a bit of a horror but nowhere at much as what it's replacing)

best code
code:
IterateAndDoSomething(list, direction){
  for(i=0;i<=list.length;++i) direction ? something(list[i]) : someOtherThing(list[list.length-i]);
}
\/\/\/ to be fair, the example used "non-standard" indexes \/\/\/

Kelson fucked around with this message at 08:56 on Dec 3, 2010

shrughes
Oct 11, 2008

(call/cc call/cc)
The real horror are all the non-ironic off-by-one errors people are posting in this thread.

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

shrughes posted:

The real horror are all the non-ironic off-by-one errors people are posting in this thread.

Cut some slack Sam, off-by-one errors are one of the two really hard problems in computer science (the other two, of course, being cache invalidation and naming things).

plushpuffin
Jan 10, 2003

Fratercula arctica

Nap Ghost

Otto Skorzeny posted:

Cut some slack Sam, off-by-one errors are one of the two really hard problems in computer science (the other two, of course, being cache invalidation and naming things).

Hoping this was intentional :)

Incoherence
May 22, 2004

POYO AND TEAR

plushpuffin posted:

Hoping this was intentional :)
It's an old joke, yes.

POKEMAN SAM
Jul 8, 2004

Otto Skorzeny posted:

Cut some slack Sam, off-by-one errors are one of the two really hard problems in computer science (the other two, of course, being cache invalidation and naming things).

As we say where I work: off by one errors really suck when you're working with booleans.

Munkeymon
Aug 14, 2003

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



Another detail I remember: the horrible for loop I came up with was also 'better' because it only required one unit test for 100% coverage - fewer test to maintain :toot:

Edit: \/\/ Each line was touched by at least one test :v:

Munkeymon fucked around with this message at 20:31 on Dec 3, 2010

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
That's an interesting definition of "coverage".

Lysandus
Jun 21, 2010
Here's a riddle for you.

Q: What do you get when you have a graphic designer who's never coded before create an application?


A: One 5000 line class that contains the entire app.

tef
May 30, 2004

-> some l-system crap ->
This is because you didn't hire a modernist.

Vanadium
Jan 8, 2005

Is it okay if you do that but also use inner classes?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Munkeymon posted:

Edit: \/\/ Each line was touched by at least one test :v:

You just gave me an awesome idea for ensuring I get 100% test coverage on my C programs.

Zombywuf
Mar 29, 2008

Vanadium posted:

Is it okay if you do that but also use inner classes?

This is what you'd get if you did hire a modernist.

Zombywuf
Mar 29, 2008

Internet Janitor posted:

You just gave me an awesome idea for ensuring I get 100% test coverage on my C programs.

I think I know what this idea is. What if I told you I've had a legitimate reason to use it in production?

PrBacterio
Jul 19, 2000

Zombywuf posted:

I think I know what this idea is. What if I told you I've had a legitimate reason to use it in production?

If it's the same idea that I'm thinking of right now then there's just no way I can imagine how that is supposed to work ... :psyduck:

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

I think I know what this idea is. What if I told you I've had a legitimate reason to use it in production?
Why would you ever have a legitimate reason to put everything on one line?

Fiend
Dec 2, 2001

Janin posted:

Why would you ever have a legitimate reason to put everything on one line?

For ternary operations such as the first couple lines of this method! These are especially useful for converting a boolean parameters to a boolean value:
code:
private double GetLocation(GeoPos gso, GeoPos gsd, bool useMetric)
{
    bool metric = (useMetric) ? true : false;
    DistanceType unitOfMeasurement = (metric) ? DistanceType.Kilometer : DistanceType.Mile;

    const double R_kilo = 6378.137;
    const double R_mile = 3963.191;
    const double R_naut = 3443.918;
    double R = 0;
    switch (unitOfMeasurement)
    {
        case DistanceType.Mile:
        default:
            {
                R = R_mile;
                break;
            }
        case DistanceType.NauticalMile:
            {
                R = R_naut;
                break;
            }
        case DistanceType.Kilometer:
            {
                R = R_kilo;
                break;
            }
    }
    // Haversine tom foolery that uses maths
}
Pretty advanced stuff.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Does it count if the language itself is horrifying?

http://xplusplus.sourceforge.net/

quote:

Superx++ is an object-oriented language that is entirely based on XML's syntactical structure. Superx++ conforms with the XML version 1.0 specification as published on the W3C web site. Programming in XML itself has great potential and Superx++ pushes the envelope!

Class test code and its output
Array test code and its output

I found this from Category:XML-based programming languages.

Dicky B
Mar 23, 2004

And I thought XSLT was horrible.

I want to know what the <cats>5</cats> at the end of that first example does.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
I like how array declarations, one of the few things here that might naturally map to an XML-style syntax, are just:

code:
<arr type="int" name="a[3]">10,20,30</arr>

Zombywuf
Mar 29, 2008

Janin posted:

Why would you ever have a legitimate reason to put everything on one line?

Short answer: IE.

Long answer: When Firefox or Safari detect a long running script they do it by wallclock time, whereas IE does it by statement count, a count that has not changed in a long time. In Javascript, much like C, many ;s can be replaced with ,s, with the only effect being to reduce the count of statements executed in IE. We have had to deploy this to get around IE's retarded long running script detection.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Zombywuf posted:

Short answer: IE.

Long answer: When Firefox or Safari detect a long running script they do it by wallclock time, whereas IE does it by statement count

Ahahahahahahahahahahahaha IE is the greatest thing ever made ever.

From Earth
Oct 21, 2005

Cute lil' horror :3:

code:
double sum = 0.0;

for ([some loop])
{
    double temp = getValue(i);

    if (temp <= 0)
    {
        sum += 0;
    }
    else
    {
        sum += getIncrement(temp);
    }
}

Munkeymon
Aug 14, 2003

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



Zombywuf posted:

Short answer: IE.

Long answer: When Firefox or Safari detect a long running script they do it by wallclock time, whereas IE does it by statement count, a count that has not changed in a long time. In Javascript, much like C, many ;s can be replaced with ,s, with the only effect being to reduce the count of statements executed in IE. We have had to deploy this to get around IE's retarded long running script detection.

Holy poo poo - that might be useful here, too. Although I suspect it would only be a little bit harder to simply rewrite a bunch of our lovely JS to just not be as lovely.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Zombywuf posted:

Short answer: IE.

Long answer: When Firefox or Safari detect a long running script they do it by wallclock time, whereas IE does it by statement count, a count that has not changed in a long time. In Javascript, much like C, many ;s can be replaced with ,s, with the only effect being to reduce the count of statements executed in IE. We have had to deploy this to get around IE's retarded long running script detection.

Jesus christ. I write a lot of javascript and I have never encountered this.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

Short answer: IE.

Long answer: When Firefox or Safari detect a long running script they do it by wallclock time, whereas IE does it by statement count, a count that has not changed in a long time. In Javascript, much like C, many ;s can be replaced with ,s, with the only effect being to reduce the count of statements executed in IE. We have had to deploy this to get around IE's retarded long running script detection.
:aaaaa:

This is the best/worst thing I've read in a long time

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost
In web development there aren't really any coding horrors that can outdo IE itself.

Vaginal Engineer
Jan 23, 2007

Monkeyseesaw posted:

In web development there aren't really any coding horrors that can outdo IE itself.

PHP :colbert:

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Vaginal Engineer posted:

PHP :colbert:
As much as I hate PHP, measuring execution time by counting semicolons is worse

ErIog
Jul 11, 2001

:nsacloud:

Janin posted:

As much as I hate PHP, measuring execution time by counting semicolons is worse

Do we know yet if that behavior is different in IE9? Microsoft seems like they understand that the old versions of IE were abominations with the decisions they've been making with IE9.

If IE9 ends up actually being on par with Chrome, Firefox, or Safari then PHP might be all we have left.

ColdPie
Jun 9, 2006

ErIog posted:

If IE9 ends up actually being on par with Chrome, Firefox, or Safari

Hahahahahahahahahahahaha

Xenogenesis
Nov 8, 2005

ColdPie posted:

Hahahahahahahahahahahaha

I'm sorry, you'll have to explain this (beyond "lol IE9 beta doesn't support all of CSS3).

OT: I present beautiful handwritten SQL for a small Rails app:

code:
      query = %Q{
        SELECT DISTINCT ON (s.user_id, s.chart_id) s.*
          FROM scores AS s
          JOIN charts AS c
            ON (c.id = s.chart_id)
            #{chart ?
            "WHERE c.id = ?" :
            "WHERE c.key_id = ?
              AND c.game_id = ?"
            }
        AND s.id IN (
          SELECT s2.id
          FROM scores AS s2
          LEFT JOIN scores AS s3
            ON (s2.chart_id = s3.chart_id
                AND s2.user_id = s3.user_id
                AND s2.judgement < s3.judgement)
          WHERE s2.chart_id = s.chart_id
            AND s3.judgement IS NULL
          ORDER BY s2.judgement, s2.score DESC
          #{"LIMIT ?" unless limit.nil?})
        ORDER BY s.user_id, s.chart_id, s.judgement, s.score DESC
      }

Adbot
ADBOT LOVES YOU

NotShadowStar
Sep 20, 2000
Looks like another Java or PHP programmer doesn't understand Rails. I bet that was in a controller too.

quote:

#{"LIMIT ?" unless limit.nil?}

Yep, definitely PHP and a bad PHP developer at that. Hello SQL injection.

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