/wdg/ - Web Development General

20170530 edition

>This season's Advent of Code:
adventofcode.com/2016/

>Discord
discord.gg/wdg
OR
discord.gg/0qLTzz5potDFXfdT
(they're the same)

>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
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:

github.com/arut/nginx-rtmp-module
github.com/ossrs/srs
know-it-all.io/
chrome.google.com/webstore/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb
start.spring.io/
toptal.com/javascript/interview-questions
twitter.com/NSFWRedditGif

install Vue.js

OLD THREAD

>he disabled JS so that he can now spend his time complaining about sites that require JS

havent been in js for a year how many million new libraries that were popular for a day and now everyone has to know them have appeared and how many new clones of grunt are there now?

of course
and umatrix and then complain about the fuckton of cdn shit

i have it off by default (and whitelist sites i care about), because of sites that seem to hate their users (use fingerprinting, popups, custom scrolling, newsletter modals, other unpredictable things)

this way i don't even have to think about any of those things, especially on sites i haven't used before and might not ever visit again

i used to work on a popup/annoyance blocker script for myself but i realized nothing beats turning off javascript

i only mentioned it because a wordpress blog doesn't sound like something that would absolutely require javascript to even show the front page

whitelisting 1st party and blocking 3rd party scripts by default seems like a reasonable middle-ground

But that's not React..

it sounds ineffective to me

In express do I have to put
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "password"
});

con.connect(function(err) {
if(err) {
console.log('Error connecting to db');
return;
}

console.log('connection established');
});


in every route js file?

I need an idea for a website to get rich off of.

I want to make a streaming website as practice.
Kind of like twitch but just one small page.
Anyone have any resources on how to do things like this?

>knowitall.io

It's not really super hard. Set up nginx, put something on your page that plays back the rtsp stream (I dunno if html5 does this), good to go.

make a website that sells an ebook of ideas for websites you can make to get rich off of

how do I catch a click event on a youtube progress bar? doesn't register..

github.com/arut/nginx-rtmp-module
or
github.com/ossrs/srs

I'm experimenting with real time streaming for a few years now, but all HLS/Dash solutions have a quite large delay (10+ seconds) and seem to be quite buggy.
The lowest I got was with an rtmp pass through file and flv.js with about 4-5 seconds.

If you don't care about latency then videojs is quite good.

okay

>try python because it's easy to use, sort of hip and cool
>realize it's python, it's interpreted and slow as hell, concurrency is practically undoable in a sane way

>try node because apparently it's the shit
>it's a meme, and you're writing javascript

>try golang because dat performance and that concurrency
>go is a shit language lacking tons of features producing tons of boilerplate and has an atrocious community that forces everyone to create new libraries for themselves but recommends NO ONE to actually use them

I'm getting really close to making a spring boot application for my real-time media aggregation web application here guys. Give Java the power of lombok, and watch that boilerplate sink away into nothing.

What am I missing? I want a good solid backend communicating with a relational database (not sold on other databases yet) coupled with a SPA using the realtime API I offer. Having tried other languages, I just look at the code I've now produced several times over again in different languages, and almost feel forced to realize that the code is just more readable, pretty and god damnit, logical in Java. But I don't want to use Java, I want to use a top tier, modern language that has performance out the wazoo.

That'd be Go, but go is fucking retarded, just like that stupid fucking gopher face.
>HURR DURR IF U WANT TO MAKE SOMETHING PUBLIC JUST USE UPPER CASE ;)

REALLY? HOW DID THAT GET PAST ANY MEETING? AT ALL?

Help me Sup Forums... he..l...p

That said of all the frameworks I tried or had a look at.... damn is django good. The absolute BEST REST API framework setup I've ever seen.

Ok, so, I have a question related to JS and python.

I need to ask, can I check for pixels inside a canvas using a python websocket?

Adding to the question, can I use python to check an image pixel by pixel and then compare with the pixels from the canvas?

Also, why does the major part of elite proxies not work? And even inside the select few that work, why does just 1 or 2 actually post stuff on Sup Forums? I am sick of wasting half a fucking hour just to talk a bit.

try .net core webapi

Just use node. Literally your only complaint about it was that you don't like Javascript. It's still good though.

This. I wish it were more popular

Business logic in javascript? Anything in javascript?

it ain't even typesafe bro

Of course you can.

Also t y p e s c r i p t

