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
QuarkJets
Sep 8, 2008

NFX posted:

Or the more exotic ones. I ran into this thing a few days ago at work:
C++ code:
if (x == 0)
	if (foo)
		bar();
else if (x > 0)
	if (foo2)
		bar2();
else // x < 0
	bar3();
Gee coworker, maybe you should have tested that. According to the version control it's been in there since at least 2003. I guess it's not a very important piece of code.

But I de-indented the else if statement so it'll go with the first if statement right? :downs:

(although that is actually how it works in Python)

Adbot
ADBOT LOVES YOU

QuarkJets
Sep 8, 2008

Wardende posted:

That's fine because it means that a hacker would have to physically be at the machine which hosts the database to hack it. *takes a monster glue huff* wooooooooooooooooooooooooooooooh. Anyway, we use keycards, so we're covered.

But then there's no reason to not have a password, right? So you may as well have one in case, heaven forbid, a hacker gets to the physical machine and has someone's keycard + pin?

QuarkJets
Sep 8, 2008

Wardende posted:

Or downloads the database onto their local machine :ssh:

Nah don't worry guys, it's cool, we'll just put up some signs around the office saying "DO NOT STEAL OUR DATABASE" and we'll be covered

QuarkJets
Sep 8, 2008

seiken posted:

I have a Python codebase where almost every class has a method like that except it's called either "SetUpX" or "SetupX" completely at random.

It's even worse when you have something like this in MATLAB, where each function belongs to one file of the same name, and fixing all of the lovely discrepancies becomes a huge pain (on a Windows system with no scripting languages installed -- just having something like Python or even cygwin would have made it okay, but nooooooooo).

QuarkJets
Sep 8, 2008

Thermopyle posted:

What kind of heathen doesn't have green comments?

What kind of poo poo class requires physical printouts of code for homework submission? Classes in the early 90s, perhaps

QuarkJets
Sep 8, 2008

Thermopyle posted:

Bleh, the whole attitude that makes people resistant to libraries sucks. Use a goddamn library, losers.

(I can see being cautious about adding another dependency, and how big a deal that is will depend on your environment, audience, and product.)

In some lines of work, this can actually be problematic. If you're on an isolated network where installing a new library may be a 3 month process (for example, some government systems), and you just need one function out of that library, it can be easier to just code the function yourself and be done with it.

If you have a library or easy access to a library, then you may as well just use it instead of reinventing the wheel over and over. This was the philosophy behind MIT's change from Scheme to PYthon in their intro programming course. Of course, if getting that library into your build process is actually a week-long project, then it may be better to reinvent the wheel.

QuarkJets
Sep 8, 2008

We're setting up a data processing system that will takes files on a NAS, make copies of them, do some basic processing on their contents, and then push a result into a database. The software engineer wants to write this system in Python. The program manager (who is sort of a software programmer who eventually clawed his way into management) is forcing him to use MATLAB :reject:

QuarkJets
Sep 8, 2008

EntranceJew posted:

Can't somebody veto this terrible thing before it happens? Surely if you yell loudly enough at the right people you should be able to scare someone into putting a little more critical thought into it.

Not happening; the project manager is actually from an outside company, they're a customer for the product. Ultimately they're purchasing whatever they tell us to make even if we recommend something else

QuarkJets
Sep 8, 2008

Plorkyeran posted:

The only reason most things on Windows support spaces in paths is because Microsoft forced the issue by putting spaces in the name of a bunch of standard directories. A typical Linux install has zero directories with spaces in their names, so no one notices when they fail to properly quote paths.

That's not a good excuse, especially for such a mainstream project like mingw

QuarkJets
Sep 8, 2008

ToxicFrog posted:

Mingw consists mostly of windows ports of GNU utilities that they are not the maintainers for. So the excuse is more like "we don't have time to go through every one of the programs to find out exactly which ones can't be arsed to quote $0 properly and then convince upstream to fix them", which I think is perfectly reasonable.

