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
gonadic io
Feb 16, 2011

>>=

Krankenstyle posted:

gonadic jo denial

monadic jo is principled jo, you can't escape out of it only >>= it

unless you use unsafePerformJo of course

Adbot
ADBOT LOVES YOU

Asleep Style
Oct 20, 2010

gonadic io posted:

monadic jo is principled jo, you can't escape out of it only >>= it

unless you use unsafePerformJo of course

That's how David Carradine died.

suffix
Jul 27, 2013

Wheeee!

Sagebrush posted:

i'm working on a project that needs to be able to detect the presence of one specific object in a video stream. imagine like jian-yang's hot dog/not hot dog software, essentially, but maybe even simpler because i'm looking for literally the same object over and over again instead of a general category of hot dogs. however, the object has a fairly complex shape and i need to be able to detect it from any angle.

i feel like this can be done fairly reliably today on desktop hardware with a well-trained neural network, but I don't know anything about what software i should be looking into. anyone got any names?

probably a small python script with keras or something? https://developers.google.com/machine-learning/practica/image-classification/

i haven't used the fast.ai library but from their posts they try to make it very easy to get something working with sensible defaults https://yashuseth.blog/2018/03/05/hotdog-or-not-hotdog-image-classification-in-python-using-fastai/

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


Asleep Style posted:

That's how David Carradine died.

i thought that was with some sort of multithreaded jo loop?

Carthag Tuek
Oct 15, 2005

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



Powerful Two-Hander posted:

i thought that was with some sort of multithreaded jo loop?

java.awt.HeadlessException

gonadic io
Feb 16, 2011

>>=

Krankenstyle posted:

java.awt.HeadlessException

runtime error: <<loop>>

