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
akadajet
Sep 14, 2003

Shaggar posted:

razor components

razor components are neat, but they aren't going to save you from the ternary operator

Adbot
ADBOT LOVES YOU

Aramoro
Jun 1, 2012




akadajet posted:

lol I had to explain observables to a jr backend dev messing with angular for the first time yesterday

I feel fairly strongly in Angular there are like 3 different ways to do everything so you need someone who actually knows what they're doing to write down how you are going to do it and make everyone do that. Otherwise someone is going to go wild with Observables and create huge memory leaks.


One my juniors wrote something like this the other day though

code:
      buttPermissionCheck: function (node) {
        var buttPermission = false;

        if (node.elem.turds && node.elem.turds.length > 0) {
          buttPermission = true;
        } else if (node.elem.farts && node.elem.farts.length > 0) {
          buttPermission = true;
        } else if (node.elem.poops && node.elem.poops.length > 0) {
          buttPermission = true;
        }
        
        return buttPermission;
      }
With the stated reason being to reduce runtime.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
ah yes, the developer who is "obsessed with performance" and will happily write a bunch of horrible code to make everything more efficient

you end up with just the horrible code

CPColin
Sep 9, 2003

Big ol' smile.

Symbolic Butt posted:

actually the more correct terminology is conditional operator :smug:

I wish somebody would popularize another ternary operator so pedants like us could :smug: even harder about it!

gonadic io
Feb 16, 2011

>>=

CPColin posted:

I wish somebody would popularize another ternary operator so pedants like us could :smug: even harder about it!

(,,)

Shaggar
Apr 26, 2006

akadajet posted:

razor components are neat, but they aren't going to save you from the ternary operator

ternary operator is fine

CPColin
Sep 9, 2003

Big ol' smile.

This operator needs a bra that lifts and separates

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


Sagacity posted:

ah yes, the developer who is "obsessed with performance" and will happily write a bunch of horrible code to make everything more efficient

you end up with just the horrible code

is it actually any faster though

I'd assume there's l->r evaluation for anded conditionals

but maybe that's not a thing in angular, maybe, too lazy to look it up

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

CPColin posted:

I wish somebody would popularize another ternary operator so pedants like us could :smug: even harder about it!

i think perl's regex substitution operator (s/pattern/replacement/) is technically sorta ternary, but the first argument is implicit (it substitutes on the default variable $_ unless you use an other operator to tell it what variable to substitute on). or you could consider the options that come after the last / to be the third argument, i guess.

sql has a few of them too, like "poop BETWEEN fart AND butts".

perl6 (which is arguably an operator-oriented programming language) also has meta-operators, some of which take another operator as the first operand and then two regular operands, but unfortunately nobody cares about perl6, which is sad because it seems loving hilarious. just look at this poo poo: https://docs.perl6.org/language/operators

Sapozhnik
Jan 2, 2005

Nap Ghost
Sordicius' posting gimmick, from 1995, is that every internet service should come with a Windows client application written in C++ using MFC

React is very good and Angular is fuckawful. The reason you see those conditional operators everywhere in React code is because JSX defines expressions and not statements, and the conditional operator is what you use when you want an if-statement but can only use expressions. That being said if a JSX expression is getting gnarly you can factor out parts of it into functions and variables, just like you would with any other sort of expression. There's nothing magical about a function that returns JSX elements, nor is there nothing magical about JSX elements as a data type for that matter, they're just JS objects ultimately.

The syntax is weird yes, but weird syntax being the biggest problem with a UI toolkit is a very nice problem to have, particularly since it is much more consistent and predictable than every other toolkit due to its unique design.

Also make sure you use TypeScript and Parcel in your project as well. Don't use Redux though it is terrible.

Sapozhnik fucked around with this message at 15:42 on Apr 3, 2019

Aramoro
Jun 1, 2012




Angular is fine.

duz
Jul 11, 2005

Come on Ilhan, lets go bag us a shitpost


our company colors are shades of blue like most companies with no originality
i bring this up because our ba/pm just asked if we can make the visited links on our website bright red so customers can clearly tell they already went to that page

Sapozhnik
Jan 2, 2005

Nap Ghost

Aramoro posted:

Angular is fine.

Angular 1, 2, or 4?

Soricidus
Oct 21, 2010
freedom-hating statist shill

Sapozhnik posted:

Sordicius' posting gimmick, from 1995, is that every internet service should come with a Windows client application written in C++ using MFC

I believe the gui clients should be written in java actually. swing and javafx are both acceptable. except on phones where they should use the native gui toolkit.

I realise this makes me overlap with a bunch of better posters’ gimmicks but I didn’t choose these opinions they’re what I actually believe

Aramoro
Jun 1, 2012




Sapozhnik posted:

Angular 1, 2, or 4?

7+ Maybe fewer breaking changes! Well I can dream anyway.

Zlodo
Nov 25, 2006
the web stack should only be used for online apps in case an online app makes sense, and also only because it's the only available tech to make apps that run in a browser. web developers should not be allowed to make desktop apps

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
use a native client or a browser client, whatever, but follow the god damned ui conventions of your environment ! ! !

