/wdg/ - Web Development General

Previous thread: >Beginner Roadmap and Overview
github.com/kamranahmedse/developer-roadmap (don't be overwhelmed, ignore the later parts and go step-by-step)
youtube.com/watch?v=UnTQVlqmDQ0

>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 to HTML/CSS/JS and Node.js or Django
freecodecamp.org - curriculum including HTML/CSS/JS, React, Node.js, Express, and MongoDB
javascript.info - curriculum providing a strong basis in JavaScript

>Further learning resources and documentation
developer.mozilla.org/en-US/docs/Web - excellent documentation for HTML, CSS & JS
hackr.io - crowdsourced collection of tutorials (ignore sponsored stuff, look at upvotes)
learnxinyminutes.com - quick reference sheets for the syntax of many different languages
pastebin.com/gfBPg24A - Collection of PHP links.

>Need help with some HTML, CSS or JS?
jsfiddle.net - create an example here and post the link

Attached: 1515238926199.png (1280x720, 180K)

Other urls found in this thread:

github.com/axios/axios#creating-an-instance
internal.com ')
twitter.com/SFWRedditVideos

First for Laravel is a steaming pile of shit.

For fuck's sake. If you faggots want help, at least post a snippet of what you're trying to do.
This shouldn't have TS errors:
interface ISomeComponentProps {
// Your props.
}

interface ISomeComponentState {
// Your state.
}

class SomeComponent extends React.Component {
constructor(props: Readonly) {
super(props);
this.state = {
// ...
};
// ...
}
// ...
}

Also, function components with hooks are better than class components.

Seconded

SFCs with Typescript are great. Not a terribly huge fan of context with it though.

function components with hooks turn into clusterfucks real fast if they are more complex than 2-3 state properties

Sure, if you treat them like append-only files. I've got a project with probably 10s of thousands LOC, almost all of the components are SFCs and there are no organizational issues. You just need to know when to break up a component and when to use certain hooks.

FC*
ftfy

You can do something like this:
const [state, setState] = useState({
// initial state
});

Only downside is that unlike the class component "this.setState", the value of state doesn't merge automatically with the new value when you call setState.
You have to do something like this or else you'll lose the rest of the state:
setState({
...state,
// your changed values
});

If you use TypeScript, it will show you an error if the new state doesn't have all the properties of the original one, ie: not spreading state.

SFC, because the function itself doesn't maintain state and it isn't instantiated. You can't tell from the outside that it tracks state. Being pedantic on a tibetan basket weaving forum is cool though.

Since the topic is React, what's the trick to have a smooth height transition? Mine gets delayed slightly right now. Couldn't find anything online.

I'm hoping this is the right place to ask, I want to build a VERY simple Android app with React-Native, literally just 1 API call. Should I do the basic React tutorial or are React and React-Native different enough that I shouldn't bother? I've got experience with plain JS and backend but every-time I see a snippet of react code it looks like a foreign langue

Just go through the React docs.

Attached: this took me all day.webm (292x300, 110K)

based

Why are people into web development? What's so fun about making websites?
I am serious. I can understand creating software that you will use, but why would you want to create websites?
Everyone just seems to be into web development as of late and I just can't wrap my head around the reason.

>Build normal desktop application
>Need to install it on 200 computers
>In the old days, it would be done manually. Putting the necessary files into a storage device or network then installing them. It takes too much time.
>Nowadays you can setup a script to do the install on all those computers simultaneously, but that would also take time and require a dev ops monkey.
>Repeat whenever you need to update.

>Build web application
>Everyone is literally using the same application that's running on the server, so no compatibility issues.
>Updates are instant, literally just reload or navigate to a new page

Ok, I want to integrate ElasticSearch in a Django project and I'm getting confused. Basically it seems that I can use :
- Elasticsearch DSL
- Django ElasticSearch DSL
- Django ElasticSearch DSL for Django Rest Framework
Which is the smartest choice for a beginner? I can hook my index to my project with any of them just fine and I'm getting search results, but to go further and add highlighting and faceted search, etc., I'm really at a loss as to which one I should go with...

Attached: 29djan600.jpg (600x335, 56K)

To continue, basically I would think that ElasticSearch DSL and Django ElasticSearch DSL would be fine, but when I search for highlighting and other similar functions, I'm always redirected to the documentation for Django ElasticSearch DSL for Django Rest Framework. Would it really be the only one to let me do those kinds of things (highlighting, searched for keywords in search results, faceting and clustering, etc.)?

Attached: MV5BMTQ0NTk0NjgyNV5BMl5BanBnXkFtZTcwNjQ4Nzk3MQ@@._V1_SX1500_CR0,0,1500,999_AL_.jpg (1500x999, 162K)

y tho?? i’m learning php right now

>tfw too stupid to implement freshman cs algorithms
jdimsa

Need some quick php help

I have a date from the db like "2018-01-25".

Need to use PHP to see if that date from the db is between now and next week.

Nothing I do can get it to compare for some reason. strtotime is giving the wrong dates (it's a day behind)

Please help.

What's wrong with context? Besides the non-null assertion (because it's not guaranteed that your context will be in scope) it's pretty gud

Attached: .png (785x154, 27K)

You need to know what timezone the database is storing the data in. It's likely defaulted to the server's timezone but also can be UTC+0

$date = new DateTime("2019-07-14", new DateTimeZone("UTC"));

// Get next week's date
$nextWeek = new DateTime();
$nextWeek->add(new DateInterval('P1W'));

// Diff given date with next week
print $nextWeek > $date; // true
print $date < $nextWeek // false

here's the basic ref guide for a semester of data structures & algorithms off the top of my head

1. sorting/searching algorithms
- bubble sort
- insertion sort
- binary search
- quick sort
- merge sort

2. Big O
- see how sorting algorithms apply to big O

3. Data structures - Singly/Doubly linked lists
- Learn about the head/tail of the list, the next/previous node
- Traversing Singly/Doubly linked lists through recursion & looping
- Stack & queue implementations using a linked list. Assignment: Implement a basic XML validator

4. Binary Trees
- Algorithms for traversing/searching binary trees (Inorder, Preorder, Postorder)

5. Learn about hash sets/tables and how it applies to Big O

6. Learn about graph data structures and the associated algorithms (e.g. shortest path)

>1. sorting/searching algorithms
>- bubble sort
>- insertion sort
>- binary search
>- quick sort
>- merge sort
But they already implement as standard libraries everywhere why do you need to know how to implement them?
???????
????????????????????????????????????
> reinventing the wheel

>I shouldn't learn about how algorithms are implemented, nor their use cases because they are already implemented

> in order to decided which car I should use for formula 1 or off-road racing or for the city I need to learn how cars are made down to every bolt and nut instead of just learning their use cases and applying them

Be my gues, waste your time. By the time you are 40yo junior I will be 30yo CEO

I came here for ass

How are you going to make a car if you don't even know how a wheel works?

Why would I want to make a car? I need to drive it to reach the result (allegory to using sorting algorithm to reach the result).
Writing OSes and or their languages is for retards like you

you wouldn't know what the best car to drive for the specific kind of race if you didn't understand the specs

The specs already summarized, there is a lot of documentation and information out there on cars just like on use-cases of algorithms.

Do you seriously never get in to situations where you need to apply concepts of sorting algorithms for specific use cases that generic libraries won't solve?

99% of the situations boils down to using already defined sorting algorithm you dont need to reinvent
The res 1% is in:
>Writing OSes and or their own programming languages is for retards like you

I have a complex react component which registers all kinds of callbacks etc, has audio processing which can be paused
How do I keep it alive when using react router and switching to other app views?
At the moment everything is killed since react router unmounts everything when showing a different route
I guess I have to move all the logic out of a react component and keep it somewhere else, using the react component only for rendering.. is this when I should use something like Redux?

If it involves keeping audio state, make it a parent of the router and share it's state through a context provider. In your page components you can then do something like but instead with "AudioPlayerContext"

Is this correct?

>~/.ssh/authorized_keys on the target machine determines which keys will be accepted
>when sshing, ~/.ssh/id_rsa.pub will get used as a key to attempt authentication

Is it worth it to learn HTML/CSS very well or is it pretty much useless in industry beyond basics? Like no job consists of writing markup all day right?

t. 60 IQ fag

based 98th percentile actually

Thank you so much. For whatever reason I couldn't get anything to work. I was worried too much about it not reading the format so I kept doing createdatefromformat or specifying the format in general and it wouldn't work.

Anons, how should I go about adding chatbots to my website? How would you add sounds to the bot responses?

I have a job interview and for the test I'm being asked to make a SPA with a login. If authenticated, It needs to display data from a json that the company has hosted, through an api.

Is it possible to do that with vanilla js or jquery? The authentication part. I have no idea how to hide information on the same page if the user isn't authenticated.

You'll learn html very well in 5 minutes.

I know people who's jobs are literally just correcting html files, it's piss easy and they make decent money.

Css is definitely worth it, especially if you mean SCSS/SASS

>I know people who's jobs are literally just correcting html files, it's piss easy and they make decent money.

Why can't I find bullshit jobs like that?

I got a fun API code/folder structure question for u guys.

At my last job, our API passed a request through certain layers.
http request => routes layer => req/res layer => service/custom logic layer => data access layer

Layers:
http request - the input to our api
routes layer - declaration of our routes and reference to their req/res layer counter part
req/res layer - basically translates http request/response format to our internal request/response formats and vice versa. Passes request to service/custom logic layer
service/custom logic layer - does custom shit (if needed) before passing request to data access layer.
data access layer - crud operations on database.

Does this sound like a good design pattern to u guys? Is that what your apis look like?

There was a little more complexity to it, but I'll summarize it by saying internal requests would go straight to the data access layer by default if there was no custom logic defined for that request. We had a 'routing' layer for that. It saved us from having to write service/custom logic when we didn't need it. My question is: does this routing layer appear in the APIs that you write?

I'm about to write my own api so I want to know what design patterns are out there.

if you have free time is worth to learn at least 5 programming language.... some thing like, HTML, CSS, Java Script, PHP, Python , Django, Node.js, Data Base, and C++....

Use React instead of vanilla js.

Pretty simple task with AWS. Host SPA on S3. Use AWS Cognito and AWS Amplify for easy authentication. Once you're logged in, make the API request.

>I have no idea how to hide information on the same page if the user isn't authenticated.
If statements, dog. If the user is signed in, request the data. If the data is available, show it.

I'd say googling it once is enough to understand why.

Rails are easier to pick up. Ruby is way more web-oriented than Python. I would assume (and I might be wrong) there are more gems for Rails than there are packages for Django but if you were to compare libraries for Ruby and Python, the situation would be the opposite.
Rails do a lot for you. Like, A LOT. Sometimes it's good other times it's bad.
Making a "decent" project with inexperienced devs is easier in Rails. Making a "good" project with inexperienced devs is easier in Django. If you have experienced devs, it doesn't really matter.

Formerly employed front end dev here,

Be very careful, dude. If you want to get in the door, do not be a jack of all trades, master of none. That is a losing strategy. You need to focus on a small subset of those languages. I believe HTML, CSS, JavaScript + some framework (React, Express/Serverless) is the hottest one right now.

Then you should become very familiar with at least one architecture/design pattern of some product (in this case, a website). For example, here is an architecture/design pattern outline for an API (for a website). If you're a junior and able to draw that out on the board for the interviewer, they should be impressed.

It's far more impressive to be familiar with the nuances of architecture/design than it is to know another language and a related framework. For example, it'd be much more impressive for a junior to be able to talk about the trade offs between client side and server side rendering of a website, than it would be to know how to set up a Hello World page using either Python or JavaScript.

For chatbots, you can use AWS's Lex or Google's Dialogflow to make your own chat bot. (Personally, I only have experience with Dialogflow, but it's really good.) I've never played sounds on a website before, but it's probably not hard. Just play the sound when a new message arrives.

Did you use a class based approach or just JS objects? (assuming you were working with node.js) I've seen some code where the functions are just in objects and I've followed that approach, but I'm questioning it right now.

thanks famalam I will try this

How big of a project (LOC) would leave a positive impression to employers on a github profile, like "ok this guy can handle some somewhat complex systems"

Given that it's not sloppy code and has more than trivial functionality ofc

sounds about right, although usually you use commands rather than dealing with those files directly

don't worry, i fine... my lowest IQ test was 110 points.... and i have a lot of free time.... basically i could be able to make an operating system by my self.... but i will not do that just to not make bill gate go bankruptcy......

or rather, the id_rsa.pub is the public key that is pushed to the remote server, and the id_rsa (with no extension) is your local private key

Each layer I described there is just a set of functions in files. They didn't sit inside objects. I'm not sure what you mean by that. Curious to know tho.

All of our data was just JSON objects. No classes. No type checking. Minimal schema. Before I left, we began to move to GraphQL and TypeScript, which has a schema and type checking. Personally I haven't seen the value in that, except for that it's the new hot meme technology, so monetarily it's worth learning. But plain old JSON objects and functions have always worked fine for me.

The API that I'm working on now will use classes since I'm using MySQL and an ORM instead of a NoSQL database like we did at my last job. Maybe that's a good way to decide whether you should use one or the other? Idk. I should look it up.

>don't worry, i fine...

No, I'm worried about you, dog. Your typing style is very strange. I would throw your resume in the dumpster if I sent you an email and you sent me a reply lookin' like that.

i know it, but i am the smarter person on the plane.... so i just would felt bad about that company owner....

I guess I'd make an exception if I knew you were ESL. What's your native language, bro?

Spanish..... but my native language is bad too...

Yes you can do it with jQuery.

Create divs for the pages with a default of display: none. Then if they need to show switch them show() with jQuery.

I generally make a function where you pass the page parameter (which is the Id of the page) then I hide all with class page and show with id of passed parameter.

Important to note that you can't play sounds anymore unless the page has been used first.

Oh, I see. Entonces no hay excusa para usar '...' tanto. Yo, aunque solo hablo muy poco Espanol, pienso que mantengo la grammatica tal que se demuestra que mi mente esta bien.

That took a long ass time to type lol. Now I see why you use the dots. It's so tempting when you're trying to figure out how the fuck to say something.

Looks like every pajeet resume out there.

They get thrown in the trash. I used to put a shit ton on my resume because I actually use a shit ton. All day all I do is program, so I know them pretty well. I would get no calls.

Once I dropped all that shit off and just listed my absolute strongest languages I started getting endless calls. I get interview requests at least once or twice a week.

Yep, you use Redux to maintain a state outside of a component.

Might not be necessary tho. With React Router, you can have components that are always rendered no matter what the current route is. Just don't specify a path prop on the component, and it will always be rendered.

Not that guy, but try speaking. Spanish is my first language and while I was already pretty good at listening, reading and writing in English I had to take classes to practice my speaking because my tongue couldn't follow my mind for shit.

Quick question, background images on a div/section still can't be animated right?

Is setting up multiple, absolute positioned empty divs with different backgrounds still the way to go if I want to change the background nicely?

how do I open a file when there is routing?

I'm using yii and I'm trying to open this.txt but when I go to open it it says page not found.

>reddit spacing

have sex

I've been typing like that for 12 years, if you don't like it, fuck off.

and reddit came out 14 years ago

high pass filter with the mithical playboy girl usually used for imag digital vision, noice

pls respond

this.txt is not a page. it's a file.

So basically the lower to columns are of a combined fixed width of 900px. Left column 300px, right 600px. They shall be centered if screen>900px. How can I attach the top column in the middle section to the right spot? (without an empty element of 600px width...) How can I attach the header so that it aligns with the columns, but may grow larger than 900px? Is it possible?

>tl;dr
>How can achieve pic related with the most conforming semantic html, without JS? Grid and flex are OK. Have not done anything like this before.

Attached: layout.png (889x444, 22K)

uh oh busted

How do I open it?

I'm getting a response from the controller containing a link and need to open it with js.

>the lower to columns
I stopped reading

why dont you guys just use godaddy to make your websites ?

Yuck, Elon Musk endorses this

Sorry, I am from pakiastan. It is not my first language. Could you still help me? The image clearly shows my goals.

Yes of course, sir. Please do the needful and all will be well.

grid or flex-box, tables if you're retarded

Fat chance but anyone has VS 2019 with Core 3 preview and netstandard 2.1 installed?

Yes, thank you, my friend. Please go on and tell me about what you consider the needful to be in this case. Thank you for showing me your trust by not hiding your racism.

>muh racism
Pajeet Jr. can't handle the bantz.

Please tell me white man: Why you make web so complicated? Is it so that we shall be your slavs for all of eternety?

Any of you experienced in making API calls with axios?

I want to create an instance with a baseURL and a params object but I can't remember for shit how to create and use it, neither find it in the docs.

>being this much of a mindless follower
you are the only one here belonging on reddit

>neither find it in the docs.
github.com/axios/axios#creating-an-instance

what docs where you looking at then?

Those docs, but couldn't you pass in a params key to axios.create, for variables to be added to the baseURL when using your axios instance?
At least I remember this to be possible in v0.18

Paki or slav, which one is it now?
Or is it both? It’s both, isn’t it

Attached: 0928136A-418C-4CD3-AD32-107207F2A04E.jpg (602x441, 123K)

oh, skipped over the params part.
Hm, .create() takes the same config argument as all the other methods, so I think you can set it there as well.
Requests should then use the ones from the instance-config, unless you specify different params in the individual request.

Can't check it right now, but did that not work when you tried it?

>formatting your posts is reddit spacing
kill yourself you fucking drooling retard

How do i change color of li links? This only changes bullet color:
let links=document.getElementById("ul").getElementsByTagName("li")
var badReg= new RegExp('internal.com ')
var goodReg=new RegExp('(ftp|http)://.+')
for (let link of links) {

if (goodReg.test(link.innerText) && !(badReg.test(link.innerText))) {
link.style.color="orange"

}
}
[/color]

have you considered the possibility that you're looping through "li" elements and not their inner "a" tags?

thank you thats what i did
var l = link.getElementsByTagName('a')
for (let i of l) {
i.style.color="orange"
}

do you guys work remotely?
whats the best thing to work on if i want to work alone from home and earn humble bucks?

I need to make an admin panel with widgets and forms to manipulate several different types of objects. These objects can be queried from a backend server. For some of the objects i need to be able to place them in modifiable lists. I also need to display statistics derived from backend data on some pages. I also need to be able to trigger methods on some objects or even the whole system and be able to handle the reply within the interface.

What’s the least shitty front end framework I can use for this sort of stuff?