<wdg/> - Web Development General

Prev threads (wtf):
>> 65933696
>> 65925151

>Free beginner resources to get started
Get a good understanding of HTML, CSS and JavaScript.
developer.mozilla.org/en-US/docs/Learn - a good introduction (independent of your browser choice)
freecodecamp.com
codecademy.com
hackr.io

>Further resources
developer.mozilla.org/en-US/docs/Web - excellent documentation for HTML, CSS & JS
github.com/kamranahmedse/developer-roadmap - Frontend+Backend learner-path suggestions
youtu.be/Zftx68K-1D4 - Web Development in 2018

jsfiddle.net - Use this and post a link, if you need help with your HTML/CSS/JS

Attached: wdg.png (822x552, 868K)

Other urls found in this thread:

stackoverflow.com/questions/43040721/how-to-update-a-nested-state-in-react
codepen.io/vincent-inb4/pen/dOQggY
youtube.com/watch?v=HlYFW2zaYQM
twitter.com/NSFWRedditVideo

Planning to learn this stuff more seriously but just wanted to know:
Can you get by as a front end dev, or is it strongly reccomended to study full stack?

So many jobs demand google accounts now, I need to make a professional one instead of [email protected]

Attached: [email protected] (1333x899, 108K)

>Can you get by as a front end dev, or is it strongly reccomended to study full stack?
They both exist but full stack devs can do both (plus back-end/API jobs) and front-end devs can only do front-end.

I'm building the server backend for a chat-like service. Which database solution should I use to store users, messages, etc.?
I don't need any complex queries, I just want it to be pretty fast in terms of reading/writing and be reliable.

I've never really used SQL for anything production-scale, I'm kinda scared of it as a whole. So I started with Redis. Don't feel completely comfortable with my choice, but it's pretty simple so I like it in that regard.

Attached: Oracle-Database-support.png (300x300, 5K)

Are users/messages being stored a long period of time? Use a database like mysql/mongodb/postgres for that and not redis; redis is mostly for caching and 'forgettable' data in most cases.

Any of the databases I previously mentioned would be fine, although I think mongodb might be the easiest to grasp if you're new to stuff like this, and mongo would suit a node.js server (if that's what you're using). Redis would work as well, if your data doesn't need to be persistent, but I don't know how exactly your website wants to function, so I can't be more specific than that.

Also look into socket.io if you haven't already, it's perfect for chat services.

>Are users/messages being stored a long period of time?
Yes, at least users are. I thought about only keeping recent/undelivered messages in redis and maybe moving the rest over to colder storage like MySQL or something, but that would be pretty complicated for what it's worth.
While redis can be pretty persistent, I realize it's not its strong suit.

Do you happen to know how does the speed of inserting data in Postgres/MongoDB compare to redis? I want message inserting to be pretty fast (a message is just a string and some number fields like src id, dst id, time, etc.).

Also, the backend is Golang and Websockets. Pretty comfy so far, much better than Python (with asyncio), which feels like a mess in comparison.

I have a learning disability and would much rather work at my own pace than in a 'fast-paced' environment. Do webdev jobs exoist which generally take things nice and easy (i.e. not a team full of rockstar ninja developers working 12 hours a day with sprint meetings) or should I start my own business and market my skills even though I have no professional experience?

>pretty complicated for what it's worth

I don't know if I agree with that: learning and using MySql and etc. is a very good idea for resumes, 'serious' websites, and for becoming a more fully-fledged developer.

>Yes, at least users are
Permanently storing user info like usernames and passwords inside redis probably isn't a good idea.

There's also the whole logistics side of when/how to put your redis data into MySQL, and when/how to retrieve that data from either or both databases.

>Do you happen to know how does the speed of inserting data in Postgres/MongoDB compare to redis

Redis is much faster, speed is what redis was built for. I don't know the exact numbers off the top of my head though. Inserting data in either scenario wouldn't be too big of a deal though, the times will both be pretty fast for a low amount of inserts or retrievals.

>I have a learning disability
what's that?

Maybe look for remote jobs?

>not a team full of rockstar ninja developers working 12 hours a day with sprint meetings
There are lots of jobs like that. They're not very interesting jobs but they exist.

Nobody is going to be happy with an unproductive worker though, so if by 'nice and easy' you mean, no deadlines and deliver when you finish something, those jobs almost don't exist any more. Everyone has to quote estimated completion times and if you consistently quote three times longer than everyone else, you're not going to keep your job.

