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
The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

lol

Adbot
ADBOT LOVES YOU

Sapozhnik
Jan 2, 2005

Nap Ghost
[making inlining decisions based on the number of characters in the source text is a little goofy]

no poo poo...

Shaggar
Apr 26, 2006

lmao

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
*adds much-needed documentation to code*

*code magically gets faster*

Luigi Thirty
Apr 30, 2006

Emergency confection port.

CPColin posted:

You think that's bad, try doing that tutorial in Ceylon!

hmm

since a 3-vertex polygon is always planar shouldn't I be able to linear interpolate Z rather than running full calculations for every point inside the polygon

I need to do some more reading

CPColin
Sep 9, 2003

Big ol' smile.
I think the problem is that, for a triangle ABC, you have to interpolate between A.z and B.z and between A.z and C.z at the same time. I went around in circles for ages before I noticed the part where the three Z values are added together before being checked against the z-buffer.

But Ceylon manages to paint a 600x600 frame in only 2.5 seconds! Software rendering!

Sapozhnik
Jan 2, 2005

Nap Ghost

Luigi Thirty posted:

hmm

since a 3-vertex polygon is always planar shouldn't I be able to linear interpolate Z rather than running full calculations for every point inside the polygon

I need to do some more reading

Barycentric rendering is poo poo-slow yes.

