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
duck monster
Dec 15, 2004

Mr. Heavy posted:

Never has a single empty method call made me want to hit something so badly.

code:
$self->maybeTakeUserFromForm();

Fuzzy logic!

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

I just found this little ripper in some code that, uh, I might of written many years ago. From memory I might not of been entirely sound of mind at the time....

code:
if ((((!(in_array($_REQUEST['context'],array(-10,-11,-12,-13)))) and ((($_SESSION['authenticated'] == 0) or ($_SESSION['authuserrole'] > 0)) or ($_REQUEST['context'] >2)))) and (!(in_array($_REQUEST['context'],array(80))))) { 
We dubbed it "ifzilla" , shortly before refactoring the poo poo out of it, once we worked out how it worked. It helped that I had written it, but I might of been a bit drunk at the time :)

A true hate crime against boolean logic.

edit: (in_array($_REQUEST['context'],array(80)) lol

duck monster fucked around with this message at 00:33 on Apr 3, 2008

duck monster
Dec 15, 2004

Surge Strip posted:

Our intern programmer makes me laugh some days. For example, he future proofed all his code, just in case the definition for a newline ever changes on Windows:

code:
CRLF := #13 + #10;
He codes mostly in Delphi, which has quite a few functions for you to use. I guess he just didn't like the Uppercase function they wrote:

code:
function Upercase(str : string) : string;
   var
   len : integer;
   count : integer;
   newstring : string;
   begin
   len := length(str);
   count := 0;
   while (count < len) do
      begin
      newstring[count] := str[count] - 32;
      count := count + 1;
      end;
   result := newstring;
   end;
So many things wrong. He even got an error that Uppercase was already defined, and so he misspelled it.

When you consider that pascals unparallelled strongpoint is set mathematics, that example is even looper than you'd imagine. You can write a flawless uppercase function in a 4 lines of code, including the "function" "begin" and the "end" lines.

duck monster
Dec 15, 2004

Jesus loving christ. If GCH emerges, I'm going to lobotomise myself so I can never understand any thread under the SH/SC forum tree again.

No. BAD NERDS. NO.

duck monster
Dec 15, 2004

edit:nope

duck monster fucked around with this message at 08:51 on Sep 8, 2022

duck monster
Dec 15, 2004

Janin posted:

cout isn't a singleton, LogSingleton isn't a (proper) singleton, almost any use of "singletons" is dumb, and the particular implementation of static methods proxying to private method is absurd.

I think they are great, because it lets you have resources that really really should be singular , like data base connections, but you just loving know dipshit junior developers will be re-instantiating over and over against. (They should be re-instantiating the cursor, but the cursors just hang off the connection.

duck monster
Dec 15, 2004

Trabisnikof posted:

Political Science major programmer checking in

hi5 buddy. our code is ideologically correct.

duck monster
Dec 15, 2004

Dijkstracula posted:

holy crap, this guy is evidentially a legend http://thestupidestmanonearth.com/

http://telusplanet.net/public/stonedan/source.txt

This code is spectacular. I haven't seen a GOSUB in decades, outside of old engineering scripts to drive RS232 poo poo around in qbasic (open "com1:" as #1,9600,blah,blah")

edit: Ahaha this is schizophrenic as hell. I don't know if anyone here ever stumbled on the "Kyoon" threads in LF. Kyoon was a paranoid schizophrenic dude , aka "The end times prophet", who managed to stumble into LF and was quickly adopted as the forum crazy-person mascot. This guys like the computer-programmer version of kyoon.

duck monster fucked around with this message at 05:32 on Jan 2, 2010

duck monster
Dec 15, 2004

Vanadium posted:

If you really want something that approaches a REPL for C++, why not go the whole distance and turn it into an IRC bot.

:colbert:

if one of you assbutts attaches #include </dev/tty> to an irc bot, I'm so going to own your box.

duck monster
Dec 15, 2004

Ignore the image macros in the thread on this patch:

https://github.com/MrMEEE/bumblebee/commit/a047be85247755cdbe0acce6#diff-0

code:
@@ -348,7 +348,7 @@ case "$DISTRO" in

   ln -s /usr/lib/mesa/ld.so.conf /etc/alternatives/gl_conf
   rm -rf /etc/alternatives/xorg_extra_modules
   rm -rf /etc/alternatives/xorg_extra_modules-bumblebee
-  rm -rf /usr /lib/nvidia-current/xorg/xorg
+  rm -rf /usr/lib/nvidia-current/xorg/xorg
   ln -s /usr/lib/nvidia-current/xorg /etc/alternatives/xorg_extra_modules-bumblebee
   ldconfig 

  ;;
:ughh:

I wonder how many people got their machines bricked by this clanger.

duck monster fucked around with this message at 08:53 on Sep 8, 2022

duck monster
Dec 15, 2004

qntm posted:

I don't know much about bash but doesn't this change fix the line of code which deletes /usr? Surely the change where that error was introduced would be more of a facepalm.

EDIT: Here we go.

Yeah thus the - + in the diff. But thats not really what I was pointing out. The fact that it was there in the first part.

From memory Eve Online had a similar bug once that wiped out the BOOT.INI (or whatever its called) on everyones windows boxes.

duck monster
Dec 15, 2004

GrumpyDoctor posted:

I'm pretty sure this is all scientific programming. I work with some physicists who have an elaborate simulation application, written in Fortran, that doesn't use any Fortran numerical libraries.

Scientists are generally horrible coders. When that whole climategate frameup was going on, people where gasping on horror at some of the numerical processing code that was leaked.

The funny thing was, I doubt there was an experienced fortran coder on the planet that would have even blinked at it. Its just what happens when you get a non programmer and put "ultramaths basic" in front of him. Its going to be awful.

Interestingly enough some of the tightest code I've seen came from some biologist dudes I worked with at my old uni that where doing DNA sequencing stuff. Those guy could code up a loving storm.

duck monster
Dec 15, 2004

Aleksei Vasiliev posted:

Labeled breaks aren't the same thing as gotos.

And yes but my case was justified and not bizarre like that thing. I haven't actually worked on it for awhile since I got bored with parsing binary->XML, but I'm pretty sure gotos would have helped me write cleaner code in that method.

Completely abuse the gently caress out of exceptions?

duck monster
Dec 15, 2004

Scaevolus posted:

Looks like a FORTRAN programmer has been forced to write C, and is resisting.

I've seen C written like that by an engineer who had only ever done verilog. Every single loving constant was defined as such Including things like const_two = 2 , etc.

Oh and the macros. God drat it macros are cool, but when every loving operation is first defined as a macro THEN applied to code, it very rapidly becomes brain damage inducing trying to read.

duck monster
Dec 15, 2004

Biowarfare posted:

Ghettocode horror: find nd replace 'id=' with 'class=' then iterate through that

Man I've been dealing with django templates from a graphic designer where there are no classes just ids repeated over and over again
code:
<h1 id="heading">blah</h1>

<p id="paragraph">rara</p>
<p id="paragraph">rarara</p>
etc
etc
Seriously how loving hard is it to understand the difference between an id and a class, and how the gently caress am I supposed to xpath that poo poo sanely.

Worst part is if I change half of them to classes (and the corresponding css) it somehow introduces mysterious subtle layout changes and since I'm completely terrible at CSS (Yet not terrible enough to confuse ids and classes) fixing them has been a real manual-at-side oval office.

duck monster
Dec 15, 2004

tef posted:

In one project ~2500 lines I found 0 semicolons. In the 12000 line one, I found import traceback; traceback.print_exc(); three times. I blame debugging.

Your move :smugdog:

I didn't actually know semicolons where allowed.

duck monster
Dec 15, 2004

Today I stumbled across a simple set of words that describe a real thing that ought cause any coder with a sense of his industry to imediately break out into a rash.

"LegacyJ : Enterprise JavaBeans and XML with COBOL"

Just saying it is like committing a hate-crime against IT workers. I'm pretty sure if my boss pulled up and said "Hey we got a job writing J2EE stuff with heaps of XML configuration using COBOL on a Java stack!" I'd probably start lighting fires.

duck monster
Dec 15, 2004

Gazpacho posted:

If you consider COBOL dead maybe your "sense of the industry" isn't quite as good as you think. :smug:

I spent the first part of my career as a COBOL programmer. Its not the language thats dead, but me who is dead, inside. Terrible terrible language.

But yeah, theres still billions of lines of that godawful poo poo out there.

duck monster
Dec 15, 2004

Zamujasa posted:

php:
<?
// END CODE FROM testcreateinfo.php
}}}}}}
}// goodtogo = 1, infoid passed is available to the passed username/password
 }// end of check to see if info id is passed
} // end of valid user/pass test and info return
} // end of is api command 'doeverything'
mysql_close($con);
} // End of is api functions?>
:smithicide:

(The lack of formatting here isn't some error, there are about 4 copies of this file and this is how they are: left justified. boss doesn't believe in indentation because he does coding on a 1024x768 TV and indents are just wasted space. :suicide:)


Edit: Oh, the snip from the last post is from this file, too, but run through a code reformatter. (Rest assured, it was left-justified too.)

quote:

} // end of is api command 'doeverything'
hahaha

duck monster
Dec 15, 2004

Aleksei Vasiliev posted:

PHP added gotos in 2009, actually.

For the love of god, bring back pascal as a mandatory educational language PLEASE aarrgghhhhhhh. There is no valid reason to use GOTO ever that does not have as its root cause "Doesn't 'get' structured programming discipline".

duck monster
Dec 15, 2004

Ensign Expendable posted:

There is an educational variant of Pascal called Turing that my high school offered in grade 9 and 10 programming courses, with Java in 11 and 12.

I just wish whatever the gently caress borlands latest hate-spawn is now called would loving wake up and offer a hacker friendly delphi or turbo pascal again at a price (or better still freeness) that makes senes. A fully updated object pascal is still a great language that emphasizes type correctness and is dead set all about doing structured and object oriented correctly. And seriously, follow the pascal rules and your code will make sense and be good and chivalrous.

The sleep of java has produced monsters.