Actually I just found out the better term is 'learning difficulty'. It arises in school when you don't process and understand information in the same way your peers do. Your brain is different so maybe you can't do arithmetic very well, or process words / sentences correctly, or keep your attention to one thing etc. So conditions like ADHD, dyslexia etc are learning difficulties.

I have developmental dyspraxia, which affects my processing of external events (e.g. being given information, instructions from others). I can work very well on my own, since it is just me and nobody else to influence the whole workflow. But working with others poses an issue since I process information more slowly than most people do and work at a slower pace.

Considering most webdev agencies want projects churned out as quickly as possible, I don't wish to work in those places and would much rather work solo, or at least at a slower pace. I'm asking whether it's advisable to start my own business in that case.

I see. It isn't that I am unproductive. I honestly work very hard and am very passionate about web development. But I also work at a slow pace and always have. Accommodations were put in place at school and that was ok, but working as an adult is a totally different world now.

I see.
Some places might give your employer incentive to hire you which could help but in the right environment, that might not necessarily be a problem. I'd try going for remote work first and foremost, you won't be under as much pressure and you can even record the video chats if you set yourself up right.

Emailed specs would help you too. Working slowly though, is going to create problems for you no matter what.

By school, do you mean university?

Thanks for the advice. I didn't expect such sensibility from Jow Forums, lol. I'll try to locate remote work.

>By school, do you mean university?
All of school effectively since age 14-15. So in UK it was secondary school, vocational college and then university.

I don't know your skillset but if you can do PHP then look into an outfit called Compucorp.
They don't pay especially well but I think they have fairly low standards and are a UK based software company that mainly does remote work.

>There's also the whole logistics side of when/how to put your redis data into MySQL, and when/how to retrieve that data from either or both databases.
That's exactly what I meant by "complicated". It's not actually complicated, it's just more code than there needs to be (and it wouldn't exist at all if I just shoved all data in one database).

I guess I'll look into Postgres and see if I can base everything on it (and maybe keep something in memory).
It's a shame, since I liked having the possibility of using redis' pubsub stuff if I ever needed it (and I did need it until recently), but I don't want to run 2 databases at once.

Postgres can do equivalent pubsub things with LISTEN/NOTIFY.

Remote work has even more pressure what are you talking about? There isn't social pressure, but there are more deadlines to hit that you normally wouldn't have to care about because people in the office can see you're working on it.

I want to set up a mysql database for my flask app using sqlalchemy.
I think I got the configuration set up, but how do I check that the database is connected?
Also, I got the SQL code for tables and the structure written already but if I want to make some changes, do I edit it in python and migrate changes as necessary? Do I need to rewrite the SQL code for all my tables into python?

I'd trade just for the ability to work wherever i choose. 9-5 makes me sick

>I'd trade just for the ability to work wherever i choose

Not every company afford this, or can they?

most companies here (Southern Europe) just want 9-5/10-6 workers

No, remote work is rare. I've done it for years but after that project dried up, finding more is tough.
I could have had a dozen on-site jobs by now if I wanted them.

Sorry, was thinking more along the lines of freelancing, not working for a company that lets me do remote work.

I'd take the pay cut and frustration in exchange of waking up without that feeling of "oh god, another 8h of bullshit ahead" and having to sit in an office the whole day.

So what do you do now?

I tried remote work once before, for me there's too many distractions at home to do proper work. I'd rather commute to work somewhere close to home.

I look for work.

Fair enough. I freelance from time to time, and never had a problem working from home or a bar.
Would love to switch to that style of work full time.
Depends if you can discipline yourself to actually work instead of jerking off and watching shows the whole day

Write a connection class, then you can call on it as required

Working wherever is irrelevant to me, quite frankly I prefer work environments that are set up for the expectation of work and not those that are multifunctional, and I sure as hell will not be looking at a computer screen while outside being tempted by a beach. That's just me.
Thankfully, there are a couple businesses that do exactly that, lease out space with the explicit notion that everyone will be working. You still get to show up whenever, no pressure socially, but zero distraction. Ultimately, I think it's where all businesses are going to move towards as talent becomes less centralized in SV and tools like Live Share come around enabling easier remote work.

in what situations would a company want to have a c/c++ backend for their webapp? all the resources I look at say it's a stupid idea unless you really need it

You need fast calculations for something.

>Fair enough. I freelance from time to time, and never had a problem working from home or a bar.

