[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/wdg/ - Web Development General

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 313
Thread images: 27

File: 1487701743799.png (731KB, 824x553px) Image search: [Google]
1487701743799.png
731KB, 824x553px
>Discord
https://discord.gg/wdg
OR
https://discord.gg/0qLTzz5potDFXfdT
(they're the same)

>IRC Channel
#/g/wdg @ irc.rizon.net
Web client: https://www.rizon.net/chat

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

>Useful Youtube channels
derekbanas
thenewboston
learncodeacademy
funfunfunction
computerphile
codingrainbow

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

>Backend development
https://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks
[Gist] backendDevelopmentBookmarks.md (embed)

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

>NEET guide to web dev employment
https://pastebin.com/4YeJAUbT/ (embed)

>How to get started
http://pastebin.com/pDT82mQS (embed)
http://pastebin.com/AL6j7GEE (embed)

>cheap vps hosting in most western locations
https://lowendbox.com
https://www.digitalocean.com/
https://www.linode.com/
https://www.heroku.com/
https://www.leaseweb.com
>>
Web development is for stupid niggers
>>
File: Capture.jpg (106KB, 940x654px) Image search: [Google]
Capture.jpg
106KB, 940x654px
>>59147202
Trying to learn me some ruby on rails,

can someone tell me why it's rendering show.html.erb instead of goy.html.erb?

If you can see, the articles controller defines goy.

If i call articles/new, it does call the new.html.erb

If you call something other than new, it will render show.html.erb no matter what.
>>
>>59147280
You need to show me your routes.rb
>>
>>59147394
Rails.application.routes.draw do

resources :articles
get 'articles/goy'


root 'welcome#index'
end
>>
I'm seem to be just making apps that connect one web api to another as of late. any suggestions lads?
>>
>>59147202
Does there exists a tutorial,video,tips for creating a wordpress e-commerce theme?

fuck im so lazy to read documentation.
>>
Is there a way to make a new sub array every time an each() or for loop iterates.
>>
Hi /wdg/, newbie here.

From all the provided learning materials in OP's pasta, what is the best focused in WebDev?
>>
File: 2000px-Node.js_logo.svg.png (94KB, 2000x1226px) Image search: [Google]
2000px-Node.js_logo.svg.png
94KB, 2000x1226px
name one reason i shouldn't use node.js to build a message board.
>>
>>59148605
Java anywhere in the title is reasons 1-10.
>>
File: Mike_Nolan.png (251KB, 466x456px) Image search: [Google]
Mike_Nolan.png
251KB, 466x456px
>Finished a very thorough full stack course.
>Feel reasonably confident.
>Start building portfolio site.
>Write all the back end in a couple of hours.
>Front end taking me days just because I'm finicking around with what to put on my page.

At what point should I start applying for jobs? I'm pretty sure that given access to google I can figure out most problems but I'm definitely still a little bit hazy on some aspects of JS.

Any advice would be greatly appreciated.
>>
>>59148605
it's a good idea.

javascript is a pretty nice language.

protip though. use EventEmitter as much as possible.

it makes your code super clean and uncoupled.

it's really fun to have index.js just be a bunch of object inits and registering .on('event', () => {}) listeners.
>>
File: the_romulans?.gif (28KB, 300x236px) Image search: [Google]
the_romulans?.gif
28KB, 300x236px
>>59147202
Can /wdg/ explain to me why all modern sites are dogshit slow, require 10MB of javascript and CSS, and redraw or refresh themselves 3-4 times before settling down. All for maybe 40KB of actual text/image content, maybe.

And why the hell did everyone suddenly decide reinventing the iframe was a good idea? With those floaty nav bar things everywhere. What the hell is going on?
>>
>>59149243
all that slow is the botnet nonfree js crap they pull in external to their site.

react, and other js frameworks standalone are quite fast.
>>
>>59147731
https://jsfiddle.net/5qjxprta/1/
>>
HALP

        var objectPlayer = [ 50, 50, 100, 100, 'div1', '#00ff00' ];
var objectNPC = [ 50, 50, 300, 100, 'div2', '#ff0000' ];

function collision( a, b )
{
var a = [
[a[2], a[3]],
[a[2]+a[0], a[3]],
[a[2], a[3]+a[1]],
[a[2]+a[0], a[3]+a[1]]
];
var b = [
[b[2], b[3]],
[b[2]+b[0], b[3]],
[b[2], b[3]+b[1]],
[b[2]+b[0], b[3]+b[1]]
];

var md = [];
var n, i;
for(n = 0; n < a.length; n++)
{
for(i = 0; i < b.length; i++)
{
md.push(a[n][0]-b[i][0]);
md.push(a[n][1]-b[i][1]);
}
}

var quadrant=[ 0, 0 ];
var col = [ 0, 0, 0, 0 ];
for(n = 0; n < md.length; n+=2)
{
if( md[n] < 0 & md[n+1] > 0 ){ col[0]=1; }
if( md[n] > 0 & md[n+1] > 0 ){ col[1]=1; }
if( md[n] < 0 & md[n+1] < 0 ){ col[2]=1; }
if( md[n] > 0 & md[n+1] < 0 ){ col[3]=1; }


part 1
>>
>>59147908
Depends on what you want to do. Career as a professional? freelance?

>>59148742
>java === javascript
no, they're as different as two languages could be.
See Java's brief explanation: https://www.java.com/en/download/faq/java_javascript.xml
>>
>>59149554
What do you want to happen that isn't? And I'm guessing this is vanilla JavaScript we're working with here
>>
                if(((md[n]*md[n])+(md[n+1]*md[n+1])) > ((quadrant[0]*quadrant[0])+(quadrant[1]*quadrant[1])))
{
quadrant[0] = md[n];
quadrant[1] = md[n+1];
}
}
if( col[0] & col[1] & col[2] & col[3] )
{
var closest = [ 0, 0 ];
if(quadrant[0] > 0 & quadrant[1] > 0)
{
a[1][0] -=b [3][0]; a[1][1] -=b [3][1];
a[2][0] -=b [3][0]; a[2][1] -=b [3][1];

closest[0] = ( a[1][0]*a[1][0] ) + ( a[1][1]*a[1][1] );
closest[1] = ( a[2][0]*a[2][0] ) + ( a[2][1]*a[2][1] );

if( closest[0] > closest[1] ){ objectPlayer[2] -= (2); }
if( closest[0] < closest[1] ){ objectPlayer[3] -= (2); }
}
if(quadrant[0] < 0 & quadrant[1] > 0)
{
a[0][0] -=b [2][0]; a[0][1] -= b[2][1];
a[3][0] -=b [2][0]; a[3][1] -=b [2][1];

closest[0] = ( a[0][0]*a[0][0] ) + ( a[0][1]*a[0][1] );
closest[1] = ( a[3][0]*a[3][0] ) + ( a[3][1]*a[3][1] );

if( closest[0] > closest[1] ){ objectPlayer[2] += (2); }
if( closest[0] < closest[1] ){ objectPlayer[3] -= (2); }
}
if( quadrant[0] > 0 & quadrant[1] < 0 )
{
a[0][0] -=b [2][0]; a[0][1] -= b[2][1];
a[3][0] -=b [2][0]; a[3][1] -= b[2][1];

closest[1] = ( a[0][0]*a[0][0] ) + ( a[0][1]*a[0][1] );
closest[0] = ( a[3][0]*a[3][0] ) + ( a[3][1]*a[3][1] );

if( closest[0] > closest[1] ){ objectPlayer[2] -= (2); }
if( closest[0] < closest[1] ){ objectPlayer[3] += (2); }
}

part 2
>>
>>59149580
                if( quadrant[0] < 0 & quadrant[1] < 0 )
{
a[1][0] -= b[0][0]; a[1][1] -= b[0][1];
a[2][0] -= b[0][0]; a[2][1] -= b[0][1];

closest[1] = ( a[1][0]*a[1][0] ) + ( a[1][1]*a[1][1] );
closest[0] = ( a[2][0]*a[2][0] ) + ( a[2][1]*a[2][1] );

if( closest[0] > closest[1] ){ objectPlayer[2] += (2); }
if( closest[0] < closest[1] ){ objectPlayer[3] += (2); }
}
}
else
{
if(col[0]&col[1]&(!col[2] & !col[3])){ return 'top'; }
if(col[2]&col[3]&(!col[0] & !col[1])){ return 'bottom'; }
if(col[0]&col[2]&(!col[1] & !col[3])){ return 'left'; }
if(col[1]&col[3]&(!col[0] & !col[2])){ return 'right';}
}

}

part 3

This is supposed to be collision correction between two squares but I basically cobbled it on the fly and am also retarded.

It works but it is monstrously bloated.
>>
>>59149566
As a java and oracle-sql programmer, I think professional, I want to implement those knowledge to use on jdbc.
>>
>>59149759
And you want to develop software or web apps?
>>
>>59149599
>supposed to be collision correction
What in the heck is that?
>>
>>59149835
I plan on learning both but right now I just want to learn web apps.
>>
var highlightBtns = (function () {

$("#startButton").on("click", function (event) {
event.preventDefault();
$(".rangesGrid table").each(function () {

var userHands = [];
var positionName = $(this).closest("[id]").attr("id");
$(this).find(".highlighted").each(function () {
userHands.push($(this).text());
});

});
});
}());


Ok I have looked at a few places, but I am stuck on JS objects, what I want to do is when the start button is pressed, the function goes through all the tables that are made, and pushes the highlighted cells in each to an array.

I have got most of this working, I just don't know how to do the object part, any help appreciated.
>>
>>59149851
While I think you can do a back-end in Java, I don't think I've ever seen any Java developers here. It's not super common to do a back-end in Java
http://softwareengineering.stackexchange.com/questions/102090/why-isnt-java-used-for-modern-web-application-development

There are plenty of other options though, that's just my 2 cents. I also don't know of any resources to get started doing a back end in Java
>>
>>59149916
I don't get what youre doing or what you mean.

Delete the first and last lines, does it work now?
>>
>>59149916
you got it m8
var highlightBtns = (function () {

$("#startButton").on("click", function (event) {
event.preventDefault();
$(".rangesGrid table").each(function (thisIsATable) {
//do something with thisIsATable
console.log(thisIsATable);
var userHands = [];
var positionName = $(this).closest("[id]").attr("id");
$(this).find(".highlighted").each(function () {
userHands.push($(this).text());
});

});
});
}());
>>
>>59150386
hm, ok then anon.
Appreciate the help.
>>
>>59150386
>It's not super common to do a back-end in Java
But that's wrong
It's my back end language of choice. There's also lots of jobs offering for java back end stuff, java being enterprise has even reached meme status
>>
>>59149842
The follow up to collision detection.
>>
>>59150569
>It's my back end language of choice
Maybe you can help him (>>59150453) find some resources for getting started with Java as a back-end. I don't know of any
>>
>>59150688
So you're mapping two arrays of coords waiting for them to intersect?
>>
>>59150854
No that function detects collision first by calculating the Minkowski difference (md) and then corrects them by determining the closest line to square B in square A by determining the quadrant square B is intersecting the most and determining which point is the second closest to the intersecting point. Then once the closest side to the collision is determined I just subtract either x or y.
>>
>>59150940
Yeah, gonna need simpler English than that
>>
>>59151375
I'm passing two objects, determining whether those two objects are colliding and then making them un-collide.
>>
>>59151426
Okay, use a fiddle or something like this next time

https://jsfiddle.net/gLtmgd51/

Also, what is this doing wrong? I see it's spitting out "left"
>>
>>59151544
It's not doing anything wrong. It's just bloated as all fuck and runs like shit.
>>
>>59150453
>>59150838
So same as other languages, you can either start learning to use the core apis to hopefully get a feel of how everything works and then look into the modern frameworks that everybody uses to get stuff done or directly skip to said frameworks.

In java's case the old way of doing it would be handling http requests from a servlet running in a servlet container like tomcat, handling database connections through jdbc. You'd serve the front end either as static html + js content, calling your servlet endpoints with ajax requests and whatever, or with some templating engine like jsp pages.
All this stuff is old as fuck and learning material is available all over, this tuorial for example seems to be a good starting point : https://www.tutorialspoint.com/servlets/index.htm

Otherwise you may want to skip directly to nicer to use frameworks like spring. Pick either graddle or maven as project manager (dependency management, test runnig, project packaging and whatever) and use spring boot to autoconfigure your stuff for you. The official getting started tutorials and example projects are a nice place to start (http://projects.spring.io/spring-boot/#quick-start). This can embed your server into your executable, handle orm mappings, setup user authentication mechanism or whatever really through their bazillion sub projects. There also are lots of tutorials available. You just want to avoid using too outdated documentation.
>>
Am I missing something with objects?

Every example I see, it has stuff like

name: "something",
rooms: "number",
ect.

Shouldn't there just be keys and the values be empty, and you add them later?
>>
>>59151622
What is confusing you? It is realy contextual whether or not you want predefined values.

It also depends which language we are talking about since in C-like languages you have to actually declare objects as types while in js you can just assign a js object outright.
>>
>>59151670

JS, so I don't need to put anything in the values when I define the object keys
>>
>>59151607
Thank you very much anon.
>>
>>59151767
You can do this yes.
var test = {
'valueA':'',
'valueB':'',
'valueC':''
};
>>
>go to website
>ctrl-F
>their own search implementation pops up
>needless to say it doesnt work

today the web died a little bit
>>
>>59151908
Dont blame the codemonkey blame the blogger who wrote an SEO article that says on page search analytics will make you instantly rich and famous no matter how small or what type of business you run. I just had to roll my own on page search stuff so I can relate even if I didn't hijack that particular functionality.
>>
>>59147280
>>59148200


I'm only answering you because /g/ hates Rails.

>can someone tell me why it's rendering show.html.erb instead of goy.html.erb?

This is correct.
With "resources :articles" you created the following actions:
index/show/new/create/read/update/delete

So "GET articles/goy" triggers the show action with the parameter (or rather "article id") "goy".

I'm not sure what you want to do here, but as I understand it you want something that is usually considered bad practice - at least by some people, who argue that all your routes should be CRUD. So in your case rather make a "goy controler" and put your action in a show action there:

# routes.rb
get 'articles', to: :show, controller: 'goyim'



However, that only one possibility. You could also set it up that the show action does something "funky" when it gets "goy" as parameter, depends on what you really want to do.


Maybe you should look though some tutorial like "Rails in Action" to get the hang. Rails is pretty easy abd powerfull, but it's opinionated, so if you work against it you'll have a hard time.
>>
>>59152385

Oh, I fogot the most obvious thing:

If you want to use the "goy" action at a certain article, your route sould be something like this:

www.example.com/articles/1/goy
>>
File: slip.jpg (16KB, 281x349px) Image search: [Google]
slip.jpg
16KB, 281x349px
>vue 2.2: 74kb minified
>angular 1.6: 163kb minified
>angular 2.4 (bare necessities: core + common + forms + http + platform-browser + zone.js): 492kb minified
>>
>>59152622
>not using bloatware: 0kb minified
>>
>>59152701
>only capable of reinventing the wheel: unemployable
>>
how can i break up what i get with an ajax call? why does it all go into responseText?
>>
>>59152759
>how can i break up what i get with an ajax call?
wat

>why does it all go into responseText?
Where should it go?
>>
>>59152778

i want to put one part of it in another variable and the rest in responeText. Is that possible? When i print out the responseText it all goes in the same spot.....retarded if you ask me
>>
>>59152792
You're not making sense. What is it you're requesting? HTML? JSON? Other kind of data?
And how is Javascript supposed to know how you want to break down your data?
>>
>>59152836

im grabbing data from a table. When i print out the data its all in one variable (responseText)

nvm dude i dont think its possible
>>
>>59152759
Sounds like youre using IE. Are you using IE?

You can do data streams with vanilla js client side or easymode with a meme library in node
>>
>>59152845
i'm assuming you're fetching data from a server to a web page using ajax

1. make your server serialize result data, into json for example
2. grab responseText, deserialize json into javascript object
3. you can now manipulate your data the same way you could on your server, congrats
4. now go read a book and learn how the web works
>>
>>59152929

no i dont use IE

>>59152953

i just called another ajax request
>>
>>59153022
then you dont have access to the responseText until the request is complete
>>
>>59153198

ya i do

first function gets response, prints it to the page, then that calls another function that gets a response, then prints other data to a different part of the page
>>
File: rubies.jpg (99KB, 1070x846px) Image search: [Google]
rubies.jpg
99KB, 1070x846px
>>59152385

>/g/ hates Rails

How the fuck can you hate THIS
>>
File: 1484545554456.jpg (116KB, 499x515px) Image search: [Google]
1484545554456.jpg
116KB, 499x515px
>>59153255
i would rail these rubies
>>
>>59153255

Look at that harlot, wearing mascara, eyeliner AND eyeshadow for a video on RoR. I bet she does anal on first date.
>>
>>59149243
database calls
>>
>>59153378
>>59153287
>she
>>
I challenge you to write a better search function.

<?php
error_reporting(0);
$search = htmlspecialchars($_GET['search']);
$posts = array();
$count = 0;
foreach(glob("posts/*.php")as $post){
if($post!=="posts/randompost.php"){
$get = strip_tags(file_get_contents("$post"));
if (preg_match_all(strtolower("/$search/"),strtolower($get))){
array_push($posts,$post);
$count+=1;
}
}
}

echo("<link rel='stylesheet' href='CSS/style.css'><h1 class='link'>$count results found for '$search' </h1><br/><a class='link' href='index.php'>go back to in$
foreach($posts as $found) {
if(file_exists($found)){
$get = strip_tags(file_get_contents($found));
echo "<link rel='stylesheet' type='text/css' href='CSS/style.css'><a class='link' href='$found'>$get</a><br>";
}
}
?>
>>
>>59153508
google.com
>>
>>59153508

>echo'ing all of that

no thanks, jeff
>>
>>59150452

Don't know if your still here, or if anyone else can help. Trying to get it to make new object(s) when the button is pressed.

var highlightBtns = (function () {

$("#startButton").on("click", function (event) {
event.preventDefault();
$(".rangesGrid table").each(function () {
function Position(name, hands) {
this.handName = name;
this.userHands = hands;
}

var range = new Position(positionName, userHands);
console.log(range.name, range.year);

var userHands = [];
var positionName = $(this).closest("[id]").attr("id");
$(this).find(".highlighted").each(function () {
userHands.push($(this).text());
});

});
});
}());
>>
File: 1484178231488.jpg (74KB, 450x600px) Image search: [Google]
1484178231488.jpg
74KB, 450x600px
I have an app that uses laravel as backend and react for frontend. Do I have to manually create an empty blade file that extends the layout for every react router page because otherwise I get a not found error?
>>
>>59153623
No. Learn how to properly route a Laravel application. Honestly, React with a PHP backend is best with PHP only providing API endpoints.
>>
>>59153508
I challenge you to use indentation
>>
>>59153623

fuck man, ditch the frameworks.

vanilla php5.0+ with AJAX calls is the way to go
>>
>>59153728
Too modern
ANSI C + CGI is the way to go
>>
I just spent an hour troubleshooting why my component function in React wasn't working. Turns out I just forgot to bind it with this. Time to drink boys
>>
>>59153782
ES6 classes? There's an autobind-decorator package that automatically binds methods to their component instance
>>
Is it possible to host a HTTPS NGINX site that's running a react webapp with proxy pass to the API endpoints on node.js?
>>
>>59153673
I have to provide a route in Laravel otherwise it thinks the route doesn't exist. I can go to the page I want by navigating and clicking buttons in react router but if I just type the url it won't work.

>>59153728
That was my plan when I started but react native made me change my mind.
>>
>>59153843
nice, I'll look it up. thanks m9
>>
File: 1480964969162.jpg (38KB, 613x556px) Image search: [Google]
1480964969162.jpg
38KB, 613x556px
I plan on hosting my Node.js webservice (web server - API - Database) on a single Amazon Web Services EC2 server and I also plan on buying a DNS record from there.

Is this a good idea? Are there cheaper or all round better alternatives?
>>
>>59153713
>Using indentation when not forced to
>>
anyone use Iris?
>>
>>59154137
aws stuff always scare me as i'm never sure what i'm actually going to pay each month
maybe try to host on a vps if you don't need your stuff to scale rapidly or whatever
digital ocean is nice and comfy but there are cheaper options on lowendbox to host small projects
>>
>>59148923
>EventEmitter
>using node.js instead of superior good old php
>>
>>59154414
Thanks! That Digital Ocean thing looks like it could be very useful during the testing stage, in which I will only be running servers in the weekend.
>>
File: 1402361621799.png (7KB, 350x346px) Image search: [Google]
1402361621799.png
7KB, 350x346px
Do people actually use single-file components in Vue apps?
It seems so weird and unnatural to have CSS, JS and HTML all in the same file
>>
>>59154944

when youre using tons of meme include .css and .js's, yeah im sure it does
>>
how do you update data on your web app with ajax via select query? im using ajax read just fine, but if i want to filter to another record how can i do that?
>>
How do people usually learn bootstrap?
Just trial-and-error messing with CSS from the bootstrap reference, like I'm (unsuccessfully) trying to do?
>>
>>59156681
i found bulma.io easier to use.

bootstrap still feels obnoxious and incomplete.
>>
>>59156681
Smart people don't.
>>
>>59156681
The documentation for most CSS frameworks are pretty informative. It tells you where to put the classes for each type of element.

Basically most CSS frameworks have some sort of grid system that is typically based on "12 columns" and you're supposed to wrap a div with a row class with divs that each have column classes that add up to 12.

If you're using Chrome, right clicking on an element and clicking inspect element also allows you to see the styling that is applied to the element. You can modify the HTML inside your browser to change classes without having to modify your code.
>>
>>59156749
I'll check it out, thanks

>>59156785
I know all the fundamentals of web dev it just seems like a lot of ritualistic inserting of class names for each element, and I don't really know how to combine stuff to get what I want. Also I'm pretty terrible at CSS in general

>>59156783
>smart people waste their time fucking with stylesheets all day
Is this the /wdg/ eqiuivalent of programming in C
>>
>>59156985
>implying css is hard at all
>>
File: file.png (253KB, 1920x978px) Image search: [Google]
file.png
253KB, 1920x978px
>>59123331
>How do I test my CSS changes on Chrome on the current page I'm on?
>On Firefox all I do is just hold Shift + F7 or Ctrl+Shift+I to open the Style Editor, scroll to the bottom of the stylesheet page and paste all my CSS. Does Chrome have anything equivalent to Firefox's Style Editor?
>>59123537
>Nevermind, I figured out a workaround albeit a bit more cumbersome than Firefox's style editor. I just change the page source, and at the bottom of the <head> block I just type in <style> and </style> and paste the CSS between those tags.

You can go to elements and enter shit in the panel on the right side, or just go to sources, select the CSS you want to edit, and edit it (pic related is the second version, notice how I changed the body's background-color to bright green and it became bright green). You can always just use jsfiddle for prototyping too.
>>
Does anyone make any passive income though adsense on sites?

I need some ideas to get me started, an extra $50/month would be nice.
>>
>>59148863
>At what point should I start applying for jobs?

Code 3 or 4 free PSDs to HTML, add some JS functionality and you're good to go.
>>
>>59154169
Not everyone is an autist
>>
I want to start selling wordpress sites,

What would the best way to go about hosting, and handling the client domain names?
>>
Hi guise. I have a vanilla-js problem that I'm sure would be helpful to everyone as well.

1: When you click on <H4> element it only toggles the first time around.

2: Also the document.querySelector doesn't seem to traverse all H4 elements for the click event to fire.

pls see the pastebin:

https://jsfiddle.net/8ecmjw86/

I could easily jQeury this thing but I prefer to try vanilla-js equivalents. Thanks
>>
>>59160791

var el = document.querySelector(".faq-list1 h4");

var nextItem = el.nextElementSibling; // works. but nw IE8
// nextItem.style.display = 'green';

function clicktrigger () {
console.log("trigger");
console.log(nextItem.className);
nextItem.className = nextItem.className == "faq-list1--hide" ? "faq-list1--show" : "faq-list1--hide";
}

el.onclick = clicktrigger;
>>
>>59153861
Yes. A bit of a pain in the ass to configure, but it's doable.
>>
Web dev beginner here

Looking for some good workflow hacks. I'm using Sublime and have installed emmet and looking how to set up snippets. Any good tips for working quickly? Also, any advice on best coding/syntax practices in general. I want to get into good habits early.

Also, am I wrong for fucking hating JQuery?
>>
>>59148863
Recommend some good learning resources please!
>>
Making a website at the moment with very little previous experience.

What's the best practice for scaling websites? I haven't had a chance to test it on mobiles yet but I can tell there will be elements that won't scale well.

Trying to keep it really light so I want to avoid using a lot of JS.
>>
>>59161494
crtl shift d

duplicates the line
>>
>>59151590
>https://jsfiddle.net/gLtmgd51/
I see why you made a lot of the decisions you did. It's really not bad at all. It could be condensed, but it would be at the expense of readability.
>>
Guys, what's the best way to get into webdev for an experienced programmer (C/C++)? I feel like literally everything is a bloody mess and so shit. What stack/tools should I try?
>>
>>59153584
var positionName = $(this).closest("[id]").attr("id");
$(this).find(".highlighted").each(function (instanceOfHighlighted) {
console.log(instanceOfHighlighted);
userHands.push($(instanceOfHighlighted).text());
});

is this what you mean to do? Also, tossing it into a fiddle helps
>>
>>59161494
>Also, am I wrong for fucking hating JQuery
No. It's great for when you get in a pinch and you just need to DO something. It's not great for building an entire app with. For that, frameworks are preferred
>>
>>59160791
You can use classlist to easily toggle classes on your elements :
nextItem.classList.toggle("hide")

https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

Use document.querySelectorAll to get an array of elements instead of just the one, define nextItem in your eventHandler function using event parameter that should get passed to it.
>>
>>59163007
>Guys, what's the best way to get into webdev for an experienced programmer (C/C++)?
lower your IQ by 50 points
>>
>>59162318
Easiest solution is to use some css responsive library with grid system like bootstrap or skeleton and hopefully get it to display your shit in a good way on small screens. Also use media queries in your stylesheets to change display depending on screen size.
>>
>>59163007
1. Learn html css javascript, to make web pages (should be easy)
2. Pick any language / framework combination you like, to make servers. Looks like you can use c++ with .net framework.
3. Learn how to interact with databases using said language and framework
4. Learn some meme js front end framework to hopefully be more productive
>>
>>59163321
as a web dev, I agree with this statement
>>
Is anyone here decent at C++? I normally never come to this board, but I'm in a C++ course and cannot find the error in my program.
>>
>>59163550
this is web development thread, unless you're making a c++ server try stupid questions thread or daily programming thread
>>
>>59163550
>>>/g/dpt
>>
>>59163590
>>59163614
thanks, I just catalogued for coding and saw this thread.

I appreciate it,
>>
>>59163550
how about posting the sourcecode and then ask for help dumbass.
>>
how can i just change some variables with ajax? im running a SELECT query, no need for a GET or POST.
>>
>>59164679
So you're making an ajax call to your back-end, your back-end is querying your database and returning results, correct?
And you're wanting to change what?
>>
>>59164752

correct

after that select query im selecting new stuff and want the variables on the page to update. (i set the variables to the new queried data). Really simply stuff
>>
>>59164777
You want to update the values with your updated data. Well, what are you using for your JS? jQuery? A framework? Vanilla?
>>
>>59163007
it's no more convoluted than any other toolkit
it's just basic MVC

choo, some fucking editor, understand asynchronous, it's not that fucking hard.
>>
>>59164807

no dude just vanilla js (ajax). The query is done with php though. I can do async stuff just fine with POST and GET but not sure how to do something like this
>>
>>59164777
ok, so select the appropriate DOM elements and update them.

or use an actual framework that handles most of this shit for you like riot or choo.

>>59164827
what the fuck are you on about? XHRs are POSTs/GETs
>>
>>59164827
So you'll populate your values the same way they were originally populated when the page loads. Just put it into a function and call it again
>>
>>59164867
>>59164890

still dont get it, heres my function. HOW THE FUCK DOES IT WORK? WHAT DO I PUT IN THE IF READY STATE CONDITION? FUCK

function loadFirstRowData()
{
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{

}
}
xmlhttp.open("GET", "loadFirstRowData.php", true);
xmlhttp.send();
}
>>
>>59165015
just use a framework, jesus fuck.
>>
>>59165015
Your inline function will be called when ajax request gets executed
Server response body will be in xmlhttp.responseText field
Parse whatever data you need from it
>>
>>59165015
what in the ... at least use jQuery to make the request for OUR sake.. what >>59165078 said. Nobody does vanilla. You're gonna kill us all with crap like this
>>
>>59165078

and bloat out my app? no thanks, jeff.

>>59165118

so i parse the responseText? wont it all be in the responseText variable? theres stuff everywhere i need to update. I need like 20+ variables then...
>>
Any Strayans here know a city with jobs that hires without a degree? I know a lot of you guys don't have one, but our government goes out of its way to fuck anything it can't outsource.
>>
>>59165173
>and bloat out my app? no thanks, jeff.

then stop bitching.
all you need to do is run your DOM selectors, find the dom elements you want, and change them. it's not rocket science.

f you need to store the values in variables, create some global scope Map() or object and just shove them in that bitch.
>>
>>59165173
What does your server returns when you make that call ? Open yourserverurl/loardFirstRowData.php in your browser.
Easiest way to parse data would be to have your server serialize the response in json, then parse the json into a javascript object in the front end so you can use it like any other js object
>>
>>59165218

im using php tho so how do i "convert" this data into js variables then?

>>59165227

loadFirstRowData just returns text, it grabs a row from a table. Thats it. I need to assign the variables that are just chillin there on my app to it. Thats all i wanna do

<div>$faggot</div>

that variable name never changes. The data it points do does though. See what im saying? So i need to prase the responseText, serialize it, then fuck herpa derpa? idk

REEEEEEEEEEEEEE
>>
>>59165227
>>59165302
Let's say your server returns an array of data serialized in json like so :
[
{"id": 1,
"name": "fagget",
"address": "123 fagget street"},
{"id": 2,
"name": "op",
"address": "mum's basement"}
]


In your inline function you can parse and use data like so :
var data = JSON.parse(xmlhttp.responseText);
data.forEach(function(row){
console.log(row.id);
console.log(row.name);
});
>>
boy do i fucking hate front end
>>
>>59165302
>im using php tho so how do i "convert" this data into js variables then?

serialize your fucking object to json?
>>
>>59165302
If loadFirstRowData just returns text you want to print in a div then just put xmlhttp.responseText into said div, where's the problem ?
>>
>>59165383

it all cant be in on fucking responseText variable because i need to SPREAD the data around the page

im gonna try SERIALIZLIZIZAERLING MY DATA
>>
>>59165368
if only there were another way
>>
editComment(comment) {
console.log(comment);

let data = this.state.data;
var newData = data.map(item => {
if (item._id == comment._id) {

console.log(item);
}
})
}


for my react comment app with socket.io. this is right after a user fires off an a comment update and the change is emitted to the other clients

how do I update this.state.data by replacing item with comment? data is an arr of comment objects, I'm doing map on the current comment arr to find the comment with the same id as the update, and then overriding only info that the update contains (the update may only update 2/4 items in the comment object, so I still want to preserve the unaffected values)
>>
For a portfolio where I'm making a twitter clone is it better to make it exactly the same in functionality or is just similar fine.
>>
>>59165529
It's better to just update all the comments. It's not going to look any different when the user works with it unless there's animation involved
>>
>>59165514
what would the other way look like? some shitty toolkit crap like Qt or GTK+?

html/css and javascript work very well in comparison to a shitload of toolkits i've used.
>>
>>59165582
pfft like I know
>>
>>59165529
call your reducer?
>>
>>59165578
nobody's really gonna look closely at it. I made a big portfolio and was interviewed by several people. No one even glanced at it.
>>
>>59165613
Alrighty goodey thanks for letting me know, will just do whatever is quicker.
>>
>>59165594
to be honest, once you understand what is actually occurring, I think you'll have a great appreciation for it all.

Markup is a bitch, but it's the only way to make sane display languages that are human readable.
>>
>>59165638
HTML is fine, it seems like CSS could use an update. I wish it were more straight-forward like programming languages. It's wildly unpredictable to me
>>
>>59165404
sounds like you just need to parse the responseText
>>
>>59165579
yeah I was going to have the individual comment component animate a bit when it got updated
>>
>have to learn all this shit just to max out at $100k a year unless you start your own company
>>
>>59147202
k guys... i learned some css and html, i know programming logic and i used C# when i was using unity. I got into javascript last week and i think im ready to start learning some back end stuff. Right now i created a web page for a pizzaria, and got a server that is running php. All i see is everyone talking about node.js and how its cool. Should i : learn PHP or just go for node JS ?
>>
>>59165673
i still dont know why everyone keeps creating classes "Like-this" in php, and not using camelCase like any normal person.
>>
>>59165324

ok i used json_encode to do it but its all in one long line how do i get it like that?
>>
>>59165977
by php i meant css
>>
>>59165956
stick with PHP for now, then move on to Django or Rails. don't touch Node unless you're forced to.
>>
>>59165929
what are you struggling with, anon?
>>
>>59156681
well there is the bootstrap page. just read it. if some functionality is fucking it up, use the inspect on your browser and look witch bootstrap class is fucking it up. After using bootstrap 4 im considering using something more lightweight. The grid is cool, the nav-bar is overused and the designers dont even use it anymore.
>>
>>59165529
editComment(comment) {
console.log(comment);

var data = this.state.data;

data.find((i) => i.id === comment.id).text = "sdfkj";

}

how about this
>>
>>59165995
ok bro. thanks.
>>
>>59156681
codeschool has a paid course on it. That's how I learned
>>
>>59165978
doesn't matter, line breaks are only there to make it human readable and the parsing code will work regardless
you can paste it into jsonlint.com tho
>>
>>59165078
>>59165165
>see 10 fucking lines of code
>Jesus Christ and God in heaven save me from this hell
I have nothing against frameworks, but that is just ridiculous.
>>
>>59166609
why does people need frameworks to do this kind of shit in the first place? its 10 lines. you dont need a fucking library for that. its like having to carry a fucking RPG to kill a spider.
>>
>>59166733

framework babbies dont want to program they want frameworks to do the heavy lifting for them
>>
Does anyone know of any good in-console tutorial systems for Ruby or Python? Something like nodeschool.io for nodejs.
>>
>>59166733
also promised based fetch api is now available in vanilla js to replace xmlhttprequests, so even less reasons to resort to a framework to handle such basic stuff
>>
>>59166871

i just started learning AJAX and been using xmlhttprequest. How are "promises" different? heard of them before but it sounds really gay

>muh promises
>>
>>59166609
It's like cutting down a tree with an ax when there's a perfectly good, free, oiled chainsaw laying right there. You're in a thread full of modern lumberjacks using bulldozers, chainsaws, modern machinery, at least a saw (jquery). And you look a little hipster coming in with you ax
>>
>>59166609
its best to learn the framework and then peek under the hood when you've grasped the basic idea of what you are trying to do to learn how it is done efficiently.

9 times out of 10 your learn that jquery is handling edge cases your shitty vanillajs would just choke to death on every fucking time.
>>
File: wewlads.png (40KB, 427x395px) Image search: [Google]
wewlads.png
40KB, 427x395px
>>59166934
I'm probably wrong but it seems like syntactic sugar to handle async execution and error handling without having to resort to a spaghetti plate of callback based event handling.

asyncThing1().then(function() {
return asyncThing2();
}).then(function() {
return asyncThing3();
}).catch(function(err) {
return asyncRecovery1();
}).then(function() {
return asyncThing4();
}, function(err) {
return asyncRecovery2();
}).catch(function(err) {
console.log("Don't worry about it");
}).then(function() {
console.log("All done!");
})
>>
>>59167191
yes they are composable, first-class objects you can chain without ugly nesting.
>>
>>59166164

for some reason this isnt working. I have my php page show the object. Cant seem to find a way to grab that data

function loadFirstRowData()
{
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
firstRow = JSON.parse(this.responseText);
document.getElementById("test").innerHTML = firstRow.dateEntered;
}
}
xmlhttp.open("GET", "loadFirstRowData.php", true);
xmlhttp.send();
}
>>
>>59166871
Not supported in ie11 and many other browsers
>>
>>59167361
ive never done with with php only node but your target url doesnt look right to me.

shouldn't it at least be
xmlhttp.open("GET", "loadFirstRowData.php/?q=", true);


i do all the routing myself in node so i have no idea what php does for you.

does the body of your loadfirstRowData.php start out like this?
<?php
$q = intval($_GET['q']);
>>
>>59167567

why cant i just GET from the php page? theres examples that do idk why mine doesnt work tho.
>>
>>59167400
IE11 is four years old, let go.

>and many other browsers
please list them, I can't seem to find any.

If you really need to support older browsers add polyfills and you'll be fine.
>>
>>59167361

1. Don't name the file loadfirstrowdata. Give it a speaking name.
2. Don't call it with .php/?q= but with .php?q=
3. Post is for uploading, get is for downloading.
>>
>>59167361
Make sure your request returns what you expect by opening the url in your browser or using curl or whatever.
Otherwise idk this might be a content type header problem, you can try this to set this before sending the request
xmlhttp.setRequestHeader("Content-type","application/json");
>>
>>59167772

i named it that because thats exactly what it does

so i cant just grab the object my .php file returns? i have to actually call the query through the URL? thats kinda gay
>>
>>59167837
didn't read anything you posted earlier

In general, passing data from Javascript to PHP can only happen via strings (bytes actually). That's what JSON is for. Just convert everything to JSON before sending it.
>>
>>59167906

yeah i am

i use json_encode() to turn the php data into json, now i want to GET that string with ajax and spit it out
>>
>>59167772
>3. Post is for uploading, get is for downloading.
Wrong.
>>
>>59167966
there are browser extensions / websites that help you debug http requests in case thats the part you assed up.
>>
If I update an item in the array that gets broken down into my individual comment components, do all the comments on screen re-render, or does only the changed item re-render? Is there a way so that I can merge in the change to the specific item, and only the comment component built from that item re-renders? this is react, everything stored in state obviously
>>
>>59168109
Why don't you try it out? And use shouldComponentUpdate to manage it if they do.
>>
File: requests.png (17KB, 1128x298px) Image search: [Google]
requests.png
17KB, 1128x298px
>>59167837
here's a schema
>>
What are cool stuff to build for a front end portfolio on Github? With React/Angular or Vue or any front end framework.
>>
>>59168281

im getting "undefined" after i try to get firstRow.name. Anyone know why?

function loadFirstRowData()
{
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
firstRow = this.responseText;
document.getElementById("test").innerHTML = firstRow.name;
}
}
xmlhttp.open("GET", "test.php", true);
xmlhttp.send();
}
>>
>>59169764