Get off my lawn kids.

duck monster
Dec 15, 2004

ultramiraculous posted:

Mother. Of. God.


Edit: After a quick test, I'm extremely disappointed that the Scala compiler isn't accepting Emoji for operator identifiers. The bikini XOR has as much right to exist as any other!


Ahahaha I love academics and what hapens when you stick them on committees to debate stupid poo poo. Long bewildering debates spanning years over the meanings of words.

I was on the academic council (reasearch funding coordination committee) at Murdoch university in the mid 2000s , and there was an ongoing debate about what the meaning of "Multidisciplinary" was in the universitys constitution. The debate had been going for 15 years and was still unresolved, and would come up as a topic about every 3 months to the same shouting match between the postmodern leaning eng-lit ("its context dependent!") department, the ultra-analytical ("Words have meanings damnit!") philosophy department , and everyone else who would watch on in bemused bewilderment, and occasionally offering "Well , I think I know what multidisciplinary means. Yesterday I borrowed a stapler from the vetrinary science guys!".

15 loving years to define a word. Still unresolved to this day. But if you walked down into the courtyard and asked an undergrad, you'd get a 5-10 second silence followed by a consise and entirely useable answer good enough for about 90% of the time. This is for a concept that was supposed to be the defining trait of the university, yet none of the boffins could agree on what the defining trait was supposed to mean!

And it was in this sort of committee environment unicode was born.

duck monster fucked around with this message at 05:40 on Nov 20, 2012

duck monster
Dec 15, 2004

I did it! I found the worst thing!

