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
Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Soricidus posted:

yeah that also works but i was having too much fun to include it

that's the great thing about python imo. timtowtdi.

mmmm I was told this would be non-spooky edition, but clearly that's not the case

Adbot
ADBOT LOVES YOU

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

meanwhile, in opposite world

quote:

* Neutronium is a library to create .NET desktop applications using HTML, CSS and javascript.

* Use all the power of the javascript stack to build .NET desktop applications.

* Use standard javascript frameworks to build UI

remember all those developers saying 'man, web development is such a pleasure and joy but having to write desktop application in c# is terrible, i wish i could use the vastly superior js stack'

HoboMan
Nov 4, 2010

hmm, it seems android's uri builder and google's maps api disagree on what a uri looks like

gonadic io
Feb 16, 2011

>>=
this was a pain to write and check, but i think it'll be much better
code:
const COORDS_TO_IX: &'static[&'static[usize]] = &[
    &[ 0, 1, 2, 3, 4, 5],
    &[ 6, 7, 8, 9,10,11,12],
    &[13,14,15,16,17,18,19,20],
    &[21,22,23,24,25,26,27,28,29],
    &[30,31,32,33,34,35,36,37,38,39],
    &[40,41,42,43,44,45,46,47,48,49,50],
    &[51,52,53,54,55,56,57,58,59,60],
    &[61,62,63,64,65,66,67,68,69],
    &[70,71,72,73,74,75,76,77],
    &[78,79,80,81,82,83,84],
    &[85,86,87,88,89,90],
];

    pub fn get_const<'a>(&'a self, x: isize, y: isize) -> Option<&'a Option<Atom>> {
        if x < 0 || y < 0 { return None; }
        COORDS_TO_IX.get(y as usize).and_then(|xs| xs.get(x as usize)).map(|&ix| &self.0[ix])
    }
vs the old, dynamic version:
code:
const ROW_COUNT: usize = 11;
const ROW_WIDTHS: [u8; ROW_COUNT] = [6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6];

    pub fn get(&self, x: isize, y: isize) -> Option<&Option<Atom>> {
        if !Self::valid_ix(x, y) { return None }
        let x = x as usize; // Valid indexes are always positive
        let y = y as usize;
        let mut current_index: u8 = 0;
        for i in 0 .. ROW_COUNT {
            if x == i {
                let board_index = current_index as usize + y;
                return Some(& self.0[board_index]);
            } else {
                current_index += ROW_WIDTHS[i];
            }
            unreachable!();
        }
        None
    }

HoboMan
Nov 4, 2010

actually it's that android's uri builder is garbage

HoboMan
Nov 4, 2010

is that rust?

gonadic io
Feb 16, 2011

>>=

HoboMan posted:

is that rust?

ya. it's slightly paraphrased (hence the awkward indentation between the standalone constants and the methods on a struct), here's a better example i put together:
https://play.rust-lang.org/?gist=161be2bdf39ad60c07f71441227dc0da&version=stable

which I'm posting on the rust gitter because i'm getting errors i don't understand when i try to write a version for mutable pointers

gonadic io fucked around with this message at 23:09 on Nov 14, 2017

gonadic io
Feb 16, 2011

>>=
ctps:
target:

current:


i think there might be an error in my math somewhere

e: getting closer!

gonadic io fucked around with this message at 23:46 on Nov 14, 2017

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

gonadic io posted:

ctps:
target:

current:


i think there might be an error in my math somewhere

Quite possibly. Doing animation stuff where I have to manage various steps of a slider and positioning so it's 3d like, and I curse the fact that I never got a particularly deep maths education because really that poo poo is basic trig, it shouldn't have taken me nearly as long as it did.

gonadic io
Feb 16, 2011

>>=

Maluco Marinero posted:

Quite possibly. Doing animation stuff where I have to manage various steps of a slider and positioning so it's 3d like, and I curse the fact that I never got a particularly deep maths education because really that poo poo is basic trig, it shouldn't have taken me nearly as long as it did.

actual thread content:
https://www.redblobgames.com/grids/hexagons/
is a loving amazing resource for giving you all the numbers about hex indexing and trig and positions and poo poo. it explains the maths too, but who cares it also gives you the coordinates of the vertices and tells you what coord system to use.

gonadic io
Feb 16, 2011

>>=
gently caress yeah did it:

MrMoo
Sep 14, 2000

gonadic io posted:

gently caress yeah did it:


All the hexagons are rotated 90°?

redleader
Aug 18, 2005

Engage according to operational parameters

NihilCredo posted:

meanwhile, in opposite world


remember all those developers saying 'man, web development is such a pleasure and joy but having to write desktop application in c# is terrible, i wish i could use the vastly superior js stack'

[internal screaming]

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

gonadic io posted:

actual thread content:
https://www.redblobgames.com/grids/hexagons/
is a loving amazing resource for giving you all the numbers about hex indexing and trig and positions and poo poo. it explains the maths too, but who cares it also gives you the coordinates of the vertices and tells you what coord system to use.

Noice.

MrMoo
Sep 14, 2000

:lol: found a new variant of odd code formatting for HTML: all the tags sit at the end of each line,
HTML code:
<BODY><DIV
	id="splash"><DIV
		id="loader">Demo loading...<DIV
			id="bar"><DIV
				id="progress"></DIV></DIV></DIV></DIV><DIV
	id="app" class="left"><DIV
		id="field"></DIV><FORM autocomplete="off"
		id="game-play" class="buttons active"><BUTTON
			type="button" name="select"    value="move"   title="Move" class="selected"></BUTTON><BUTTON
			type="button" name="select"    value="attack" title="Attack"></BUTTON><BUTTON
			type="button" name="select"    value="turn"   title="Turn"></BUTTON><BUTTON
			type="button" name="pass"                     title="End Turn"></BUTTON><BUTTON
			type="button" name="surrender"                title="New Game"></BUTTON><BUTTON
			type="button" name="turn"      value="N"      title="Turn NW" class="fa fa-location-arrow fa-rotate-270 hidden"></BUTTON><BUTTON
			type="button" name="turn"      value="E"      title="Turn NE" class="fa fa-location-arrow hidden"></BUTTON><BUTTON
			type="button" name="turn"      value="S"      title="Turn SE" class="fa fa-location-arrow fa-rotate-90 hidden"></BUTTON><BUTTON
			type="button" name="turn"      value="W"      title="Turn SW" class="fa fa-location-arrow fa-rotate-180 hidden"></BUTTON><BUTTON
			type="button" name="swapbar" class="fa fa-bars" title="Swap Bar"></BUTTON></FORM><FORM autocomplete="off"
		id="game-settings" class="buttons"><BUTTON
			type="button" name="resize"  title="Resize"   class="fa fa-expand"></BUTTON><BUTTON
			type="button" name="movebar" title="Move Bar" class="fa fa-eject fa-rotate-270"></BUTTON><BUTTON
			type="button" name="rotate"  title="Rotate"   class="fa fa-location-arrow fa-rotate-270"></BUTTON><BUTTON
			type="button" name="sound"   title="Sound"    class="fa fa-bell"></BUTTON><BUTTON
			type="button" name="swapbar" title="Swap Bar" class="fa fa-bars"></BUTTON></FORM></DIV></BODY>
http://www.taorankings.com/pixi-bug/webgl.html

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

gonadic io posted:

gently caress yeah did it:


I can't stand the green-red, please choose nicer colors. here take these:

#6A8B84 rgb(106, 139, 132)
#BD9431 rgb(189, 148, 49)

those are the colors of the horses in your avatar

jesus WEP
Oct 17, 2004


c tp s: gently caress protobuf

Doom Mathematic
Sep 2, 2008

MrMoo posted:

:lol: found a new variant of odd code formatting for HTML: all the tags sit at the end of each line,
HTML code:
<BODY><DIV
	id="splash"><DIV
		id="loader">Demo loading...<DIV
			id="bar"><DIV
				id="progress"></DIV></DIV></DIV></DIV><DIV
	id="app" class="left"><DIV
		id="field"></DIV><FORM autocomplete="off"
		id="game-play" class="buttons active"><BUTTON
			type="button" name="select"    value="move"   title="Move" class="selected"></BUTTON><BUTTON
			type="button" name="select"    value="attack" title="Attack"></BUTTON><BUTTON
			type="button" name="select"    value="turn"   title="Turn"></BUTTON><BUTTON
			type="button" name="pass"                     title="End Turn"></BUTTON><BUTTON
			type="button" name="surrender"                title="New Game"></BUTTON><BUTTON
			type="button" name="turn"      value="N"      title="Turn NW" class="fa fa-location-arrow fa-rotate-270 hidden"></BUTTON><BUTTON
			type="button" name="turn"      value="E"      title="Turn NE" class="fa fa-location-arrow hidden"></BUTTON><BUTTON
			type="button" name="turn"      value="S"      title="Turn SE" class="fa fa-location-arrow fa-rotate-90 hidden"></BUTTON><BUTTON
			type="button" name="turn"      value="W"      title="Turn SW" class="fa fa-location-arrow fa-rotate-180 hidden"></BUTTON><BUTTON
			type="button" name="swapbar" class="fa fa-bars" title="Swap Bar"></BUTTON></FORM><FORM autocomplete="off"
		id="game-settings" class="buttons"><BUTTON
			type="button" name="resize"  title="Resize"   class="fa fa-expand"></BUTTON><BUTTON
			type="button" name="movebar" title="Move Bar" class="fa fa-eject fa-rotate-270"></BUTTON><BUTTON
			type="button" name="rotate"  title="Rotate"   class="fa fa-location-arrow fa-rotate-270"></BUTTON><BUTTON
			type="button" name="sound"   title="Sound"    class="fa fa-bell"></BUTTON><BUTTON
			type="button" name="swapbar" title="Swap Bar" class="fa fa-bars"></BUTTON></FORM></DIV></BODY>
http://www.taorankings.com/pixi-bug/webgl.html

This is the kind of thing you see if it's critically important that there be no white space between one <button> and the next.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Doom Mathematic posted:

This is the kind of thing you see if it's critically important that there be no white space between one <button> and the next.

It really is nicer for layout concerns if you can render without whitespace in between (luckily the default for React). No white-space means things you often do with floats or flexboxes often layout with inline-block real nicely.

wide stance
Jan 28, 2011

If there's more than one way to do a job, and one of those ways will result in disaster, then he will do it that way.
It's funny how JavaScript was seen as some slapdash language cobbled together in a week under duress as a stopgap solution.

Now it's the gold standard for browsers and making its way heavy into mobile and now desktop apps. There's nothing on the horizon that can even remotely challenge it.

JavaScript is strong and it will loving kill you. Good thing no one actually use prototype inheritance any more.

a witch
Jan 12, 2017

were you looking for a grey thread friend?

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

wide stance posted:

It's funny how JavaScript was seen as some slapdash language cobbled together in a week under duress as a stopgap solution.

Now it's the gold standard for browsers and making its way heavy into mobile and now desktop apps. There's nothing on the horizon that can even remotely challenge it.

JavaScript is strong and it will loving kill you. Good thing no one actually use prototype inheritance any more.

source your quotes

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

wide stance posted:

JavaScript is real, he is strong, and he's my friend.

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

a witch posted:

were you looking for a grey thread friend?
maybe the hn thread

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?

NihilCredo posted:

meanwhile, in opposite world


remember all those developers saying 'man, web development is such a pleasure and joy but having to write desktop application in c# is terrible, i wish i could use the vastly superior js stack'

this is a common affliction among people with web “development” brain damage

redleader
Aug 18, 2005

Engage according to operational parameters
react looks overengineered to all gently caress. i can see the problem they're trying to solve, and i understand why react was designed that way, but holy heck

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

redleader posted:

react looks overengineered to all gently caress. i can see the problem they're trying to solve, and i understand why react was designed that way, but holy heck

why does it look overengineered? it’s got a reasonably small api, a super predictable model, and uses that to deliver on performance goals through the optimum development path, rather than as a post optimisation. there’s a reason it’s top dog right now in UI rendering, it works.

Angular 1.x is the definition of overengineered, overlapping concepts, all batteries included, none of it done well.

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Maluco Marinero posted:

why does it look overengineered? it’s got a reasonably small api, a super predictable model, and uses that to deliver on performance goals through the optimum development path, rather than as a post optimisation. there’s a reason it’s top dog right now in UI rendering, it works.

Angular 1.x is the definition of overengineered, overlapping concepts, all batteries included, none of it done well.

Lots of people using it are not doing so because they actually need the performance benefits of virtual DOM. Many design choices in React are there to support the virtual DOM.

React isn't over-engineered for what it is supposed to do, it just moved many people to a way of working that would allow them to make their poo poo much more performant than >90% of them need.

redleader
Aug 18, 2005

Engage according to operational parameters

Maluco Marinero posted:

why does it look overengineered? it’s got a reasonably small api, a super predictable model, and uses that to deliver on performance goals through the optimum development path, rather than as a post optimisation. there’s a reason it’s top dog right now in UI rendering, it works.