and if i go like this

            document.getElementById("test").innerHTML = this.responseText;



it works, but that displays the entire responeText as a string. I need it to be an object, right? when i tried JSON.parse(responseText) it didn't work. Nothing happens.
>>
>>59169764
>>59169902

NEVERMIND I FIGURED IT OUT HOLY FUCK IT WAS BECAUSE OF SOME I HAD BODY TAGS AND SHIT IN MY PHP FILE IT NEEDED TO LITERALLY JUST BE THE PHP CODE AND WHATEVER IT ECHOS OUT. YOU DONT HAVE TO WORRY ABOUT EXTRA TAGS THO IF YOUR GET REQUEST RUNS A QUERY THROUGH THE URL.

FINAL WORKING CODE:

function loadFirstRowData()
{
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
var firstRow = JSON.parse(this.responseText);
document.getElementById("test").innerHTML = firstRow.name;
}
}
xmlhttp.open("GET", "loadFirstRowData.php", true);
xmlhttp.send();
}



JUST WASTED HOURS TRYING TO FIGURE THAT OUT REEEEEEEEEEEE
>>
>>59170193
learn your developer tools, press F12 and it should have told you long long LONG time ago that it can't parse the response as JSON.
https://developers.google.com/web/tools/chrome-devtools/
>>
>>59170682