Instead of saying "we don't support spaces" it would be better to support spaces and then say "we support spaces, but other projects might not support spaces, in which case it's not our fault if your poo poo breaks".

QuarkJets fucked around with this message at 03:08 on Aug 25, 2013

QuarkJets
Sep 8, 2008

Plorkyeran posted:

I think you do not understand what mingw is or something.

Maybe, I only use mingw for cross compiling Linux projects into Windows environments

QuarkJets
Sep 8, 2008

sklnd posted:

The entropy reduction from alpha-numeric to strictly numeric characters is pretty upsetting, and the maximum password length is something like 12 characters. Good job, guys.

Vanguard's maximum password length is ten :smith:

My minimum password length at work is 22 characters. My password is a loving sentence, and I mostly write open source software (science stuff)

QuarkJets
Sep 8, 2008

evensevenone posted:

Yeah, you don't want to end up like MATLAB where naming a variable "quit" means you can't close the IDE.

MATLAB is a coding horror

QuarkJets
Sep 8, 2008

Innocent Bystander posted:

MATLAB is the siren song of the scientific community.

No; any language that can't even do basic arithmetic with 64-bit integers is not a real scientific language. gently caress MATLAB. People need to stop using this piece of garbage. MATLAB is the PHP of science and engineering; it just barely works once you figure out several dozen workarounds to make it do what you want it to do

QuarkJets fucked around with this message at 12:20 on Sep 10, 2013

QuarkJets
Sep 8, 2008

quiggy posted:

Unfortunately I don't know of any better alternatives except maybe R. I'd be more than happy to learn about others, though.

Python, R, Octave, and a dozen others. Python combines the interactivity of MATLAB with the power of a real programming language and is generally a pleasure to use. R is pretty great, too. Most importantly, both accomplish the same tasks in less time and with less code written. Octave is basically MATLAB lite and isn't that good

MATLAB needs to die, I don't know what the gently caress Mathworks does with all of their licensing money but it's definitely not "release good math/science software"

QuarkJets
Sep 8, 2008

quiggy posted:

Ha ha ha ha Python as a Matlab replacement ha ha ha ha

I like Python but it does not do what Matlab does.

You're right, Python does it much better

QuarkJets
Sep 8, 2008

quiggy posted:

I didn't know about scipy/numpy :blush:

I'll check them out.

They're based on the same Fortran libraries as MATLAB, so it's remarkable how easy it is to switch from one system to the other. Python is row major whereas MATLAB is column major, but fundamentally they have the same capabilities. Python has advantages in that it's a well-designed language first and a scientific tool second.

MATLAB is still great if you're just prototyping something small and already have a license and already know how to use it, but it's a dinosaur.

QuarkJets
Sep 8, 2008


This looks interesting and easy to use. And those benchmarks are outstanding. How's the library support? If I need to use a bunch of one-liner Python/MATLAB functions, will Julia code be similar or will I probably have to roll my own for a lot of the less common features?

e: I answered my own question by discovering that Julia can call Python and has a lot of cross-compatibility, so anything that Python has Julia also has.
http://conference.scipy.org/scipy2013/presentation_detail.php?id=203
Julia with Python libraries for whatever Julia might not have yet sounds like an interesting combination, especially for those of us who must use some looping (such as when your data array would normally exceed your memory capacity)

QuarkJets fucked around with this message at 21:19 on Sep 12, 2013

QuarkJets
Sep 8, 2008

Harvey Mudd is a pretty good engineering school, but they're small, so most people haven't heard of them

QuarkJets
Sep 8, 2008

SurgicalOntologist posted:

E: yes, yes, Matlab is the real horror, I know.

This can't be said often enough

QuarkJets
Sep 8, 2008

Java can be good, but for whatever reason a greater percentage of the good software than I see is written in Python and C++, whereas when I see a Java app it tends to suck. Java is easy enough for a novice to use, but it's not as easy and intuitive as Python, so you end up with a bunch of coding abominations written by "Java programmers" who just wanted to make Minecraft mods or whatever. The same novice in a Python environment would be able to get by and probably produce something that's pretty good with minimal effort because there's almost no learning curve by comparison. The same novice in a C++ environment will probably just give up before releasing anything.

