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
Dominoes
Sep 20, 2007

Any reason not to use shortcut funcs like this?
JavaScript code:
function getId(id) {
    return document.getElementById(id)
}

Dominoes fucked around with this message at 20:33 on Mar 10, 2017

Adbot
ADBOT LOVES YOU

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Dominoes posted:

Any reason not to use shortcut funcs like this?
JavaScript code:
function getId(id) {
    return document.getElementById(id)
}

It's a fine line between usefully abstracting away parts of the application, and needlessly confusing things. If you are doing it just to save some keystrokes, probably not a great idea. If it provides you with some meaningful abstraction, then it's a good idea.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
If you're targeting specific ids like 100 times in a file, sure.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dominoes posted:

Any reason not to use shortcut funcs like this?
JavaScript code:
function getId(id) {
    return document.getElementById(id)
}

I just set up abbreviations in my editor so when I type dgebi it expands to document.getElementById() with the cursor in the parens.

Dominoes
Sep 20, 2007

Thx. On the spectrum between obfuscation and reducing boilerplate, I think this falls enough towards the latter to make it worthwhile. (Outsider's perspective). Ie, if I see myself repeating a chunk of code many times, I try to break it into a function; this seems like a trivial example of that pattern.

Shayl - thanks. I ended up switching most of my Jquery to normal JS with lodash - didn't realize that manipulating elements was straightforward there too. This feels more consistent, while JQuery almost feels like another language inserted. Still using it for tasks involving next/closer etc.

Dominoes fucked around with this message at 00:00 on Mar 11, 2017

Munkeymon
Aug 14, 2003

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



Dominoes posted:

On the spectrum between obfuscation and reducing boilerplate, I think this falls enough towards the latter to make it worthwhile.

This is my main reason, actually. Why the hell would I reimplement it but without the years of testing?

Yeah, editor shortcuts are good for this, but there's other annoying, repetitive junk it papers over like setting every property individually on a new node/xhr. At least C# has nice sugar for that.

Cugel the Clever
Apr 5, 2009
I LOVE AMERICA AND CAPITALISM DESPITE BEING POOR AS FUCK. I WILL NEVER RETIRE BUT HERE'S ANOTHER 200$ FOR UKRAINE, SLAVA
Anyone have a recommendation for somewhere to host HD video that one can just stream on a site for a fancy landing page background or something? Tried Vimeo Pro, but its utterly fails at delivering 1080p video uninterrupted (and, as far as I can tell, the problem is on their end).

fuf posted:

Do people use display:flex as a matter of course yet or is support still flaky?

Use case is a very high end jewellery site so users skew older but also richer so more likely to have new devices.

http://caniuse.com/#feat=flexbox seems to indicate it's pretty safe?
Flexbox is awesome and I couldn't live without it, but you're definitely going to spend some time addressing Microsoft's lovely implementations. IE10 does it poorly, IE11 fixes a bit, but still has major quirks, and even Edge has random flexbugs that will make you groan when you come across 'em. Safari's actually about on par with Edge (or they've decided their bugs are the 'proper' implementation of the spec). I can't think I've run into a single flexbug in either FF and Chrome.

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes

Maluco Marinero posted:

Yeah, that's fair. As an aside, we pretty much ALWAYS make page sections full width for this reason. If we want to maintain some sort of Grid measure we maintain a Measure Component that handles setting max-width, centering, etc.

We did such on this site: https://archierose.com.au/


Just wanted to say the design of that site is cool and all but the header background made me think my monitor was dirty.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

nexus6 posted:

Just wanted to say the design of that site is cool and all but the header background made me think my monitor was dirty.

It's caught me out trying to check/clean my monitor on more than one occasion.

Thermopyle
Jul 1, 2003

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

Ha, I noticed the same thing when he initially posted the link I just didnt say anything.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Thermopyle posted:

Ha, I noticed the same thing when he initially posted the link I just didnt say anything.