the only thing i was looking at when i opened dev tools up was it was telling me a 404 error to the server, didn't specifically say something wrong with the json parsing. Technically, it was parsing just fine......

random question, which is better? key notation or dor notation? does it matter?
>>
>>59167191
Unless you're going to call another promise with additional parameters or access variables inside the parent function scope, you don't need to write an inline function inside the then() argument if you're just returning another promise.

Instead you could just chain like this:

make_query(query)
.then(download_files)
.then(process_files)
.then(add_to_db)


I'd also go on to learning and using ES7 async/await though; it's much more clearer and easier to use.
>>
>>59171231
>I'd also go on to learning and using ES7
wtf i thought ES6 was the most recent supported version for some reason
do you have a link where spec releases are announced by any chance ?
>>
File: maxresdefault.jpg (33KB, 1200x900px) Image search: [Google]
maxresdefault.jpg
33KB, 1200x900px
in what way can you do web development for a living and not be a corporate nigger cattle slave?
>>
>>59169207
pls respond
>>
>>59172543
Devote yourself to implementing web assembly.
>>
File: 1487682857556.jpg (30KB, 544x471px) Image search: [Google]
1487682857556.jpg
30KB, 544x471px
Im kinda new to this and i dont wanna waste too much time learning the ins and outs of js
How much JavaScript do I need to know before starting to learn jQuery?Do you have to learn JavaScript for web developmen?
>>
I can't think of any other place to shill my new website and I need some feedback on what I can improve:
http://reen.co.de