QuarkJets
Sep 8, 2008

Soricidus posted:

I seriously use Java to write client software today. :(

It can have some genuine advantages in that space, when you don't have any control over the target environment. For example, deploying a JAR is trivial compared to C++ (compile a different version for every user platform? no thanks) or Python (it's much more likely that a random computer will have a JVM than a Python interpreter). I can literally email a single file to a new user and be confident that they can just double-click on it and the application will appear on their screen. I don't know of any other technology that offers that.

Basically, if you still need to write desktop software at all, Java isn't actually a terrible choice for that.

Distributing Python and Java are pretty similar in that both require some sort of runtime environment. I don't see how it's reasonable to expect a user to have access to a JRE but not expect them to have access to a Python interpreter

Or as Pollyanna said, if you're worried about it then create a binary

QuarkJets
Sep 8, 2008

I was able to successfully name an internal python project PIRATE. Everyone loved it and still does

QuarkJets
Sep 8, 2008

Seriously though, Java is rife with bullshit design choices and both is a coding horror and produces the greatest number of coding horrors. gently caress Java

e: I take that back, MATLAB is worse

QuarkJets
Sep 8, 2008

Sagacity posted:

Please, go on. Can you give a few examples of the extreme ideology?

I think he's specifically referring to "EVERYTHING IS A CLASS, NO EXCEPTIONS" as extreme ideology

QuarkJets
Sep 8, 2008

I, too, did not base my "gently caress Java" statement on a hello world example. Java has plenty of important things to be concerned about without using "ease of writing hello world apps" as a metric

QuarkJets
Sep 8, 2008

tef posted:

Yep, python has really strong typing

code:
>>> True * 3
3
:v:

Yeah, there's simply no way that True could be inheriting from int, seeing as how no language has ever allowed True and False to represent 1 and 0

QuarkJets fucked around with this message at 08:46 on Dec 17, 2013

QuarkJets
Sep 8, 2008

het posted:

Well he wasn't necessarily saying it was absurd on the whole, just that it didn't represent what you would call strong typing. Also, coercing 1/0 to true/false seems more reasonable than the converse to me.

edit: oh, you edited. whatever, I still think that's sort of silly even if it's one of those things that doesn't often impact real world coding

I think that having False and True be represented by integers has become so ingrained in so many languages that if it suddenly wasn't the case then people would just be making GBS threads on Python for that instead, even though it's largely irrelevant trivia at this point

e: Although I guess in Java false and true aren't representable by integers, so there's that

QuarkJets fucked around with this message at 09:25 on Dec 17, 2013

QuarkJets
Sep 8, 2008

PleasingFungus posted:

See, this kind of poo poo is why mathematicians write the worst code.

If knowing how to use a Kronecker delta means that you write the worst code then I guess all scientists and engineers write the worst code

