/wdg/ - Web Development General

Prospect edition
w3.org/TR/payment-handler/
interledger.org/

>Last thread
>IRC
#Sup Forumswdg irc.rizon.net/6697
rizon.net/chat/

>Getting started
github.com/kamranahmedse/developer-roadmap/
github.com/verekia/js-stack-from-scratch

>Learn
developer.mozilla.org/en-US/docs/Learn/
developer.mozilla.org/en-US/docs/Web/
freecodecamp.com/
codecademy.com/
github.com/getify/You-Dont-Know-JS

>Languages
python.org/
typescriptlang.org/
ruby-lang.org/
elixir-lang.org/

>Useful
caniuse.com/
jsfiddle.net/
codesandbox.io/

>Backend frameworks
nodejs.org/
djangoproject.com/
rubyonrails.org/
phoenixframework.org/

>Frontend frameworks
reactjs.org/
angular.io/
vuejs.org/

Other urls found in this thread:

nin.ten.dog/sapphire-vector/
whoishiring.io/
secure.php.net/manual/en/language.variables.scope.php
boost.ink/
my.mixtape.moe/uafxgm.txt
my.mixtape.moe/etbjus.txt
my.mixtape.moe/rygbvu.pdf
foundation.zurb.com/
developer.mozilla.org/en-US/docs/Web/Accessibility
jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil
youtube.com/watch?v=cN_DpYBzKso&t=833s
w3techs.com/technologies/details/pl-php/all/all
pymotw.com/2/bisect/
codepen.io/lsirivong/pen/ekBxI
stateofjs.com/2017/front-end/results
altbdoor.github.io/bootstrap-button-color/
twitter.com/AnonBabble

spring
p
r
i
n
g

boot
o
o
t

What are some unpopular basic projects I can do to test myself.

Very basic (HTML + CSS)

Posting my project that I just finished. I recreated the opening to pokemon sapphire with vector graphics and CSS animations:

nin.ten.dog/sapphire-vector/

>tfw trying to figure out Django
How do I configure multiple databases?
I.e. domain.com/A shows stuff from A database while domain.com/B shows stuff from B database. Also the models for the two databases are identical.

Can I get some hints on finding a job?

I graduated with a B.S. last December. Took some time off to help my father with something. But so far I've applied to about 30 places. Have my resume on monster/dice/angel/cyborcoders. I have fullstack projects, with a person site that has them all hosted. A shitty linkedin. I didn't get an internship, yeah I know. I did research instead like an idiot. I reached out to a recruiter and he said he doesn't have much for junior, aka nothing. What other avenues should I take? Is going to meetups on meetup dot com a meme?

Get gud. I don't know django, but you should be able to configure a database connector that your models use. Detect your domain and modify the parameters of the connector appropriately.

very noice

where are you from?

I'm looking in the Boston area. or RI.

Go to meetups. Apply to different places. If need be, apply for internships as well. Be careful with how many places you apply to. If you apply to a ton of different companies, the quality of each individual application will surely decline. Quality over quantity. Cover letters are not optional.

...

whoishiring.io/

check out your area in the website

a decent looking business card kind of website which a company would want and a blind person could use (accessibility). then with a custom form on it, e.g. one where the visitor can select a contact possibility and then only that form input is shown. and again, a blind person has to be able to use it.

I love Spring Boot unironically.
t. non pajeet fullstack Java dev.
Come at me

When I'm looking I normally use keywords Entry/Junior/Front End/Back End/ Full Stack and go from there. I'm also applying to places that say 1+ year of experience because I know youre saying that there is plenty of Junior developer jobs, but I've found only a couple that say 0+ experience.

Do an internship first mate

also, please do apply to places that want more experience than you actually have, because all their requirements are just the ideal candidate, but most companies actually hire the closest they can get.

tfw just started an internship at a large company and they're assigning me to a Spring Boot + Angular 4 project.
Been doing tutorials the past two days and it's pretty fun desu.

Thanks for all the feedback. Appreciate it.

that's awesome. keep it up.

Any tips on getting a junior Dev job? I've gotten two interviews but no job yet. I have a good portfolio and resume, but 0 webdev work experience.

>I have a good portfolio and resume,
for you

really fucking cool. Keep it up!

