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
Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Pollyanna posted:

I just found out that the bioinformatics intro class I'm taking online will be primarily using Perl. :negative:

edit: Wait no I'm wrong, it's Python mostly :woop: but it does include Perl at some point so :barf:.

I'd be concerned if it was PHP. Perl isn't a horrible language.

Edit: at least not enough to go "oh god :stonk:"

Volmarias fucked around with this message at 13:04 on Sep 19, 2013

Adbot
ADBOT LOVES YOU

double riveting
Jul 5, 2013

look at them go

Volmarias posted:

Perl isn't a horrible language.

It's true. Kind of like my dog never throws his cat litter across the floor.

kitten smoothie
Dec 29, 2001

Yeah, my previous employer (a genomics lab) was actually a Perl shop, although we designed our stuff in the same way you'd write any modern software project, and we had unit tests, CI, and modern version control. Basically, we wrote Perl because that's what the analysts in the lab, downstream of our software, who wrote the academic papers used.

That being said: every day that I don't have to write Perl anymore is a day that the sun is a little brighter, the grass is a little greener, and my kid smiles a little more than the day before.

astr0man
Feb 21, 2007

hollyeo deuroga
I can't post any examples, but a common practice in my current workplace is to just comment or #if/#endif out old, incorrect or dead code instead of just deleting it. And since this product has been in development for 15+ years, we have some files that are tens of thousands of lines long, where a giant fuckoff long block in the middle of the file might be #if 0'd out, but there's no easy way to tell when you are just scanning the file. And yes we use source control, but no one here understands how to properly use it :negative:

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

astr0man posted:

I can't post any examples, but a common practice in my current workplace is to just comment or #if/#endif out old, incorrect or dead code instead of just deleting it. And since this product has been in development for 15+ years, we have some files that are tens of thousands of lines long, where a giant fuckoff long block in the middle of the file might be #if 0'd out, but there's no easy way to tell when you are just scanning the file. And yes we use source control, but no one here understands how to properly use it :negative:

Holy hell, delete it all. I'm sure no one needs 99% of it, and if they do they should learn how to utilize source control.

astr0man
Feb 21, 2007

hollyeo deuroga
Yeah, I delete poo poo like that when I come across it. But I guess part of the problem is that we use Oracle's proprietary internal source control which is sort of like clearcase except that it's not clearcase (but is still just as terrible as clearcase) :smith:.

Drape Culture
Feb 9, 2010

But it was all right, everything was all right, the struggle was finished. He had won the victory over himself. He loved Big Brother.

