/wdg/ - Web Development General

>Discord
discord.gg/wdg

>IRC Channel
#Sup Forumswdg @ irc.rizon.net
Web client: rizon.net/chat

>Learning material
codecademy.com/
bento.io/
programming-motherfucker.com/
github.com/vhf/free-programming-books/blob/master/free-programming-books.md
theodinproject.com/
freecodecamp.com/
w3schools.com/
developer.mozilla.org/
codewars.com/

>Useful Youtube channels
derekbanas
thenewboston
learncodeacademy
funfunfunction
computerphile
codingrainbow

>Frontend development
github.com/dypsilon/frontend-dev-bookmarks

>Backend development
en.wikipedia.org/wiki/Comparison_of_web_application_frameworks
[Gist] backendDevelopmentBookmarks.md

>Useful tools
pastebin.com/q5nB1Npt/
libraries.io/ - Discover new open source libraries, modules and frameworks and keep track of ones you depend upon.
developer.mozilla.org/en-US/docs/Web - Guides for HTML, CSS, JS, Web APIs & more.
programmableweb.com/ - List of public APIs

>NEET guide to web dev employment
pastebin.com/4YeJAUbT/

>How to get started
pastebin.com/pDT82mQS
pastebin.com/AL6j7GEE

>cheap vps hosting in most western locations
lowendbox.com
digitalocean.com/
linode.com/
heroku.com/
leaseweb.com

Other urls found in this thread:

youtube.com/channel/UCFI15Elhx6bkvwSwdlU0cCQ
youtube.com/watch?v=JEpY9C49sqU
codeforgeek.com/2014/07/node-sqlite-tutorial/
stackoverflow.com/questions/42822082/trying-to-turn-an-api-request-to-a-const-after-its-made-its-call
supermenupos.com/
twitter.com/NSFWRedditImage

first

secondo

turd

I made a webdev channel send help

youtube.com/channel/UCFI15Elhx6bkvwSwdlU0cCQ

Learned some cool shit about makin' music the other day.

(function(){
var i = 0;
var audIntv = setInterval(function(){
(function InitSampleSound(fr, du){
var _p = {};
_p.audioCtx = new AudioContext();
_p.oscillator = _p.audioCtx.createOscillator();
_p.gainNode = _p.audioCtx.createGain();
_p.oscillator.connect(_p.gainNode);
_p.gainNode.connect(_p.audioCtx.destination);
_p.oscillator.type = 'sine';
_p.playSound = function playSound(f, d){
return new Promise(function(res, rej){
_p.oscillator.frequency.value = f;
_p.oscillator.start();
setTimeout(function(){
_p.oscillator.stop();
setTimeout(function(){ _p.audioCtx.close(); res(_p); }, 50);
}, d);
});
};
return _p.playSound(fr, du).then(function(){
return InitSampleSound;
});
})(600, 900).then(function(rfn){ return rfn(800, 900); }).then(function(rfn){ return rfn(600, 900); }).then(function(){ i++; if (i >= 4){ clearInterval(audIntv); } });
}, 3300);
})();


Probably going to get in trouble, because i'm not supposed to be coding at work. But I barely have any free time at home, so I always end up writing at least a little code, and getting in trouble.

Still. Learned about the Web Audio API. So shit was worth it.

>got laid off
>5 months of runway before living off credit cards
>previously finished FCC front end cert about a year ago

If I spent 8 hours a day learning and building, would 4 months be enough to become an employable js developer?

You should be able to just copypasta that code into the js console on any page (including this thread) and have a genuine justWerks™ Experience.

>Useful Youtube Videos
youtube.com/watch?v=JEpY9C49sqU

>boo wee boo
what in the? I didn't know you could make speakers play with js!

yes, with half that exp

>Still. Learned about the Web Audio API. So shit was worth it.
It isn't even final yet. Hell, spatial audio is buggy as fuck.