Back when I worked a 'proper' corporate job, I couldn't work stay focused on the rare days I got to work from home either but the second time around when I was in startups and weird project work, I had no trouble doing it full time. I did it for six years.

>Would love to switch to that style of work full time.
>Depends if you can discipline yourself to actually work instead of jerking off and watching shows the whole day
There are days when you watch an episode of something on the clock or play a bit of something that runs in linux but on the whole, if you like your work, it's pretty easy to stay focused. It's only when my job sucked that I had any trouble.

>c/c++ backend
Speed basically. There's not a lot of other reason. If you're doing something very complicated in real-time then you might want to use C/C++. Usually, you just find a different way to do it, if speed is that essential, you probably need to rethink the work-flow and find a way to do it as a batch and let the client poll for job completion (or push with web sockets or something).

There isn’t a reason to go that close to metal for web dev.

You use a c/c++ program that you queue up with a web backend to perform your calculations or whatever. It’s just more hassle than it should be to just render a webpage and parse requests and responses. You would have an easier Time using golang or python for that.

>tfw doing C++ webdev right now
>it's not even for a company

You do you man.

But seriously, what's the motivation?
I'm not knocking the language(s) but for webdev? It's not a tool that springs to mind, what's your purpose?

>You use a c/c++ program that you queue up with a web backend to perform your calculations or whatever
I'd use R or possibly even do it natively in Python unless it was very computationally expensive but then see and rethink your process. I've written a web app that did statistical regression in real-time and that used R and was good enough. Still no need to get down to C/C++.

>what's your purpose?
proof-of-concept of C++ as a web-ready language

something like a cryptocurrency exchange would be a good candidate then? i see binance uses java and c++ on the backend

>C++ a web-ready language
I'd readily concede "web-capable language", you can make it web-ready with the right libraries of course.

>something like a cryptocurrency exchange would be a good candidate then? i see binance uses java and c++ on the backend
Maybe, I'm not sure the crypto couldn't be done fast enough in Python or something but yeah, that would do. You'd probably be importing C++ functions into Java though or something like that.

That's the other thing, you can generally just write a library in C++ and then import the functions you need into another language that's actually doing your API or whatever, that's how those languages actually work after all.

Are you Kevin from coinmetro?

If I'm setting up analytics on a react web app, but the URL on the browser is the same throughout the steps you click, what should I put for the path?

hitType: pageview;
page: URLgoeshere

You could always use a router and have a changing URL but assuming you don't want to do that, why not log the class? If you're using a fat/thin component pattern then you probably want the fat component class, not the thin.

I'll try that, thanks user.

state = {
grandparent: {
name: "",
last_name: "",
parents_in_array: [
{
name: "",
last_name: "",
}
],
single_parent: {
something: "",
whatever: "",
},
this_too: ""
}
};

handleGrandparentChange = event => {
const { name } = event.target;
const { value } = event.target;
this.setState(prevState => ({
grandparent: {
...prevState.grandparent,
[name]: value
}
}));
};
handleArrayOfParentsChange = event => { ??? };
handleSingleParentChange = event => {
const { name } = event.target;
const { value } = event.target;
this.setState(prevState => ({
grandparent: {
...prevState.grandparent,
parent: {
...prevState.grandparent.parent,
[name]: value
}
}
}));
};


I'm sure I can make some generic handleChange function using recursion perhaps, maybe something like handleChange(...array) and calling it like handleChange("grandparent", "parent"). Thing is that I'm not smart enough to make one.

I wish the remote jobs weren't rare.

It would be nice to go wherever you want. It's my goal. Working in an office sucks.

is it no longer standard to use $ as document.getElementById? i heard jquery fucked this up.

what?

Was that a standard?

I don't use jquery but I think the $ is more like querySelectorAll. Plus it returns its own type of object to apply styles and register events and stuff.

>nodemon doesn't stop the server if there's an error
>have to kill the port manually

I don't like this.

stackoverflow.com/questions/43040721/how-to-update-a-nested-state-in-react

Why this doesn't work?
have this:
dropArea.addEventListener("drop", FileSelectHandler, false);
container.addEventListener("drop", FileSelectHandler, false);


the idea was to put dropArea, and container to an array and use foreach:
["dropArea","container"].forEach(function(i){
i.addEventListener("drop", FileSelectHandler, false);

});


but the browser returns:
TypeError: i.addEventListener is not a function
but when i do console.log(i); it prints dropArea and container. What I'm missing here?