https://github.com/ajlopez/CobolScript/blob/master/samples/mysqlweb/database.cobp

Its HTML, with embedded COBOL. Running on Node.

:suicide:

duck monster
Dec 15, 2004

Steve French posted:

In what way is for less powerful than while?

You can implement a for loop using while (some variant of the yourdon loop I guess) but your going to end up getting your hands dirty implementing many of the while use cases with for. At least in the python iterator/generator sense of for:

duck monster
Dec 15, 2004

Soricidus posted:

It's not about editing faster for the sake of it. An efficient editor lets you get right to the next bit of thinking without breaking your chain of thought.

I've recently started using Emacs again (It was my first editor when I was learning unix, like, 20 years ago) and set up with a whole bunch of useful add ons (including the nav sidebar. Why thats not standard I'll never know) and with my chord memory starting to return, Its a loving lightning bolt to use. I mean sublime text is cool and all, but emacs really is a tight piece of software. And in 2015 "Omg it uses 8mb of ram" isn't exactly the memory hog it was in the 90s.

duck monster
Dec 15, 2004

Not quite a coding horror, but I just stumbled across this horrorshow of a comment on some blog for some random NoSQL vendor;-
gently caress this guy

quote:

The elephant in the room here is that SQL is not suitable for any situation where data input is from unregulated sources, owing to its vulnerability to malicious code injection. The issue arises because SQL, unlike most other database languages, has no concept of variables. Therefore, all input has to be in the form of commandlines containing a mix of instructions and literal values. Slip a suitable command into submitted data, and you have control of the database server.

Major websites have gone down like a line of dominoes to code injection hacks over the last couple of years, leading to extensive thefts of personal information, the need for mass password changes and reissue of bank cards, etc. It's getting to the point where the public confidence in the security of online trading is at an all-time low. If confidence is to be restored in ecommerce, then the use of SQL on the Web needs to be deprecated. Or better, forbidden by the banks for any site wishing to handle card payments. The sooner the better.

*cues up webscale.mov*

And this is why our database with our info will continued to be owned forever, because mouthbreather hipsters like this keep being allowed to use computers....

duck monster
Dec 15, 2004

Suspicious Dish posted:

I guess it's his fault he's never read enough blog posts to learn about prepared statements.

The irony is half the nosql json databases out there dont actually support prepared statements, as your just POSTing json into a store, and that means you can insert all sorts of crazed poo poo into there, including javascript statements on certain engines.

I could rant for hours about the cargo cult nonsense I've seen on some jobs regarding the NoSQL databases, invariably from young coders who flunked out on database theory and couldnt tell an INNER JOIN from a DROP TABLE to save their arse. Like serious, No ACID guarantees a good thing? Fuuuuuuck that.

duck monster
Dec 15, 2004

LeftistMuslimObama posted:

What we were told was that the latter is formally the case, but that some auditors are more likely than others to decide to nitpick and make things harder on you if they spot indications of "lax culture". For the same reason we had to stop using issue titles like "Architecture of <thing> is incredibly stupid", and QA was banned from using cat memes in QA notes.

Hah. I thought I was the only one who always attcahes cattes to trouble ticket upload fields.

duck monster
Dec 15, 2004

Subjunctive posted:

Sometimes writing a unit test involves having to hook the OS, or simulate complex hardware. Not everyone is set up to write a dummy USB driver.

Yep. A job I had a bunch of years ago, involved writing device drivers for embedded linux boards in pan tilt camera heads (The hardware needed low level access to DMA so it wasnt as simple as driving a serial line from user space, alas). Boss wanted it all to be unit tested. Good idea, until I realised I had no loving idea how to mock up a god drat operating system kernel.

We kind of fudged it a bit.

duck monster
Dec 15, 2004

Subjunctive posted:

Just use Hack.