It's meant to be soot from in the distillery processes. We didn't do the design, just the development, I tell you the metric ton of little details on this site. Take a look at the button with lines extending out, that extend on hover. Keeping development on budget was challenging.

huhu
Feb 24, 2006
Does anyone else loath the process of moving a website from local to live? I did it once with Django and now I'm trying with a Flask website and I feel like it shouldn't take me this many hours to setup. I've had issues every single step of the way.

No Gravitas
Jun 12, 2013

by FactsAreUseless

huhu posted:

Does anyone else loath the process of moving a website from local to live? I did it once with Django and now I'm trying with a Flask website and I feel like it shouldn't take me this many hours to setup. I've had issues every single step of the way.

I use a variant of this.

code:
scp *.html remote_end/staging_directory
#Verify everything works in staging
ssh remote_end ln -f staging_directory live_directory
Then again, my website is fully static, so it does not need much verifying and things cannot really break.

Thermopyle
Jul 1, 2003

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

How lovely deploying dynamic websites is is a big reason heroku came into existence.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Thermopyle posted:

How lovely deploying dynamic websites is is a big reason heroku came into existence.

As you know, I am an idiot, but I always found getting a server up and a site deployed easier than Heroku.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Lumpy posted:

As you know, I am an idiot, but I always found getting a server up and a site deployed easier than Heroku.

Same, but I've spent a lot of time (and was willing to) on my provisioning strategy for my Linodes, but many people don't really wanna do that, and Heroku is great for that.

lunar detritus
May 6, 2009


Maluco Marinero posted:

Same, but I've spent a lot of time (and was willing to) on my provisioning strategy for my Linodes, but many people don't really wanna do that, and Heroku is great for that.

And Dokku works really well if you want something cheaper.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
The head of our web dev department thinks that "mobile first" is just a buzz-word and isn't an actual thing. :stare:

Data Graham
Dec 28, 2009

📈📊🍪😋



Make Mobile Great Again

ufarn
May 30, 2009
I don't understand how people deploy Django to services that don't have deploy hooks. Doing it manually made me lose my mind.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

ufarn posted:

I don't understand how people deploy Django to services that don't have deploy hooks. Doing it manually made me lose my mind.

Do it once then save the commands as a shell script?

Thermopyle
Jul 1, 2003

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

Lumpy posted:

As you know, I am an idiot, but I always found getting a server up and a site deployed easier than Heroku.


With heroku this is literally all you do to deploy a new site.

code:
$ heroku create
$ git push heroku master
$ heroku ps:scale web=1
There's all sorts of things you can do to add complexity, but that's the case with rolling your own as well.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Thermopyle posted:

With heroku this is literally all you do to deploy a new site.

code:
$ heroku create
$ git push heroku master
$ heroku ps:scale web=1
There's all sorts of things you can do to add complexity, but that's the case with rolling your own as well.

For some reason I always get all sorts of errors and issues the times I've tried to install / use Heroku. Something doesn't work, then their documentation falls apart with outdated poo poo and conflicting advice. I'm just lucky I guess.

Thermopyle
Jul 1, 2003

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

Lumpy posted:

For some reason I always get all sorts of errors and issues the times I've tried to install / use Heroku. Something doesn't work, then their documentation falls apart with outdated poo poo and conflicting advice. I'm just lucky I guess.

Or maybe I'm just the lucky one! I can't say I've ever had any problems with their stuff yet. I like using them rather than rolling my own anymore because maintaining servers is not my idea of enjoyable.

Ahz
Jun 17, 2001
PUT MY CART BACK? I'M BETTER THAN THAT AND YOU! WHERE IS MY BUTLER?!

Thermopyle posted:

With heroku this is literally all you do to deploy a new site.

code:
$ heroku create
$ git push heroku master
$ heroku ps:scale web=1
There's all sorts of things you can do to add complexity, but that's the case with rolling your own as well.

Yes, once you have configured your app for Heroku and it's completely different than dev config for for DB and static file handling to another domain like S3 which you then have to manage additional scripts for.

