/wdg/ - Web Development General

Weeb Dev General

Previous thread: >Beginner Roadmap and Overview
github.com/kamranahmedse/developer-roadmap
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 from across the web for learning languages and libraries (ignore sponsored stuff, look at upvotes)
learnxinyminutes.com - quick reference sheets for the syntax of many different languages (generally not sufficient on their own for learning something, but very helpful)
pastebin.com/gfBPg24A - Collection of PHP links.

>Asking questions
jsfiddle.net - Use this and post a link, if you need help with your HTML/CSS/JS
3v4l.org/ - Use this and post a link, if you need help with PHP/HackLang

Attached: wdg_template_n.jpg (1280x720, 82K)

Other urls found in this thread:

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
web.archive.org/web/20080516162853/http://radio.javaranch.com/pascarello/2006/03/30/1143735438047.html
web.archive.org/web/20070106232535/http://radio.javaranch.com/pascarello/2006/03/31/1143817890773.html
keelypavan.blogspot.com/2006/03/reusing-xmlhttprequest-object-in-ie.html
developer.mozilla.org/en-US/docs/Web/API
codepen.io/user/pen/pmamZg
vulfpeck.com/
codingame.com/playgrounds/9799/learn-solve-call-apply-and-bind-methods-in-javascript
youtube.com/watch?v=8De8DlrCzoY
gravitypdf.com/
twitter.com/NSFWRedditGif

>Not using Rust for Backend
>Not having insanely fast Web Apis

Attached: 367373467.jpg (477x477, 41K)

>not shooting yourself in the foot

Just learn Go, user.

If i wanted to use Go i'd just use .Net-Core

>not being part of the PHP master race
it just werks!

Attached: htgawm-5x13-2[1].jpg (300x203, 69K)

>.Net-Core
A-user, please d-don't

Any reason why class="btn btn-outline-light" would render like shit on Chrome (picrelated), but work fine in FF?

Bootstrap4 btw.

Attached: Selection_001.png (134x97, 1K)

A little troubleshooting later, I reach the following conclusion:

THIS ONE WORKS

THIS ONE DOESNT


Wat do now

This is the best I could think of off the top of my head. It could be greatly simplified by using the built-in methods of Array, but that would, in all probability, be slower. Basically in JavaScript if you want it to be fast, it's also going to be verbose.

function delFromObjArr(arr, ...KeyValPair) {
const klen = KeyValPair.length;

// We probably don't want to remove everything
if (klen < 1)
return;

loop_entry:
for (let i = 0; i < arr.length; i++) {
// Skip holes and other garbage
if (typeof arr[i] !== "object")
continue;

for (let j = 0; j < klen; j++) {
if (!arr[i].hasOwnProperty(KeyValPair[j][0]) || arr[i][KeyValPair[j][0]] !== KeyValPair[j][1])
continue loop_entry; /* Jump to the entry of the parent loop */
}

// This is potentially dangerous (and stupid) and also leave holes. But it IS faster than splicing.
delete arr[i];
}
}


Where KeyValPair is a set [p_0, p_1, ..., p_n] of key-value pair sets [key, value]. Any immediate member object of arr, with a set of properties that is either equal to KeyValPair or that KeyValPair is a subset of, will be deleted.

Most standard elements have default style values associated with them. for instance has "color", "text-decoration" and "cursor" set by default.

(repeating my response from the last thread)
If you have an array then you don't have a dictionary, so the answer should be obvious. Array.filter would be what you are looking for, but if you know that the property should always be unique (an "id" or something), you could build a Map, then just delete the key from the map when you want to remove it.

Yeah it is definitely not a good Dictionary replacement

Alright, thank user, I think i just iterate like a retard from 90s because javascript has no hashset-based collections in 2019

What exactly do you want to do? You have some value and you want to delete an object that has that has a property with that value?

It seems like you could just use a Map or Set:
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set

how do I make a button post it's ID to a php page in HTML?

Maybe work on articulating the problem coherently first, before you tackle it or ask for help.

Half of the time that already solves your problem.

Attached: wtf is this.jpg (540x750, 55K)

>have a button
>button has an ID
>need to send that ID to another page for processing when I press the button

that's about it

Map looks alright, thank

What's wrong with

Hi.


or


or somesuch.