It's a slightly more autistic youtube video downloader than what's out there right now and I was bored while waiting for something else to pop up.

>>59172725
You only really need to know the basics of JS (like up to functions and objects) to be able to use jQuery, but I recommend learning how to use pure JS first to get an idea on what jQuery actually does and does not do better.

And yes, you do need to know JS to get anywhere in WebDev, at least on the front-end side of things.
>>
>>59166609
no it really isn't.

i've seen and even written an entire "VanillaJS" single page front end before and I almost wanted to kill myself when I realized what I created.

it's not good.
that 10 lines of code becomes 100's of copy pasted spaghetti code literally everywhere throughout your app.
>>
Am i the only one who prefers

async on npm vs using promises?

async.waterfall feels so much cleaner.
>>
>>59172769
The web of trust extensin says your site is a scam. It probably isn't, but do you have any idea why this could happen?
>>
>>59172815
the fuck you on about m8?
>>
>>59172762
>http://reen.co.de
looks good, what frameworks did you use
?why you dont have an mp3 format?
>>
>>59172867
https://www.mywot.com/en/scorecard/reen.co.de
It's a browser extension that lets people rate websites based on how trustworthy they are, and it seems like some people gave your site a bad rating. The domain reen.co.de may have been owned by someone else in the past, and they may have ran a shady website, or someone may have just flagged you for no good reason.
>>
>>59173032
uh. not my site m8.