The problem with hack is it solves the wrong problems. Well mostly. I mean the static typing is good. PHP definately needs that. But its focus on performance isnt really that useful unless your running google or facebook. The problem with PHP is its inconsistency. Its the only language I know where despite using it for a decade I have to keep looking up functions because I cant remember what order the parameters go. Its "best" frameworks are symfony which seems like it was designed by twirly moustached Java villains and has serious troubles downscaling and Laravel which has *serious* troubles upscaling and an ecosystem that revolves almost solely on web dev and is composed of horrifically poorly written modules that get spat out in one revision and then abandoned. And Hack cant fix any of that.

duck monster
Dec 15, 2004

Had an issue at work where a grid navigation control on a web table wasnt working quite sensibly.
On page one clicking > would go to a page starting at record 201. Then on 201 clicking > would go to 2211 , then 22311 and so on.

Turns out javascript was taking the record number, adding 20, then adding 1 *as a string*, the reason being that for some reason the REST endpoint was putting quotes around the index. And Javascript being a dumpster fire of a language, instead of typecasting it to an int, or raising an error , decided 20 + '1' = '201'.

I hate my job.

duck monster
Dec 15, 2004

Pollyanna posted:

I fuckin love bugs that stop happening when I put logging statements in. :shepicide:

I had one of these last week. Php laravel thing I had cooked up for the marketing people , for doing reseller poo poo , on safari, and only safari, it'd randomly start breaking the http connection to the server on a particular page, and do it silently with nothing in any log I could find. So I started adding in logging (on the server) and the bug stopped. Remove logging, bug reappears. Put it back in, bug stops. Ended up just leaving the logging in and filing it under "Mystery" in the bug tracker. Later worked out that upping timeout on apache fixed it too, but I'm still none the wiser as to the real cause.

duck monster
Dec 15, 2004

TIME TO VOMIT BLOOD OVER EVERYTHING YOU HOLD DEAR

http://www.veryant.com/products/cobol-mobile.html

quote:

isCOBOL Mobile from Veryant, now available for Android compatible devices, provides a comprehensive, cost-effective COBOL solution for application development on mobile devices. Developers that are thinking to provide applications running on tablets and phones can take advange of this new add-on of isCOBOL Evolve suite for many reasons:
<snip>hate hate hate</snip>

duck monster
Dec 15, 2004

M31 posted:

code:
PROGRAM-ID. hello. 
CONFIGURATION SECTION. 
REPOSITORY. 
    class web-area as "com.iscobol.rts.HTTPHandler"
    . 

WORKING-STORAGE SECTION. 
01 hello-buffer identified by "_comm_buffer"
   03 filler identified by "_status"
      05 response-status pic x(2). 
   03 filler identified by "_message" 
      05 response-message pic x any length. 
   03 filler identified by "hellotext"
      05 xml-hellotext pic x any length. 

LINKAGE SECTION. 
01 lnk-area object reference web-area. 

PROCEDURE DIVISION using lnk-area. 
main-logic. 
    move "Operation successful" to response-message. 
    move "OK" to response-status. 
    move "Hello World from isCOBOL!" to xml-hellotext.
    lnk-area:>displayXML (hello-buffer).
    goback. 
As if using COBOL isn't enough you also get to gently caress around with Java deployment descriptors and jQuery v1.

edit:
The above code doesn't actually do anything, you need to create a WebView from Java, then use jQuery 1 to query the webserver running in COBOL (on Java) to display anything. Also, the tutorial skips all good practices from the last 10 years and uses a version of the Android SDK that hasn't been supported since 2015.

My first IT job in the early 90s was maintaining lovely old COBOL for the tax dept. God I detest that language.

duck monster
Dec 15, 2004


https://github.com/azac/cobol-on-wheelchair

At least these guys have a sense of humor about it.

"Report-host-terminal" pattern lol

duck monster fucked around with this message at 03:09 on Feb 13, 2018

duck monster
Dec 15, 2004

RobertKerans posted:

Naming is hard:

http://erlang.org/pipermail/erlang-questions/2018-February/094769.html

This collection of absolute loving morons on show here is...something I guess.