attach a click event to your button.
the button itself will be in the event target property you get on a click.
use fetch to post it to your php file.

my half ass approach:
-have hidden input
. button type submit
- on click prevent default
. send the button id as parameter on click
.fill in the hidden field with the id of the button
- on the page on post retrieve the value of the hidden field that contains the id of the button

there might be more optimal ways to do this, but as I said this would be my halfass attempt

second one should be type="button" ofc

>clicked.php?id=myButtonId
this transfers the parameter to the page (clicked.php) via GET, correct?

When that shitty PHP script runs, it will have the value of "id" stored in $_GET like so:

why are modern web developers insane? why do i have to enable javascript to view a static web page? take me back

just as I thought, thank you for confirming

blame marketers, not the developers.

elaborate, developers are on the wrong for putting those practices at use and neglecting the no-js first rule

Do I really need to reuse XMLHttpRequest or it is an old meme?
web.archive.org/web/20080516162853/http://radio.javaranch.com/pascarello/2006/03/30/1143735438047.html
web.archive.org/web/20070106232535/http://radio.javaranch.com/pascarello/2006/03/31/1143817890773.html
keelypavan.blogspot.com/2006/03/reusing-xmlhttprequest-object-in-ie.html

I provided an answer given the restraints that _you_ set out. Obviously limited within the bounds of possibility. So don't complain to me when you are the one that stubbornly attempt to bend one language into working like another.

Had you actually asked "what's the best way of storing a key-value pair, preferably without having to implement any helper methods?" I would have told you to use Map or perhaps just a plain null prototype object. But you specifically said Array. Meaning that you'll almost inevitably end up having to, one way or another, iterate through it.

>I think i just iterate like a retard from 90s
It's not at all retarded. It's a task that machines excel at because it allows the CPU to leverage caching, out-of-order execution and/or SIMD. When utilized properly it can yield significant performance gains. Remember that time complexity is not a measure of performance. Particularly when taking caching into account, big O can be very misleading if used as such, due to the CPU caches being orders of magnitude faster than RAM.

>elaborate
Marketers want to learn as much about you as possible, thus attempt to track you across multiple sites. This is made very difficult without the use of JS. One way to increase the probability of the user not disabling JS, is simply to deny access to content, or considerably worsen the experience if not enabled.

I see, wow, fuck t hose kikes

Oh and I forgot to mention that Dictionary is considered obsolete and has been for quite a while now. Use the Map interface instead.

>Dictionary is considered obsolete
JS neevr had Dictionary, how it can be obsolete if it didnt exist?

I'm talking about Java, not JS.

Oh, I see. I meant c# dictionary when I was talking about it which is why your statement "it is obsolete" confused me. C# Dict is miles ahead of Java's one and supermegauseful.

Had my job interview.

I just went from 10/hr to 19 an hour to 54k to 150k 100% remote in 2 years 3 months.

Hot damn.

describe the job interview

what's your role like? JS developer?

kickass, living the dream user!

how old are ya

30. Started at 28 professionally but was a hobbyist my whole life.

Senior-level full stack. I'm joining another senior in building a product from the ground up and that really excited me.

Basically they gave a rundown of their products and how they work. He wanted me to be mid-level but I explained I am senior-level. I said my work is trusted by over 10 million a day to get very sensitive information out and that I run a lot of side businesses by myself that I built from nothing but ideas. He asked my rate so I said another recruiter had called about a position and said the pay was 75 so I want that and it was accepted.

>my work is trusted by over 10 million a day
alpha as fuck

>trusted by over 10 million a day
what do you mean

Which Web APIs should I learn in first place?

what do you mean by Web API? What is webapi for you?

developer.mozilla.org/en-US/docs/Web/API

Attached: 1243913630722.png (292x256, 43K)

Oh that
Well, yo need to know evetything

Start with fetch.
Do the rest when you need them.

Over 10 million daily users of my work.

what are your stacks?

I main LAMP/LEMP.

Backend/desktop dev here.
How do I make a somewhat professional looking web frontend (SPA) without wanting to pull my hair out?
I like minimalist, sleek UIs, like material UI or whatever.
Please recommend your favorite frameworks and stuff, thanks.

>LAMP
das my stack yo! Any tips for a beginner that has done minor projects like a mini CMS for a slider with ajax and a MySQL database?

