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
TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
I know some people who write modern idiomatic C++ and it is a terrifying sight to behold

Adbot
ADBOT LOVES YOU

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
this miserable pile of angle brackets and colons allegedly wraps a c function that uses setjmp/longjmp for error handling (lol libjpeg) such that it throws c++ exceptions instead and im not sure if it’s terrible or awesome

maybe “awful” in the olde English sense is the word I’m looking for

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Slurps Mad Rips posted:

This is actually pretty neat. setjmp/longjmp error handling in stuff like lua means you need to compile these C libraries as C++ just so destructors run and that's a nightmare. That said, this code is deffo c++11/c++14. result_of_t was deprecated in c++17 and removed for c++20.

A more "modern" code example would look like this. i probably hosed up the perfect forwarding for returning a value but who cares you get the idea

it's a few years old yeah. still, c++ generics just look like :pwn: to me

e: the same guy has also written a good deal of video dsp code that uses c++ templates in combination with assembler intrinsics and there's just something vaguely unsettling about that to me

TheFluff fucked around with this message at 15:23 on Aug 16, 2018

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
https://twitter.com/felixrieseberg/status/1032642127178547201

gary bernhardt's The Birth and Death of Javascript was intended and received as a joke, but it was actually incredibly on-point and deeply prophetic. this is the future now. dehumanize yourself and face to javascript

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
laptops are the loving worst. if you work with computers your employer should at the very least have the god damned decency to provide you with a workstation - a real computer that can actually use its cpu without thermal throttling after thirty seconds, and that you can actually repair, not one of these small plastic toys urging you to bring work with you wherever you go. for too long we have accepted the mountain coming to muhammad as natural. physically leaving your desk should be equivalent to mentally leaving work behind. bringing your loving laptop with you is dysfunctional as gently caress.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
ban laptops

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
or at least impose heavy tax penalties on them, gently caress

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Luigi Thirty posted:

you write one template function in C++ and suddenly your whole world is internal compiler errors when it breaks
tiny brain: uses preprocessor macros as poor man's generics
ascended brain: uses C++ templates for generics
galaxy brain:
code:
#define BUILDER_MEMBER(type, name) \
  template <class T> \
  auto set_##name(T &&val) -> decltype(*this) { name = std::forward<T>(val); return *this; } \
  type name;

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
the first programming thing i learned was regular expressions. i was 9 or 10 years old at the time - my dad taught me. to this day i maintain that it really wasn't a bad place to start thinking abstractly about a single symbol being a representation of some other set of symbols. i didn't learn anything about state machines until over a decade later though.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
proponents of vim/emacs will claim that learning them properly lets you edit that much faster by learning keyboard shortcuts for everything and that anyone who wants to be good at touching computers should spend time to learn proper tools for it. these people also tend to be very mad about things like tab order in forms in various applications, etc. there also tends to be a strong overlap between these and people who complain about modern computers being slow.

and sure, they have a point. if you learn an unintuitive keyboard interface well, you can get very fast at doing whatever it is designed to do. however, very few people actually want to spend a lot of time imprinting shortcuts for a very specific editor (probably with a very specific config too) into muscle memory, not even people who spend most of their work time with a single tool. in user interfaces, flexibility and intuitiveness has turned out to be far more important than how efficient you can get at using the interface if you spend a lot of time training with it.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
if you defend vim/emacs you are in the same boat as noted dead rear end in a top hat erik naggum, who in 1997 wrote

quote:

what makes _me_ sad is the focus on "most folks" and "Joe Sixpack".

why are we even _thinking_ about home computer equipment when we wish to
attract professional programmers?

in _every_ field I know, the difference between the professional and the
mass market is so large that Joe Blow wouldn't believe the two could
coexist. more often than not, you can't even get the professional quality
unless you sign a major agreement with the vendor -- such is the investment
on both sides of the table. the commitment for over-the-counter sales to
some anonymous customer is _negligible_. consumers are protected by laws
because of this, while professionals are protected by signed agreements
they are expected to understand. the software industry should surely be no
different. (except, of course, that software consumers are denied every
consumer right they have had recognized in any other field.)