I used to think Heroku was helpfully abstracting away Ops work for me, but after the initial pain of deploying and setting up secondary configuration for Heroku, static files SSL configuration, database migrations etc, I didn't feel it was worth the additional monthly cost. Heroku felt like its own mini-ops discipline I didn't feel like getting too comfortable with compared to just understanding linux ops better.

If Heroku we're cheaper than a potential 10X or higher compared to other hosts, I would probably consider it.

Thermopyle
Jul 1, 2003

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

Ahz posted:

Yes, once you have configured your app for Heroku and it's completely different than dev config for for DB and static file handling to another domain like S3 which you then have to manage additional scripts for.

I used to think Heroku was helpfully abstracting away Ops work for me, but after the initial pain of deploying and setting up secondary configuration for Heroku, static files SSL configuration, database migrations etc, I didn't feel it was worth the additional monthly cost. Heroku felt like its own mini-ops discipline I didn't feel like getting too comfortable with compared to just understanding linux ops better.

If Heroku we're cheaper than a potential 10X or higher compared to other hosts, I would probably consider it.

Ehh, I think you're overselling the difficulty there.

Your DB config should be stored in an environment variable or something no matter where you're deploying so that's a non-issue. Same thing with S3...I mean, your dev config isn't going to push to S3 even if you're running your own servers is it?

I guess if you're going to server your own static files (though heroku python best practices now have you serving straight from heroku except for user-uploaded media), there's a difference there, but you should have separate dev and production configurations anyway so I'm not sure you're really saving anything here.

Dominoes
Sep 20, 2007

Heroku's super-easy. There is (was?) an alternative called OpenShift... that was a PITA!

Ahz
Jun 17, 2001
PUT MY CART BACK? I'M BETTER THAN THAT AND YOU! WHERE IS MY BUTLER?!

Thermopyle posted:

Ehh, I think you're overselling the difficulty there.

Your DB config should be stored in an environment variable or something no matter where you're deploying so that's a non-issue. Same thing with S3...I mean, your dev config isn't going to push to S3 even if you're running your own servers is it?

I guess if you're going to server your own static files (though heroku python best practices now have you serving straight from heroku except for user-uploaded media), there's a difference there, but you should have separate dev and production configurations anyway so I'm not sure you're really saving anything here.

Perhaps, just as you understated.

code:
$ heroku create
$ git push heroku master
$ heroku ps:scale web=1
There are guides either way, and neither is as simple as they sound. But one has a higher operational cost and the other has transferable knowledge gained when once you've mastered a basic dev-ops education.

It's all about priorities of course, but I found that designing a fairly robust application architecture has brought me to a point where I don't need to worry about routine ops problems that Heroku claims to solve. Sure you avoid occasional db or server patching, but it still doesn't avoid app maintenance either way which is likely the bulk of real ops work and maintenance code updates. Again, that being said, I would probably use Heroku if it was much closer in price to what I'd get in a Linode vm + some extra $ for the convenience.

Thermopyle
Jul 1, 2003

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

Ahz posted:

Perhaps, just as you understated.

code:
$ heroku create
$ git push heroku master
$ heroku ps:scale web=1
There are guides either way, and neither is as simple as they sound. But one has a higher operational cost and the other has transferable knowledge gained when once you've mastered a basic dev-ops education.

It's all about priorities of course, but I found that designing a fairly robust application architecture has brought me to a point where I don't need to worry about routine ops problems that Heroku claims to solve. Sure you avoid occasional db or server patching, but it still doesn't avoid app maintenance either way which is likely the bulk of real ops work and maintenance code updates. Again, that being said, I would probably use Heroku if it was much closer in price to what I'd get in a Linode vm + some extra $ for the convenience.

Well, I think we're going to have to agree to disagree here because I don't really want to spend my time white knighting heroku here, but I think you'll find that I wasn't understating anything as if you design your app with modern best practices, deplying to heroku is just like what I said.

edit: That may have sounded sounded more harsh than I intended. I was trying to whip it out real quick before I stepped away from my desk. Sorry.