Angular 1.x is the definition of overengineered, overlapping concepts, all batteries included, none of it done well.

yeah, you're right. i misspoke; i said 'overengineered' when i actually meant 'verbose and boilerplatey'

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

reactive programming is easier for stupid people like me to write without making mistakes

mystes
May 31, 2006

prisoner of waffles posted:

Lots of people using it are not doing so because they actually need the performance benefits of virtual DOM. Many design choices in React are there to support the virtual DOM.

React isn't over-engineered for what it is supposed to do, it just moved many people to a way of working that would allow them to make their poo poo much more performant than >90% of them need.
It's the other way around. It requires the virtual dom for its simple one way functional mapping of model to view, because there's no inherent way to track what elements have changed without diffing the virtual dom state. All similar systems (i.e the Elm architecture) have to have virtual doms.

Workaday Wizard
Oct 23, 2009

by Pragmatica

fart simpson posted:

reactive programming is easier for stupid people like me to write without making mistakes

i loving love declarative programming

e: unironically too

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

mystes posted:

have to have virtual doms.

text me

akadajet
Sep 14, 2003

Symbolic Butt posted:

I can't stand the green-red, please choose nicer colors. here take these:

#6A8B84 rgb(106, 139, 132)
#BD9431 rgb(189, 148, 49)

those are the colors of the horses in your avatar

I make all of my prototypes yospos green and black

akadajet
Sep 14, 2003

Maluco Marinero posted:

why does it look overengineered? its got a reasonably small api, a super predictable model, and uses that to deliver on performance goals through the optimum development path, rather than as a post optimisation. theres a reason its top dog right now in UI rendering, it works.

Angular 1.x is the definition of overengineered, overlapping concepts, all batteries included, none of it done well.

We still use Angular 1 at work and I really want to start migrating some of our stuff to react/redux for the virtual dom stuff and better state management.

Sapozhnik
Jan 2, 2005

Nap Ghost

redleader posted:

yeah, you're right. i misspoke; i said 'overengineered' when i actually meant 'verbose and boilerplatey'

not really though?

you write a function from a props object to a tree of elements, and jsx gives you a decent shorthand for doing that. what would you simplify further?

state management is performed asynchronously, i guess there is that, but you do need to notify react that your component state is changing somehow, otherwise you won't ever re-render.

now, redux, yeah that's kinda verbose. but there's a reason why the redux guys hop up and down for an entire chapter in their introductory documentation saying "hey maybe you don't actually need this if you're doing something simple!". even then, redux is not an all-or-nothing thing; you can have small bits of localized state in your components and bigger more widely-used chunks in the redux store.

like you really don't have to store the current sort order of every single table in your ui in redux and create actions, reducers, and selectors for every single one of them, stuffing that state into this.state is perfectly fine.

HoboMan
Nov 4, 2010

c tps:
i suggested react for our new thing and the other devs built it really fast and it's full react-redux

i now have add a number to a screen

i have no loving clue how to do this

cinci zoo sniper
Mar 15, 2013




c tp mysql s:

SQL code:
SELECT
  foo.a,
  foo.b,
  foo.c,
  GROUP_CONCAT(bar.b) AS X
FROM table foo
  LEFT JOIN (SELECT
               baz.a,
               baz.b,
               baz.c
             FROM table baz) bar ON foo.a = bar.a AND foo.c > bar.c
yields, figuratively speaking X1 X2 X1 X2 X1 X2 X1 X2 X1 X2 as the output of single X. substituting for inner join gives me X1 X1 X1 X1 X1 X2 X2 X2 X2 X2

:eng99:

gonadic io
Feb 16, 2011

>>=
YOSPOS > i actually have reasons to post here unlike half of the people with impostor syndrome

lol nice. would be better with "terrible programmers:" at the front though

e:


now i need to work out how to draw a border. i want the line to be inside the hex, so it can't be specified using the same coords as the hex verts i think

e2: also i'm pretty sure this framework doesn't support selection mode so i have to work out which hex gets clicked on directly from the mouse pos hurray. luckily the hex resource i posted about earlier tells you the math to do this

gonadic io fucked around with this message at 16:48 on Nov 15, 2017

Adbot
ADBOT LOVES YOU

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

YOSPOS > i actually have reasons to post here unlike half of the people with impostor syndrome

lol nice. would be better with "terrible programmers:" at the front though

  • Locked thread