Bulma/Bootsrap/Material UI. Pick your poison. That or git gud with CSS it isn't that hard.

Considering stealing this material UI implementation and just tweaking it to my needs.
Sadly it uses scss, which is complete aids.
>mfw you need a C++ runtime to compile CSS

Someone explain to me flutter. How do you build an iOS + android app with it?

I've glanced through the documentation, and they seem to have 2 different component (widget) versions for iOS and android.

Now how to structure the project to build both versions at the same time? Seems like you have to build 2 different codebases for the layouts...

Hello did I do something wrong? It seems to be impossible to set a value to default
codepen.io/user/pen/pmamZg

When you have a date with a value that is the default value, if you press the "x" or the "reset" button it sets the input to mm/dd/yyyy however it does not POST this, it sends the POST of the value="" which is your default value (here it is 2019-05-23)

In order to get around that, do we have to reset the value using hacky javascript?

$('input[type=date]').change( function() {
if (this.value == '') {
this.defaultValue = 0;
this.value = 0;
this.value = this.defaultValue;
}
});

This does work, and does POST correctly, though it should be default function of the browser?
Is there a better way to achieve this?

...

>No using actually good back ends built with Go, C#, and Haskell

Net core 2.2

Signin manager works fine and the login is successful and it also registers accounts just fine. If i login with invalid credentials it says "invalid attempt" as expected.

But somehow if its successful it never adds the cookies. It just stays logged out. Only server side it logs in.

I added the identity to an existing mvc project.

I dontnknow how to debug this

Unironically just git gud with CSS
You don't need CSS frameworks
You don't need stupid meme css preprocessors

Get a CSS/site design book. Learn about the box model. Learn about commonly used designs. Shouldn't take more than 2 days.
Can't get more minimal and professional than that.

Send help

I guess this is what will cause the least frustration in the long run.

I guess just keep building stuff until you've used about everything PHP has to offer. Learn about apache reverse proxy and virtual host, redis/memcache, cron, how to consume APIs, and I think that covers most of it.

Building a CMS is a pretty top-tier project though. That's cool.

>Minimalist
Don't even think about CSS then. Plain HTML is the best

I have some server code that relies on some C++ binaries that are compiled from some source code and static libraries. If I make a docker image of this code, would it also capture the static libraries the binaries are built from?

Is there an online resource for like, good-looking components?
I can probably recreate stuff if I have examples to take from, but I don't even know how I want my stuff to look.

Statically linked libraries are baked into the binary file, so you don't have to add anything extra.
But in theory you can put whatever you want into the docker image, it just depends on what commands you run in your dockerfile.

Think of Flutter almost as a game engine. It just takes a blank canvas and draws shit on top of it. It uses zero native (Android or iOS) graphic elements. When you make your app with flutter, you can tell it to use material design (what many Android apps use) or Cupertino (mimics how iOS apps look). If you choose Cupertino as the style, the app will look like an iOS app both on Android and iOS. If you wanted, you could make a style that makes all widgets look like Windows 98 UI elements. Making an app that uses material design for Android and Cupertino for iOS is going to be really difficult, so just choose either one, or come up with a completely original UI design.

Or rather it will take much more work to build the UI's separately for iOS and Android so you should just stick to one design.

based and redpilled

How expensive to have conditional CSS like

.className > .anoherClass .finalClass {}


In this case, .className > .anoherClass are the two sibling elements, however, .finalClass is like 999 elements deep
How bad it is performance wise? Anything I can read up on the subj?

Almost done with my simple backend for a gay anime RP message board. What are some front-end modules that complement Angular and worth checking out? I only have Angular Materials in mind.

How do I fill an empty array? I am using chart.js and want to be able to switch out the X axes labels by making an if statement that determines what array is used. I have a js file that holds the data to be used for making the chart and labels is set to " [ ] ".

data: {
labels: [],
datasets: [{
data: [0, 3, 2.5, 2.8, 5],
label: "Driver",
borderColor: "#15a15f",
fill: false
}
]
},

array = new Array().fill() ?

hmm well I want to have a separate js file where I could do something like:

this.labels = this.functionToSetArray()

desu this
look at this website vulfpeck.com/
perfectly functional and very little CSS required

