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
double riveting
Jul 5, 2013

look at them go
code:
#define V1(f) A f(w)A w;
#define V2(f) A f(a,w)A a,w;
...
V1(iota){...}
V2(plus){...}
V2(from){...}
V1(box){...}
V2(cat){...}
V2(find){}
This is obviously done to avoid duplication at a lower level than what we would think of today as code duplication. It seems likely that the editing environment at hand made it awkward or annoying to type and/or change the same thing multiple times. Have you ever used ed(1)? In fact, the article states "produced—on one page and in one afternoon" so it sounds like he might have written this by hand, even.


Beef posted:

I've seen a similar style before, with mathematician coders being the factor in common:
https://github.com/jluttine/suitesparse/blob/master/CSparse/Source/cs_chol.c

Being kind of a mathematician coder, though more of the latter than the former tbh, more arguments come to mind:

1. Short variable names make it easier to visually recognize/parse a medium-sized formula at once.
2. In specific situations, certain identifiers may just be idiomatic, so calling something "K" or "I" could be down to familiarity and may in fact communicate well to someone familiar with the algorithm or problem domain.
3. Establishing one's own language can be a great boon to working with a problem; much of mathematics revolves around it. That's more a general comment rather than about the sources given; but it might explain a tendency in mathematicians to come up with seemingly weird internal dialects. I've certainly done it to extents.


As to the question of what I think about the particular style, it seems to cross the line in the examples given, at least from today's standpoint, but I can definitely sympathize with it. In general, I do feel that there is an argument to be made in favor of what could be considered unreadable or unmaintainable code, just as there are arguments in favor of verbose identifiers and "plain" coding style (think Python's stance against higher-order functions). It depends on context (like how many inexperienced coders have to work with this), but from an abstract (what would you expect from your coders rather than what can you expect) standpoint, I think that too much is made of "coding style" and "readability". A reasonably proficient coder can read these things; if they can learn an API, they can learn some macros and snowflake idioms. However, consistency trumps policy - work with existing style rather than imposing another; and this goes both ways.

double riveting fucked around with this message at 15:19 on Apr 5, 2018

Adbot
ADBOT LOVES YOU

Munkeymon
Aug 14, 2003

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



Couldn't decide if this should go in any of the working/oldie/newbie threads: https://stackoverflow.com/jobs/162835/free-bass-fishing-lessons-for-full-stack-c-sharp-net-catch-co

Certainly an interesting tactic for getting me to click on your job ad.

For a probably-horror, have the idea behind this startup: https://stackoverflow.com/jobs/155287/full-stack-developer-at-sports-tech-startup-teamgenius Taking kids sports way too seriously but with an app!

Munkeymon fucked around with this message at 16:11 on Apr 5, 2018

VikingofRock
Aug 24, 2008




ratbert90 posted:

I just translated a massive project with 28 sub-projects from GNU Autotools to Meson.
Meson is good if anybody is wondering (they weren't lol).
I am now comfortable with GNU Autotools, CMake, and Meson, and I like Meson the best.

Pros:
- Being python based makes Meson very easy to read.
- Decent documentation.
- It's very very fast to start.
- Built-in unit testing
- Built-in support for clang-tidy
- Many major projects are already switching (or have switched) to Meson, such as systemd, GStreamer, and all of Gnome. As such, it's being actively worked on and has a ton of new features being built with a very active community behind it.

Cons:
- Meson requires python 3.5+, so getting it working on Debian8 (not my choice, I was hired on in the middle of the project) was a bit of a pain.
- The Unit test framework lacks a bunch of nice features other make systems have (Auto running and grouping are two big ones.)
- It only supports Ninja as it's primary build system.
- No IDE fully support it, so you will have to have a Makefile/CmakeLists.txt wrapper anyways to invoke some of the basic commands.
- The syntax is clean enough that it points out just how horrible Autotools is.

Verdict:

Out of all 3 major make systems, I would say that it's at the top, but not by much.
When to use Meson:
- If you are using Autotools and are looking to make it maintainable or switching.
- If you are creating a new application and are currently choosing a make system.
- if you want to be a hipster.
- If you aren't familiar with any make system but you like python.

When not to use Meson:
- If you already using CMake, I wouldn't switch. CMake is fairly easy to understand and has a ton of the features (and more) of Meson.
However, CMake is a bit more difficult to read and maintain, but not by much.

Sorry for the long diatribe. :unsmith:

This is a good post, thanks.

So I'm set to graduate from my doctoral program soon, and before I do I'd like to fix up the code for a pipeline I wrote (lest I see it in this thread in a few years). Right now I'm in charge of maintaining and updating it, but the pipeline is extremely useful to a lot of people so after I graduate maintenance will pass on to some other graduate students, my advisor, and whoever else is interested in the project.

One of the things I'm looking at updating is the build system. Right now it is an artisanal handcrafted makefile, but I'd like to move it to something more maintainable / reasonable / portable, and I'm looking for suggestions. My current thought is actually autotools, because it's the de-facto standard in my field. Is CMake enough better than autotools that ignore that standard?

Relevant info: the project is about 12 kloc of C++, with a few extraneous files that it needs to be able to refer to. Also, this will be run primarily on old CentOS clusters and old Ubuntu desktops (my advisor runs 12.04), so I can't count on a recent CMake being easily installable.

Xarn
Jun 26, 2015

VikingofRock posted:

One of the things I'm looking at updating is the build system. Right now it is an artisanal handcrafted makefile, but I'd like to move it to something more maintainable / reasonable / portable, and I'm looking for suggestions. My current thought is actually autotools, because it's the de-facto standard in my field. Is CMake enough better than autotools that ignore that standard?
Yes!

VikingofRock posted:

Relevant info: the project is about 12 kloc of C++, with a few extraneous files that it needs to be able to refer to. Also, this will be run primarily on old CentOS clusters and old Ubuntu desktops (my advisor runs 12.04), so I can't count on a recent CMake being easily installable.

Lets make that a maybe. Downloading a current CMake binary generally works pretty well, is there a reason you cannot do that?

VikingofRock
Aug 24, 2008




Xarn posted:

Lets make that a maybe. Downloading a current CMake binary generally works pretty well, is there a reason you cannot do that?

Nah, that should work. Or, I guess if there's a problem with that, people can always build CMake from source. I was thinking that people would want to install it from their package managers, or use whatever is already on the cluster, but you are right--downloading the binary shouldn't be much of a hassle.

FlapYoJacks
Feb 12, 2009
What is the oldest cent distro you are using?

Edit*
To get Meson/Ninja working on Debian8, I did these steps:

Meson:
1) Downloaded Miniconda using This script .
2) Ran the script and installed it to /opt/python3.6.4/
3) Ran /opt/python3.6.4/bin/pip install meson
4) Added /opt/python3.6.4/bin/ to my path
5) Tarred /opt/python3.6.4/ and added it to the vagrant project.

Ninja:
1) Downloaded ninja from This link
2) Ran './configure.py --bootstrap'
3) copied the resulting ninja binary into /usr/bin
4) Backed up the ninja binary to the vagrant project.

FlapYoJacks fucked around with this message at 19:57 on Apr 5, 2018

Bonfire Lit
Jul 9, 2008

If you're one of the sinners who caused this please unfriend me now.

VikingofRock posted:

old Ubuntu desktops (my advisor runs 12.04)
Your advisor should upgrade, 12.04 isn't getting security updates anymore.

JawnV6
Jul 4, 2004

So hot ...
why are you replacing something that works

FlapYoJacks
Feb 12, 2009

JawnV6 posted:

why are you replacing something that works

Maintainability/extensibility/others probably need to actually look/change it?

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
Our build system "works" and needs to be replaced badly

VikingofRock
Aug 24, 2008




ratbert90 posted:

What is the oldest cent distro you are using?

Edit*
To get Meson/Ninja working on Debian8, I did these steps:

Meson:
1) Downloaded Miniconda using This script .
2) Ran the script and installed it to /opt/python3.6.4/
3) Ran /opt/python3.6.4/bin/pip install meson
4) Added /opt/python3.6.4/bin/ to my path
5) Tarred /opt/python3.6.4/ and added it to the vagrant project.