Microsoft and its ilk has done a marvelous job at marketing their software
in the mass market so that non-professional programmers pick them up and
non-programmers who decide where the money should be wasted will get a warm
fuzzy feeling from certain brand names. I mean, they _must_ recognize that
nothing else they buy for their company is advertised in the newspapers
that morning and they aren't swayed by consumer ads when they buy office or
plant equipment, are they? so _why_ do they swallow this nonsense from the
mass-marketing guys hook, line, and sinker?

they don't make poles long enough for me want to touch Microsoft products,
and I don't want any mass-marketed game-playing device or Windows appliance
_near_ my desk or on my network. this is my _workbench_, dammit, it's not
a pretty box to impress people with graphics and sounds. when I work at
this system up to 12 hours a day, I'm profoundly uninterested in what user
interface a novice user would prefer.

I'm reminded of the response to how people of little or no imagination were
complaining about science fiction and incredibly expensive space programs:
"the meek can _have_ the earth -- we have other plans".

no, this is not elitist, like some would like to believe in order to avoid
thinking about the issues. this is just calling attention to the line
between amateurs and professionals, between consumers and producers, that
is already there in _every_ field. I want people to wake up to this
difference and _reject_ the consumer ads when they look for professional
tools. if it's marketed to tens of millions of people, it is _not_ for the
professional programmer, and not for you. if its main selling point is
novice-friendliness, ignore it unless you _are_ a novice. (and if you are
a novice trying to sell your services in a professional market, get the
hell out of the way.)

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
writing any kind of moderately complex gui app is a pain in the rear end in pretty much any plang I can think of. javascript as a language is bad but you can't really blame it for the fact that managing a spaghetti mess of stateful garbage is just really obnoxious in general.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
https://json-schema.org/

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

cinci zoo sniper posted:

i know about it. the real world adoption rate is 0, as far as i am concerned

i provided schema files for an api we provided to an outside contractor but i don't think they used those

i used it in our own tests though

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
if you want a more expressive type system for your serialization format, just use protobufs. of course, it's not as portable, but that's the price you pay for complexity. in both xml and json you soon land in having to serialize almost everything as a string anyway.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

prisoner of waffles posted:

hoo doggy :rip:

give temporal_tables a look? http://clarkdave.net/2015/02/historical-records-with-postgresql-and-temporal-tables-and-sql-2011/

I've never implemented "table w/ full change history" but wow testability goes up when a system component doesn't have DateTime.Now() hardcoded in several magical places

temporal/system-versioned tables are extremely cool and good. I've only used them in production in MSSQL tho (where they come builtin these days), but the functionality is so loving useful and saves you a ton of time and manual wrangling if you have almost any kind of slowly-changing dimension or need for auditing or whatever. best thing is, you can just add it to an existing table and blammo, now you have change tracking for very little cost, while to any regular user the table appears and works exactly like it always did before.

TheFluff fucked around with this message at 21:39 on Nov 1, 2018

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

CRIP EATIN BREAD posted:

Just keep in mind that jOOQ is NOT an ORM. It simply creates some implementations of a "Table" class that allows you to write SQL in typesafe manner.
this is the correct thing to do. some people claim that it's dumb to have a query builder API in your application language because SQL is already a DSL designed for that purpose. "if you want something more complex than a simple select, just write raw sql", they say. they are wrong. it is because SQL is a DSL made for writing queries that it lacks the kind of reflection (or metaprogramming, I guess) needed to make the programs (queries) you are writing composable and extendable. there's no straightforward way to build queries programmatically in SQL itself so you have to do it in a higher level language. SQL is really cool and good when you add the ability to make small parts (like joins or subqueries or what have you) reusable and query building composable.

sqlalchemy for python also uses this philosophy, and it is good.

watching django turn my elegant delete() on a queryset into a SELECT followed by an UPDATE to enforce an ON DELETE SET NULL constraint (why? the constraint is in the database! mind your own drat business and let postgres do its job!) finally followed by a DELETE makes me depressed. how on earth are you supposed to write transaction safe code with this kind of circus going on?!