dropArea != "dropArea"

One is a DOM node and one is a string.

>makes fun of C++ fags for having to write header files, and setup compile flags
>have to deal with arduous "transpiling" and "packing" workflows that are incredibly confusing and prone to break at every "module" update

web devs are huge fags. I just spent 4 hours figuring out how to use webpack to build a bootstrap project and now I can finally start building my webpage.

Attached: cringe.jpg (1280x720, 96K)

shit,.. thanks.

I saw this awesome example of animated css background on codepen:
merging few different pictures into one place and animate them:

codepen.io/vincent-inb4/pen/dOQggY

I wonder is this a right approach? I can see that the pictures are 1920px, I wonder how this would scale on bigger res screens, have no idea how to test it.

>have no idea how to test it.
google chrome dev tools -> responsive design mode

>>have to deal with arduous "transpiling" and "packing" workflows that are incredibly confusing and prone to break at every "module" update
Yeah, those things suck. But it's the web in 2018, everybody's on it now so you have to conform to several standards to keep things secure and also looking sexy.

Thats basically what im doing right now, my question isnt about that

just use makefiles to string together various command line tools

Anybody here with depression using webdev as a creative outlet?

I don't think you'll ever have traffic big enough to worry about that performance. If you really give that much of a massive shit about performace you can dump messages into Kafka and then have another application read the topics and dump them into a database as large CLOBs. You really don't need to have each message queryable by its own key. I'd drain a Kafka topic and dump them into the DB as 30+ messages per row. When someone scrolls back into history you want to load messages in bulk anyway.

Yes. Why you're asking?

Well, because I do too. And I'm lonely.

I'm lonely too. What are you working on? What interests you in web dev?
I'm currently messing around with three.js.

>delete 5 react apps from my computer
>deleting 100000 files....

Attached: 1526502207929.png (593x577, 58K)

you guys don't leave the house for walk in the woods?

get a bicycle

Right now I'm following Brad Traversy's video on Push Notifications using Node.js and 'Service Worker'.

youtube.com/watch?v=HlYFW2zaYQM

>What interests you in web dev?
Webdev is very large now and there's a lot to work with. I've always loved the internet, ever since I was 8 back in the late 90s and it was such a wild-west kind of place. Programming in general is great, I love automating things with computers. What do you enjoy about webdev dude? Three.js sounds interesting, got a project going?

I do, I go for walks a lot. But it's all the same place and I don't like seeing other people.

>I don't like seeing other people

>Man is by nature a social animal;
>Sn individual who is unsocial naturally and not accidentally is either beneath our notice or more than human.
>Society is something that precedes the individual.
>Anyone who either cannot lead the common life or is so self-sufficient as not to need to, and therefore does not partake of society, is either a beast or a god. ”

― Aristotle

> Right now I'm following Brad Traversy's video on Push Notifications using Node.js and 'Service Worker'.

Noice. I currently follow his MERN stack but I got stuck on the redux part so I'm procrastinating by doing some other projects.

I like his channel and his little project based tutorials. And if you are interested in javascript then his Modern Javascript course is something I would 100% recommend.

> ever since I was 8 back in the late 90s and it was such a wild-west kind of place.

Same here. I regret not studying computer science or something related as it was such a logical choice. But I went to study something my parents wanted and then dropped out. Now, I wallow in self-pity and use programming as an outlet. I think if it weren't for programming, I would have offed myself some time ago. I really like that there's so much to learn and do.

And yeah, the internet was such a different place. I remember Jow Forums back in 2005, it was like an obscure place with a special kind of humor. It felt like a tight knit community but that changed quickly as it gained popularity.
It was fun while it lasted I guess.

> What do you enjoy about webdev dude?

Everything. I really like creating things and having others use it. I managed to generate some small passive income, I could even make more but the depression gets the better of me and then I don't see the point.

> Three.js sounds interesting, got a project going?

Yeah, I'm hoping to create a multiplayer game with javascript alone and currently, I'm just messing with three js. A-frame is also something I'm looking into, you can make a 3d/vr portfolio in a short timeframe with it.

> I love automating things with computers

What do you automate? Which languages do you use?

This is why I want a home incubator like Silicon Valley. Making stuff is lonely work.

nice trips and an inspiring quote

>I don't like seeing other people.
You don't need a home incubator.
There are remote work spaces in like every major city. Go to one. Go to a coffee shop. Go to a hackathon.
Variety of options, there is ZERO reason for you to feel lonely while making stuff unless you have explicitly set out to isolate yourself.