Oh and if you're going down this route of thinking then you should never ever use anything other than PHP or you're a fucking idiot.

Admittedly, node.js is looking better and better. But then I remember how good Java actually is, and I start wondering why it isn't used more. I mean good god, the developer tools for it are amazing, and with a testing framework like spock(groovy) it's even fun to write tests. Is it because it's slow or something? Here, here's a spock test:


@Unroll
def 'poster should receive #numberOfYous per second after shitposting in thread #threadnumber'() {
given:
def website = injectedWebsite.getInstance()
expect:
website.postInThread(threadNumber) == numberOfYous
where:
treadNumber | numberOfYous
340000000 | 32
340000001 | 2
340000002 | 3
340000003 | 5
340000004 | 6
}

each of the rows in the where table becomes it's own "test" and is treated like one. How are the testing libraries in javascript? Anything as eloquent and neato as this? There's also amazing mock support.

>php
It's 2017 grandpa.

What do you guys work on in your employment, day-to-day? It seems like there's a lot of informed opinions about the best X, rather than people using whatever their business uses.

>It's 2017 grandpa.
PHP is also one of extremely few languages that can be considered as thoroughly safe for business logic as it has been tried and tested for eons now.

Funnily enough I get to make all the calls about all the technology my place uses, so I am what (not mine) my business uses.

call jewkerburg and make another social media website that steals peoples personal information

I don't know about these other bozos, but I'm still wagecucking in a warehouse until I can finish my portfolio and can afford to move out of hicktown.

Crap, my bad, it's actually
know-it-all.io/

What's the best framework to learn in order to get the highest paid jobs/ best future security?

jquery

...

Trying to switch from neetbucks to freelancebucks at the moment.
So I guess I can at least choose my tech freely.

vue, node, hexo (maybe metalsmith?), netlify-cms, webpack

What are you actually building with these tools?

Perl

Where do I go to learn React?

It's no specific project at the moment. (except my own portfolio page, which i use vue for)

Those are just frameworks that I think will probably let me handle most requests a client could have.

Vue for single page applications and reactive elements.
It's single file components are also really nice to work with.
Haven't tried react so far though, which I still mean to do as well.

Node as backend obviously

Hexo, if I ever need to build something blog-like or just simple static stuff.

netlify-cms, so they can edit things on their own.

webpack took some time to understand and get right, but now it's a great help and bundles everything nicely.


Hope I don't sound too naive, still a beginner.

I am also wondering if I should get some basic PHP/Wordpress skills, just because it's so common and I probably have to deal with it at some point anyway.

You sound like you understand more than me. I'm a meme magento FE dev looking to move to not-magento, and every job listing wants some JS framework experience like Angular/ Node/React, and I don't even understand how it connects with everything else.

For me, I have Magento being the EVERYTHING, and then I can edit some phtml files, XML files for layout/ widgets, LESS and JS for regular frontend shit.

Angular is like, part of what Magento would do, but it's for single page applications? I don't really have an appreciation for the greater thing as a whole (like how a user logs in and goes to their account page - this is all backend, with Angular just fetching some values?)

It's intimidating and sucks all the confidence out of me.

You never "[had] to know" any of them, and people are dumping the grunt paradigm entirely for lower-level tools like webpack and discrete scripts.

Use flow for strong typing and es2017 with object rest and spread. Write functional and immutable code. Pretend it's c with namespaces and object destructuring. Also pretend it's lisp and use a single params object argument for all functions to make your API incredibly flexible and simple to refactor. All of these things are greater than the sum of their parts and become incredibly expressive. JS is actually a really good language now.

function allowFutureAtsInfo(params) {
// TODO: reasses as year 3000 approaches
const blocking = blockingAtsInfo(params);
return {
...blocking,
selectableQuantity: availableQuantityForDate({ ...params, arriveOnDate: new Date('3000-01-01') }),
warningAbove: blocking.selectableQuantity,
};
}

but did you try dotnet

>>It's intimidating and sucks all the confidence out of me.

I think I kind of know what you mean.
There are so many libraries I will never get around to learn, so it always feels like I am still lacking something before I could do actual work.

You're used to a monolithic environment, but most of what you're talking about not understanding are smaller toolkits and micro-frameworks.

Angular is a fairly light library that makes some MV* assumptions but mostly provides JS two-way data binding.

