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
teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
WHATEVER

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Grump posted:

WHATEVER

(Wonderful post, name, and avatar combo)

Tei
Feb 19, 2011
Probation
Can't post for 16 hours!
- Can you make something quick in two days?
- Sure.

And then javascript was created*.



* for comical reasons this post is exagerated, it was 10 days.
This happened in 1995. Is taking more than 10 days to fix it.

Tei fucked around with this message at 14:13 on Oct 18, 2017

Pollyanna
Mar 5, 2005

Milk's on them.


We’re just gonna go full JS on this one. HTML5 inputs are okay for basic stuff, but more complicated behavior necessitates more robust solutions.

Lumpy posted:

code:
<input type="number" step="1" min="0" />
.
<input type="number" step=".1" min=".0" max="0.9" />
<input type="number" step=".01" min=".00" max="0.09" />
YOUR WELCOME. :colbert:

What about my welcome :colbert:

Pollyanna
Mar 5, 2005

Milk's on them.


Related question: we’ve got some code for interpreting input field strings as integers, two-place floats, etc. This was all made in-house. This seems like something that is best handled by an external library that’s well tested and commonly used, but I have trouble reconciling that idea with the stereotypical “use a bunch of modules for everything” approach ala padLeft. I’ve heard that I don’t want to fall into that hole.

Is it forgivable to use a number/currency parsing and formatting library such as accounting.js, or is it better to write your own thing?

luchadornado
Oct 7, 2004

A boombox is not a toy!

Pollyanna posted:

Related question: we’ve got some code for interpreting input field strings as integers, two-place floats, etc. This was all made in-house. This seems like something that is best handled by an external library that’s well tested and commonly used, but I have trouble reconciling that idea with the stereotypical “use a bunch of modules for everything” approach ala padLeft. I’ve heard that I don’t want to fall into that hole.

Is it forgivable to use a number/currency parsing and formatting library such as accounting.js, or is it better to write your own thing?

If it's a core competency or has a unique implementation that either reduces risk/improves performance/allows for use cases that provide ROI - build it yourself. Otherwise use someone else's code. The absolute best code in the world is code that you don't need to write.

My point about custom JS form components before boils down to convincing the business that designers might not necessarily know when writing your own forms provide ROI. Any developer can write form components. A good developer will find a library that does it or convinces the business that it doesn't provide value. We're often fixated on "yeah I can do that", but a valuable skill is learning how and when to push back.

luchadornado fucked around with this message at 15:24 on Oct 18, 2017

Analytic Engine
May 18, 2009

not the analytical engine

Thermopyle posted:

Yeah, he's probably the best/nicest/most-helpful guy I've come across.running an OSS project.

Mike Bostock of D3 would like a word with you.
Well, no, he's too humble to think that.

Pollyanna
Mar 5, 2005

Milk's on them.


Helicity posted:

If it's a core competency or has a unique implementation that either reduces risk/improves performance/allows for use cases that provide ROI - build it yourself. Otherwise use someone else's code. The absolute best code in the world is code that you don't need to write.

What is a core competency? We’re not building a number formatting library or anything, it’s just useful for our purposes.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

Lumpy posted:

code:
<input type="number" step="1" min="0" />
.
<input type="number" step=".1" min=".0" max="0.9" />
<input type="number" step=".01" min=".00" max="0.09" />
YOUR WELCOME. :colbert:

"Yeah, we're gonna need you to support internationalization and have commas and decimals appear for the correct countries, as well as the correct spacing."

luchadornado
Oct 7, 2004

A boombox is not a toy!

Pollyanna posted:

What is a core competency? We’re not building a number formatting library or anything, it’s just useful for our purposes.

You're building a library for internal use that has to be maintained, reasoned about, migrated to new stacks, etc. It could be the thing that causes an outage on the busiest day of its use. A core competency is something central to your business and helps distinguish you from your competitors. There's lot of poo poo that's "useful", but at the end of the day you need someone like a product owner to balance useful things with things that make money.

It's how you end up with 2 million lines of code that don't provide value and require intensive babysitting (seen it). Or how you end up spending weeks reviewing every 3rd party library for licensing issues that could affect your IPO (seen it). Or fixing vulns in 3rd party libraries (seen it). It's not a hard and fast rule to never use dependencies, just keep in mind that you've got risks either way and assessing the tradeoffs is important.

Drastic Actions posted:

"Yeah, we're gonna need you to support internationalization and have commas and decimals appear for the correct countries, as well as the correct spacing."

Seen this too :smith: There's a reason they say the final 20% of an implementation takes 80% of the time.

