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.
 
  • Locked thread
Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

HoboMan posted:

i figure jquery is good and has better defined behavior, but my biggest problem is with the .val() method.
it don't feel good to use
JavaScript code:
$("#myTurdColor").val("brown");
to assign when i could be doing
JavaScript code:
document.getElementById("myTurdColor").value = "brown";
i guess could just do
JavaScript code:
$("#myTurdColor")[0].value = "brown";
but that kinda defeats the purpose of using jquery

in the modern web that's actually a false assumption assuming you prefer things to fail loudly. look up youmightnotneedjquery.com for alternative of doing what it does. it'll usually be more verbose but as far as compatibility if you target IE10 and up you'll have little issue with cross compatibility. the benefit of using native Dom is if you typo selectors, generally the code will fail at some point and tell you why.

Jquery code adopts the keep on trucking mentality of much of the web, so you may think you just did 5 operations on a bunch of DOM elements, but actually you just ran 5 operations on a blank selector, or bound events to a blank selector.

if you're interested in learning, try to explore non jquery ways of doing things. if you just wanna hammer things together, JQuery is fine, just remember to be wary about silent failures, so be real particular about reading your code when debugging.

Adbot
ADBOT LOVES YOU

HoboMan
Nov 4, 2010

thank you, it looks like i would really prefer not using jquery then because elements not existing kinda makes everything break and i like things complaining about that.
my target is specifically ie8 though.

also: i noticed all this code assumes element.value is a thing but according to w3 spec it's actually element.nodeValue
could this be my problem? can i just make up new properties by going element.myProp = "fart";
the only indications i have that this might work is this code i'm looking at, i can't find anything online

HoboMan fucked around with this message at 23:13 on Apr 29, 2016

MeruFM
Jul 27, 2010
i thought the web is a failure because of IE6

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
You can put random crap on DOM objects but that doesn't mean it'll do anything. use setAttribute and getAttribute if you want to change one of the attributes on the DOM element. .value is fine. if you're targeting IE8 you should probably just be more fastidious with jquery rather than doing the DOM manually, in that territory there are far more gotchas, it's not too bad but if you don't know what to look for you'll just be wasting your time.

Soricidus
Oct 21, 2010
freedom-hating statist shill

MeruFM posted:

i thought the web is a failure because of IE6

ie6 was the hitler in the axis of the web. undeniably evil, but even if you'd killed it before it had a chance to rise to power, you're still going to end up with genocidal fascists everywhere

Corla Plankun
May 8, 2007

improve the lives of everyone

kalstrams posted:

hm, thats a good call. ill check this and plugins, and maybe then i can plot obscene amounts of data at once

just read it line by line instead of all at once and hopefully your plotter understands generators

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Vanadium posted:

ohai.path

not everything that has .com in it is a website

shut up ruby is awful i shouldn't have to truth test whether a url has been parsed it should do the reasonable thing and throw an exception if it fails. otherwise there should be a separate url.parse that's more tightly scoped to urls that conform to "#{scheme}://#{host}:#{port}"

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?

JawnV6 posted:

what CAD do you mean? VLSI DRC is tuned to be so obnoxious as to require waivers. EE CAD will let you route acute angles that will cause silkscreening issues, or run a ground trace right under a crystal. ME CAD systems have 'designer modes' with unrealizable 2d NURBS, even after being banged into a non-intersecting geometry you still need a DFM review by a tooling expert. i think solidworks still balks at an extruded figure-8's midpoint.

they're safety nets, and poor ones that still require human experts to cover the gaps

that's exactly the sort of thing I mean: producing big visible errors on invalid markup, instead of just trying to produce some "reasonable" interpretation of the input, would have been better for everyone

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?

Barnyard Protein posted:

what is the standard procedure for reviewing software design?

this is a question the industry has been asking since software was first written

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?

Doublethink
Sep 11, 2001

Umpossible my dear fellow, simply umpossible
Ran across this today,

code:
 var r = new Random(int.Parse(Guid.NewGuid().ToString().Substring(0,8), System.Globalization.NumberStyles.HexNumber));

cinci zoo sniper
Mar 15, 2013




Corla Plankun posted:

just read it line by line instead of all at once and hopefully your plotter understands generators
im reading line by line, but before plotting i need to run bunch of math over the giant array, which is where the devil hides. unless im low on bits somewhere, not going to bother with it this evening.

weird
Jun 4, 2012

by zen death robot

Blinkz0rz posted:

shut up ruby is awful i shouldn't have to truth test whether a url has been parsed it should do the reasonable thing and throw an exception if it fails. otherwise there should be a separate url.parse that's more tightly scoped to urls that conform to "#{scheme}://#{host}:#{port}"

why would uri.parse throw an exception when it successfully parses a uri

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

Doublethink posted:

Ran across this today,

code:
 var r = new Random(int.Parse(Guid.NewGuid().ToString().Substring(0,8), System.Globalization.NumberStyles.HexNumber));
cool, that looks like a thing i wrote the other day
code:
[int]($req.Entries | Select-Object @{E={$_.Attributes['gidnumber'].getvalues('string')};Name="gid"} | Sort-Object "gid" -Descending).gid[0]+1