Ninja:
1) Downloaded ninja from This link
2) Ran './configure.py --bootstrap'
3) copied the resulting ninja binary into /usr/bin
4) Backed up the ninja binary to the vagrant project.

CentOS 6.6. And thanks for the instructions! Neither seems too bad.

Bonfire Lit posted:

Your advisor should upgrade, 12.04 isn't getting security updates anymore.

I know, and I've tried convincing her to update, but it's a losing battle. She's convinced that everything will break upon updating, which is a valid fear, because in my experience astonomy tools are notorious for breaking on OS updates and Ubuntu specifically seems to have more problems with updates than other distros. And she's more loathe to deal with that than she is worried about some nebulous security threats. I'm meeting with her this afternoon; I'll pester her about it again then and maybe I can convince her to update.

Ranzear
Jul 25, 2013


I love not having tab completion in sftp or scrolling in top.

fritz
Jul 26, 2003

VikingofRock posted:

She's convinced that everything will break upon updating,

She's not wrong, can you get a second machine for her to transition to?

VikingofRock
Aug 24, 2008




fritz posted:

She's not wrong, can you get a second machine for her to transition to?

I mean, she's my advisor, usually she's the one getting me machines if anything. Probably when I graduate this summer she'll put some of her newly-freed-up grant money towards a new computer, so really this particular problem will probably fix itself then.

UraniumAnchor
May 21, 2006

Not a walrus.
I have uncovered hell, and it is timezones.

As part of a system upgrade, we discovered that some of our timezone files were out of date. Specifically, trying to set a particular new timezone in Russia would cause truly nasty things to happen, as in the page straight up would throw errors rather than loading because reasons.

Anyway, so they update the timezone files, build new info, update the libraries, and it fixes that timezone. All done, right?

Enter Buenos Aires. In the previous timezone files, it was marked thusly:

code:
-3:00    Arg    AR%sT
More on why that's already bad in a minute, but let's get to the new problem.

When we updated the timezone files, for whatever reason they switched Buenos Aires to this format:

code:
-3:00    Arg    -03/-02
See the %s and the slash? That means that the timezone in question has a DST switchover. The %s gets replaced with either S or D, and the slash means 'use the first when DST is off'.

Here's the thing:

Argentina doesn't observe DST and hasn't for nearly a decade. The most recent I can find is that San Luis briefly experimented with it back in 2009 and enough people hated it that they stopped. So since 2009, all of Argentina is in "ART", or -3.

This means that there is no rule in the IANA files for when DST begins and ends, because it's currently not observed at all.

Now, the timezone library we were using to parse all this out, it has some code to handle the case of a timezone being marked as observing DST, but having no rules defined for when the switchover happens. DST is just assumed to be off all the time.

If the zone DST is defined using the %s format.

There is a bug in the library that causes the retrieval of the timezone abbreviation to fail. Specifically, it tries to access the DST switchover rule, but the switchover rule does not exist, and it chokes. There is a null check in the case of %s format, but not the split slash format. Adding a null check and falling back to 'DST always off' like the %s format fixed the problem.



After figuring all this out and fixing the problem so the page actually loads, I went and checked to see where in our code it was trying to load the time zone and see what it was doing with it.

It only cared about the minute offset, and immediately threw the abbreviation away. We never even use the data it was choking on trying to retrieve.

:suicide:

Bongo Bill
Jan 17, 2012

"Falsehoods programmers believe about time zones"

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
Time is an abomination. The universe would be much easier to program if everything happened simultaneously.

dis astranagant
Dec 14, 2006

https://www.youtube.com/watch?v=-5wpm-gesOY

Absurd Alhazred
Mar 27, 2010

by Athanatos
It'll all become easier once everyone's moved to DNT.

Xerophyte
Mar 17, 2008

This space intentionally left blank
I for one write all my date and time operations exclusively in the french revolutionary calendar and swatch internet time. Happy .beat 279 of 18 Germinal!

Xerophyte fucked around with this message at 05:45 on Apr 7, 2018

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