i think you replied to the wrong people.
>>
>>59172800
>Am i the only one who prefers async on npm vs using promises?
Yes

>async.waterfall feels so much cleaner
bluebird's .map, .mapSeries and .reduce methods can all accomplish the same (each with a slightly different syntax)
>>
I know the basics of HTML/CSS and finished the codecademy course on Javascript but it doesn't teach you how to actually use it for a website since it doesn't teach getElementById and anything else like that.
I don't know any back end language yet, but should I just start working on a website I have in mind and using google along the way, or should I just keep reading through documentation.
It feels kind of overwhelming with all this different shit you have to know.
>>
>>59173088
Oh, yeah, >>59172815 was meant to be a reply to >>59172762
>>
>>59173032
Yep, that's my site, not >>59173088
Thanks for the heads up though! Honestly, it's only been up less than a day so I would be shocked if anything's associated with it.

>>59172901
Use Django with Django_ajax module and some jQuery. It uses youtube-dl to download the stuff.
Also, you can download with .mp3 by clicking that Output Format's dropdown. I'm probably going to include a little triangle or arrow or something to better indicate that.
>>
>>59173150
Start doing shit using google AND reading documentation along with it. Don't try to get good at theory before you put it in practice because that's not what web development is about.

>It feels kind of overwhelming with all this different shit you have to know.
It is at first, until you specialize. For example, technically I'm a professional web developer but I don't touch JS or CSS. Don't fall for the full stack jew, just learn what interests you.
>>
>>59173291
>technically I'm a professional web developer but I don't touch JS or CSS.