(I'm not disagreeing)

Deus Rex posted:

I'm not sure exactly who or what you're replying to, but this compiles just fine in C++ and as C (with appropriate typedefs added to the structs).

He's replying to the weak vs strong typing discussion by providing a great example of weak typing and suggesting that any language that can't do the same is not weakly typed. He's not saying that it's bad code or that it won't compile

QuarkJets
Sep 8, 2008

Yes, you can do weird-looking things when bool inherits from int. I don't see a problem with this; it's a feature that preserves an old convention of using integers to represent true/false, and if you're intentionally using bool's int features and screw them up then that's on you (just like every other feature in every other language)

QuarkJets
Sep 8, 2008

Dren posted:

A list of examples of operators behaving in incongruous ways depending on their arguments is php-like.

I find
Python code:
(True and 'a')
returning 'a' to be kind of funky.

That's because you don't actually understand what 'and' does:

Python.org posted:

x and y: if x is false, then x, else y (2)

QuarkJets
Sep 8, 2008

ninjeff posted:

the only logical date format is none at all because calendars and absolute time are puny human inventions

It's too bad that most of us work for humans

QuarkJets
Sep 8, 2008

I still don't really understand git but even I regularly make commits. It's merges and branching and poo poo where I get all hosed (oh god so many obscure commands that do things oh gently caress)

QuarkJets
Sep 8, 2008

EAT THE EGGS RICOLA posted:

I would probably go with "well yeah that's what 'reset --hard' does what did you expect it's right in the name, aren't you committing multiple times a day like you're supposed to?"

Or maybe "Oh that sucks a bit but at least your last commit was just a couple hours earlier at worst"

Horatio is being a non-lovely empathetic human being. Giving him smarmy comments to make back at his coworkers isn't going to help him or his relationship with his coworker. You sound like an unpleasant person to work with

Horatio, just apologize and tell your coworker that they should be committing much more often.

e: Basically I agree with brosmike

QuarkJets fucked around with this message at 19:26 on Dec 28, 2013

QuarkJets
Sep 8, 2008

EAT THE EGGS RICOLA posted:

I was being mostly flippant, but this person hosed up, not Horatio. He should be helpful, but his coworker needs to learn how to do his job properly.

I definitely agree with that. If you find a coworker who's committing weekly, talk to them about the importance of committing much more frequently than that.

QuarkJets
Sep 8, 2008

After a few months of very light git usage, I still have a lot of problems doing anything beyond simple committing, pulling, and merging, which I guess is 99% of what you should need to do anyway. But recently I found this cheat sheet:



This is some help, but many of these commands I fear may be doing things other than what the cheat sheet suggests. For example, git reset --hard is under "resolve merge conflicts -- discard conflicting patch" and "return to the last committed state", but if you were naively trying to undo a merge and used this command with uncommitted changes then you'd also be losing those changes. But on the whole, this is a nice little guide to some basic git commands

When when would you need git commit -a --amend? What does this do?

This also doesn't tell you how to create a standalone git repository, which is really useful if you need to merge changes from one network to another and the networks aren't allowed to ever touch except via physical media.

e: I guess that my problem with git is that all of the power is hidden behind an extremely obfuscated interface, which makes it hard to learn these commands without a very in-depth guide

QuarkJets fucked around with this message at 19:47 on Dec 30, 2013

QuarkJets
Sep 8, 2008

Suspicious Dish posted:

You mean the part where it says git init?

No, I was trying to describe creating a repository without a working directory: git --bare init and git --bare clone

QuarkJets fucked around with this message at 10:00 on Dec 31, 2013

QuarkJets
Sep 8, 2008

Suspicious Dish posted:

Any specific reason?

Bare repositories are useful for all sorts of things, such as transporting changes between networks that can't touch each other except via optical media (government work)

QuarkJets
Sep 8, 2008

ninjeff posted:

Assuming we're still around in fifty thousand years, the interstellar humans of the future will look at this video and enjoy the laughable idea that there's a Time that applies across the whole of the human species at once, then send version-vector-stamped hypertweets to their friends about the dumbass third-millenium humans.

An atomic clock in a universally agreed-upon inertial reference frame :colbert:

QuarkJets fucked around with this message at 19:55 on Jan 1, 2014

Adbot
ADBOT LOVES YOU

QuarkJets
Sep 8, 2008

ninjeff posted:

That's what we're using now, and it doesn't scale. Your terrestrial ideas have no place in Big Space.

Why doesn't it scale? You travel with your own atomic clock that stays in your reference frame. From time to time your computer checks in with the space system's central atomic clock to see how far you're off by and making an adjustment accordingly. It's not going to be exact, but time-keeping between two non-inertial frames where you don't necessarily know your velocity relative to the central clock that well is going to be impossible. The atomic clock is basically like having a clock tower; each town (space system) gets its own and from time to time some people get together to make sure that all of the clocks are running about right. I don't see us being able to do much better than that with the technology that exists today, and it's a pretty good and realistic solution

And I hardly see what's terrestrial about a system of atomic clocks orbiting stars so that spaceship pilots can have some reasonably accurate way of telling time, but okay

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