Thermopyle fucked around with this message at 20:10 on Mar 13, 2017

Dominoes
Sep 20, 2007

I take back what I said about Heroku; once you've figured out its subtleties, it's easy (As Ahz implied), but it's sensitive to certain config variables, database configs, static configs, etc; A disproportionate amount of my commits are titled "Heroku troubleshooting", since there's a lot of trial+error involved when the program works locally, but fails when deployed.

Thermopyle
Jul 1, 2003

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

Dominoes posted:

I take back what I said about Heroku; once you've figured out its subtleties, it's easy (As Ahz implied), but it's sensitive to certain config variables, database configs, static configs, etc; A disproportionate amount of my commits are titled "Heroku troubleshooting", since there's a lot of trial+error involved when the program works locally, but fails when deployed.

I think that just like with a regular server setup there's a learning curve. The question is not so much how "hard" it is for your first few project, but how easy it is on your 30th project.

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes
Are you guys still talking about deployment? At the agency I work at we just
  • copy site's files from staging server to live server
  • copy site database from staging server to live server
  • configure live site to use live database
  • set up apache config
or are you all talking about deploying something else?

NewForumSoftware
Oct 8, 2016

by Lowtax

nexus6 posted:

Are you guys still talking about deployment? At the agency I work at we just
  • copy site's files from staging server to live server
  • copy site database from staging server to live server
  • configure live site to use live database
  • set up apache config
or are you all talking about deploying something else?

Heroku is it's own thing, basically an abstraction layer that means you don't have to deal with setting up Apache or MySQL(instead you configure Heroku, what an upgrade). It's really expensive and not worth it, especially for an individual.

Maintaining a web server should be a tool in every web dev's toolbox.

NewForumSoftware fucked around with this message at 23:22 on Mar 13, 2017

Dominoes
Sep 20, 2007

How do I deploy without Heroku? ELI5.

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Dominoes posted:

How do I deploy without Heroku? ELI5.

It depends entirely on what it is that you are deploying and every single solution sucks in entirely different ways that nobody is ever satisfied with. Stick with what you know and what works until you are given a compelling reason to change, like it not actually working or costing too much money/time/effort/sanity.

fantastic in plastic
Jun 15, 2007

The Socialist Workers Party's newspaper proved to be a tough sell to downtown businessmen.
The only thing I don't like about Heroku is that handling file uploads takes some additional work and tends not to play well with out of the box file uploading libraries. Otherwise, it's been a dream for my purposes (small client work where I'm usually the opsy person as well as a developer).

ModeSix
Mar 14, 2009

You should all just use Visual Studio publishing to publish to an IIS server that has Web Deploy installed.

Once your environment is set up initially, publishing is literally a one click operation.

:smug:

Edit: Jesus I never thought I'd say "Hey use this Microsoft product that I think is superior to all your fancy open source things."

ModeSix fucked around with this message at 17:46 on Mar 14, 2017

Warbird
May 23, 2012

America's Favorite Dumbass

Is regular old Visual Studio a reasonable tool to use for general Web Dev? I've used it with MCV ASP.NET applications years back, but never for HTML/Javascript/etc before. And doesn't deploying via that method limit you to using a Windows box for your webserver?

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Warbird posted:

Is regular old Visual Studio a reasonable tool to use for general Web Dev? I've used it with MCV ASP.NET applications years back, but never for HTML/Javascript/etc before. And doesn't deploying via that method limit you to using a Windows box for your webserver?

Take a look at Visual Studio Code, it's a free, pared down IDE aimed specifically at HTML/JavaScript/TypeScript development.

Adbot
ADBOT LOVES YOU

Kekekela
Oct 28, 2004

Warbird posted:

Is regular old Visual Studio a reasonable tool to use for general Web Dev? I've used it with MCV ASP.NET applications years back, but never for HTML/Javascript/etc before.

I use Visual Studio for C# and Visual Studio Code for Javascript. I think this is fairly normal.

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