Node is literally just a javascript interpreter, it allows you to run javascript in environments outside of the browser, i.e., on the server. It also provides some convenient APIs that are necessary for working outside of the browser like filesystem access.

React is an alternative to stuff like Angular, it eschews traditional two-way data binding for a more simple forward-only approach. It also does a lot less than angular, it makes no assumptions about MV* and is largely just a low-level tool for building reactive UI components.

Just pick something and learn it. After a while you'll realize that learning any individual toolset is actually really easy. Learning something like Magento is hard because there's actually a ton of shit to remember. Learning react is easy because it's like three functions. Writing good code and having solid organization and architecture is hard, but those skills are largely independent of your toolset.

so it boils down to
>PHP for business frontend
>COBOL for backend
anything I am missing for bsns?

Ikr? Why the shit do we need scripting languages when he had Java since forever

>I start wondering why it isn't used more
I heard two complaints about Java:
1) It's not hip enough, too enterprise-y ("I want to work in a startup with node.js")
2) It's difficult

Moreover, some companies that are not "hip" or "cool" tend to go with .net instead of java because they already have established relationship with Microsoft and the whole ms stack is familiar to the company

So Java is idd pretty nice, the problem is how employable you'll be after creating things using it. For example, the are a bunch of .net jobs around me + a lot of php ones, couple of node.js and ruby and no Java at all.

Attach the database object to the request as a new parameter using app.param
You missed the opinion from 2008

It's too verbose. Also, more expressive languages feel better to work in. I don't want to HAVE to rely on an IDE to refactor because there's just so much fucking code. I'd rather be able to write less code and do more.

Okay. So, node.js. I want to make a real time web application. What do I use?

Is working with Redux ever NOT a soul-crushing experience? New job uses it and it's been fucking brutal so far.

look at socket.io or maybe webrtc if you feel funny today

Haven't figured it out yet either.
Stores are like a global accessible object or something, right?

Swift.

node.js

>For example, the are a bunch of .net jobs around me + a lot of php ones, couple of node.js and ruby and no Java at all.
where do you live?

asynchronous javascript

Currently replacing legacy code all over the place. going from a dojo frontend to a react frontend. From a rails backend to simpler ruby for now, possibly something like Elixir in the future.

for phoenix channels

i need help to align this vertical menu , i already tried float:left but no sucess.
Any help pl

Thank you friend, you have encouraged me. I guess I'll learn basic React or Angular and then apply for jobs at the weekend/ next week.

Why is tech support (or ESL for that matter) allowed in /wdg/?

Remove the margin, and add some padding.

Why don't more people use .NET? Holy shit it's amazing.

t. not a microsoft employee.

tech supp ???????

>Attach the database object to the request as a new parameter using app.param
Can you make a quick code snippet of that please? Thanks in advance

.class {margin-left:-20px}

if that doesnt work try

.class {margin-left:-20px!important}

in this case .case is li i think. just try it .

i also recommend you this addon:

chrome.google.com/webstore/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb

you can edit css live without messing with F12 cyka blyat menu

Some really quality posting right here.

is meteor any good or is it a meme?

Anything like React Native for vue?

That shit's a meme.

Cuz people only know javascript

Weex, but I bet it has less support for complex stuff.

The JVM ecosystem has wider range of and better quality libraries, better languages (Kotlin and Scala), Linux/macOS as first-class citizens, and non-authoritarian development process. I'm glad it exists because competition is good, but I see no reason to use it.

I'm learning djangorestframework right now. Too much to take in all in one go, but I'll make several attempts. Any good resources for it? Im following pic related but the author writes like an autistic retard.

I am writing more code with Django and python, node.js (express) or even golang to do the basic stuff a spring boot application does. StrongLoop's loopback framework looks interesting though.

You can get really non-verbose Java applications these days, thanks to lombok. I get not wanting to be dependent on an IDE, but you're not really that cool when you fire up vim you know. At the end of the day, you rely on tons of command line tools which complicate the process a lot. Then refactoring is childs play with an IDE - ever regretted a name choice a year into production, and it's everywhere? Done in a few minutes, without any errors. Feels good man.

Cleaner, more sane code. There's some really cool stuff you can do with the java EE spec, and inheritance. Let's say you want to import "pictures" from various sites into your application. Make an interface called "PictureImporter".

interface PictureImporter {
List importPictures();
}


then implement that interface for every source you want, like Sup Forums, facebook whatever.