(that's a legit GHC error message btw)

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

runtime error: <<loop>>

(that's a legit GHC error message btw)

bröther...

Carthag Tuek
Oct 15, 2005

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




oh man that reminds me of that game developer brøderbund.

i used to like playing Wings of Fury but then one of my friends said "propaganda piss" and i was like yea obviously and i kinda figured he had heard his dad say it or something. Anyway he's a racist now so :shrug:

also even though broderbund merely means brother-association, there is a fairly nazi odor about it
https://www.youtube.com/watch?v=YWsNqJ6YP88&t=115s

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Krankenstyle posted:

oh man that reminds me of that game developer brøderbund.

i used to like playing Wings of Fury but then one of my friends said "propaganda piss" and i was like yea obviously and i kinda figured he had heard his dad say it or something. Anyway he's a racist now so :shrug:

also even though broderbund merely means brother-association, there is a fairly nazi odor about it
https://www.youtube.com/watch?v=YWsNqJ6YP88&t=115s

Whoa that's way better looking than the version I used to play on Apple IIc.

Carthag Tuek
Oct 15, 2005

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



Finster Dexter posted:

Whoa that's way better looking than the version I used to play on Apple IIc.

tbf the amiga1000 is like 4 years newer than the appleiic

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
and also Apple II video was an amazing hack in 1977 when a literal few kilobytes of RAM was common, but by 1980 was laughably baroque and terrible

chunky pixels where the palette to use is influenced by the high bit of the byte with different lines in different areas of memory, what the hell Woz

Carthag Tuek
Oct 15, 2005

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



yeh, as long as you didnt have the amiga with the bad ram lol

Carthag Tuek
Oct 15, 2005

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



https://www.youtube.com/watch?v=vFh07lXfxTY

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

Finster Dexter posted:

Is this why game engines are written in c++? because they're literally programs that are generating specific game programs?

that, and the zero/predictable overhead. if c++ didn't have templates, game engines would be written in c

Asleep Style posted:

This is a really interesting post. Gonna have to think hard about if these are the type of problems I would like to have at my job.

if you ask me, c++ the language is perfect for any job. development is front-loaded with type system trickery and it tends to be pretty bottom up as a result, so you won't see your program come together for a long time, but letting the type system do most of the correctness work, I've written literally bug-free code under crazy time constraints and without the benefit of automated testing. I used to love c++ as a sort of intellectual game, but I've used it professionally for years now, and I've come to appreciate it as a unique and (currently) irreplaceable language

its weakest point is actually third party libraries: there isn't a standard anything. no standard build system, no standard library format, no standard repository, not even consistent coding conventions, and setting it all up is so hard and outside of most programmers' skills that a lot of libraries will have misguided "simplified" build systems or binary distributions. it's a lot of work setting up a project with several external dependencies

hackbunny fucked around with this message at 23:05 on Dec 1, 2018

akadajet
Sep 14, 2003


lol 50fps

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
gently caress yeah, procedural Copper lists.

I'm so totally over demoscene music, though.

Glorgnole
Oct 23, 2012

Glorgnole posted:

does anyone around here work with CUDA?

I have some code for integrating depth images into a truncated signed distance field that was developed under cuda 8.0, and I'd like to use it with cuda 10.0, but something broke between 8.0 and 9.2. no build or runtime errors, but the image data doesn't get integrated into the device memory anymore (i.e. it doesn't work, for mysterious reasons).

the project uses half floats pretty extensively so I suspect that there was a change to float-to-half conversion beyond the removal of the __float2half_rn() built-in. interesting in finding out if anyone else has run into this sort of thing, and where else to look for answers.

i figured this out eventually, meaning that i found someone who had run into the same problem and then did what they did (here, if you're curious), which boils down to representing the contents of each voxel as short2 on newer architectures and ushort2 on older ones.

my big takeaway is that CUDA device code is a giant flaming heap of "#if defined __CUDA_ARCH__ >= XXX" to work around the radically different behavior between different compute capabilities and releases

redleader
Aug 18, 2005

Engage according to operational parameters

hackbunny posted:

if you ask me, c++ the language is perfect for any job. development is front-loaded with type system trickery and it tends to be pretty bottom up as a result, so you won't see your program come together for a long time, but letting the type system do most of the correctness work, I've written literally bug-free code under crazy time constraints and without the benefit of automated testing. I used to love c++ as a sort of intellectual game, but I've used it professionally for years now, and I've come to appreciate it as a unique and (currently) irreplaceable language

yeah, but you're a bit of a special case because you extremely know your poo poo and have also internalised all the dark corners of c++ etc etc. i guarantee that if you set me or most of my coworkers loose on a c++ project that we wouldn't be able to write "bug-free code under crazy time constraints", even given a longass ramp-up time.

what about c++'s type system do you find so powerful? i personally haven't heard anything special about it, but that may just be because it's not new + cool. what makes c++ different to any other compiled, statically-typed language in this respect? why couldn't you do the same thing in e.g. java?

Volte
Oct 4, 2004

woosh woosh
compile-time safety in most languages means type safety. in c++, you have a whole metaprogramming layer above the type system that can encode arbitrary constraints.

VikingofRock
Aug 24, 2008




redleader posted:

yeah, but you're a bit of a special case because you extremely know your poo poo and have also internalised all the dark corners of c++ etc etc. i guarantee that if you set me or most of my coworkers loose on a c++ project that we wouldn't be able to write "bug-free code under crazy time constraints", even given a longass ramp-up time.

what about c++'s type system do you find so powerful? i personally haven't heard anything special about it, but that may just be because it's not new + cool. what makes c++ different to any other compiled, statically-typed language in this respect? why couldn't you do the same thing in e.g. java?

IMO one of the most interesting (and unique within mainstream languages) aspects of C++ types is allowing constants as template arguments. For example you can have a template representing an NxM element matrix, and then instantiate that with specific N and M values giving you e.g. a type representing a 2x3 matrix. Then, you can do compile-time operations on those arguments, like making it so a 2x3 matrix times a 3x1 matrix gives a 2x1 matrix. This enables all sorts of neat type-level programming, like ensuring that matrices have the correct dimensions, physical quantities have the correct units, etc. This can be pretty easy to abuse and write yourself into corners with (e.g. what if you need to incorporate a matrix whose size is determined at runtime?), but occasionally it is very useful.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
what tends to trip me up with c++ are all the subtle details you need to know that aren't warned about at all (at least when I was using msvc 5 years ago)

like, when you don't have a constructor it will autogenerate not 1 but 5 different ones for you. if you write one constructor yourself, well....better also write the 4 other ones because if you don't then things will behave subtly incorrectly at some point later in your program, etc

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

redleader posted:

what about c++'s type system do you find so powerful? i personally haven't heard anything special about it, but that may just be because it's not new + cool. what makes c++ different to any other compiled, statically-typed language in this respect? why couldn't you do the same thing in e.g. java?

I can encode state in a variable's type. thanks to zero overhead, I can do it without actually adding any state. thanks to move semantics, I can enforce state transitions. you can encode state as statically checked type in java too, but you'll have overhead and no real equivalent of move semantics. heck I can't even enforce non-null pointers in java (except with nonstandard annotations I guess). you can add a c++ wrapper in front of a c library/api, and express lots of constraints that are left implicit in c, and make them explicit and enforced at compile time, again with zero overhead compared to handwritten code

the irreplaceability of c++ comes from its ubiquity and the fact that it's largely binary-compatible with c. I think I already mentioned that my last big c++ job was a cross-platform application core that ran on three different operating systems (ios, android, windows) and implemented three different bridges to higher level languages (objective c++, jni, c++/cli), which no other language outside of c can realistically achieve

biggest issue in c++ is the extremely poor support for pattern matching: compile-time only, and even then mostly a hack. I'm not hopeful for the future either

The_Franz
Aug 8, 2003

hackbunny posted:

the irreplaceability of c++ comes from its ubiquity and the fact that it's largely binary-compatible with c.

rust has decent interoperability with c via the foreign function interface, but c++ isn't supported and you need rust bindings for whatever you want to use. libc has well supported "clean" bindings, but for other libraries it's a tossup. even if they exist, sometimes they will be someone's bespoke safe wrapper around the raw c library, which may or may not be documented, isn't guaranteed to be maintained and is certainly unsupported by the library authors if you run into bugs or need help

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

hackbunny posted:

you can add a c++ wrapper in front of a c library/api, and express lots of constraints that are left implicit in c, and make them explicit and enforced at compile time, again with zero overhead compared to handwritten code

this sounds like a neat idea but I never encountered something like this, most of the time I see is just a shallow wrapper to make everything more OOP or something

I'm familiar with a couple of instances where c++ forces you to be more explicit than c and I'm not sure how I feel about that. like you have to be a little more pedantic with casting and type signatures have to be more precise because of overloading

gonadic io
Feb 16, 2011

>>=

The_Franz posted:

rust has decent interoperability with c via the foreign function interface, but c++ isn't supported and you need rust bindings for whatever you want to use. libc has well supported "clean" bindings, but for other libraries it's a tossup. even if they exist, sometimes they will be someone's bespoke safe wrapper around the raw c library, which may or may not be documented, isn't guaranteed to be maintained and is certainly unsupported by the library authors if you run into bugs or need help

also definitely less powerful type system, so stuff like borrowing is baked into the compiler instead of being a library which I imagine it could be in c++. does have good pattern matching and build tools though

FlapYoJacks
Feb 12, 2009
I like that C++ forces you to be way more implicit when casting. The reasoning is two fold:

1) In most cases, you shouldn’t be casting, you should be setting your variables correctly to begin with.

2) static_cast<int> is easy to search for vs (int)

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

I have a terrible casting story: In my last job I noticed the ingress website would take numbers and cast them to floats and then decimals in sql. Most of the numbers where things like age, phone number and drivers license id numbers which meant a phone number like 123-4213-333 would get cast to 1234213333.0000000000001 and then recast as a decimal with very high precision but also 0 numbers are the decimal point.


its :psyduck: all the way down

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

Symbolic Butt posted:

this sounds like a neat idea but I never encountered something like this, most of the time I see is just a shallow wrapper to make everything more OOP or something

think unix, where file handles are simple ints, except there's nothing simple about them. not all files support all operations, some are special files that only work with a very specific set of functions (eg. ipc objects), and they represent resources that need to be managed somehow. not to mention how easily it is to pass an int around by mistake. on windows the situation is just as bad, as HANDLE is almost as vague as int (it's a typedef for void *), but it can represent dozens of different resources that have absolutely nothing to do with each other. with c++ you can wrap them in more agreeable types that can't be assigned by mistake, passed to the wrong functions by mistake, leaked by mistake etc. I tend to skip "official" c++ wrappers to popular libraries as they often are pretty misguided, eg. solving this issue with class hierarchies and virtual methods (pointless! it's not like the underlying c library lets you override the implementation so why bother with virtual?)