I have three elements with multiple options in every element. How can I search my SQL database for the option values selected? PHP and SQL is really non intuitive for me so excuse my brainlet question.

>I said my work is trusted by over 10 million a day to get very sensitive information out and that I run a lot of side businesses by myself that I built from nothing but ideas. He asked my rate so I said another recruiter had called about a position and said the pay was 75 so I want that and it was accepted.
Do businesses really fall for that stuff? Unless you actually went more in depth? Cause that is stuff anyone can say but it doesn't really mean it's true. Congrats though user I suck ass at this shit.

>tfw learned about setTimeout(0) trick for deffered execution

Attached: 1551112590969.png (274x242, 4K)

So are your select elements wrapped in a form with the method "post"? If so, you should be able to write a PHP file/method for handling the request when its method is post. For example if the action of the form is on "options.php", you could write into that a function that accesses the $_POST array, the key for your element will be its HTML "name" attr

>course assignment is make a Wordpress theme
oh okay
>need to document the entire process down to the last detail, looking at up to 50 pages of "i pressed button"
I just wanna make scam sites, fuck this

SEND HELP please somebody

Try removing the built in css for the anchor when it has your btn class. You could also put an anchor around the button, but that seems weird to me

let a = 'a'
const o = {
a: 'b',
p: {
a: 'c',
getA: function(){
return this.a
}
}
}

console.log(o.p.getA())
let f = o.p.getA
console.log(f())

What does this print? You should be able to solve this.

> 'c'
> 'a'

Never hurts to review lexical scope. If you had used an arrow function it would have been 'a' twice. I get fucked over by this type of thing about once a week.

You're not even correct though

>Get a CSS/site design book
Any recommendations, friend?

fyi this changes if you turn on strict mode, which you generally should do.

The second one doesn't print 'a' because when you use 'let', the variable isn't on the window object, so it's not in any this context.

That's literally taken from:
codingame.com/playgrounds/9799/learn-solve-call-apply-and-bind-methods-in-javascript

No shame, faggot

>Or rather it will take much more work to build the UI's separately for iOS and Android so you should just stick to one design.

I thought there was some kind of trick one could use. For example..
>if iOS, use Cupertino else use material...

But I guess those widgets are not interchangeable? or have different names or?

React-native works differently. Each component uses the appropriate style depending on OS. Some rare components are only supported by one of those..

how to you get users to your side projects? i do web dev for fun, but have no idea how to attract first users to my projects

spam them here on Jow Forums

youtube.com/watch?v=8De8DlrCzoY

This shit is fucking awesome. I cant wait

Hey everyone.

I have a side navigation that I want to give the effect of a SPA. I.e. when a link is clicked, it will just change some text, not updating the entire page, just some paragraphs, and images.

Can i do this with jQuery?

you can do this with js

How so?
Store text/images in an array or object? pls help

Sup /wdg/, my sister in law asked me if I could implement, on her professional website, a form her customers could fill and it would generate a pdf (or odf) filled with the information they user had input earlier.
There is a constraint : her website doesn't use a database because she hasn't needed it up to, maybe, now.

I just wanted to know if such thing could be possible without having to create a database and implement it.
Is it possible to do that without a database? I was thinking about using a json or some other type of flat file. Is it possible to do this as is, ie with no database or even a json?

I keep seeing these type of css classes everywhere, does anyone know what library are they using? I assume it's css in js stuff

Attached: 3r.png (433x203, 59K)

the generation of the PDF is probably more complex than the form stuff. you need SSH access to that server to install software which can generate PDF-s (from html or whatever).

but if you have SSH access, what prevents you from installing a database server as well to save the input?

I think styled components (in react generates such classes). Never used it though, mixing css with JS makes only sense if you create modules for NPM (and even then people get pissed off, since it becomes hard to overwrite those styles with random classes)

I think the generation will be ok, I'll just use a plugin (her website was made with wordpress wordpress), something like gravitypdf.com/

>but if you have SSH access, what prevents you from installing a database server as well to save the input?
Time, or rather the lack of it. I just want it done quick, it's just about filling a simple pdf with personnal infos, plus an insurance company and it outputs an estimate.

>her website was made with wordpress wordpress
Wordpress uses mysql database and most form plugins already save the data to the Wordpress db (you could even write your own plugin and save data to it)