How do I make $u equal to the query of pages whose id are equal to data? (there's only one page since id is unique and incremental)

Let's say data is 1. That means $u should return all pages whose id is 1. And $article should then be equal to that single page.

Apparently so. I can't seem to find it anymore, but on a different day I remember reading a whole thing about this dude basically being able to define his own waveforms using the trigonometric equations, then sending the "samples" to an html5 audio element, and basically playing the wave he just created.

Reminded me of LabView kind of.

He also had a full spectral analyser based on a bunch of stuff I don't understand (yet) like FFT. He did all of this in js.

It made me realize that with the way it keeps being expanded, js could soon be a power in the world of instrumentation. I mean, with everything else you can do in js, why not?

I mean, it's one of the oldest languages. There's tons of libraries and support for it. Its market share has grown exponentially over the past decade. I'd say it's already a heavyweight in the world of instrumentation

$dat = (isset($_GET['data']) ? $_GET['data'] : die("need data param"));
$lnk = new mysqli("127.0.0.1", "root", "", "MyDataBase");
$edat = $lnk->real_escape_string($dat); // if you forget to escape your inputs, hackers will destroy your life
$res = $lnk->query("SELECT * FROM pages WHERE `ID` = '$edat';");
$row = $res->fetch_object();
$article = $row->article;
header('Content-Type: application/json');
$out = (object) [
"article" => $article,
"otherData" => $row
];
echo(json_encode($out, JSON_PRETTY_PRINT));

anyone has a job in web developing here? was it hard to get? how's the pay? and how are your hours?

>It made me realize that with the way it keeps being expanded, js could soon be a power in the world of instrumentation. I mean, with everything else you can do in js, why not?
Lack of realtime performance, garbage browser APIs and limited IO - you won't have VST for your browser, even WebMIDI is a joke, inferior throughput, something that still matters in professional audio production. Unlike in games, there is exactly zero (0) tolerance for small hickups.

What am I doing wrong here? I'm trying to translate the boolean to actual text, but it just says "passed" on every item, it says 1 and 0 just fine if I remove the if, ifelse part.

>$row['passed'] = 0
>$row['passed'] = 1
do you mean to be assigning? I think you mean double equals for equality check.
$row['passed'] == 0
$row['passed'] == 1

Don't worry user. Police are on their way

why isnt this working lads?

$dir = "/images";
$files = scandir($dir);
print_r($files);

ah shit that always gets me, thanks

How good is MySQL/MariaDB? Is the convenience from it worth it?

Use case wise I'm not very experienced with it, but hearing from people in my circle MySQL went to shit after the acquisition by oracle.

>went to shit after the acquisition by oracle.
That's normal to happen for everything gets their jew claws on.

anyone? i fucking hate PHP its cancer. I tested it by echoing /images/123.jpg into an image tag and it displayed the image. So i know i'm getting access to the server just fine. However for some reason i cant echo out each file name

seriously fuck PHP i did this in 2 seconds with JS....

How do I skip the first row when selecting everything from a table?
Isn't there a SKIP function or something like there's a LIMIT function?

SELECT Id, OrderDate, CustomerId, TotalAmount
FROM [Order]
WHERE NOT (TotalAmount >= 50 AND TotalAmount

idk, but off the top of my head.
while($row < $row.length + 1) {
echo row[i + 1];
i++;
}

I don't get what's so hard to grasp about "This"

Is there a specific language/framework that is focuses on security? Like what do banks use to prevent hacking? Would a meme like nodejs + express be secure?

In react its kinda hard, in big applications

So database management. MySQL/MariaDB sounds cool. Do I have to learn SQL to use it? Can't I use another backend language like python or java entirely to manage my database?

Who here /postitnotes/ because too autistic to conceptualize how your javascript functions flow?

...

once you write them and know what they do its hard to forget. The toughest part for me is knowing where they are so i can get to them faster

>[LIMIT {[offset,] row_count | row_count OFFSET offset}]
LIMIT does what you want already.

ORMs exist for a lot of languages already.
But you really want to know what's going on behind them.

/ is the root directory of your server, so unless you have a directory called images there and have permissions to read it it's not going to work.

can i do something like require() from node js in raw javascript? im trying to call a worker function. I would just put it in there but theres a lot of other JS on the page which the worker loads each request and it slows my app down

Is knowing jquery enough to be a front end? This job for one says they want html, css with responsive design and jquery. I know html and kinda css, not responsive design unless that's the resizing depending on browser window and don't know a js module? Not sure what they're called but I know how to do javascript for basic things

no.
knowing css "kinda" isn't enough either.
90% of anyone mentioning responsive it means using css media queries, not JS.

Whoever makes these threads should advertise in the old one, like a decent general.
Optionally link to the old thread in the body too.

I think I'm having an issue with two way binding? here's the code

editComment(comment) {
let comments = this.state.data;
let currentIndex = comments.findIndex(item => {
return item._id == comment._id
});
comments.splice(currentIndex, 1, comment);
this.setState({
data: comments,
bgcolor: comment.color
});
this.fadeColor();
}

fadeColor() {
let animation = setInterval(() => {
if ((this.state.bgcolor[0] >= 255) && (this.state.bgcolor[1] >= 255) && (this.state.bgcolor[2] >= 255)) {
this.state.bgcolor = [255,255,255];
clearInterval(animation);
}
else {
let colors = this.state.bgcolor;
((colors[0] < 255) ? colors[0] = colors[0] + 6 : 255);
((colors[1] < 255) ? colors[1] = colors[1] + 6 : 255);
((colors[2] < 255) ? colors[2] = colors[2] + 6 : 255);
this.setState({
bgcolor: colors
});
}
}, 1);
}


edit comment is fired when the server sends a comment update. 'data' is the array of comment objects, 'bgcolor' is the color stripped out of the target comment to be edited. after state is updated, fadeColor is called to fade the color values to 255 over setInterval. each time the interval fires, the value increments then I set state for bgcolor to get the updated color to render to the page.

currently the page renders the color fade fine, but the issue is that the backgrounColor on the edited comment itself also fades to white, which isn't directly set anywhere. is there any two way binding here I'm not aware of?

sorry this is in react

>not using redux with react
Filthy pleb

How do i get a job in backend web dev? I graduated and got a diploma in software engineering and have focused on web dev but no one wants to hire me.

I recommend you decouple your controlling logic from the state of your components if for no other reason than the fact that you will be forced to cache some fo these values you are calculating on the fly every time you render.

wow console.log is a disaster for working with large files. I thought the entire time something was fucked with my app because it was logging stuff so slow (im parsing some csv files). It's actually fast when i do what i want with the data in the DOM.....

do you have a portfolio? build stuff

I have a portfolio with two apps, one is a blogging system written in php using laravel framework, the other is a basic social media app written just in php.

more apps. make some quick front end ones if you want, 2 just strikes people as a low number

Maybe you are right. I will do that, any other tips? Do you have a job in backend?

Alright how the fuck do I make a schema in mongo db?

So I'm scraping phrases from chat logs and then I store how many times the phrases have been used on a specific date.

Is this right?
var phrasecountSchema = new Schema({
date: String,
phrases: [
{
phrase: String
times_used: Integer
}
]

});


Or do I omit the phrase object inside the array? But I want to specify what data there's about a phrase. HELP!

>nosql
For what purpose?

all that college debt just to learn out of date tech must really sting

for mongoose 4.x
// app/models/example.js

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var MuhSchema = new Schema({
name: String,
comments: [{ body: String, date: Date }]
});

module.exports = mongoose.model('Schemaname', MuhSchema);

use mongoose

Because it solves high traffic distributed network problems without having to reinvent the wheel of a custom distributed data store and caching layers.

I'm using mongoose.

>all those nested anonymous functions
please don't

Hello /wdg/. How would one make a webpage properly react to window resizing (As in prevent the void space below the background and properly have my images resize to compensate for the length/width loss.). I'm not all too knowledgeable in html or css because I just started learning, so sorry if the answer is obvious.

im really fucking pissed off right now why the FUCK doesn't this line work:

document.getElementById("tracking-num").innerHTML = row.data[0][4];


in this code

Papa.parse("/tracking/track_ups_test.csv", {
worker: true,
fastMode: true,
download:true,
step: function(row) {
if (row.data[0][2] == ReplacementNumber && row.data[0][7] == "REPLACEMENTS")
{
alert(row.data[0][4]);
document.getElementById("tracking-num").innerHTML = row.data[0][4];
console.log(row.data[0][4]);
}
else
{
document.getElementById("tracking-num").innerHTML = "Not available.";
}
},
complete: function() {
console.log("Tracking file success! " + ReplacementNumber);
},
error: function(error) {
errorMessage("Tracking file error: " + error);
console.log(error);
}
});


The ALERT and CONSOLE LOG right before and after it work JUST FINE. WHY THE FUCK ISNT IT PUTTING IT IN MY DIV ELEMENT? GOD FJUCKING DAMNIT

Materialize.

I'm about to create a Dropwizard-esque framework for php. Would anybody like to collaborate?

FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC FUCK FUCK FUCK FUC

How do you build stuff if nobody hires you?

What kind of question is that

open your favorite text editor and start typing

>if ($row['passed'] = null) {
stuff != work stuff

FUCK ING MOTHER FUCKER IT WORKS ON EVERY OTHER ID ELEMENT I HAVE ON MY PAGE WHAT THE UCK IS GOING ON IVE BEEN STUCK ON THIS ALL FUCKING DAY GOD FUCKING DAMNIT WHAT THE HELL FUCKING WASTING SO MUCH TIME

>Alright how the fuck do I make a schema in mongo db?
codeforgeek.com/2014/07/node-sqlite-tutorial/

HOLY FUCK I JUST FIGURED IT OUT

I NEEDED TO CALL parser.abort() to stop searching through the rows once I found a match. Im basically trying to imitate a query with JS, and i needed to be specific and tell the piece of shit Worker to stop what its doing when i say so.

I LITERALLY SPENT ALL FUCKING DAY TRYING TO FIGURE THAT OUT. But hey I learned something.

FUCK

Any idea what features to but in a key gen (as in game, invite, coupon keys...) I have length, delimiters, upper/lower case, only numbers/only chars so far

You build it for fun/experience. Employers look for people who like to do this shit in their spare time. Building something for a portfolio allows you to fuck around with shit that you normally wouldn't be able to in a work environment and show off what you know.

I'M FUCKING GLAD THAT FUCKING EVERYTHING TURNED OUT SO FUCKING WELL FOR YOU!

Isn't there one already?

Okay, thanks

Hey there. Making a blog using PHP, sql and a PDO object (Kind of new, only made one site with all this). What would be the best way to be able to store HTML in a column of SQL, avoiding SQL injection and JS execution.

I've been reading up about PHP markdown, but I've also seen things about bind value (rather than bind params)? Any recommendations?

need help with a simple react problem, im using react-saga but im sure u guys will understand its not really a framework problem


stackoverflow.com/questions/42822082/trying-to-turn-an-api-request-to-a-const-after-its-made-its-call

posted it on stackoverflow HALP HALP HALP!

Can I learn backend on my own? I'm fine with frontend but that's easy and some of the code posted here looks indecipherable. What's the best way to learn the concepts (like routes seem to be constants between server-side languages)?

Did you follow guides? Do you still have guides open to this day when making webapps?

I'm trying to echo a list of files in a directory on a mapped drive in PHP but having trouble. I'm connected to it just fine. However i've tried scandir(), readdir(), fopen(), etc and im not getting results. Any ideas?

i'm really excited lads. i've delved into a php framework for the first time since laravel and im actually enjoying it. i'm not gonna say which framework it is because i know one of you pricks will give me reasons to dislike it but yay im having fun with it and learning at the same time XDDDD!

Start by picking a backend language (PHP, Python, Ruby, NodeJS, Go, etc) and learning it, along with a framework for that language if you want. Learn how HTTP works if you don't already know. Find some tutorials to follow and also experiment on your own. Then, when you feel you're ready, try to make a few complete projects on your own.


also backend is easier than frontend when you get the hang of things imho.

>I know HTML/CSS/JS + Bootstrap/jQuery

What should I build for my portfolio that will give employers boners?

Learn PHP and SQL and build a messaging platform. That's what I did, got a junior PHP developer job starting a week from Monday.

link it plz, i want to see how complicated it is like if its just text or you coded everything by scratch, i know it would be pretty easy for me, but i want to know if its worth learning php

Media queries, CSS framework grids, flexbox...

It's pretty basic desu. Do the codecademy PHP course and a few YouTube tutorials and you'll be up to speed.

Not that hard to get, interned here and then interviewed after graduating. I make a bit over $80k. Hours vary...usually around 40 but I've also put in over 80 in a few rare cases.

How hard is it to land job with only a portfolio and no internships or work experience?

It took me a year and a half.

My work is so god damn slow, we move at a turtle pace due to Microsoft fanboy-ism senior developer. I get paid to much to leave.

Does anyone here have any experience working part time for another company?

How does a company that makes a website like this make software like it does?

Look at the "sample screen" and tell me what software they used to make that :)

supermenupos.com/

java applets for website
java for their desktop apps

I work for myself at night building my own cms as i go

Question about best practice kind of stuff

I have a class that encapsulates unique data per client that is retrieved from an API call.
Would it be better to instantiate the object by passing that data in through the constructor or should the object itself make the call to get the data?

Depends on your implementation and how you will use caching. Your (meme)framework determines best practice

Object. Constructor shouldn't do anything.

What would make a better twitter?

Other than real async feed loading.

Any competitor wouldn't be able to serve that amount of complex media at the start. Videos are expensive and so are pictures. Throwing that up without investors would get you in the hole real quick.

I have a small project I was hosting on Heroku, but I recently incorporated some NLP capabilities which require ~500mb of data to be installed. Is there are a similar service to Heroku (git integration, ease of use etc.) that allows you to configure how much server storage you need? Heroku is max 300mb. I heard AWS Elastic Beanstalk is a decent alternative.