quote:

code:
# From Paul Eggert (2018-01-23):
# Perhaps San Luis operates on the legal fiction that it is at -04
# with perpetual daylight saving time, but ordinary usage typically seems to
# just say it's at -03; see, for example,
# [url]https://es.wikipedia.org/wiki/Hora_oficial_argentina[/url]
# We've documented similar situations as being plain changes to
# standard time, so let's do that here too.  This does not change UTC
# offsets, only tm_isdst and the time zone abbreviations.  One minor
# plus is that this silences a zic complaint that there's no POSIX TZ
# setting for time stamps past 2038.

# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
#
# Buenos Aires (BA), Capital Federal (CF),
Zone America/Argentina/Buenos_Aires -3:53:48 - LMT	1894 Oct 31
			-4:16:48 -	CMT	1920 May    # Córdoba Mean Time
			-4:00	-	-04	1930 Dec
			-4:00	Arg	-04/-03	1969 Oct  5
			-3:00	Arg	-03/-02	1999 Oct  3
			-4:00	Arg	-04/-03	2000 Mar  3
			-3:00	Arg	-03/-02

i'm sorry, but whatever paul eggert says your time is, that's what your time loving is

Nude
Nov 16, 2014

I have no idea what I'm doing.
I am curious on what kind of app someone is writing where historians are calling you, seemingly out of the blue, going uh by the way...

I'm just imagining a historian making a profile and going gently caress this is the wrong calendar I can't role play as King Henry the 8th now.

UraniumAnchor
May 21, 2006

Not a walrus.

DELETE CASCADE posted:

i'm sorry, but whatever paul eggert says your time is, that's what your time loving is

I dug a little further and the updated files have Argentina divided into 12 sub-zones, 9 of which don't use DST at all and 3 that do.

Everything I've found elsewhere indicate that all of Argentina is -3 all the time, including a couple people I know who actually live there. :shrug:

Nude posted:

I am curious on what kind of app someone is writing where historians are calling you, seemingly out of the blue, going uh by the way...

I'm just imagining a historian making a profile and going gently caress this is the wrong calendar I can't role play as King Henry the 8th now.

I'm sure SOMEBODY must use the historical data for something but I imagine it's 100% useless for 99.9% of people who just wanna know what loving time to show their users RIGHT NOW.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Nude posted:

I am curious on what kind of app someone is writing where historians are calling you, seemingly out of the blue, going uh by the way...

I'm just imagining a historian making a profile and going gently caress this is the wrong calendar I can't role play as King Henry the 8th now.

I guess your name isn't Bill or Ted.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

UraniumAnchor posted:

I'm sure SOMEBODY must use the historical data for something but I imagine it's 100% useless for 99.9% of people who just wanna know what loving time to show their users RIGHT NOW.

What a weird outburst. Historical data just changed: we're not talking ancient history, a change happened what, two weeks ago? Do you want to show wrong timestamps for last month's events?

UraniumAnchor
May 21, 2006

Not a walrus.

hackbunny posted:

What a weird outburst. Historical data just changed: we're not talking ancient history, a change happened what, two weeks ago? Do you want to show wrong timestamps for last month's events?

When I say history I mean the parts of the data that fall under 'we have no events in the app that are this old'.

The frustration is more because it's apparently not even completely correct for parts of Argentina NOW.

nielsm
Jun 1, 2009



TooMuchAbstraction posted:

Time is an abomination. The universe would be much easier to program if everything happened simultaneously.

Definitely. We would also not care much about halting problems or P-NP questions.

EssOEss
Oct 23, 2006
128-bit approved

Tom says a naughty thing there and says that Unix timestamp is the solution to leap seconds but it definitely is not. Unix time does not have leap seconds - it is a count of seconds since January 1 1970 minus the leap seconds!

iospace
Jan 19, 2038


Timezones are the devil and if you're rolling your own library, congrats, you've stared into the abyss and it's stared back.

xtal
Jan 9, 2011

by Fluffdaddy

TooMuchAbstraction posted:

Time is an abomination. The universe would be much easier to program if everything happened simultaneously.

