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
redleader
Aug 18, 2005

Engage according to operational parameters

sarehu posted:

I know, and... we didn't make any List<int>'s. Or any List<struct>'s either.

Ah right, fair enough. I'm a little surprised, just because a list of numbers is a pretty common use case. Or so I'd thought...

Soricidus posted:

except that anyone working with lists of integers in java who finds this to be a problem will be using one of the approximately gazillion libraries that provide memory-efficient primitive specializations of all the data structures, so it's not really a problem in practice.

unless you have some code that needs to be completely generic and operate efficiently on lists of specific primitive types, but that's not very common.

I didn't know that you could get such libraries - I'm not a Java person. Good to know, thanks.

Adbot
ADBOT LOVES YOU

Beef
Jul 26, 2004

QuarkJets posted:

Scientists and engineers are insulated from the often-obscene costs of working with Matlab by a layer of managers who don't understand that that there are superior free alternatives for almost all of Matlab's use cases. Even if Julia was a 1:1 Matlab replacement that simply made everything run faster, you'd still be facing a ton of inertia from older engineers with Stockholm Syndrome

You're absolutely right. I had a rare flaring up of misplaced optimism.

We did have a pharma middle manager flip his poo poo once he got a quote for running matlab on a sizable cluster. This is from a company that will happily pay 6-digit a year license fees for a program that is completely subsumed by an R-library. (A program/company built around a bunch of FORTRAN77 routines from 1980 that somehow became "industry gold standard". Allegedly, the entire code base has a bus factor of 1: the original author.)

Hammerite
Mar 9, 2007

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

Beef posted:

(A program/company built around a bunch of FORTRAN77 routines from 1980 that somehow became "industry gold standard". Allegedly, the entire code base has a bus factor of 1: the original author.)

Not a surprise. Our company now maintains a program that needs to be regularly updated with new data, is relied upon by large oil firms, and until recently was maintained by three old ex-industry guys (none of them with any formal software education afaik) from their home offices looking to retire.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

QuarkJets posted:

Scientists and engineers are insulated from the often-obscene costs of working with Matlab by a layer of managers who don't understand that that there are superior free alternatives for almost all of Matlab's use cases. Even if Julia was a 1:1 Matlab replacement that simply made everything run faster, you'd still be facing a ton of inertia from older engineers with Stockholm Syndrome

That depends on environment. Academic institutions are increasingly feeling the squeeze on funding especially in the research wings, so an academic discount might not be enough to retain MatLab users in academia.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
Semi-related story.

My computer at work is locked down, as normal, and I can't install or upgrade software.

Today I found out that my billion-dollar employer has no facility for hitting the "free upgrade" button on VMWare. They can only purchase a new license.

So I now have two licenses for VMWare.

I'm tempted to see how many I can collect over the course of my employment.

QuarkJets
Sep 8, 2008

TooMuchAbstraction posted:

That depends on environment. Academic institutions are increasingly feeling the squeeze on funding especially in the research wings, so an academic discount might not be enough to retain MatLab users in academia.

Maybe, but it seems like whenever I talk to a Matlab user in academia I just hear the same excuses that we have in industry: too much legacy code (various conversion tools are quite good), "it's a good prototyping language" (except it often isn't), it's used everywhere in industry (because dumbfucks like you are afraid of change!)

I know exactly one professor who is actually switching to something else (Python) and that was only because of the slimy way in which MathWorks tries to extort more money out of users who want to run their parallelized code to a supercomputer. No no no, the parallel computing toolbox isn't for serious parallel computing, that costs extra (we can't tell you how much extra until you tell us how much you can afford to spend)

The silver lining to this cloud is that I don't know a single dedicated Matlab user under 35; they all use Python or R for most things and only resort to using Matlab when it's absolutely necessary (aka the PM is a dedicated Matlab user).

Eela6
May 25, 2007
Shredded Hen
San Diego State is switching it's whole math program over from MATLAB Python. So it is happening, one department at a time.

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)

QuarkJets posted:

Maybe, but it seems like whenever I talk to a Matlab user in academia I just hear the same excuses that we have in industry: too much legacy code (various conversion tools are quite good), "it's a good prototyping language" (except it often isn't), it's used everywhere in industry (because dumbfucks like you are afraid of change!)

I talked to someone who uses matlab for trading, and he said that it's very convenient for that purpose, if only he didn't have to call mathworks every time their poo poo fucks up, which it apparently does all the time. I think he switched to using java. I used matlab for like one semester of school a long time ago and now I forget it exists ...

QuarkJets
Sep 8, 2008

Yeah, and I know MIT switched from Matlab years ago. Things really are getting better, objectively, I'm just salty that my ring of older colleagues is so stubbornly entrenched

Foxfire_
Nov 8, 2010

Juliachat: I'm on day 2 of porting/redesigning a program from Python to Julia! It's a video processing thing where you shove about 30GB of video in one end and descriptions of objects comes out the other.

Our reasons for switching were mostly driven by performance and python multiprocessing being a trainwreck. Julia added some inter-process queues in its last release that are good enough for easy IPC producer-consumer stuff and that's all we needed for synchronization. There's the start of a multithreading module, but it didn't have that many features last time I looked at it.

We did a bunch of Numba stuff in the python implementation, but it ended up being super annoying because you were basically always programming in the super striped down python numba supported, so in practice it was clunkier than even something like C++ (no vectors, no structs, no nested arrays, ...)

Cerberus911
Dec 26, 2005
Guarding the damned since '05
code:
getAccessToken = function(grant_type, grant_code, cb) {
  if(typeof grant_code === "function" && grant_type === "refresh_token"){
    cb = grant_code;
    grant_code = this.refresh_token;
  }
  ...
Some js code that's making me sad :(

These chunks are in multiple places.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
I just had some fun dealing with cargo cult programming in PowerShell. One of my co-workers asked me for help with something he was working on -- he needed to load a list of connection strings from a JSON file and update/create the connection strings in an Azure Web App.

Now, PowerShell has some horrors around types and I don't fault anyone who's not familiar with the horror who gets tripped up by it. But the logic was clearly the result of getting errors, googling them, and blindly copying code from Stack Overflow that made that error go away.

Old logic:
- Load the list of connection strings from disk into memory
- Use ConvertFrom-Json to turn the JSON into a PSCustomObject.
- Convert the PSCustomObject into an associative array
- Get the list of current connection strings from Azure. Azure PowerShell "conveniently" converts the JSON result into a PSCustomObject, which is just an anonymous type. Properties are attached to the object, not stored in a key/value pair or anything like that. So if you had a connection string "a", you'd be able to access it as $result.a, but not as $result['a'].
- Copy the connection strings from Azure into a new PSCustomObject
- Iterate over associative array containing the new connection strings and build in-memory JSON via string concatenation
- Convert that JSON to a PSCustomObject
- Attempt to attach the PSCustomObject to the associative array
- Convert the associative array back to JSON
- REST call to the Azure API to store the connection strings

Those last few steps would never have worked, the data structures weren't equivalent and building JSON via string concatenation when the language has first-class support for converting things to/from JSON is insane.

I rewrote it as follows:
- Load the list of connection strings from disk into memory
- Use ConvertFrom-Json to turn the JSON into a PSCustomObject.
- Get the list of connection strings from Azure as a PSCustomObject
- Iterate over the list from disk, if the property exists on the object from Azure update it, if it doesn't, add it
- Convert the object back to JSON
- REST call to the Azure API to store the connection strings

Pollyanna
Mar 5, 2005

Milk's on them.


Edward_Tohr
Aug 11, 2012

In lieu of meaningful text, I'm just going to mention I've been exploding all day and now it hurts to breathe, so I'm sure you all understand.

:cumpolice:

Space Kablooey
May 6, 2009



:quagmire:

vOv
Feb 8, 2014


https://www.mathworks.com/help/matlab/ref/cumtrapz.html?requestedDomain=www.mathworks.com

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner

Food $200
Data $150
Rent $800
Cum $3,600
Utility $150
someone who is good at the economy please help me budget this. my family is dying

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
Clearly the post was about the uncapitolized To. Get your minds out of the gutter.

Pollyanna
Mar 5, 2005

Milk's on them.


Meat Beat Agent posted:

Food $200
Data $150
Rent $800
Cum $3,600
Utility $150
someone who is good at the economy please help me budget this. my family is dying

stop spending so much on cum

pseudorandom name
May 6, 2007

Pollyanna posted:

stop spending so much on cum

He's a cattle farmer, that'll just make things worse.

Space Kablooey
May 6, 2009


Pollyanna posted:

stop spending so much on cum

no

sunaurus
Feb 13, 2012

Oh great, another bookah.
I have some contractors building a javascript frontend for a Project that I'm working on.
I recently had a look at what they had produced so far, and it definitely made me laugh (or cry). It had:
- methods called setX(param) which looked exactly like setter methods but actually just did a http GET request
- around 50 unit tests, most of which basically just tested if if the javascript `=` operator works correctly (literally they just just asserted that a value was unchanged after assigning it to a variable)
- new and innovative ways of writing for-loops:




I rewrote all of their javascript code (and ported it to typsecript) and took away their repo access permissions. They now have to do pull requests.

Tweak
Jul 28, 2003

or dont whatever








code:
vm.dimension.error = false ? true : false;
if (vm.dimension.error == false) {
...
} else {
...
}

the only code i cut was within the if/else blocks

note: this guy has probably been coding for decades, even if he's only used javascript briefly over the last year

edit: HE DID IT TWICE

Tweak fucked around with this message at 03:02 on Jan 27, 2017

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Tweak posted:

code:

vm.dimension.error = false ? true : false;
if (vm.dimension.error == false) {
...
} else {
...
}


the only code i cut was within the if/else blocks

note: this guy has probably been coding for decades, even if he's only used javascript briefly over the last year

edit: HE DID IT TWICE

Just delete everything but the stuff inside the else and move on. You probably have better things to get upset over.

Jaded Burnout
Jul 10, 2004


leper khan posted:

Just delete everything but the stuff inside the else and move on. You probably have better things to get upset over.

You mean everything but the stuff inside the `if`? `vm.dimension.error` will always be `false`.

smackfu
Jun 7, 2004

Your IDE should really complain about that.

Polio Vax Scene
Apr 5, 2009



Something tells me his javascript IDE is Notepad++

Tweak
Jul 28, 2003

or dont whatever








yes intellij (the IDE we both use) highlights it and says it can be simplified to vm.dimension.error = false;

Carbon dioxide
Oct 9, 2012

I refuse to believe this is real.

http://thedailywtf.com/articles/the-inner-json-effect

No one would be that stupid, right? Right?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I did some contracting work on a system which was depressingly similar to that except everything was stored in salesforce rather than svn.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Aren't they all stdh.txt for programmers?

xzzy
Mar 5, 2009

Someone should point the puppet people that came up with r10k to that article.

(yes I know r10k is actually reasonable but the parallels are definitely there)

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)

Carbon dioxide posted:

I refuse to believe this is real.
http://thedailywtf.com/articles/the-inner-json-effect
No one would be that stupid, right? Right?

Powaqoatse posted:

Aren't they all stdh.txt for programmers?

I haven't recently read any of the daily wtf's articles besides this one. But the thing is, no matter how much they exaggerate, I totally believe that those stories could happen, unlike most stdh.txt

Spatial
Nov 15, 2007

Hardware horror: Another team accidentally sent out a bitwise-inverted ROM image to be etched into silicon. Unsurprisingly it can't boot. See you in three months!

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Spatial posted:

Hardware horror: Another team accidentally sent out a bitwise-inverted ROM image to be etched into silicon. Unsurprisingly it can't boot. See you in three months!

Owned lmao

Guess someone is not getting a bonus

Plorkyeran
Mar 22, 2007

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

dougdrums posted:

I haven't recently read any of the daily wtf's articles besides this one. But the thing is, no matter how much they exaggerate, I totally believe that those stories could happen, unlike most stdh.txt
They're supposedly fictionalizations of real events which preserve the core wtf while making up everything around it. With that in mind I've never found it hard to believe that the thing which inspired the story actually happened but with a quarter of the drama.

ThisIsNoZaku
Apr 22, 2013

Pew Pew Pew!
A while back I spent maybe 8-12 hours over the course of a week on a converter that would take JSON put into a REST endpoint and map it into an instance of a dynamically chosen class in Java. I even got it to work in some preliminary testing.

I scrapped it because I was then serializing the object into JSON and storing it in Mongo.

In my partial defense, the theoretical goal was to allow the manipulation of the object before storing it but that use case was pushed far off to the side.

ThisIsNoZaku fucked around with this message at 00:14 on Feb 1, 2017

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Spatial posted:

Hardware horror: Another team accidentally sent out a bitwise-inverted ROM image to be etched into silicon. Unsurprisingly it can't boot. See you in three months!

I'm a hardware imbecile. Is this something that is in any way easy to do by accident? Is it like a t-shirt where I have to print it out backwards so it transfers on forwards?

Spatial
Nov 15, 2007

pokeyman posted:

I'm a hardware imbecile. Is this something that is in any way easy to do by accident? Is it like a t-shirt where I have to print it out backwards so it transfers on forwards?
No. They send a hex dump that directly maps onto the end result. The tool they use is more general than that so it has an option to invert the output and they left it on by accident. Pure incompetence.

It's a very easy mistake to catch. They should've compared hashes of the original ROM binary versus the output image, and they also should've confirmed the final output with the firmware team who wrote it. Any firmware guy will instantly see that it's hosed because the first four bytes of the ROM are the address of the first instruction to execute. Normally it would be 0x0000xxxx. If it's some wacko address like 0xFFFFFFBF you know the train is off the tracks well before it leaves the station. But nobody checked.

This isn't the first time. A while back someone sent out a completely blank ROM because they used the wrong input file and never checked the output. Pretty obviously wrong if it's all zeroes. Again, even just looking at the first four bytes would've revealed that error because all-zero isn't a valid reset vector.

Not only is this kind of thing hugely embarrassing, it also costs six figures! :v:

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Ahaha that's amazing! Thanks for explaining.

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