Soricidus
Oct 21, 2010
freedom-hating statist shill

Blinkz0rz posted:

shut up ruby is awful i shouldn't have to truth test whether a url has been parsed it should do the reasonable thing and throw an exception if it fails.
uris behave exactly the same way in java and probably every other language too. that's the obvious interface to provide, given how they're defined.

Blinkz0rz posted:

otherwise there should be a separate url.parse that's more tightly scoped to urls that conform to "#{scheme}://#{host}:#{port}"
yeah, java does have this too though and it's probably bad if ruby doesn't

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

weird posted:

why would uri.parse throw an exception when it successfully parses a uri

i've never come across a situation in any language where i used a uri.parse method for anything other than urls and you probably haven't either

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Soricidus posted:

yeah, java does have this too though and it's probably bad if ruby doesn't

ruby is loving godawful and i hate every day that i have to write it

Progressive JPEG
Feb 19, 2003

i thought it was already back out of fashion tho?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Blinkz0rz posted:

i've never come across a situation in any language where i used a uri.parse method for anything other than urls and you probably haven't either

Blinkz0rz posted:

i've never come across a situation in any language where i used a uri.parse method for anything other than urls and you probably haven't either

guess you've never used ojective c

brap
Aug 23, 2004

Grimey Drawer

HoboMan posted:

so i have a javascript best practices (lol) question: should i try to do everything with jquery objects rather than just directly using dom objects when i'm messing with the html or should i prefer using dom objects over jquery or does it not matter at all?

use the standard dom API as a first resort. if you need crazy jquery selectors to make your page work, you are doing something bad

Progressive JPEG
Feb 19, 2003

MALE SHOEGAZE posted:

guess you've never used ojective c

thank god

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

MALE SHOEGAZE posted:

guess you've never used ojective c

idgi

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?

someone's confused about the difference between the language and the frameworks

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i was gonna say 'i guess someone has never used foundation' but i figured someone would say 'idgi'

redleader
Aug 18, 2005

Engage according to operational parameters
jquery is a much nicer api to use than the standard dom imo

e.g.
JavaScript code:
el.insertAdjacentHTML('afterend', htmlString);
that's just nasty

fritz
Jul 26, 2003

terrible programmer sighted: https://medium.com/@raymondchandler/down-and-out-in-the-magic-kingdom-92b0a715778f#.goh7nwgy3

distortion park
Apr 25, 2011



this essay really goes places

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
what a wonderful chain of bad decisions

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

MALE SHOEGAZE posted:

i was gonna say 'i guess someone has never used foundation' but i figured someone would say 'idgi'

still don't get it???????

weird
Jun 4, 2012

by zen death robot

Blinkz0rz posted:

i've never come across a situation in any language where i used a uri.parse method for anything other than urls and you probably haven't either

i mean if you want urls then wanting a url parsing function is fine and it is weird if ruby doesn't have one regardless. saying that the function uri.parse should actually be a url parser that throws on valid uris is braindead. you asked it to parse a uri and it parsed a uri

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
i'm just saying that in my many years of programming i've never had to parse a uri that wasn't a url

weird
Jun 4, 2012

by zen death robot
sure, but that doesn't change what a uri is. you asked it to parse a uri and it parsed a uri. getting mad that ruby doesn't have a url parsing function makes sense, but there wasn't any silent failure

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
it's cool that you're being pedantic in the terrible programmers thread

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

Blinkz0rz posted:

it's cool that you're being pedantic in the terrible programmers thread
agreed unironically :munch:

Soricidus
Oct 21, 2010
freedom-hating statist shill
"it's dumb that this function implements the full standard instead of only handling the particular special case i happen to care about"
-- someone who is posting in the right thread

ErIog
Jul 11, 2001

:nsacloud:

Blinkz0rz posted:

i'm just saying that in my many years of programming i've never had to parse a uri that wasn't a url

Yeah, it would be nice if there was a built-in URL parser in Ruby. It's stupid to parse "foo.com" with a URI parsing function, though, and then get mad when it doesn't give you back stuff like the port and the scheme when that information was never provided to the parsing function in the first place.

How would the parser know if the scheme is supposed to be HTTP or HTTPS (or literally anything else)? If it doesn't know the scheme then how could it possibly begin to even assume anything about the port?

Ruby's not great, but it not assuming everything is HTTP on port 80 for URI's is not what I would consider one of its major flaws.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Blinkz0rz posted:

i'm just saying that in my many years of programming i've never had to parse a uri that wasn't a url

relative paths

weird
Jun 4, 2012

by zen death robot

Blinkz0rz posted:

it's cool that you're being pedantic in the terrible programmers thread

i'm just saying that uri.parse should not throw an exception on a valid uri (it does throw on an invalid uri), and that calling it silent failure is objectively wrong

Valeyard
Mar 30, 2012


Grimey Drawer
ruby is real bad

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Blinkz0rz posted:

it's cool that you're being pedantic in the terrible programmers thread

no you're actually just extremely long

  • Locked thread