care to elaborate on this? whenever i go to apply to stuff i kinda get intimidated by all the stuff they want you to know. is that all just a meme?
>>
>>59173552
Don't apply to generic webdev positions, search for specific keywords that matter to you (like a specific framework, a specific task, etc). If you think you can do the job, apply even if you don't meet all the requirements.

if you just search for "web dev job" you'll see "15 years experience in nodejs and cobol" listings.
>>
File: 1481559556552.jpg (174KB, 1054x1378px) Image search: [Google]
1481559556552.jpg
174KB, 1054x1378px
>>59173656
thanks anon. i just need to drop my fear of having to move i guess. i live in fucking ohio with a bunch of corn farmers and boomer trash.
>>
>>59173727
>i live in fucking ohio with a bunch of corn farmers and boomer trash.
so do I, i'm >>59173150
I'm a at least 45 minute job with any city with dev jobs, and from the remote job listing I've seen they all want full stack. Those were all startups on angel list though.
>>
>>59163294
jsfiddle pls?
>>
How far in should I be before I start applying for entry level positions?
>>
First day at first web dev job tomorrow.

Panic!
>>
>>59174862
What langues are you using aside from HTML/CSS and Javascript?
How much did you have in your portfolio?
>>
>>59173145
The thing is that while Promises for the most part prevent you from going in to callback hell, it is very easy to slip in to a form of 'Promise hell' in certain situations.

async/await fix these issues while having the same functionality as Promises under the hood.

Take for example this function that was recently rewritten. In the example I had to create inline functions because of the dependence of variables in the parent function that wouldn't otherwise get passed through a promise chain.