Apply a perspective transform first to get screen X,Y co-ordinates (but keep the Z around because you'll need it later), then sort the triangle's vertices by Y co-ordinate. Split the triangle into an upper half triangle and a lower half triangle with a horizontal line running through the middle vertex as the common edge.

For each scan line in each half triangle, determine the start and end of the scan line using Bresenham's line drawing algorithm. Then you're just drawing a series of horizontal lines. Do your Z-buffer test for each pixel and then apply perspective-correct interpolation to whatever vertex attributes (texture co-ordinates u,v for texturing and/or normals for lighting) and then stuff those into your "pixel shader".

Sapozhnik fucked around with this message at 05:09 on Jul 19, 2016

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

working as intended to punish idiots who dont minify their scripts i have no idea if a tab is technically any more characters then a space

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

CPColin posted:

You think that's bad, try doing that tutorial in Ceylon!

i was thinking of looking into this because redhat but it doesnt really get me excited

Bloody
Mar 3, 2013

MALE SHOEGAZE posted:

working as intended to punish idiots who dont minify their scripts i have no idea if a tab is technically any more characters then a space

lol really

CPColin
Sep 9, 2003

Big ol' smile.

MALE SHOEGAZE posted:

i was thinking of looking into this because redhat but it doesnt really get me excited

The language has some neat ideas, but Eclipse definitely struggles to deal with it and it's type system is a pretty big drain on my laptop's limited resources, regardless of whether I compile for JavaScript or the JVM. I definitely like the concept of having certain parts of a codebase compile for both platforms and, in theory, act the same, but I think the language tools need some polish.

Xarn
Jun 26, 2015

qntm posted:

so

literally every single piece of example code involving a C++ iterator is wrong

Nah, its a rare case of hackbunny being wrong (or it mightve been that way in older C++, Ill admit I am a bit hazy on standards before C++11)

Different fun thing though, user defined iterators are allowed to overload the "," (comma) operator. :v:
This means that this
code:
for (;...; ++iter1, ++iter2) {)
might do something weird. The solution? Cast one of them to void, so the overload doesn't apply to the expression. :suicide:

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?

Mr Dog posted:

just cut to the chase and create a single FACTS(ID, KEY, VAL) table

who needs SQL anyway!

but if you choose assertions(predicate,noun,noun) instead you get so much more flexibility!

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Xarn posted:

Different fun thing though, user defined iterators are allowed to overload the "," (comma) operator. :v:
This means that this
code:
for (;...; ++iter1, ++iter2) {)
might do something weird. The solution? Cast one of them to void, so the overload doesn't apply to the expression. :suicide:

what the heck how does anyone get anything done in c++

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?
this is now the second operator,() overload I've seen discussed

the first was in MetaKit:

quote:

c4_View c4_View::operator,(const c4_Property &prop_) const

Defines a column for a property.

The following code defines an empty view with three properties:

code:
  c4_IntProp p1, p2, p3;
  c4_View myView = (p1, p2, p3);

Returns:
the new view object (without any data rows)
See also:
c4_Property

who the hell thought operator,() was a good idea?

Xarn
Jun 26, 2015

eschaton posted:

this is now the second operator,() overload I've seen discussed

the first was in MetaKit:


who the hell thought operator,() was a good idea?

Dehumanize yourself and face to operator. overloading.

Xarn
Jun 26, 2015

fart simpson posted:

what the heck how does anyone get anything done in c++

When I write code, my PoV is that if you do dumb poo poo like that, its not my problem when it blows up.

People who maintain and write STL are of the opinion that what isn't forbidden is allowed and must be accomodated, and because of the model of definitive standard vs various implementations, they are probably right.


Honestly I don't think I've ever been bitten by operator overloading, but I didn't have to work with types that overloaded && or || yet. Also these things are usually way overblown, I have yet to meet overloaded "," operator in the wild.

Xarn fucked around with this message at 11:15 on Jul 19, 2016

Luigi Thirty
Apr 30, 2006

Emergency confection port.

MALE SHOEGAZE posted:

working as intended to punish idiots who dont minify their scripts i have no idea if a tab is technically any more characters then a space

\t vs 0x20

Mr Dog posted:

Barycentric rendering is poo poo-slow yes.

Apply a perspective transform first to get screen X,Y co-ordinates (but keep the Z around because you'll need it later), then sort the triangle's vertices by Y co-ordinate. Split the triangle into an upper half triangle and a lower half triangle with a horizontal line running through the middle vertex as the common edge.

For each scan line in each half triangle, determine the start and end of the scan line using Bresenham's line drawing algorithm. Then you're just drawing a series of horizontal lines. Do your Z-buffer test for each pixel and then apply perspective-correct interpolation to whatever vertex attributes (texture co-ordinates u,v for texturing and/or normals for lighting) and then stuff those into your "pixel shader".

okay thanks i'll try this instead

redleader
Aug 18, 2005

Engage according to operational parameters
today in code review: 15 minute discussion between 3 devs about whether it is better to create xml that uses attributes or xml that uses elements

i.e.
XML code:
<a b="123" c="asd" />
vs
XML code:
<a>
	<b>123</b>
	<c>asd</c>
</a>

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

so what's the answer

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

redleader posted:

today in code review: 15 minute discussion between 3 devs about whether it is better to create xml that uses attributes or xml that uses elements

i.e.
XML code:
<a b="123" c="asd" />
vs
XML code:
<a>
	<b>123</b>
	<c>asd</c>
</a>

what's the answer?

Luigi Thirty
Apr 30, 2006

Emergency confection port.

fart simpson posted:

so what's the answer

we have two senior devs who once they get into an argument on a code review will never stop

my lead's official advice was "just delete the review, do whatever one of the two says, and hope the other one doesn't notice it this time"

redleader
Aug 18, 2005

Engage according to operational parameters
the answer: we have no standards or conventions for xml in any way, so whatever anyone ever writes is fine

this is unless the cto decides to get on his high horse and proclaim that 'we should be using <Fucking_Awful_Cased_Xml With_Attributes="Wherever possible" />' this week - and, of course, totally forget about his decree the week after

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD
always use elements, because sooner or later you are going to want to put an xml blob inside one, and you can't put a CDATA in an attribute

The Leck
Feb 27, 2001


https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e#.e6wdtz7yl

optimize your comments for best performance

comedyblissoption
Mar 15, 2006

using a verbose markup language for computer data was such a terrible industry decision that we deserve all the bikeshedding we get

Shaggar
Apr 26, 2006

redleader posted:

today in code review: 15 minute discussion between 3 devs about whether it is better to create xml that uses attributes or xml that uses elements

i.e.
XML code:
<a b="123" c="asd" />
vs
XML code:
<a>
	<b>123</b>
	<c>asd</c>
</a>

attributes for 1:1 relationships, elements for 1:*

HoboMan
Nov 4, 2010

comedyblissoption posted:

using a verbose markup language for computer data was such a terrible industry decision that we deserve all the bikeshedding we get

sins of the greybeards





also holy gently caress js optimizing based on character count is the most shitshow thing i've ever heard of


e: speaking of shitshow
JavaScript code:
var statusicon = closed ?
reason == "Accepted" ? "Accepted" : "Canceled"
: submitted ? "Submitted"
: locked ? "Locked"
: "Unlocked";

HoboMan fucked around with this message at 15:02 on Jul 19, 2016

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

HoboMan posted:

sins of the greybeards





also holy gently caress js optimizing based on character count is the most shitshow thing i've ever heard of

php function-name length hashing?

HoboMan
Nov 4, 2010

lol it gets worse
C# code:
var statusicon = doctype == -1 ? "" :
        closed ?
            doctype == 0 ? (string)d["DocumentStatus"] : "Accepted"
	: submitted ? "Submitted"
	: locked ? "Locked"
	: "Unlocked";

Captain Foo posted:

php function-name length hashing?

i had not heard of this

HoboMan fucked around with this message at 15:19 on Jul 19, 2016

Sapozhnik
Jan 2, 2005

Nap Ghost
Awful_Case is objectively the worst casing style, bikeshed all you want about c_case and C_CONSTANT_CASE vs javaCase and PascalCase though.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Mr Dog posted:

Awful_Case is objectively the worst casing style, bikeshed all you want about c_case and C_CONSTANT_CASE vs javaCase and PascalCase though.

sorry,, the worst is rEVERSEcAMEL

tef
May 30, 2004

-> some l-system crap ->

HoboMan posted:

lol it gets worse

i had not heard of this

rasmus picked the standard library calls to have unique-ish lengths as a result

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

fleshweasel posted:

the natural end state of SQL is a table with a key column and a value column containing arbitrary XML

Luigi Thirty posted:

hello this is the basis of one of our product's primary features

:same:

tef
May 30, 2004

-> some l-system crap ->

fleshweasel posted:

the natural end state of SQL is a table with a key column and a value column containing arbitrary XML

jsonb

tef
May 30, 2004

-> some l-system crap ->
here's some useful database advice

- put an index on it
- no, really


tbh, the whole "schemas for everyone" works best when you have a number of small tables with no shared functionality, and uh you're 100% ok with downtime for migrations

i've tended to go for schemas of <every indexable field gets a column> and <everything else gets dumped in jsonb>

it has worked very well for our use case

Shaggar
Apr 26, 2006

tef posted:

- put an index on it

sql troubleshooting 101

abraham linksys
Sep 6, 2010

:darksouls:

tef posted:

i've tended to go for schemas of <every indexable field gets a column> and <everything else gets dumped in jsonb>

so i've got super limited database experience, but i did work somewhere that hacked a solution like this together (with a mysql text field), and it sorted worked until you suddenly had a feature request like "filter and sort over this field" that you had in your json blob, and you had to write an annoying migration to pull the field out of the json into a column

i guess using postgres's actual jsonb type you can now add indexes to json fields and stuff, right? so maybe this isn't as big of an issue, idk

Shaggar
Apr 26, 2006
dont put json or xml into a column

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
how long until we can put sql in json?

  • Locked thread