luchadornado fucked around with this message at 15:47 on Oct 18, 2017

Pollyanna
Mar 5, 2005

Milk's on them.


Helicity posted:

You're building a library for internal use that has to be maintained, reasoned about, migrated to new stacks, etc. It could be the thing that causes an outage on the busiest day of its use. A core competency is something central to your business and helps distinguish you from your competitors. There's lot of poo poo that's "useful", but at the end of the day you need someone like a product owner to balance useful things with things that make money.

It's how you end up with 2 million lines of code that don't provide value and require intensive babysitting (seen it). Or how you end up spending weeks reviewing every 3rd party library for licensing issues that could affect your IPO (seen it). Or fixing vulns in 3rd party libraries (seen it). It's not a hard and fast rule to never use dependencies, just keep in mind that you've got risks either way and assessing the tradeoffs is important.


Seen this too :smith: There's a reason they say the final 20% of an implementation takes 80% of the time.

So since we don’t focus on number formatting and parsing as our product, why not just leverage a library for it and save ourselves the trouble? That’s how I see it, and that’s what I understand you’re getting at.

luchadornado
Oct 7, 2004

A boombox is not a toy!

Pollyanna posted:

So since we don’t focus on number formatting and parsing as our product, why not just leverage a library for it and save ourselves the trouble? That’s how I see it, and that’s what I understand you’re getting at.

Go for the library then. You might want to ask if it's a real requirement and if the value from incorporating this library outweighs the risks outlined in the last few posts between us. Surprisingly enough, designers aren't necessary good at assigning value to tasks, and I've seen product owners have to reign them in quite a bit.

This seems pedantic and common sense, but I'm getting old and not looking forward to working with developers that think just because it can be done it should be done. It's also more interesting to me than whether I can rewrite HTML5 input functionality as React components - I crossed that bridge quite awhile ago. Stating this out loud provides opportunities for people to challenge my stance and make me a better developer.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Drastic Actions posted:

"Yeah, we're gonna need you to support internationalization and have commas and decimals appear for the correct countries, as well as the correct spacing."

Instead of the ., use a nameless disabled input with the value .01 and style it so that only the separator shows, just like you'd have to style the ones around it such that only their significant digit is showing - nbd.

Gul Banana
Nov 28, 2003

Helicity posted:

Go for the library then. You might want to ask if it's a real requirement and if the value from incorporating this library outweighs the risks outlined in the last few posts between us. Surprisingly enough, designers aren't necessary good at assigning value to tasks, and I've seen product owners have to reign them in quite a bit.

This seems pedantic and common sense, but I'm getting old and not looking forward to working with developers that think just because it can be done it should be done. It's also more interesting to me than whether I can rewrite HTML5 input functionality as React components - I crossed that bridge quite awhile ago. Stating this out loud provides opportunities for people to challenge my stance and make me a better developer.

you're not wrong. the place i was coming from is that i build component libraries for LOB apps, and we try to sell based on having nice widgets - so hopefully it is a core competency. in reality a *good* control is a ton of work. one of my coworkers recently built a kind of combobox, and then several of us have pitched in to test and tweak it - it could end up costing multiple manweeks. overlaying a couple of buttons on an html textbox, which can still do the number formatting bit itself, doesn't sound hard to me.. but that's probably because i haven't tried it yet :)

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Pollyanna posted:

Related question: we’ve got some code for interpreting input field strings as integers, two-place floats, etc. This was all made in-house. This seems like something that is best handled by an external library that’s well tested and commonly used, but I have trouble reconciling that idea with the stereotypical “use a bunch of modules for everything” approach ala padLeft. I’ve heard that I don’t want to fall into that hole.

Is it forgivable to use a number/currency parsing and formatting library such as accounting.js, or is it better to write your own thing?

Just for numbers, I'd do it myself.

https://www.w3schools.com/jsref/jsref_tofixed.asp https://www.w3schools.com/jsref/jsref_parsefloat.asp

code:
let myFloat = 3.366666;
myFloat.toFixed(2); // "3.37"

let userInput = parseFloat("3.37");
if (isNaN(userInput)) throw new Error("Invalid input");
Don't test it and don't tell anyone.

edit:

Unless we're talking about server code. Then I would feel much more comfortable using an accounting library of some sort, because for one thing it's hidden, but also there might be more important logic there.

Something feels superficial to me about client side coding, I don't feel like the logic there matters as much.