function process_report(reports) {

return new Promise(function(resolve, reject) {

var valid_reports = [];

Promise.mapSeries(reports, function(report) {

return get_charges(report.case.charges_uri).then(function(charges) {

return get_actor(report.actor.actor_uri).then(function(actor) {
var processed = process_report(report, charges, actor)
valid_reports = valid_reports.concat(processed.formatted);
// Add report to database
return add_reports_to_db(processed.mysql_reports)
}

}).catch(function(err) {
console.warn(err);
})
}).then(function() {
resolve({valid_reports, skipped_reports});
})

})
}


And here's the re-write to async/await

async function process_all_reports(reports) {

let valid_reports = [];

for (let report of reports) {

let charges = await get_charges(report.case.charges_uri);
let actor = await get_actor(report.actor.actor_uri);
let {formatted, mysql_reports} = process_report(report, charges, actor);

valid_reports = [...valid_reports, ...formatted];

// Add report to database
await add_reports_to_db(mysql_reports);
}

return valid_reports;
}
>>
How can I create a web service, where I can use CuRL to download something from said service, preferably with authentication.

Any pointing in the right direction would be appreciated.
>>
>>59175957
HTTP basic authentication would probably be the easiest way to implement something like you're describing.

You can host a NGINX, Apache or Node.js server that are configured to serve your files and have HTTP basic authentication as a way to only allow authenticated users access the files.

NGINX would probably be the easiest solution.
>>
>>59176118
>HTTP basic authentication
Thanks anon
>>
I just came across this in documentation while trying to implement a time series chart.

>a value of 0 will completely shut your piehole
I want to give a shout out to the technical writer or developer that documented that.
>>
Imagine you want to create a URL to your site and your site would load specific data from your backend for this special URL. How would you secure such a thing?
I would think you'd generate a secret token which you append to your usual sites URL and onLoad you'd be retrieving your data as referenced by given token. Thoughts?
>>
heres my dilemma:
>premium wordpress themes are botnet and bloated but easy to set up and launch
>cookie cutter themes do not look good on your portfolio
>making site from scratch using memestrap is too time consuming but lean if you make separate desktop version and mobile version

wat do
>>
how do you guys scaffold more organized way? trello? pseudo code in comments?
>>
>>59174960
PHP.

My portfolio is 1 really massive website and several smaller websites. Some useful APIs, a few little scripts. That's it.
>>
>>59177710
>Imagine you want to create a URL to your site and your site would load specific data from your backend for this special URL. How would you secure such a thing?
You want the client-side app to access data via an API?
Use the session to secure against the user.
If you mean that it should only be used by the app, you literally can't secure that. Any URL called by the browser can be manipulated/repeated by the user, the browser is under their control, not yours.

Look into PHP sessions and user management for more details, assuming you're using PHP.

>>59177893
>cookie cutter themes do not look good on your portfolio
Look harder, there are billions of themes, some of them look pretty good. Just look for more obscure ones that aren't instantly recognisable as being used on half the web.
>>
>>59178292
Well, yeah - session would be easy. In this case I'm getting data from a third party, which I persist and return a URL, afterwards user gets redirected to my site. This site should load data I've saved previously by calling my API and display it. I need to make sure that only someone who has my URL can access said data.
>>
File: Untitled Diagram.png (14KB, 379x211px) Image search: [Google]
Untitled Diagram.png
14KB, 379x211px
>>59178292
>>59178470
>>59177710
>>
>>59175625
I feel like the promise version can be severely simplified, but the other anon was talking about the async library, not ES6's async/await syntax
>>
Im trying to change an onclick to another function on the first click. However, js instantly runs the new onclick on the first click. I just want it to change the onclick so that it triggers the new function on the second click, but it triggers both functions on the first click, why???

PS: Im new and i suck at this

<div id='candy' onclick='pleaseHalp()'>Kill yourself</div>

function pleaseHalp(){
document.getElementById('candy').onclick = goFuckYourself();
}

function goFuckYourself(){
alert("You've got aids!");
}


On the first click it get "You've got aids" alert, but shouldnt it be on the SECOND click???
>>
>>59180215
<div id='candy' onclick='pleaseHalp()'>Kill yourself</div>

function pleaseHalp(){
document.getElementById('candy').onclick = goFuckYourself;
}

function goFuckYourself(){
alert("You've got aids!");
}


No parentheses when specifying a function directly in js.
>>
>>59180215
thats the most retarded shit i've ever seen
>>
File: 100% completion.png (560KB, 600x593px) Image search: [Google]
100% completion.png
560KB, 600x593px
Anyone got an example of what a GOOD but basic portfolio might look like?

I would like to get employed doing this shit.
>>
>>59170739
the only time I use key notation is when I need to dynamically change a property name I'm dealing with. For example I have a function that checks up to 3 slots in a chassis. I deal with them as this.something["chassisSlot" + $someNumber]

>>59172643
I had a friend who was an actor that needed a portfolio. I made it for him and his portfolio became a part of mine. Win-win. Although years later he wanted updates and I didn't have the time :P
Your own portfolio site can also be one.


>>59177919
What do you mean scaffold? Scale?
>>
>>59180215
> onclick
> The year of our emperor, MMXVII
>>
File: 1478663423564.jpg (38KB, 388x452px) Image search: [Google]
1478663423564.jpg
38KB, 388x452px
>>59174862
>>59177993
gl anon!
>>
>>59180648
m8 pls, some of us are at work. If you want professionals in here, you can't be posting nsfw things here
>>
What should I learn first Angular or Angular 2?

Also, does anyone know a good free course from 0 about the best option?
>>
>>59165995
Don't listen to this fucking idiot. If you're doing any kind of JavaScript, you need to learn node.
>>
So... I want to go into web development. I did a lot in java and Android development. The main reason to go into it is because I want to continue doing apps for Android and I read that doing it with JS its a good idea.

Im thinking in using MEAN stack, is it a good idea? Where should I begin with? Any full course about it?
>>
>>59180594
What should we be using instead?
>>
>>59180865
>angular 1 or 2
I work professionally with angular and angular 1 is the one I would recommend you learn between the two. Reasons being:
More jobs in 1.X market- https://www.indeed.com/jobtrends/q-angular-q-angular-2.html
and transitioning from a 1.X job to a 2 job is easy. I took a quick course on 2 and feel fairly confident I could be ramped up on an angular 2 project within a week. 80% of the skillset learned in 1 carries over to 2.

I first got started learning angular 1 with the free codeschool.com course. That's the best resource I've found
>>
>>59180993
Well your stack should be determined by your app idea. MEAN involves a non-relational database, that excludes a lot of app ideas. If you need a db with relationships (users), you're going to want a different stack
>>
>>59156681
Bootstrap 3 official documentation is pretty much retard proof, if you can't learn with it I'm afraid I can't help you.
>>
>>59180993
why don't you leverage your java skills into web development and learn spring
>>
>reading article
>scroll down
>strange ad scrolls by but no content.
>finally get to content
>scroll unresponsive and about to close page and reboot
>animated interstitial loads

Fuck this shit. I have a Galaxy S7 on 4G and your shit is loading so fucking slow.

These dickheads are finally going to get people pushed into adblock browsers on mobile and fuck it up everyone with minimal ads AGAIN.
More than half my revenue is from mobile. Ad servers to to impose limits and google needs to punish interstitials more.
>>
>>59182557
With how much control Google has over the internet, you'd think they'd have better standards
>>
File: 1280260389475.jpg (6KB, 126x126px) Image search: [Google]
1280260389475.jpg
6KB, 126x126px
Why did Github suddenly become more blue
>>
>>59180507

the reason im doing key notation is because some of the column names im working with in this shit database has # signs in them. Yeah its really gay. So i have to do it like this

data["id-#"]
>>
>>59183341
I didn't think of that, but that's another completely valid reason, yeah.
>>
how do i get my app to clear cache automatically? complete n00b to caching. Nver had to worry about it before...now that im using JS/AJAX i have to? feels bad man
>>
>>59183494
if it's just for development and you're using chrome, there's a setting in dev tools to disable caching while dev tools are open
https://www.technipages.com/google-chrome-how-to-completely-disable-cache
>>
>>59183623

yea im using that now, but will if have caching issuse when its live? i dont want users to have to clear their cache
>>
I'm playing around with Vue 2.x and I'm not exactly clear when the updated method of a component fires: it it only when the data/$data changes? Do props/$props changes not cause the component to be updated?
>>
>>59183650
You can do it with your html
http://stackoverflow.com/questions/1341089/using-meta-tags-to-turn-off-caching-in-all-browsers

or in your htaccess file
https://varvy.com/pagespeed/cache-control.html#htaccess

If you have a caching issue while it's live, you're kinda screwed because the browser won't get a fresh copy until the current copy hits its expiration date or until the user manually dumps their cache. A hacky manual way to do it assuming index.html isn't cached is to rename the files you want the client's browser to stop using cached versions of.
For example if app.js is cached I rename it to app1.js and link it in my index.html. User will get index and will fetch app1.js because it doesn't have it.
>>
  {
"id": 20604,
"name": "538NL",
"country": "NL",
"image": {
"url": "https://cdn.devality.com/station/20604/logo_radio538nl_640x300.jpg",
"thumb": {
"url": "https://cdn.devality.com/station/20604/thumb_logo_radio538nl_640x300.jpg"
}
},
"slug": "538nl",
"website": "http://www.538.nl/",
"twitter": "",
"facebook": "",
"total_listeners": 20,
"categories": [
{
"id": 45,
"title": "Variety",
"description": "Variety or various, playing more or less everything.",
"slug": "variety",
"ancestry": "44"
}
],
"streams": [
{
"stream": "http://vip-icecast.538.lw.triple-it.nl:80/WEB06_MP3",
"bitrate": 128,
"content_type": "audio/mpeg",
"listeners": 10,
"status": 1
}
],
"created_at": "2015-12-13T14:19:14+01:00",
"updated_at": "2015-12-13T14:23:50+01:00"
}

So how do I transform this,in this case, dummy data from an API into an actual radio stream?

Guess I should access the streams array and the stream property but honest to fuck no clue what to do with them, in which element embed them? Can't be quite as trivial as sticking it in the src of an audio element, can it?
>>
>>59184073
Try out answer #2 and report back.. I'm assuming you know how to plug in from that api with JS
http://stackoverflow.com/questions/16978301/html5-audio-livestreaming
>>
>>59184073
You don't need an element.
let stream = new Audio(data.streams[0].stream);
stream.volume = 0.5;
stream.play();


your stream url seems to be dead though.
>>
Are webforms completely dead or still worth it for enterpise development?
>>
>>59184782
I still have to maintain them at work and it's fucking awful.
Avoid them at all costs.
>>
>>59184806
I had to work with them a couple weeks at work. I'm not advanced enough in the back-end to tell the big difference between web forms and whatever the heck it is we use now. What are the draw-backs?
>>
>>59184832
posting back for everything.
anything dynamic is a pain in the butt because how databinding/validation works.
loads of shitty injected javascript for no good reasons.
fucking viewstates, I don't think that feature was useful at any point in time at all to me.
a huge mess because of mixing code and markup.

It's just outdated and doesn't work with todays web anymore.
>>
>>59147202
How can I make user authentication as simple as possible? I am using nodejs. I know there are libraries but are they safe to use? Should I just do my own authentication?
>>
Is it possible to animate views display in Laravel?
For example to fade in ? I was somewhat able to quickly hide them when they are retrieved from server and show them with animation but there is that moment when whole content is shown before i hide it with js which makes sense of couse its just i dont know how to apply style to a "not yet loaded" content.
>>
>>59185103
reinventing the weel in auth, especially if you are a beginner is death warrant
use the fucking OAuth
>>
>>59183494
There is a way with js to refresh the page if they hit back. Thats all ive ever needed.
>>
>>59184073
put stream url in html audio tag
>>
File: bitcoin_logo_256x256.png (13KB, 256x256px) Image search: [Google]
bitcoin_logo_256x256.png
13KB, 256x256px
New to payment processing, wondering if there's a way to go through paypal and bitcoin processing services, and then when payment has gone through and paypal makes a callback send the user a email with customized information, in this case, an API key. I can imagine how I would make a basic implementation of this in PHP, but I'd love somewhere to reference.
>>
>>59186559
never done payment processing myself but you might be interested in this
https://vc.gg/blog/how-to-accept-bitcoin-payments-with-electrum.html
>>
ive come to realize it literally doesnt matter which back end you use. As long as the server doesnt suck. Python, php, etc etc all query stuff pretty much the same way and time.
>>
>>59186952

i guess the main difference is to use SQL or NoSql, Mongodb, etc
>>
Well its time for me to pick a framework for JS, dunno which to pick.

Vue, angular, or ember /g/entlemen?
>>
>>59187359
Vue
>>
>>59187359
I've recently switched to Vue after writing Angular 1.x for a long time and I don't miss it in the slightest
There are a few things you have to keep in mind when writing Vue apps (like being mindful of what properties have been mutated by Vue so you don't accidentally overwrite them and lose reactivity), but overall I've found that using Vue leads to better and more self-contained code (and also better performances)
>>
>>59187431
>>59187467
Hmmm. I know just browsing through job listings it seems Angular has the most traction right now.

Ive heard a lot of people talking about vue but not really seen many listings for it. Do you think that's because it's so new? Think it will start taking off?
>>
>>59187730
Angular and Vue share many traits, you could start with one and then eventually switch to the other. The learning curve for the one you pick up second will be a lot smoother.
Which one you want to start with depends on you, go for Angular if you feel like it'll get you more jobs.
Angular is more carefree and lets you write pretty much whatever you want to write, which generally leads to terrible code unless you already have some experience with the framework and have a general idea on how you want to structure your app and the flow of its data. Vue is more opinionated and tries to force you to follow certain (good) conventions (eg how it handles component and directive definitions) so you don't write too much dumb shit (you can still do dumb shit with it, though)
>>
Is there money in making .io games?
>>
>>59187888
Ah I see. Thanks for writing that up man. ppreciate it
>>
>>59152759
Did you set the correct response headers ?
>>
File: dhjdyj5.jpg (44KB, 451x392px) Image search: [Google]
dhjdyj5.jpg
44KB, 451x392px
>the browser refreshes during the use of his web app
>>
>>59187965

no what does that do? i figured it out by just calling multiple ajax calls, i still didn't do anything with response headers. It works. Do i still need them? what is it
>>
https://learnbchs.org/

Is this a meme?
>>
Why do npm modules contain all that shit ?
Why aren't they compiled into single files ?
Why does babel-preset-stage-0 weight so fucking much ?
>>
>>59188062
>https://learnbchs.org/

SQLite is good, C is good obviously, https is just the protocol, idk what BSD is

sounds decent. Try it out?
>>
>>59188019
Most libraries use response headers to understand what kind of input they're receiving (plain text,json,xml), if none is provided plain text is assumed.

Otherwise you have to specify what input you're expecting, e.g: on jQuery you can use
dataType: 'json'
to specify you're expecting a json input
>>
>>59163321
>>59163456
>>59164815
thanks faam
>>
>>59188019

what im doing is just JSON.parse(responeText) on some .php files that echo out results via JSON_encode()

does that sound right? it works lol
>>
>>59188258

meant to quote
>>59188166
>>
>>59188258
That works, but you're adding an extra step jQuery or whatever framework you're using could take care of for you.

Well, unless you're handling raw XMLHttpRequest, then you can do as you wish.
>>
>>59188327

ya im doing everything vanilla. I dont want extra milliseconds of load time
>>
>>59184668
I do, only problem now is the API is not allowing me access even though I have a token which means I'm probably doing something wrong. Thanks for the SO link though.

>>59184754
Totally forgot about the Audio object, thanks a lot.
>>
Has anyone used https://developer.mozilla.org/en-US/ to learn web stuff? How is it?
>>
>>59189333

ya but i prefer official docs or w3schools
>>
Been going through freecodecamp and have reached the first set of actual projects.

What do you guys use to host your files while you test?
I know I could just run it locally but I'd rather do it 'properly' now so that when I learn the back end stuff I don't need to completely change my work flow.
>>
File: whyy.png (12KB, 609x195px) Image search: [Google]
whyy.png
12KB, 609x195px
So I'm using chrome Postman to send a GET request to an API. Can't use an XMLHttp request from a script because of access control issues.

After copying the contents of Postmans GET request (valid json) to a .json file I'm trying to fetch that and format it into a JS object with the .json() fetch api function but guess I'm fucking up somewhere. Not sure where though?
>>
>>59189559
>w3schools
This has been what I was using for html and about to move onto CSS. I will stick with w3 then
>>
>playing around with Chart.js, trying to create a simple sparse line chart with 3 (three) points
>as soon as the chart is created everything freezes
>turns out the library doesn't correctly parse time on the x axis and instead of plotting just 3 points it tries to plot a point for every millisecond between the first and the last point
>no check on the maximum number of points that should be created so it just goes ahead and tries to plot 170 million fucking
points
This is why we can't have nice things
>>
>>59190704
use d3 you pleb
>>
>jQuery-Ui doesnt support mobile browsers and touch events.
then why the fuck is this still a thing? it is preferred at my work i can use either this or wordpress. what in the fuck seriously?
>>
Is there a security vulnerability doing
element.setAttribute("class", remoteUserControlled);

I'm using a css spritesheet so the class corresponds to a sprite.

Is this insecure? If so, is there a way to make it secure without hardcoding every possible valid input?
>>
>>59192826
>>59192826
>>59192826
NEW THREAD
>>
Also it's required I tie my email to my phone.

The email goes through google smtp and I'm afraid they will see my other gmail addresses which are tied to my youtube channel, twitter, and literally every identity. Would google show them that?
Thread posts: 313
Thread images: 27


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.