Thanks, I just understood the plot of Final Fantasy eight. Ultimecia is a programmer

UraniumAnchor
May 21, 2006

Not a walrus.

iospace posted:

Timezones are the devil and if you're rolling your own library, congrats, you've stared into the abyss and it's stared back.

Definitely not rolling my own library, but after realizing this one's got this stupid bug in it and hasn't been updated in years I'm going to look into switching to something else.

Munkeymon
Aug 14, 2003

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



iospace posted:

Timezones are the devil and if you're rolling your own library, congrats, you've stared into the abyss and it's stared back.

I think at that point you've leapt into the abyss yelling "this can't be that hard".

Ranzear
Jul 25, 2013

EssOEss posted:

Tom says a naughty thing there and says that Unix timestamp is the solution to leap seconds but it definitely is not. Unix time does not have leap seconds - it is a count of seconds since January 1 1970 minus the leap seconds!

It's the solution to leap seconds in the same way it's a solution to time zones: It just doesn't give a gently caress about them.

Which is great, because neither do I nor most of anybody else. Converting a unix timestamp to human readable and localized is a display issue, not an implementation issue. There can't be 'invalid' values or, particularly if using decimals, seconds that are longer than others.

Moar:
https://www.youtube.com/watch?v=84aWtseb2-4

Ranzear fucked around with this message at 19:28 on Apr 9, 2018

Jeb Bush 2012
Apr 4, 2007

A mathematician, like a painter or poet, is a maker of patterns. If his patterns are more permanent than theirs, it is because they are made with ideas.
not giving a gently caress about leap seconds would be if it was just a count of the number of seconds since Jan 1 1970, the unix timestamp explicitly does care about them (because it wants to be able to keep the 1 calendar day = 86400 seconds fiction)

double riveting
Jul 5, 2013

look at them go
The only correct time reference for use on Earth is Geocentric Coordinate Time, obviously.

Carbon dioxide
Oct 9, 2012

double riveting posted:

The only correct time reference for use on Earth is Geocentric Coordinate Time, obviously.

I'm more of a fan of Egocentric Coordinate Time.

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.

double riveting posted:

The only correct time reference for use on Earth is Geocentric Coordinate Time, obviously.

wikipedia posted:

It is equivalent to the proper time experienced by a clock at rest in a coordinate frame co-moving with the center of the Earth: that is, a clock that performs exactly the same movements as the Earth but is outside the Earth's gravity well.

Am I reading it right that this means a second on the surface on the earth is some different amount of time than a second in this system?

Absurd Alhazred
Mar 27, 2010

by Athanatos

KernelSlanders posted:

Am I reading it right that this means a second on the surface on the earth is some different amount of time than a second in this system?

Yeah. Time doesn't move the same speed at different places in the gravity well. Or, rather, if you try to synchronize clocks along a gravity well, you have to consider the one further in as slower.

MononcQc
May 29, 2007

Ranzear posted:

It's the solution to leap seconds in the same way it's a solution to time zones: It just doesn't give a gently caress about them.

Which is great, because neither do I nor most of anybody else. Converting a unix timestamp to human readable and localized is a display issue, not an implementation issue. There can't be 'invalid' values or, particularly if using decimals, seconds that are longer than others.

if you pick 1970/01/01T00:00:00Z as a UTC timestamp and convert that precisely to a unix epoch, you should technically get -27 as a value. If you use UTC formatting to validate the input to your internal epoch conversion and that you use an unsigned integer, you underflow and get millenias in the future.

There's suspicions that this is what ended up bricking a bunch of iPhones a few years ago: https://www.theguardian.com/technology/2016/feb/12/setting-the-date-to-1-january-1970-will-brick-your-iphone-ipad-or-ipod-touch

Adbot
ADBOT LOVES YOU

rarbatrol
Apr 17, 2011

Hurt//maim//kill.

KernelSlanders posted:

Am I reading it right that this means a second on the surface on the earth is some different amount of time than a second in this system?

Even satellites in Earth's orbit need to account for this to get the accuracy we expect, due to their velocity.

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