If he says, then it must be true!

What part don't you agree with?

The part that I'm a god.

you're socializing right now through the internet. that quote doesn't apply here in the slightest
also aristotle is always right, yes

>is either a beast or a god
If you aren't a god you're a beast

All sounds really cool user. I hope to make some passive income in the near future myself. I sympathise with you on not studying computer science, it would have been a great help but what can you do really. We're doing what we enjoy now and that is what matters.

Also this is like the pot calling the kettle black or that Spiderman meme image doing the rounds on Twitter but I wish you the best in feeling better and I hope you don't go through with killing yourself. Programming is too fucking fun to miss out on mate.

For automation right now I stick to JS and userscripts to fill in forms and click the button automatically, but I hope to learn webscraping in the future. I did the Automate The Boring Stuff course for Python on Udemy which was fun, but I wouldn't want to touch Python too much since the lack of semicolons makes me feel uncomfortable.

Before I die I will leave you just 1 suggestion which mankind never deserved, but should have had since the creation of webpages.

2 layouts in 1 website toggled with the push of a mouse button. Instantly change your websites' layout from an imageboatd to a forum.

aristotle is only right in the sense that he's the perfect ironic shitposter

reddit already does this
changes layout from instagram to headlines

Ok and how do you expect the logic of this to work. People posting in forum mode don't traditionally post a lot of images, it's more focused on text. Unless you're thinking outside the box and six-dimensionally, in which case I hope to reach your level of genius someday.

When your non-TLS serving web application receives a request over http, throws out the response and then sends another request back to the origin (which is also a webserver, but one that _is_ serving TLS), is your request encrypted?

I guess what I'm asking is does anyone have a good primer on how TLS/SSL works?

Thanks, mate, I wish you the best. Hopefully, you'll be able to make some nice dosh with your skills.

I used to do things in Python and I did the same course, but you can do pretty much everything in JS on the web so I'm currently focused on making stuff with it.

Thought of going back to Python for machine learning but now with tensorflow.js, I don't even need to.

i have a domain name

i can hook it up to whatever web host (like an ecommerce platform) but not multiple hosts?

and i can ALSO hook it up to an email host (like outlook.com or whatever)?

how am i supposed to know what works with what? this stuff is
about as difficult to get a clear overview of as the tax code for freak's sake

How do I into design?

By learning general design fundamentals and growing from there.
Otherwise just use css frameworks and hire a designer later.

i'm bored

Attached: 1.jpg (1143x603, 109K)

The one rule of displaying dialogue is to have the first speech bubble on the left since it is how westerners read user.

>Using create-react-app

Attached: chrishandsome.jpg (1280x720, 34K)

Create a gigantic page which you have to scroll bar in order to reach the tab you want. You have a minimap indicating where you are.

It would be funny as fuck and a response to those retarded website blogs where you have to scroll down 2 miles till you finally reach the content you wanted.

You can only hook one url up to one server, but you can hook multiple urls to one server.

e.g.
www.urlname.co.uk points to -> 84.123.43.32
subdoamin.urlname.co.uk points to -> 123.123.123.12
subdomain2.urlname.co.yj points to -> 123.123.123.12

Yes you can hook it up to emails, most likely cost implications on hooking it up to the main ones (gmail, outlook)

>i can hook it up to whatever web host (like an ecommerce platform) but not multiple hosts?
If you want multiple hosts, you can use a subdomain.

e.g. "example.com" could be hosted at 1.3.5.7, but then "blog.example.com" could be at 2.4.6.8

> and i can ALSO hook it up to an email host (like outlook.com or whatever)?
Mail servers are a different protocol/port than HTTP servers. So there's a different DNS entry for looking up the address of a mail server, so you can have that point to a different place.

Simply use a modified website function that allows you to post 5-10 thumbnails and resize the image when clicked. Avatarfags will look awkward in the process, but better for us anons.
Same deal like Jow Forums X allowing gallery mode to view images easier without clicking them and auto pre-loading.

>Using create-react-app

What to use instead, user?

Attached: 1526488507239.png (1440x900, 892K)

Just setting up react, and react-dom, webpack, and babel as dependencies and going from there boyo.

Any easy way of creating a report template in html? I'm shit at design, literally the only thing left of my internship. I've the format they use, but I'm that much of an idiot..

Show me examples of horrible web dev practices used on relatively large sites.