TheFluff fucked around with this message at 00:00 on Nov 2, 2018

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
i have Opinions about sql

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Finster Dexter posted:

What did you do with a postgres table before sql support?

relational databases as a concept predate sql (of course - you don't write a dsl for querying databases if you don't have any databases to query), and the original postgres research project predates the sql standard as far as I know.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
re: julia, this is from 2014 but it's not encouraging

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
https://twitter.com/garybernhardt/status/600783770925420546

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
the empty freetext search box is the original sin of computer user interface design. such a simple and seemingly innocent thing, and yet it is a constant reminder of the monumental hubris of techbros. the foundation of human knowledge is not the nerd virtue of being able to remember endless bits of pointless trivia, but rather systematic classification. organizing and cataloging information is a skill as old as writing itself, and here we are supposed to ignore all advances in the field since the dawn of time and instead blindly hope we remember the incantation necessary to coax some idiot scoring algorithm into coughing up a somewhat related result. it is fundamentally anti-intellectual. death to freetext search, all hail archival science.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Captain Foo posted:

ok vannevar
Bush Was Right

seriously though if anyone hasn't read As We May Think yet you should, it is good

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
the search box is bad because it hampers association when a good search tool should encourage and exploit it

is what vannevar bush would have said, and he would have been right

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

ComradeCosmobot posted:

as opposed to remembering the special incantation needed to remember where something is classified

ontology alignment is hell

yospos is not the place to post nuanced takes but if i were in a charitable mood i guess i might concede that the problem is really more like having a freetext search as the only significant tool you can approach your index with

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

gonadic io posted:

stuff like slack now has free text field and the ability to set a bunch of parameters. it's not like i understand the core problem here well but that seems like a nice middle ground

well, not really. if a search box lets you search for e.g. records in a given date range then that's very good but it's not the kind of free text box i'm harping about. free text search is a very blunt tool, or perhaps more aptly put, a way too sharp tool. it sorta works if you know exactly what you're looking for and can come up with sufficiently distinct keywords. it's almost useless for exploring a topic, finding related records, or cross referencing in general. again, it doesn't encourage association. one of the most heinous examples i can think of is spotify. their free text search is almost completely useless, of course, but what really pisses me off is that they have shittons of metadata that they do their best to stop you from exploring, because they want to show you their own "top recommendations" or whatever the gently caress the big record companies want you to listen to.

perhaps it is more symptom than disease, though. it's a very common programmer thing to not really think about record classification or metadata and just shovel user input into unstructured text fields - if you're lucky you get both creation and update timestamps (but almost never previous versions), and then a free text search is really the only way to approach your dataset (you can't even speak of an index). a humble tagging system is a very powerful search tool, but only if the metadata is carefully curated and maintained - ask any librarian. really, computer nerds ought to talk more to librarians and archivists.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
why do people not use interactive debuggers? literally my first instinct when i'm asking myself "hey hold on what's going on here" is to launch a debugger on it. meanwhile when i'm pairing with my coworkers they, like, start running tests and adding print() statements to poo poo, and when i ask them "hey can you run it in a debugger" they go "uuuuh, haven't really gotten around to setting that up...". even really experienced people who are definitely better programmers than me do it. weirds me the gently caress out.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
efficient engineering teams are all alike; each dysfunctional team is dysfunctional in its own way. thanks all for you're posting on the human condition.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

bob dobbs is dead posted:

they are all alike inasmuch they dont exist

and even if they did exist they would not be worth telling stories about, was what ol' Tolstoy was trying to say

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
there were many things that drove people to make everything a webapp but one of them is that native apps are only really native on one platform. writing good crossplatform gui apps that actually look and feel native on the supported platforms is a pain in the rear end. javascript is bad but so is wxwidgets.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Powerful Two-Hander posted:

sql server has a pivot function that can maybe be used for this to shift your rowset to columns so that an in() will work but I'll be damned if I know how to use it

you're already damned so maybe it will work for you though?

SQL code:
SELECT *
FROM terrible_children
WHERE terrible_children.id IN (
  SELECT unpivoted_child_id
  FROM terrible_parent
  UNPIVOT (
    unpivoted_child_id FOR child_id_col IN (
      child_id_1, child_id_2, child_id_3 /* ... */
    )
  )
  WHERE terrible_parent.id = :parent_id
)
not tested. buuuut it's sqlite so it doesn't matter, it doesn't have unpivot. when you use unpivot you get one row in the result for each unpivoted column. unpivoted_child_id becomes a column where the values from the unpivoted columns end up, child_id_col becomes a column where the name of the unpivoted column ends up.

either way OP said he wanted an actual join so this doesn't even do what i think he wants. if you only want columns from one of the tables though (that is, you're using the join only to check for existence in the related table), then you should usually use a semi-join instead (usually written as WHERE EXISTS (subquery goes here)). it's easier for the planner to optimize, it doesn't duplicate, and it's usually easier to write if you have a complex join condition.