Nolgthorn fucked around with this message at 21:34 on Oct 18, 2017

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
My application has reached the stage where I need to send html emails. :(

So I'm experimenting with Mjml the issue I'm having is that it seems to use a lot of padding around every `mj-column` and every `mj-section` and every everything.

My emails are data heavy, where I need basically small headers, squares with blurbs in them, compact, links on everything. I really need a more data-centric look. Am I better off reading a comprehensive book about how to structure html emails? If I don't care about supporting every email client since the beginning of time do I need to worry about it?

Maybe I can just write a template that uses normal html and be done with it these days.

The Fool
Oct 16, 2003


Nolgthorn posted:


Maybe I can just write a template that uses normal html and be done with it these days.

This is what I do for some automated reports. There may be some gotchas that I’m not aware of (weirdness in different mail clients, etc), but it has otherwise worked fine.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
God I'm so done trying to use Typescript in React.

It's such a pain to not have type definitions. And making declaration files is really confusing to me

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

What don't you have type definitions for? Most things have them available on npm...

prom candy
Dec 16, 2005

Only I may dance
Counterpoint: I am loving typescript with react, the extra time spent is more than saved by having a less brittle codebase.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself

Thermopyle posted:

What don't you have type definitions for? Most things have them available on npm...

I mean to name a couple, React-icons and sort-by.

React-icons has one, but it's buggy because they don't seem to be exporting their components correctly. I try to import and get ''no default export for this component'

I like Typescript. it's just so much extra work to use an npm package.

Pollyanna
Mar 5, 2005

Milk's on them.


Nolgthorn posted:

Something feels superficial to me about client side coding, I don't feel like the logic there matters as much.

We're writing a UI-heavy form so we can't skimp on the logic and rigor :( We have a lot to focus on, so quibbling about how to implement non-core stuff distracts us.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Grump posted:

I try to import and get ''no default export for this component'

Typescript is harder the more 3rd party stuff you use. If a package was built with Typescript the language is pretty cool that it doesn't need definitions and just works. But I had a similar problem as you. Typescript doesn't handle globals basically at all. So if you have a library that just defines a bunch of stuff on `window`, you can trick Typescript into performing an "import" but not multiple imports.

There's a workaround described here.

https://github.com/rollup/rollup/issues/1476#issuecomment-314033953

On second thought that's probably a separate issue from what you meant.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Pollyanna posted:

We're writing a UI-heavy form so we can't skimp on the logic and rigor :( We have a lot to focus on, so quibbling about how to implement non-core stuff distracts us.

Bikeshedding is an essential part of team software development.

Pollyanna
Mar 5, 2005

Milk's on them.


I've learned that rather quickly...

Currently trying to figure out why we have an input.text with a pattern=\d* attribute instead of just a number field, and for the life of me I can't remember. The only person who would know would probably be our former team lead...

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

One thing to remember about forms is that often thats where a large part of your business logic happens so of course they're going to not just be this simple no-brainer thing.

Pollyanna
Mar 5, 2005

Milk's on them.


Thermopyle posted:

One thing to remember about forms is that often thats where a large part of your business logic happens so of course they're going to not just be this simple no-brainer thing.

As long as I'm not the only one whose brain turns to mush when trying to implement logic-heavy forms and it's not a reflection of a poor capacity and quality as an engineer, then I'm fine.

Rubellavator
Aug 16, 2007

This field needs to pop up only when x is selected and its selections should be based on y and z, also, the selections are role-based and won't be available to certain users when certain options are selected.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Rubellavator posted:

This field needs to pop up only when x is selected and its selections should be based on y and z, also, the selections are role-based and won't be available to certain users when certain options are selected.

Also it has to look good on mobile.

skul-gun
Dec 24, 2001
I got this account for Xmas.

Pollyanna posted:

I've learned that rather quickly...

Currently trying to figure out why we have an input.text with a pattern=\d* attribute instead of just a number field, and for the life of me I can't remember. The only person who would know would probably be our former team lead...

At least on my phone, a text input with that pattern will bring up the telephone keypad keyboard, while a number input without pattern brings up the normal keyboard in number/punctuation mode.

Maybe a number input /w the pattern attribute would work for you?

Giga Gaia
May 2, 2006

360 kickflip to... Meteo?!
So my new gig is to take this monstrosity(hundreds of pages on this bullshit PHP include "system") of an ancient site and bring it into a modern static site ecosystem and make the fucker responsive. I've got a lot of my thoughts worked out on the subject, but the actual "generator" is still up in the air. Right now Metalsmith seems to be leading the pack since it's seemingly so customizable. I'm curious if anyone has used it or experienced crazy bugs with it?

I'm open to other static site systems in any form sans-Jekyll. I've already decided it's general format and style isn't for me. I'm keeping my sights on Node and Ruby but I'll go PHP/Laravel if someone has a good suggestion. It's very open right now. I basically have free-reign to do whatever the hell I want since they've never had a full-time developer on the team and all the management is 2000 miles away and has been manually updating this thing for over a decade.

Selfishly I'm looking for something really cool to put on my resume so new hotness(and thus Metalsmith) is totally an option. I'm using Yarn and Webpack for all my build stuff right now just because I can, for example.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I can't really picture what you're trying to do, but Gatsby is pretty cool for a static site generator.

Pollyanna
Mar 5, 2005

Milk's on them.


skul-gun posted:

At least on my phone, a text input with that pattern will bring up the telephone keypad keyboard, while a number input without pattern brings up the normal keyboard in number/punctuation mode.

Maybe a number input /w the pattern attribute would work for you?

I got a response from the team lead and apparently it's because we need to "support older browsers" and "work properly on mobile", where apparently most people on old lovely iOS phones get a spinner instead of a number keyboard. :shrug: I don't actually buy that explanation, but whatever, I'm leaving.

At least the current guard of front-end devs are incredibly pissed at the weird poo poo we're doing instead of lying down and taking it. I just hope change happens, but if they're happier elsewhere I hope they don't get suckered into sticking around.

Giga Gaia
May 2, 2006

360 kickflip to... Meteo?!

Thermopyle posted:

I can't really picture what you're trying to do, but Gatsby is pretty cool for a static site generator.

Gatsby looks nifty so I'll toss that one on the pile.

I'll try to elaborate. We've got a website with 500+ pages of editorials, infographics, quizzes and words (sort of like a wiki) that's never once had a CMS or style guide, just a few random disorganized .php include files from 2004. It's not even responsive and has an insanely badly made mobile site that's just a PHP script running on top of a page you load that tries to figure out if you're actually on a device or not. It's also the number 1 or 2 (depending on how Wikipedia and some competition is ranking that day) on the net for their subject matter.

I need to take this thing and migrate it over to real systems while preserving their SEO juice, which is why I want to stick with Static Site (since all their files are .html and they have a weird directory structure) rather than something like Drupal or Wordpress (though I will be looking at Wordpress' API/Calypso thing when i have time). Also I hate those systems generally and want to stay with this job for more than a year. I feel like going with something based on Node or Ruby will give them a better foundation to grow off of in the future, too.

I've been working on getting their CSS and DOM organized and building the basics of a UI system so I can A/B test and do proper UX design work on it. But I'm looking towards 2018 and a proper migration away from all this ancient PHP. So that's why I'm asking about decent static site systems.

Does that help explain the situation any better?

Giga Gaia fucked around with this message at 01:26 on Oct 20, 2017

geeves
Sep 16, 2004

Pollyanna posted:

I got a response from the team lead and apparently it's because we need to "support older browsers" and "work properly on mobile", where apparently most people on old lovely iOS phones get a spinner instead of a number keyboard. :shrug: I don't actually buy that explanation, but whatever, I'm leaving.

Thankfully we only have to support down to IE11. Most of our issues with IE are limited to performance issues that Chrome, Firefox and even Edge handle pretty well.

The rub is that while IE usage is extremely low, one of our most high-paying clients is IE only. It sucks, but if I'm being paid because of them, then amen. They said they will all be on Edge soon. I cannot wait.

smackfu
Jun 7, 2004

How exactly did the Angular team settle on a naming scheme that makes their new product very hard to Google? Couldn’t they just have gone with AngularX or something to make my life easier?

geeves
Sep 16, 2004

smackfu posted:

How exactly did the Angular team settle on a naming scheme that makes their new product very hard to Google? Couldn’t they just have gone with AngularX or something to make my life easier?

It should have been completely renamed from the moment it was decided that there was no easy migration from version 1 to 2.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



smackfu posted:

How exactly did the Angular team settle on a naming scheme that makes their new product very hard to Google? Couldn’t they just have gone with AngularX or something to make my life easier?

They're trying to send you a message: even they don't want you using it.

HaB
Jan 5, 2001

What are the odds?

geeves posted:

It should have been completely renamed from the moment it was decided that there was no easy migration from version 1 to 2.

This.

Apparently they learned nothing from the "let's name it by association" debacle that is java / javascript.

Aside from a couple of terms being the same (and mostly the generic MVC terms, at that), Angular 1 and 2 are basically nothing alike.

They should've called it: "Jamming: And It Aint The Story Of Jelly"

Adbot
ADBOT LOVES YOU

Pollyanna
Mar 5, 2005

Milk's on them.


I would not recommend using Angular these days.

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