public class FacebookImporter implements PictureImporter {
public List importPictures() {
return (facebookpics);
}
}

public class 4chanImporter implements PictureImporter {
public List importPictures() {
return (4chanpics);
}
}
}


and then injecting the interface as a list of instances means you can import from them all - just by ADDING code. No "registering", just implementing an interface.

Wow. I'm not really sure the params... thing is really that good. Am I missing something?

Google is always the best resource, and stack overflow. Use your google-fu to answer your questions, and use Django's official documentation which is very well written, and has plenty of examples.

Where I live there's mostly Java jobs though, as well as some .NET stuff. Employability isn't really an issue, if you know Java you can adapt to .NET.

spasiba , its work
ty
dude STFU

and I mean, is this really verbose at all?

Does other languages have as simple a process as this?

What resources would you recommend to start building shit with spring boot? I've always loved Java but not sure where to start with Spring

Look at all that OOP boilerplate. The more experience I gain the fewer pros and the more cons I recognize for OOP and inheritance structures. Functional programming is just a more sane solution for almost everything.

And I can understand the theoretical value in declaring a function to be protected / private, but not only have I never worked in an environment where I think it WOULD have value, I also can't imagine WANTING to work in an environment where it would have value.

>Sup Forums is NOT your personal tech support team
kys

What you're missing from the params thing is the big documentation block outlining all the params (there are like four). The actual code of the function is only aware of the params it actually uses though, which in this case is none of them, it just passes them along to further-decomposed implementations.

Well that's great - what do other languages do better in terms of reducing boilerplate here? I think the pros here is that by reading the code, you can tell what it does very easily, and it is typesafe, so people using your code doesn't screw up as easily.

How would this look in another language? Let's say I wanted some "import/webscraper" functionality, and I want to import/scrape from various sources - how would it look and feel to write?

Googling it, I'm not really sure if books are necessary. Use gradle or maven, and use the spring boot starter. start.spring.io/

gradle is the preferrred "new" build tool. Maven is also good though.

>And I can understand the theoretical value in declaring a function to be protected / private, but not only have I never worked in an environment where I think it WOULD have value,

Well I have one story about that. There was this caching API, which had a function which sounded usable, that was public. So people who wanted to "refresh" the cache could simply call the "refresh()" method. Except it didn't refresh or reload the cache, it was a small helper function for something else that was set to public.

So the developers who wanted to interact with this library then introduced errors into the code, because they mistakenly called an internal function that wasn't supposed to be called. Setting it to private would have prevented such misuse.

The value is in protecting methods in your libraries you don't want people to call frivolously, and let them use a defined, safe API that doesn't botch up everything if they aren't careful.

Assuming I understand your example correctly:

function fetchFacebookPictures() {
// ...
return [{url: ''}, ...];
}

function fetch4chanPictures() {
// ...
return [{url: ''}, ...];
}

is probably how I would write it. As far as I can tell the only thing I lose here is strict type safety, which in theory I could implement with flow, but I don't know why I would want to. Worst-case scenario, somebody changes the `url` key name, in which case tests fail and unhandled exceptions occur leading me directly to the source of the error.

Ex PHP/JS dev currently learning Golang and planning on moving further to Elixir, Crystal and C#.
How fucked am I?

>"functional programming is just a more sane solution"
>posts javascript code

Why did you choose Go?

Seems to be on the rise in quit short time for a programming language.
Also because Robert Griesemer, Rob Pike, and Ken Thompson

pic related

Simplest possible example to illustrate my point in this case.

toptal.com/javascript/interview-questions

Are these anything like what you've been asked in IRL interviews?

>writing anything but React
>2017

...

I swear if I see this one more time on someone's personal portfolio website I'm gonna lose my shit.
Please don't do this, it's corny as fuck.

It's the opposite for me, definitely better to write some more safe code that you know it just works instead of some duct-taped mess that may be unreadable or breaks easily.

People like you who dogmatically follow their CS undergrad courses are the reason why JS devs are so smug and happy right now.

Why the fuck would anyone need Java in 2017 except "apps" on phones? Its use case was a fragmented hardware landscape thats vanished over a decade ago.

That feel when no 80% responsive skill.
That feel when no dramatically seize BF oriented GF.

this is 150% pussy shit. I know a dude who had that on his site for awhile. he was in fact a pussy.

made me remember this for some reason