Aramoro
Jun 1, 2012




Zlodo posted:

the web stack should only be used for online apps in case an online app makes sense, and also only because it's the only available tech to make apps that run in a browser. web developers should not be allowed to make desktop apps

We're very much in the 'delivering a desktop app in a browser' kinda area which is where a lot of our pain comes from. But it's also the only way a lot of our customer will accept an application now, one of our recent contract wins specifies no installed components on the client which is a massive pain in the rear end for some of our legacy components and CTI etc.

Captain Foo
May 11, 2004

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

Soricidus posted:

I believe the gui clients should be written in java actually. swing and javafx are both acceptable.

thread title checks out

CPColin
Sep 9, 2003

Big ol' smile.

:eyepoop:

NihilCredo
Jun 6, 2011

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

someone give a chutzpah award to my pm who just wrote the following to the client:

"we will not go into detail about how this feature will work, in order to avoid ambiguities"

cinci zoo sniper
Mar 15, 2013




NihilCredo posted:

someone give a chutzpah award to my pm who just wrote the following to the client:

"we will not go into detail about how this feature will work, in order to avoid ambiguities"

lol

Captain Foo
May 11, 2004

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

NihilCredo posted:

someone give a chutzpah award to my pm who just wrote the following to the client:

"we will not go into detail about how this feature will work, in order to avoid ambiguities"

that's incredible

darthbob88
Oct 13, 2011

YOSPOS

Private Speech posted:

is it actually any faster though

I'd assume there's l->r evaluation for anded conditionals

but maybe that's not a thing in angular, maybe, too lazy to look it up

Yeah, short-circuit evaluation. That's an idiomatic way to skip writing "if (node.elem.turds) { buttPermission = node.elem.turds.length > 0; }". OTOH, all that saves you AFAIK is a line or two of code or the possibility of NPEs from checking node.elem.turds.length before checking if node.elem.turds is even defined, I don't think it's significantly faster.

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

redleader posted:

use amber, you sick freak

Soricidus
Oct 21, 2010
freedom-hating statist shill
the best ternary operator is ?: in php

galenanorth
May 19, 2016

welp, I've sent out eight remote Django job applications on Ziprecruiter (edit: and one on LinkedIn). Now all I have to do is wait and fill time with leisure activities

I guess if I don't hear anything by a week, I'll settle for remote call center work or something instead. I could learn NumPy and SciPy, but I don't really want to do it unless I can get a job doing it and which sounds interesting since I have a math minor and there don't seem to be any remote jobs available on Ziprecruiter that don't require a master's in analytics or statistics, or they require four years of experience to start with

If I can't find anything, I could launch my business anyway even though I can't get a Home Occupation License and see if I can make enough money to move out

galenanorth fucked around with this message at 23:46 on Apr 3, 2019

Doom Mathematic
Sep 2, 2008

Sapozhnik posted:

Angular 1, 2, or 4?

Angular 1 is a real piece of work. It boggles my mind that anybody voluntarily used it, or achieved anything with it, prior to the 1.5 release. After that it was possible to retain a bit of sanity by exclusively using components and one-way bindings but it still has a hopelessly overengineered architecture and the absolute worst documentation. Every page in the AngularJS docs makes perfect sense if and only if you already understand everything about AngularJS. Every example is so convoluted that it's impossible to grasp what they're actually trying to demonstrate. To this day I have still not been able to find the page in the docs where they explain the full list of possible binding sigils and what they all do. And I love how the module system is perfectly designed to flummox any bundling system more complicated than "manually concatenate all the source files in the right order".

E: Angular 2+ might be great, I don't know, we've moved to React.

Doom Mathematic fucked around with this message at 20:59 on Apr 3, 2019

Sapozhnik
Jan 2, 2005

Nap Ghost
Yeah I had the "pleasure" of using angular 1 to build a mobile app using ionic.

Would not recommend.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
i've said it before, and i'll say it again

react is cool and good

typescript is cool and good

angular is flaming hot garbage. idc what version you're talking about

animist
Aug 28, 2018
typescript's type system is stupidly powerful. honestly i've never used another language with nicer unions:

code:
interface Banana {
   kind: "banana",
   color: string,
   peeled: boolean
};
interface Apple {
   kind: "apple",
   color: string,
   leaves: number
};
function examineFruit(fruit: Apple | Banana) {
   console.log(fruit.kind);
   console.log(fruit.color); // valid
   // console.log(fruit.peeled); // invalid; not all members of `Apple | Banana` have a `peeled` member
   if (fruit.kind == "banana") {
      console.log(fruit.peeled); // valid; fruit is now inferred to be `Banana`
   }
}
this works for unions of as many types as you want.

of course, it's still javascript, so it'll run slow and have weird edge cases. and also the type system is full of unsafe holes. but it works well enough for what it is

galenanorth
May 19, 2016