(tl/dr guy who wrote the Erlang webserver Cowboy releases a package manager. It's called Coon. Mononcqc politely suggests that this a bad name. Cowboy guy plants his flag on his hill, several other fuckwits join him, someone suggests if it gets on Reddit front page any publicity would be good publicity, yadda yadda yadda)

Edit: Cowboy guy didn't release it, he just seems to be staunchest defender of the name

The idea that its just a north american slur is flat out wrong.

Since we dont have racoons in australia the *only* context of that word here is a racial slur thats considered considerably worse than the N word. You start using that word in public, someones going to break your jaw.

Programmers are the worst goddamn people sometimes.

duck monster
Dec 15, 2004

1337JiveTurkey posted:

That's probably because I've read some of the work that's built on that regarding partial ordering of events but never got around to that paper. (Available here for anyone curious) Intuitively having a distributed clock never seemed worth the trouble versus simply accepting the partially ordered nature of things but it looks worth a read. Thanks!

Generally speaking it tends to be a "If you have this problem, you're probably doing it wrong". Parallelize what can be parallelized easily (Ie lots of pure tasks that dont have horizontal dependencies). And do serially everything else. Unless you absolutely have to, in which case , its good to have a prescription for anti anxiety drugs, or thorazine if you've been doing this poo poo too long and still keep falling into the same hole.

duck monster
Dec 15, 2004

Foxfire_ posted:

Unix filenames are a dumpsterfire anyway and essentially nothing handles them correctly. They are arbitrary binary blobs, not text.

Fun prank: put files on someone's system whose name has bytes that (if interpreted as text) have newlines, spaces, invalid unicode sequences, valid but not normalized unicode codepoints, and some invisible codepoints

Oh its worse than that. Back when I first learned Unix (pre linux) I worked out you could put VT-100 control sequences into file names. And the VT-100 control sequences where borderline turing complete. You could remap keys, tell the terminal to send out arbitary commands back to the mainframe, the whole lot. And all your victim needed to do was type "ls".

I had a *lot* of fun screwing around with that in the computer lab at uni. I dont think Linux , or modern terminals, are quite that bad, but you can still do stupid poo poo with file names. Though the optional case insensitivity in macos can cause *very stupid* poo poo to occur.

duck monster
Dec 15, 2004

Just had the new guy at work decided to rewrite a NodeJS UDP server in loving PHP, because "NodeJS cant scale". I argued with him a bit before the boss said "Dude, let the new guy own his project". His theory is that NodeJS can't spread across multiple cores. Like, sure, but these things are deployed in containers in a kubernetes cluster, its never going to get to that stage.

The initial protype uses forks for multitasking, and periodically shits itself because he doesn't understand memory management, and he now doesnt know how to get the incoming AMQP (This thing bridges from IoT devices to our AMQP network) into those forks.

Like dude, these where all solved problems.....

Its not my project, but I cant help thinking its gonna end up mine in the aftermath.

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

So I left an internal project to hand it over to a new guy and move onto something non lovely.

This fucken guy convinced the boss to throw out the nodejs tcp server because "nodejs cant scale" and replace it with .... PHP ....

He's written this PHP daemon using forking for multitasking, this new thing is an entire gigantic file with no functions, just big ol' spaghettio, and it constantly pegs the server at 100% CPU because he doesnt understand multitasking at all. And to my horror, he's decided to replace the postgres DB with a mysql db with the following line ;-

code:
    $sql = "INSERT INTO  logs(`timestamp`,`type`,`message`)VALUES('$timestamp','$type','$message')";
    $conn->query($sql);
    $conn->close();
I'm attempting not to have an anneurism here..... He's not even doing the mysqli_real_escape thing. That message is poo poo coming straight over the the wire from devices that let people type data in. I havent seen code like this since the 1990s.

Lord have mercy, I think for the first time in years I'm going to ask the boss to fire someone.

I pine for the sweet embrace of death.

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