TheFluff fucked around with this message at 14:32 on Nov 28, 2018

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
i've seen a table with a TEXT column containing a string with comma separated ID's for related records. the application would load the record, deserialize the id's into a list and do a select from the related table where id in(:psyduck:). i guess someone thought having a many-to-many join table with a lot of rows would be slow or something, but come on, at that point you might as well give up and use mongodb.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
"it made sense at the time", i'll cry when justice finally finds me and drags me to the unesco tribunal for terrible programmers to answer for my crimes. when the new york times covers it they'll write something about the banality of evil, probably.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Finster Dexter posted:

Exciting headlines on hacker news today for the Go community (not to be confused with Go!)

* We have a new blog post about Go 2. This version of Go will be much more community driven, so can't wait to see what the Go community can come up with!
* The Go community came up with a new fixed precision decimal library called Fixed. It's great and has hard-coded limitations to 7 decimal places and supports numbers up to 99 billion! (Perfect for Belize as the GDP is only about US$1.8b)

https://twitter.com/daemon404/status/1068195329890295808

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Kevin Mitnick P.E. posted:

"template metaprogramming is worth it to avoid a 16-byte overheard wrapping an int into an EpollFd"

C++ code:
template <class T = native_endian_t>
explicit constexpr uint48(uint64_t val,
                          typename std::enable_if<std::is_same<T, big_endian_t>::value>::type * = 0) :
	x{ get_u8(val, 2), get_u8(val, 3), get_u8(val, 4), get_u8(val, 5), get_u8(val, 6), get_u8(val, 7) }
{
}

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

bob dobbs is dead posted:

did you just tell me to gently caress myself

parental advisory: explicit constructors

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

AggressivelyStupid posted:

what the goddamn gently caress

source

it's from a class (in c++ a struct is a class but with all members default public) representing an endian-independent unsigned 48-bit integer. the template voodoo is there to select the correct constructor depending on the machine's native byte order, so if you pass it a native uint64 it'll do the right thing automatically without having to branch at runtime. the constexpr thing tells the compiler this code can be evaluated at compile time, so you can use this 48-bit int where a constant expression that is known at compile time is required. it also does this while being a "POD", plain old datatype, binary compatible with C interfaces.

i think. i'm not actually good at this, i just know people who expose me to this while claiming it has legitimate uses in video processing. i need to share the pain, sometimes.

TheFluff fucked around with this message at 03:42 on Dec 3, 2018

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Soricidus posted:

are there many computers left whose native byte order isn’t little endian?

no, but arm can at least in theory be run as either endianness. not sure if anyone actually does that tho.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
my current job has all kinds of mildly terrible programming but one thing that absolutely owns is that when you make a PR you can click a button and it will spin up a full test env running that branch with a full test db and everything for you. when the branch is merged or the PR closed it automatically kills the test env. very needs suiting.

Adbot
ADBOT LOVES YOU

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
incredibly hot take: realtime systems exist

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