I'm not 100% sure about why React is useful. This Packt textbook starts by talking about the view, or the template in Django, and reduction of boilerplate code, but Django already has a template inheritance system built in for that. Maybe it's that it binds the inheritance of the HTML, the inheritance of the JavaScript, and the inheritance of the CSS into one inheritable app or widget. If that's true, I can see how that might be useful for something like creating custom form widgets without having the code in three separate documents. I see a lot of job listings with React in combination with Django, though, so I'll probably try it anyway and see where I end up.

galenanorth fucked around with this message at 01:47 on Apr 4, 2019

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

galenanorth posted:

I'm not 100% sure about why React is useful. This Packt textbook starts by talking about the view, or the template in Django, and reduction of boilerplate code, but Django already has a template inheritance system built in for that. I see a lot of job listings with React in combination with Django, though, so I'll probably try it anyway and see where I end up

if you're building a boring data munging application based on the fundamental concept of forms in and tables out, it's really not an improvement over django at all, especially since you get a metric fuckton of boring poo poo (looking at you, rendering of forms/validation of forms/etc) for free with django that you don't get out of the box with react. django is very good at forms and viewing the stuff that you input with those forms as static html, while react is more of a general-purpose gui toolkit.

so, as soon as you want to start having any kind of dynamic elements on the page that require some kind of javascript logic (like almost any kind of interactive UI element that isn't a html builtin one), then you should switch from django templates to react. don't try to mix the two; having two different gui frameworks is far worse than either one is on its own. just replace your django serializers/forms and views with ones from rest framework and you get almost as much nice poo poo for free as you do with plain old serverside rendered django. your models and managers can stay the same.

MrMoo
Sep 14, 2000

Surprisingly little knowledge about the basics of SSL for some developers, my banky client is deploying to AWS ECS with a load balancer with a public cert on that is ok but the upstream connection to Docker is using self signed certs with no attempt at following RFC2812 and setting subjectAltName properly. The main TCP connection appears to function but the HTTPS health check is failing in many different forms. A bit weird though, the TCP connection should be rejected too.

In TV news I've upgraded from BSODs to RSODs for device issues on initial startup, Microsoft doesn't have a smiley for those so I picked one randomly.





LG TV's are basically a giant QT.io app with QtWebEngine running CEF for the browser engine. I wonder if their app is coded like their examples with half of everything commented out multiple times. There was reported instability with some signage campaigns after a few hours, I see random APIs just stop working. They presumably are using Chrome's MessagePort interface to create an asynchronous API from JavaScript to the main app, instead of using Promises as their code is ancient they have a pair of callbacks for success and failure. After a hour or so the callbacks for some modules just don't bother getting called at all. Yay, wrapping every single drat API call in a timeout is awful.

I have a callWithTimeout() wrapped for use with fetch() but the juggling with Promises makes the code just as awful when simply inlined.
JavaScript code:
static async getSystemUsageInfo(deviceInfo) {
        let id = null;
        return Promise.race([
                new Promise(resolve => {
                        const options = {
                                cpus: true,
                                memory: true,
                        };
                        deviceInfo.getSystemUsageInfo(resolve,
                                error => {
                                        console.warn("[getSystemUsageInfo] Error Code [" + error.errorCode + "]: " + error.errorText);
                                        resolve({});
                                }, options);
                }),
                new Promise(resolve => {
                        id = setTimeout(() => {
                                console.warn("[getSystemUsageInfo] timeout.");
                                resolve({});
                        }, NATIVE_API_TIMEOUT * 1000);
                }),
        ]).finally(() => id && clearTimeout(id));
}

MrMoo fucked around with this message at 01:59 on Apr 4, 2019

akadajet
Sep 14, 2003

angular 1 sucks much rear end

-signed

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
ime react is cool because it provides dirt simple integration between application state and the user interface, and jsx is a reasonable way to model it

you kinda gotta buy into react's conventions to make it work, but it can be worth the effort. use it right, it can make a lot of glue code go away

ymmv ofc

akadajet
Sep 14, 2003

angular 7 works just fine

vue looks reasonable as well

blazor looks like something you'd hit some brick walls real fast with

akadajet
Sep 14, 2003

you know. like a tesla

abigserve
Sep 13, 2009

this is a better avatar than what I had before

DaTroof posted:

ime react is cool because it provides dirt simple integration between application state and the user interface, and jsx is a reasonable way to model it

you kinda gotta buy into react's conventions to make it work, but it can be worth the effort. use it right, it can make a lot of glue code go away

ymmv ofc

I was talkin trash on React but realistically I accomplished more with it in two days than I did over a much longer time period with jquery years ago when I was using that so it must be ok

also I'm poo poo at javascript so that probably doesn't help

Adbot
ADBOT LOVES YOU

DaTroof
Nov 16, 2000

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

abigserve posted:

I was talkin trash on React but realistically I accomplished more with it in two days than I did over a much longer time period with jquery years ago when I was using that so it must be ok

also I'm poo poo at javascript so that probably doesn't help

being good at javascript doesn't help either. i'm not totally convinced that such a thing even exists. douglas crockford comes closest, and just look at how miserable it makes him

as a general rule, anything that abstracts the javascript away from you is a good thing. back in the day it was jquery. today it's react and typescript. (today it's also still jquery if you want to avoid node toolchains, which is a reasonable thing to want)

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