c++ is not unique in this (some of it, with significantly more effort, can be done even in C), but it's the most comprehensive I know of

Nomnom Cookie
Aug 30, 2009



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

akadajet
Sep 14, 2003

template metaprogramming is something i looked briefly into in college and decided to nope over to .net instead

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) }
{
}

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

TheFluff posted:

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) }
{
}

did you just tell me to gently caress myself

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

Nomnom Cookie
Aug 30, 2009



akadajet posted:

template metaprogramming is something i looked briefly into in college and decided to nope over to .net instead

extremely same op

AggressivelyStupid
Jan 9, 2012

TheFluff posted:

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) }
{
}

what the goddamn gently caress

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

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The good thing about c++ is that someone who really understands it can write abstractions the are only a little bit leaky. This means that you, as the person writing code to actually do a thing, can just use them without caring what's under the hood too much.

If you have someone who doesn't understand it that well or is just a little bit lazy writing your abstractions though, you're in for a bad time.

Nomnom Cookie
Aug 30, 2009



yeah it's a sword with no handle but it doesn't cut you very much if you're really good at holding it

Nomnom Cookie
Aug 30, 2009



TheFluff posted:

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.

POD doesn't apply to classes I think. that's the other difference between structs and classes

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill
are there many computers left whose native byte order isn’t little endian?

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