The End.
I think (it's been a while since I used it) that Visual Studio will mark inaccessible blocks from defs like comments, so that might make it easier to find.

And as far as Perl, I write it every day as the backend to some Web pages. The only thing that drives me nuts is that there is no debugger, and printing variables out isn't practical in all contexts. Oh, and piss poor (read: practically no) IDE support.

evensevenone
May 12, 2001
Glass is a solid.
How could it know though? There's nothing to prevent someone passing -DFOO on the command line.

Dicky B
Mar 23, 2004

It marks the ones it knows about, which should be all of them as long as you do things The Visual Studio Way (preprocessor definitions should be specified in the configuration properties). What's a command line?

EntranceJew
Nov 5, 2009

JavaScript code:
//Ths portion of cde wan´t removed yt sincewe n´t know if it wilbused or not.
This line, in and of itself, is very telling of my working conditions.

kitten smoothie
Dec 29, 2001

ManlyWeevil posted:

And as far as Perl, I write it every day as the backend to some Web pages. The only thing that drives me nuts is that there is no debugger, and printing variables out isn't practical in all contexts. Oh, and piss poor (read: practically no) IDE support.

There totally is a Perl debugger, although it gets hairier if you're trying to remotely debug a script running on a server. ActiveState has some remote debugging hooks in Komodo IDE though so you can debug CGI or mod_perl, but that costs money.

The downside to the Perl debugger is that the GUI to it is in TK, and it has this bug in the TK interaction where 10% of the time hitting "continue" will cause the thing to run away on you and ignore every breakpoint downstream.

No Safe Word
Feb 26, 2005

EntranceJew posted:

JavaScript code:
//Ths portion of cde wan´t removed yt sincewe n´t know if it wilbused or not.
This line, in and of itself, is very telling of my working conditions.

Can't even tell if it's lovely use of texting abbreviations in code or just terrible spelling or a mixture of both or something worse.

fritz
Jul 26, 2003

kitten smoothie posted:

There totally is a Perl debugger, although it gets hairier if you're trying to remotely debug a script running on a server. ActiveState has some remote debugging hooks in Komodo IDE though so you can debug CGI or mod_perl, but that costs money.

The downside to the Perl debugger is that the GUI to it is in TK, and it has this bug in the TK interaction where 10% of the time hitting "continue" will cause the thing to run away on you and ignore every breakpoint downstream.

I haven't perl'd for closing in on ten years but I remember making heavy use out of some kind of text mode debugger.

fritz
Jul 26, 2003

And if bioinformatics is anything like any of the other scientific code out there in the world, perl'll be the least of your problems.

(I think it was the forums poster who got renamed 'dognostic' worked on a bioinformatics research team and made conclusions about science and programming and the nature of the universe from that experience).

HFX
Nov 29, 2004

fritz posted:

And if bioinformatics is anything like any of the other scientific code out there in the world, perl'll be the least of your problems.

(I think it was the forums poster who got renamed 'dognostic' worked on a bioinformatics research team and made conclusions about science and programming and the nature of the universe from that experience).

Perl isn't a bad language if you consider the inventor and the purpose for which he originally wrote it. If I had one complaint about Perl, it would be that so many people for a while seemed to want to do things for which it wasn't really designed. Amazingly, parsing DNA strings fits well into what Perl does well.

Coding horror of the day: Everyone is supposed to use Eclipse and use the officially blessed set of preferences. What do these preferences contain? Spaces up, tabs down. Thanks. I didn't like being able to set my tab stops. I know Eclipses code formatter for Java is kind of poo poo in that the tab stop length fucks with the maximum line length.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
I just fixed a bug in one of our websites where a user with a corrupted cookie would cause a very slow stack overflow.

To determine who was logged in, the security code was checking the session for an auth variable. If not found, it would check for a valid encrypted auth cookie then set the session variable (e.g. refresh the login). If the auth key was un-encryptable for any reason, the security layer would throw an exception which was caught and logged.

The logger, however, calls to the security layer to check who is logged in, which would then throw an exception... ad infinitum. The crash would take like 5 minutes to happen since each exception was wrapped in a try/catch which significantly slowed down the loop.

It was a particularly bad security bug, because all an attacker has to do is screw with their auth cookie and the whole site slowly crashes.

Hammerite
Mar 9, 2007

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

HFX posted:

Spaces up, tabs down.

What does this mean? Is this some technical language I haven't encountered before, or is it just your idiosyncratic way of saying your standard mandates spaces and not tabs

BTW let's not take this anywhere we don't want to go.

EntranceJew
Nov 5, 2009

No Safe Word posted:

Can't even tell if it's lovely use of texting abbreviations in code or just terrible spelling or a mixture of both or something worse.

I think it's just a failure to grasp the English language -- which means the code they write using primarily English keywords will be very good and undoubtedly decorated with comprehensive comments. ;-*

Opinion Haver
Apr 9, 2007

Hammerite posted:

What does this mean? Is this some technical language I haven't encountered before, or is it just your idiosyncratic way of saying your standard mandates spaces and not tabs

BTW let's not take this anywhere we don't want to go.

Tabs down, spaces up, that's the way we indent stuff

double riveting
Jul 5, 2013

look at them go

yaoi prophet posted:

Tabs down, spaces up, that's the way we indent stuff

Great idea; too bad it only lines up properly as "space down, tabs up" (which is really the wrong way around).

Ah gently caress it, cue brodustrial
https://www.youtube.com/watch?v=WouR3mwIHNk

coaxmetal
Oct 21, 2010

I flamed me own dad

IMlemon posted:


Java code:
@Test
public void someTest() {
     for (SomeEnum val : SomeEnum.values()) {
            if (val.equals(SomeEnum.A)); 
            else if (val.equals(SomeEnum.B));
            else if (val.equals(SomeEnum.C)); 
            else if (val.equals(SomeEnum.D)); 
            else if (val.equals(SomeEnum.F));
            else if (val.equals(SomeEnum.G));
            else if (val.equals(SomeEnum.H));
            else if (val.equals(SomeEnum.J));
            else if (val.equals(SomeEnum.K));
            else if (val.equals(SomeEnum.L));
            else if (val.equals(SomeEnum.M));
            else if (val.equals(SomeEnum.N)); //No need sorting
            else if (val.equals(SomeEnum.O));
            ...
            around 20 more similar if statements
            ...
            else {
                // assert some stuff
            }
        }
}

mixed 5 and 7 space indent???? :barf:

e: ahhh and the brackets don't even line up to the correct outer-indent

ephphatha
Dec 18, 2009




code:
begin-select
foo
  if &foo = ''
    let &foo = $last_valid_foo
  end-if
  if &foo <> 'X'
    !use foo
  end-if
from bar
where foo in ('A', 'B', 'C')
end-select
Apparently we can't trust the IN clause to actually restrict results to the values specified, better check for null values ('') and values outside our given set. :smith:

Maniaman
Mar 3, 2006
I spent the better part of 3 hours today rewriting a PHP script that queried inventory levels from different stores to display them. The entire piece of software is PHP and html smashed together with no way to modifying the template without diving into all of the business logic.

I had to clean up one of these abominations:
code:
while ($result = mysql_fetch_assoc($query)) {
  while ($result2 = mysql_fetch_assoc($query2)) {
    while ($result3 = mysql_fetch_assoc($query3)) {
      while ($result4 = mysql_fetch_assoc($query4)) {
        //do something
      }
    }
  }
}
I should also mention along with everything in this using the deprecated mysql_* functions, almost none of the querystrings are sanitized, and there's not a single JOIN in any query. Just lots of nested queries inside of while loops.

Each of the 4 while loops above was spitting out HTML too. HTML with <font> tags!

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.

EntranceJew posted:

I think it's just a failure to grasp the English language -- which means the code they write using primarily English keywords will be very good and undoubtedly decorated with comprehensive comments. ;-*

I immediately saw the genius in this.

code:
>>> string = "//Ths portion of cde wan´t removed yt sincewe n´t know if it wilbused or not."
>>> len(string)
79
edit: despite this being what I think the code Kerbals write looks like, you have to admit not a lot of people have successfully abbreviated "don't" to " n't " before.

Pythagoras a trois fucked around with this message at 03:41 on Sep 20, 2013

fritz
Jul 26, 2003

Cheekio posted:

I immediately saw the genius in this.

code:

>>> string = "//Ths portion of cde wan´t removed yt sincewe n´t know if it wilbused or not."
>>> len(string)
79

edit: despite this being what I think the code Kerbals write looks like, you have to admit not a lot of people have successfully abbreviated "don't" to " n't " before.

It could be cant won't or don't.

NtotheTC
Dec 31, 2007


fritz posted:

It could be cant won't or don't.

Or "shouldn't".

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
It could have been, but it n't.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

fritz posted:

I haven't perl'd for closing in on ten years but I remember making heavy use out of some kind of text mode debugger.
A decent option if you can start a process by hand, not so much for live services.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
So our codebase is (still) full good ol' $result = mysql_query($query) code. Maybe about a year ago I decided that at least I shouldn't add to it and looked at the options and saw mysqli and pdo. I chose mysqli. So yesterday I got fed up with writing so much god drat boilerplate and I actually looked up pdo.

Why the hell didn't I choose pdo in the first place? :suicide:

jony neuemonic
Nov 13, 2009

Wheany posted:

So our codebase is (still) full good ol' $result = mysql_query($query) code. Maybe about a year ago I decided that at least I shouldn't add to it and looked at the options and saw mysqli and pdo. I chose mysqli. So yesterday I got fed up with writing so much god drat boilerplate and I actually looked up pdo.

Why the hell didn't I choose pdo in the first place? :suicide:

I prefer PDO, but having used both I never found that much difference in the amount of boilerplate?

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

fidel sarcastro posted:

I prefer PDO, but having used both I never found that much difference in the amount of boilerplate?

Well, if I just learned the bare minimum of mysqli and managed to use it in some particularly idiotic and verbose way, that's on topic as well.

jony neuemonic
Nov 13, 2009

Wheany posted:

Well, if I just learned the bare minimum of mysqli and managed to use it in some particularly idiotic and verbose way, that's on topic as well.

It's definitely more verbose, since you can't do things like pass an array of parameters to execute. I just don't remember wanting to tear my hair out last time I used it.

PDO is absolutely the better choice, at any rate.

jony neuemonic fucked around with this message at 12:16 on Sep 23, 2013

dreamin of semen
Feb 22, 2013

MULTIPLICATION
So back in 2008, I was still pretty new to coding in general. I'd done a bunch of VB6 garbage and some .NET stuff by then I think; I was pretty big into C#. One day I found out about the magic of inline conditionals.

Then I went ahead and did whatever the christ this is.
I'm posting a pastebin for a reason - 568 chars, 27 left parentheses, 1 line.
Included is my attempt to actually put it in proper C# syntax, sorta.

5 years later, I still have no idea how I wrote this. It actually works pretty well (!!) considering the rest of the project it's from. All this does is draw little falling peak indicators over the bars in a VU meter custom control. They fall faster near the top, which is, from what I remember, why the code is so confusing. That and apparently I was paranoid about the compiler getting the order of operations right on the math.

That whole project was a train wreck, if you couldn't guess. Almost 20k lines (not including .cs libs I took from the internet) for a basic music player. I just searched Form1.cs (5k lines) for comments and there is one, ONE that is even remotely helpful. "//don't call this, it's broken" above a reimplementation of string.Contains(). All the rest are disabling code. I could probably open any of these .cs files and find something horrible within seconds. And there are PLENTY of cs files, oh yes, almost 50!

Basically what happened is I tried to write an interface for Bass.NET and ended up with the plastic swiss army knife of music players. It does a whole ton of things, but none of them are very useful and most of them break easily. Want to change songs by sending arbitrary strings to a network port? You're in luck, my lovely player has a control server (which crashes if you send anything to it)! Media keys? Hell yeah, but only sometimes. Logitech G15 LCD support? Why not, let's add a 700 line function to handle that. Do you want a large spectrum analyzer dancing around on your desktop, wasting CPU cycles on basically nothing? Well it's got it! Lyrics search? Only if Songmeanings.net hasn't changed at all in 5 years!

I have written some dodgy stuff intentionally before, but this whole project... :cripes:

raminasi
Jan 25, 2005

a last drink with no ice
That's adorable, it's like digging up an elaborate macaroni-and-glitter art project from when you were six years old :3:

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

fidel sarcastro posted:

It's definitely more verbose, since you can't do things like pass an array of parameters to execute. I just don't remember wanting to tear my hair out last time I used it.

PDO is absolutely the better choice, at any rate.

There are about a billion little pdo libraries that makes working with arrays of parameters a cinch. Or you can write your own, your call.

return0
Apr 11, 2007
Is it seriously called pdo? Is it pronounced like pedo?

Hammerite
Mar 9, 2007

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

return0 posted:

Is it seriously called pdo? Is it pronounced like pedo?

It never occurred to me to read it that way. I always assumed it was pronounced "pee dee oh".

return0
Apr 11, 2007

Hammerite posted:

It never occurred to me to read it that way. I always assumed it was pronounced "pee dee oh".

I thought that was what it probably was, but I am very juvenile.

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



PHP Data Objects are no laughing matter, mister.

Adbot
ADBOT LOVES YOU

the littlest prince
Sep 23, 2006


If we could not talk about poop dough that'd be great.

puns are ok though

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