can you make a dating sim like that as browser game?

For someone with my experience level it's fine. I've gotten interviews but it's so difficult to get a door in the door.

Clarifying and reposting my question from previous thread:

I have at index.php the following code

require_once 'framework.php';

test();
print moot;
print $hiro;


test() successfully runs and prints 'test OK'. "Print moot" successfully prints 'google employee of the month'. "Print $hiro" prints 'japanese dataminer spy assigned to the west'

Framework.php looks like this


function test() {
print 'test OK';
}
CONST moot = "google employee of the month"
$hiro = "japanese dataminer spy assigned to the west"


This is where I get confused. Within any other PHP class file (I'm working inside class now after index.php and framework.php), this is the behavior. Let's say I have some class file outputbuffering.php:

final class outputbuffering {
public function clearOutputbuffering() {
//do shit
}

public function testingScope() {
test(); //it works just like in index.php
print moot; //works as well
print $hiro; //crashes - $hiro i undefined
}
}


Why is only $hiro undefined when we are dealing with php files that did not directly require framework.php?


Someone linked me this on teh previous thread. I will read now and see if it answers that question directly. secure.php.net/manual/en/language.variables.scope.php

In case it doesn't and someone knows the answer let me know please

Thanks for the suggestion, a question on this too. How long do you think this should realistically take to do?

>it's so difficult to get a door in the door.
you usually get a foot on the door, not another door

do projects
a portfolio is not enough when not backed by either a degree or a shitton of projects

also learn php, not just the trendy hipster shit

I made a "complete steps to unlock" type url shortenener and finished it recently.
Ignoring the purpose my site serves, what do you guys think of my front end design?

boost.ink/

I recently got a job as a Python backend dev, self-taught, no work experience. Here I'm sharing 3 coding challenges I had to do (for different companies) as part of their technical interviews. I passed all three interviews, but in the end they hired someome with more experience.

>my.mixtape.moe/uafxgm.txt
>my.mixtape.moe/etbjus.txt
>my.mixtape.moe/rygbvu.pdf

thanks!

this is good for training

answering my own question, any function inside framework.php would have to do:

$hiro = 'Sup Forums owner';

function getHiro() {
global $hiro;
return $hiro;
}


to retrieve the value. But that is only the case for .php files that do not call 'request framework.php'. I don't get why the different behavior but at least I can work with it now

that's why I'm sharing. Also, I got tons of hackerrank and codility challenges, so work on those.

use foundation.zurb.com/ to build the site
stockphotos from unsplash.com
good design ideas and state of art from uplabs.com
developer.mozilla.org/en-US/docs/Web/Accessibility
lorem ipsum

idk how fast you learn, but can do it in a few hours if you know what to do lol

good shit! nichts wirklich auszusetzen, gut gemacht.

Any typescript advice?
I just start learn it, and i have background in C# php C++ and bit of javascript.

Don't use globals. Those are really bad practice. You should build your application with correct inheritance and scope management so you dont need globals.

Same guy from last thread btw. Again your examples make very little sense. Where do you intialize your class? Where do you run the method? Please provide full examples so we can see how your project is structured.

Variable scope is limited to whatever function you're in. Nothing else is really relevant. You can inject variables into your scope with the "use" keyword. That is mostly relevant for anonymous functions. Regardless, you should use the GLOBALS array or some custom array/object instead of using a variable by name, since it limits your ability to check its existence, and is very fragile.

>Don't use globals. Those are really bad practice. You should build your application with correct inheritance and scope management so you dont need globals.

If you don't have one global object, you end up instantiating an object for each single file you work with. You need a way to call Database->query() from each file. You can either:

>instantiate an object for every single file. Tedious task and looks bad.
>Do something like Laravel and use .../façades, so you can do DB::query->
>pass an object to every single class as a parameter to have access to the framework methods. Again, tedious and looks bad

honestly I'm going with a global method for this, where you can simply call framework()->doSomething(). And personally I find "USE namespace" declarations at the top of php files an ugly and confusing way to work with things, I don't want to do something like laravel.

I know globals are bad, but I'm going with 1 global for my framework object

Embrace it completely. Use strictNullChecks and noImplicitAny. If it is annoying for you to have to be explicit about handling edge cases, deal with it, it will make the application far more robust.

Look at Fat-Free Framework. They have a vaguely similar idea to you. You may not like Laravel, but they do the things they do because years of making software has trended in the general direction of global state being a dangerous animal.

Just use design patterns to deal with the shenanigans. Don't make the Framework object a god object that knows/does everything. You could have a singleton Configuration object, a singleton Database object, and a singleton Framework object. Each of them have very clear responsibilities, and you would get the comfort of using object instance (->) syntax.

>You could have a singleton Configuration object, a singleton Database object, and a singleton Framework object.

The database object is part of the framework object however. The constructor of the framework object should take the configuration files so it knows how to set up the environment and the database information based on a config file. That is how I intend to build it. Seems logical to me.

I get what you say about global objects though.. I could let my framework not be a global object but rather passed between methods.. but like I said, then every single view object for instance or controller requires the framework object so they can make a call to the database or anything else the framework deals with. Having a global object is clean and practical, if dangerous. Maybe in the future I'll get rid of the framework object as a global.. but for now I can't see how that could backfire.

I will look at fat free, I'm doing something similar it seems, thank you

I think I'm coding something simpler than fat free. It is also more pleasing on the eye, everything in my framework is an instantiated object - no requires and no USE anywhere, they make the code much harder to read and follow as you can import methods and use them without really knowing where they are coming from.

I also dislike that like laravel, they are making you set up routes manually. There is no need for that my routing system is automatic. I'll continue working on my framework, release it on /webg/ someday and get mocked by everyone here for being an awful coder, but I'll stick to what makes sense to me and has been working on the website I'm making

sharing a cool article on the Ruby GIL, but also applies to the Python GIL.

>jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil

Opinions on multithreading?

what's better?

Concurrency or Parallelism?

>personally I find "USE namespace" declarations at the top of php files an ugly
So you're not going to follow established good design practices that people have developed over 20 years because you think they make your source code look "ugly"? Well I guess this discussion is over.

That's the way you're supposed to do it though. If a controller needs access to the database -> use Namespace/DatabaseClass and instantiate the class, then use the object to make your calls. It's not clean or practical to have a class object loaded as a global, it's just dangerous.

This is just a recipe for disaster. Global objects of database classes and automatic route generation. Surely you see how insecure this is. There is a reason Symfony & Laravel are designed like they are, it's called years of experience. You're breaking multiple important design principles. Read up on what Singleton classes are and chekc out PHPTheRightWay

What you describe as simplicity is just magic in disguise. I've worked in a codebase with hundreds of files, all of which just add shit to the global namespace or use some magic object that knows way too much. As soon as you progress beyond a trivially small application that any design would work with, you will be in for a world of hurt.

>no requires and no USE anywhere, they make the code much harder to read
The "use"/"require_once" keywords do the exact opposite of what you describe. They literally say "here is the list of modules/features that I need for the following code". You really can't get much simpler than that. Namespaces let you organize your code into logical compartments.

You're probably going to be stubborn because you've convinced yourself that you've cracked the code on good system design, but you're actually just falling into one of the oldest traps in software design. The only reason that ANY of your code makes sense to you is because YOU wrote it. If you take a break from your codebase for like 2 months and come back to it, you're gonna ask yourself what the fuck you were thinking.

Sick of dealing with this at work, hence the fuckhuge tirade.
/rant

>Responsive Web Design

I take it you start designing from 1920x1080 and scale down right?

Mobile-first. You start small, then work your way up. If you start big, you inevitably make some feature/design that just can't be properly scaled down. Media query breakpoints should be used to apply styles specific to larger screens, not smaller screens.

youtube.com/watch?v=cN_DpYBzKso&t=833s

no idea, but this is a good talk on the subject

Mobile first

>started web first
Damn it

thats a lot of of SVG/CSS animations user, how long did that take you?

Wouldn't you say that
$object = new Object();
$object->method();


is a better practice than

use namespace;
use namespace as myObject;

method(); //no idea what file is calling this method
myObject->doSomething;// you now have an object accessible to your whole php script. What if you wanted an object just for one method?


I prefer to not use USE on my files. It is cleaner

I know what a singleton is (and that people even say we shouldnt use them anymore now btw) and I have read PHPTherightway

Maybe in the future I won't use a global framework object, right now I really don't see the point. Maybe experience will show me the way. It is a minor fix at any case if I go that way

I only use one global however, no more. Having multiple global declarations is a mess I agree. Having just one seems to be convenient and not dangerous - especially when that one global file is a class file with private methods that protect itself from error and abuse

>The "use"/"require_once" keywords do the exact opposite of what you describe. They literally say "here is the list of modules/features that I need for the following code". You really can't get much simpler than that.

You can by declaring which objects you need for a class within its methods or constructor. It is even cleaner than USE as I mentioned on my previous post. At least seems that way to me.

> If you take a break from your codebase for like 2 months and come back to it, you're gonna ask yourself what the fuck you were thinking.
on the contrary, it was extremely easy to understand and I was happy with what I done. On this new iteration of the framework I've made it even simpler. Depiste not having USE and instead using NEW within my class files, and having one global object, the code is very easy to read. Easier than reading laravel or code igniter in my opinion, by a huge factor, precisely because I use NEW object instead of USE object and everything is wrapped inside classes

Been working on it on and off for a couple months.

>php
i fucking hate php
It's a mess of a language

Jeb's a mess

w3techs.com/technologies/details/pl-php/all/all

Either you stay a react/node hiptser forever and complain in these threads why your SPA portfolio didn't land you a job or you learn Laravel/Spring and real programming concepts like algorithms, testing and design patterns and do memes on your spare time.

Something is not right with this /wdg/ thread.

I haven't been around much lately, but this level of language wars is a bit unusual, isn't it?

Also, pic related is awesome

not that user,
but if I have knowledge of JS/Node/SPA's already.
Should one still start PHP from scratch or start using Laravel right away?

It's almost the same except the syntax in PHP is backward for some stuff compared to JavaScript.

Read a quick tutorial about php's syntax and namespaces then you're good to go if you already know node/express

For those of you that have faffed with vichan, how would I go about disabling image uploads for non-moderators?

this. port katawa shoujo

What the hell are those examples. The right way is:
use MyNamespace\ClassName;

function someFunction()
{
$instance = new \MyNamespace\ClassName();
$instance->method(); // The instance of this class object exists only inside this function scope. It ceases to exist once the function ends.
}

You autoload your libraries through Composer. You call the namespace at the top of your controller/model and then you instantiate a class object where you need it.

I struggle to understand why you won't use 'use'. Just open up any large scale modern PHP project and you'll understand why it exists.

I mean hypothetically that would be possible. But in general games are better off being written in JavaScript with Canvas/WebGL, with vectors as source graphics if you want that. Actually scripting animations is a better, more scalable approach than what I did (no JS at all, pure CSS).

>In this task you'll try to distinguish the meaning of words within sentences. To be more precise, you'll try to determine whether the sentence you're looking at talks about mice, the rodents with the elongated noses, or mice, the input devices used to control a computer.
the fuck? what is this supposed to guage?

>use MyNamespace\ClassName;
>$instance = new \MyNamespace\ClassName();

if you are saying new \namespace you don't need the USE on top. The autoloader takes care of it

>composer
ew

Just do spl_autoload_register(); and you can automatically do instance = new \namespace without having to put USE at the top

this is natural language processing. Read the instructions:
> The mouse is connected to the computer
> The mouse is eating cheese

your program should be able to analyze both sentences and say which one refers to mouse-animal and which one to mouse-computer part.

It depends on the project itself. If it's an app geared towards mobile users then naturally you will start mobile first. However, for anything else you can decide whether you want to go mobile first or not, it's a personal choice.

nice, gonna mess around with that

it seems you are confused by what i said. i know what the question wants, I'm questioning the point of it as a challenge. He said it was for a backend interview.

From the CGScope website:

>CGscope focuses on bank corporate governance intelligence. We collect and analyse critical governance data and information buried in thousands of pages of public disclosures using purpose-built data mining techniques. Our analysis is presented to clients in regular benchmarking reports. In addition, we provide our clients with governance intelligence updates and access to dedicated experts.
>Our data collection techniques are based on innovative purpose-built software using data mining and artificial intelligence techniques.

I guess they take backend in a broad sense, meaning to include data mining and stuff like that.

not the same user, but how do you solve the problem?


just check if there is "modern" in the sentence and if there is, it means it's a computer mouse otherwise it isn't?

there's many solutions, none are perfect, but they each give you a different degree of success. For all of them you need to first compose a corpus of words, one for mouse-animal, another one for mouse-computer. The easiest solution (though a bit naive) is to just use the wikipedia article for each term as its corpus.

You could also add a third corpus of words to ignore (called stopper words: all prepositions) and maybe remove words found in both mouse corpora.

Then comes your main algo, which could be a naive bayesian classifier. The easiest solution though is code related, though not the best of course.

def analyze(self, text):

# Break up the input into single words
tokens = word_tokenize(text)

# Initiate scores for both possibilities
mouse_score = 0
comp_score = 0

for token in tokens:
if token.lower in self.ignore:
pass
elif token.lower in self.mouse:
mouse_score += 1
elif token.lower in self.comp:
comp_score += 1

# If scores are equal there's no way to know which mouse it is, so just return computer
if mouse_score > comp_score:
return 'animal'
return 'computer-mouse'

How do I structure a web application that's supposed to have real time features?

>my.mixtape.moe/rygbvu.pdf

can anybody share their solution to the running median problem? Just curious...

python 3. not sure if it is 100% correct

a = int(input())
lst = []
for i in range(a):
lst.append(float(input()))
lst_len = len(lst)
if lst_len % 2 == 0:
b = lst[int(lst_len/2)]
c = lst[int(lst_len/2)-1]
print (float((b+c)/2.0))
else:
b = lst[int(lst_len/2.0)]
print (float(b))

this is correct for an ordered input, but not for anything else. You gotta sort the array after every append, or use bisect to append items in order.

Check out the bisect library here: pymotw.com/2/bisect/

sheeit completely forgot that
a = int(input())
lst = []
for i in range(a):
lst.append(float(input()))
lst.sort()
lst_len = len(lst)
if lst_len % 2 == 0:
b = lst[int(lst_len/2)]
c = lst[int(lst_len/2)-1]
print (float((b+c)/2.0))
else:
b = lst[int(lst_len/2.0)]
print (float(b))

but seriously, sorting 10 items is no problem, but sorting an increasingly growing array for every iteration is insane. Look up bisect, it's p. cool

Get a new slogan bitch. That shit gets parroted in every fucking thread. It's on 70% of websites in one way or another.

Git Gud

how do i turn radio buttons into a 5 star rating thing. everything on google is ugly and half broken

codepen.io/lsirivong/pen/ekBxI

thanks works well

I'm trying to get back into web development after just focusing on desktop stuff for several years. Can someone give me a quick rundown of what kind of tools/frameworks people are using nowadays? Like, I know about jQuery, but is like Bootstrap still a thing? Is that a popular / go-to type thing? What about other stuff like these Angular / React type things?
Basically I just want to know what the major popular thing is that everyone uses, so I have a direction. Thanks.

Bootstrap is still used, but Angular and Vue.js are getting popular really fast.

PHP and Laravel are popular too.
Avoid Codeigniter, since it's not supported anymore.

stateofjs.com/2017/front-end/results

Personally I recommend react or vue. Angular is unpleasant to learn imo.

Less or Sass or Stylus?

Make some BS4 button colors. Made for the small projects that I just slap the CSS CDN link and did not bother with SCSS.
altbdoor.github.io/bootstrap-button-color/

anyone use vscode for javaee developement? The java ide's are shitty as hell but let me debug inside of them.

Anyone using Jekyll or Hugo here?

Wait there are IDEs for web development? I've always used Notepad

I've used Jekyll a little bit, largely for GitHub pages stuff. But Jekyll is growing to a huge mess imo.

What's messy about it?

vscode is basically notepad on steroids and is modded out the ass to support debugging, code snippets, intellisense, error checking, and live page previewing as you write. I can't imagine wasting my time fucking with notepad.

I know Jekyll's core is for blogs and whatnot, but I mainly use it to craft out static sites from scratch. The inclusion of themes is good for blogs, not so much for sites.
It also adds a whole lot of new bloat in the installation with themes, and the dev team seems to be focusing more on the theme aspect. But yeah, that's my view.