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
mystes
May 31, 2006

Deep Dish Fuckfest posted:

oracle is a law firm
lol I was thinking about posting this

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009
Why would anybody who isn’t working for Google use Go over Rust? :psyduck:

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

NihilCredo posted:

i once interviewed a poor young bastard who had been trained exclusively in xslt for ~3 years

like, i gave him my standard exercise (parse a list of names and generate a random family tree) and he spent 2 hours in total silence trying to do it in xslt. brain worms doesn't begin to describe how sad it was

we purposely trained him in xslt... as a joke

The Fool
Oct 16, 2003


FlapYoJacks posted:

Why would anybody who isn’t working for Google use Go over Rust? :psyduck:

go was forced on me by the nature of using hashicorp products

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
'tech company' is less a property of actual technology and more a profound wish to get bigger companies to be credible competitors so as to not be target of antitrust investigation

mystes
May 31, 2006

Cold on a Cob posted:

we purposely trained him in xslt... as a joke

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
xpath was probably the best of the xml-adjacent technologies. even 1.0 worked quite well as long as you weren't dumb enough to use xml namespaces, and 2.0 filled in a lot of the awkward gaps. it's definitely something that died because of the general backlash against xml rather than because of its own faults.

Shaggar
Apr 26, 2006
namespaces are fine

mystes
May 31, 2006

Namespaces are pointlessly inconvenient like 99.9% of the time

pseudorandom name
May 6, 2007

dpkg chopra posted:

string([local-name()='metadata']/*[local-name()='artist-list']/*[local-name()='artist'][1]/@id)

A statement dreamed up by the utterly deranged.

Web developers have played us for absolute fools.

isn't that equivalent to string(metadata/artist-list/artist[1]/@id) ?

Carthag Tuek
Oct 15, 2005

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



we had a "super user" meeting today to hear what they think of our website & one of them was this ancient dude like "i got my first job programming in 1964 :bahgawd:", he said he could help us with the code if we needed lol

also i have a habit of paraphrasing people's requests, and he'd be like "that's not quite what i said" but i think he might be on the spectrum

anyway it was actually good feedback

mystes
May 31, 2006

pseudorandom name posted:

isn't that equivalent to string(metadata/artist-list/artist[1]/@id) ?
aren't they different if they have a namespace?

FlapYoJacks
Feb 12, 2009
Namespaces suck and I have yet to see a good reason to use one other than in a library that other applications may use.

mystes
May 31, 2006

FlapYoJacks posted:

Namespaces suck and I have yet to see a good reason to use one other than in a library that other applications may use.
wait we're talking about xml namespaces here.... are you saying you think programming language namespaces are bad?!

Plorkyeran
Mar 22, 2007

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

mystes posted:

aren't they different if they have a namespace?

yes. bare "foo" matches an element named foo in the default namespace, while "local-name()='foo'" matches an element named foo in any namespace. it is hard to imagine when the latter would actually be what you want, but it's one of the cargo-culted solutions that people who don't understand xml namespaces tend to write because they can't figure out the correct way to do it.

(not understanding xml namespaces is pretty reasonable)

mystes
May 31, 2006

Plorkyeran posted:

yes. bare "foo" matches an element named foo in the default namespace, while "local-name()='foo'" matches an element named foo in any namespace. it is hard to imagine when the latter would actually be what you want, but it's one of the cargo-culted solutions that people who don't understand xml namespaces tend to write because they can't figure out the correct way to do it.

(not understanding xml namespaces is pretty reasonable)
The correct way being to go through a bunch of steps to set up namespaces in your xml parser first so your xml library will deign to allow you to use the namespace abbreviations?

dpkg chopra
Jun 9, 2007

Fast Food Fight

Grimey Drawer

pseudorandom name posted:

isn't that equivalent to string(metadata/artist-list/artist[1]/@id) ?

when I tried this it would not return any results unless I used the local-name flag

Plorkyeran
Mar 22, 2007

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

mystes posted:

The correct way being to go through a bunch of steps to set up namespaces in your xml parser first so your xml library will deign to allow you to use the namespace abbreviations?

yes. that's something which should be exactly one step (e.g. register_namespace("foo", "http://example.com/foo")) and featured very prominently in the library's getting started instructions, but generally is actually ten steps and never mentioned as a thing you need to do because all xml libraries are garbage for some reason.

Powerful Two-Hander
Mar 10, 2004

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


xslt is ok in moderation but beyond a certain point you have to ask yourself what the hell you're doing. I am fortunately blessed with a short attention span so this didn't take long for me.

speaking of convoluted bullshit though what's going on with JSON schema these days?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
i think the moment you write a recursive function is the moment it's time to use something other than xslt. it's cool and all that it's a pure functional programming language with tail recursion, but programming in xml is still terrible.

it's like regexes in that it can be way better than any other option in sufficiently simple scenarios but it scales up incredibly poorly

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
xml is a vision of lisp, through a glass darkly. if you need a good modern lisp its clojure or sometimes racket.

cool av
Mar 2, 2013

Plorkyeran posted:

yes. bare "foo" matches an element named foo in the default namespace, while "local-name()='foo'" matches an element named foo in any namespace. it is hard to imagine when the latter would actually be what you want, but it's one of the cargo-culted solutions that people who don't understand xml namespaces tend to write because they can't figure out the correct way to do it.

(not understanding xml namespaces is pretty reasonable)

uhh the latter would be what you want in every situation, actually

the person who cargo culted and doesn’t understand xml namespaces is the one who gave you xml that had namespaces in it in the first place

Just a Moron
Nov 11, 2021

dpkg chopra posted:

I honestly don't know, but the main function of the app is to take an input audio stream (originally the microphone, but any device can be selected), and detect whether a song is playing in it. My understanding from reading the comments to the code is that it does this by

1) downsampling the original stream,
2) slicing 12 second samples,
3) fingerprinting the middle of the sample, and
4) using that to query the Shazam api for any matches.

I would imagine it just runs the 12 second loop continuously without an error state, it either gets a hit back from Shazam or it doesn't.

So my first idea was to just change the "12 * 16000" mentions to "30 * 16000" in algorithm.rs. This compiled fine but when I ran the program, I would get an error about a mismatch between the source slice and destination slice. This led me to microphone_thread.rs, where I found a bunch of "12 * 16000" lines, which I also changed to "30 * 16000". This made the error go away, but now I don't get any matches, regardless of whether a song has been playing for over 30 seconds or not.

This is why you don't hardcode magic numbers. I don't know what namespace management looks like in rust but there should be some kind of global constant for sample time length.

You should check the Shazam api and make sure that's not relying on a particular sample sizes as well

redleader
Aug 18, 2005

Engage according to operational parameters
i'd rather write xslt than js tbh

Bloody
Mar 3, 2013

xml namespaces are extremely useful in xaml therefore xml namespaces are good

outhole surfer
Mar 18, 2003

redleader posted:

i'd rather write xslt than js tbh

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
i sort of love xslt actually but i can’t imagine ever introducing it into a project. maybe if development on it continued and we had xslt 6.9 and it was unambiguously always the best way to transform xml into different xml, but the thing that actually exists is an esolang that’s sometimes very good but all too often is actually kinda bad at the thing it’s supposed to be for

sb hermit
Dec 13, 2016





Plorkyeran posted:


sometimes very good but all too often is actually kinda bad

like my posts

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i loving hate xslt and do everything i can to avoid it. in contrast i think xml + xsd still has its uses.

is json schema still basically ignored and unloved or has it actually started to gain traction?

mystes
May 31, 2006

I like xml schemas in theory but I think the actual xsd syntax kind of sucks

Shaggar
Apr 26, 2006
ive never written an xsd by hand but i use them all the time.

json schema is exclusively used by visual studio for appsettings.json

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

mystes posted:

I like xml schemas in theory but I think the actual xsd syntax kind of sucks

it's not great but it's at least readable, unlike xslt or xpath (at least to me)


Shaggar posted:

ive never written an xsd by hand but i use them all the time.

json schema is exclusively used by visual studio for appsettings.json

still better than yaml tho

azure devops has me writing cursed poo poo like this now and i hate them for it:

YAML code:
condition: and(succeeded(), or(ne(${{parameters.Foo}},''), ne(${{parameters.Bar}},'')))

MrMoo
Sep 14, 2000

Cold on a Cob posted:


is json schema still basically ignored and unloved or has it actually started to gain traction?

it’s gone through many versions to start being useful, it’s in the right direction at least.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
i work on a thing that indirectly uses json schema and it’s a problem because apparently our not very complicated schema isn’t representable with json schema

Shaggar
Apr 26, 2006

Cold on a Cob posted:

it's not great but it's at least readable, unlike xslt or xpath (at least to me)

still better than yaml tho

azure devops has me writing cursed poo poo like this now and i hate them for it:

YAML code:
condition: and(succeeded(), or(ne(${{parameters.Foo}},''), ne(${{parameters.Bar}},'')))

oh yeah lol i use the "classic editor" in devops so i dont have to touch yaml

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

MrMoo posted:

it’s gone through many versions to start being useful, it’s in the right direction at least.

Plorkyeran posted:

i work on a thing that indirectly uses json schema and it’s a problem because apparently our not very complicated schema isn’t representable with json schema

good to know. i will continue deserializing and validating in-code then vOv

i have an external vendor that sends us garbage and i'd love to give them a schema and say "use that and if your poo poo fails to validate, fix it before you send it to us"

in retrospect, should have asked them to use xml + xsd

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Shaggar posted:

oh yeah lol i use the "classic editor" in devops so i dont have to touch yaml

isn't that going away?

i put up with yaml because being able to copy/paste outweighs the warts but goddamn is it terrible anyway

Shaggar
Apr 26, 2006
i dont think there are any plans to get rid of it mostly because afaict behind the scenes its yaml


also you can clone steps and stuff in it plus you can export and import entire pipelines to do the equivalent of copy/paste.

12 rats tied together
Sep 7, 2006

the only yaml part of that is that its a mapping, where the key is "condition" that maps to a string that is a godless abomination

Adbot
ADBOT LOVES YOU

Xarn
Jun 26, 2015

Blinkz0rz posted:

i don’t like a lot of go but error handling isn’t much different than checking exceptions except there’s no stacktrace

returning errors is just the same as not catching or re-throwing exceptions

This is the sort of galaxy brained take I come into this thread for.

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