[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 Dev General - Put on your programming socks edition

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: 332
Thread images: 37

trying out updated OP from two threads ago
improvements welcome

>old thread
>>60711471

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

>Getting started
Get a good understanding of HTML, CSS and JavaScript.
Everything you learn will have these as their base.
The Mozilla Developer Network offers a good intro (no matter your browser choice)
https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web

>Online courses
https://www.codecademy.com/
https://www.freecodecamp.com/
https://www.bento.io/

>Further reading/viewing
https://www.youtube.com/watch?v=sBzRwzY7G-k [Embed]
https://github.com/kamranahmedse/developer-roadmap
https://github.com/dypsilon/frontend-dev-bookmarks
https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md

>Code challenges
https://www.codewars.com/
https://www.hackerrank.com/
https://codefights.com/

>Useful tools
https://developer.mozilla.org/en-US/docs/Web - Guides for HTML, CSS, JS, Web APIs & more.
https://libraries.io/ - Discover new open source libraries, modules and frameworks and keep track of ones you depend upon.
http://www.programmableweb.com/ - List of public APIs
https://caniuse.com/ - Check browser support for front-end web technologies

>Useful Youtube channels
derekbanas
learncodeacademy
funfunfunction
computerphile
coding train

>cheap vps hosting in most western locations
https://www.digitalocean.com/
https://www.vultr.com/
https://www.linode.com/
https://www.scaleway.com/
https://www.heroku.com/
https://lowendbox.com

I'm not really gay though, I just like feminine penis
>>
>>60755444
>I'm not really gay though, I just like feminine penis
cancer
>>
Just bought Codeacademy Pro ayyyyy
>>
Azure or AWS?
>>
What's the cheapest website hosting available?
>>
>>60755927
Heroku free
>>
>>60755896
aws, azure is trash
>>
>>60755974
Why?
>>
I am getting a better handle on javascript and I want to move on. Which library should i learn? Everyone says Jquery is outdated but it seems to have the most content about it.
>>
>>60756133
You don't need a library, use modern js and you get most of what jQuery offers.
>>
so the Procfile in my heroku webb is

java -jar target/myApp.jar

and it runs fine, but when i want to try to locally run using the same command it says mainclass is not found??

i already have defined

<manifest><mainclass>myApp<mainclass><manifest>

in the pom.xml
>>
>>60756133
I'm on the same train. After much thought I've decided to learn jquery well before moving to the cool 1000 different frameworks that are created everyday, I think it's more practical from a learning perspective.
>>
>>60755998
If you're backend is .NET Azure is pretty good otherwise AWS
>>
>>60756234
so just continue using vanilla JS?
>>
>>60755697
what a waste of money lmao
>>
Sorry /g/uys, noob question here:

For a school project we're building a simple recipe website with Java EE.

What I'm trying to implement now is the following:

1. Entering a searchstring into a search field in the nav bar
2. Making request to servlet, saving the string in session scope (or elsewhere?), forwarding to a JSP with the frame of the Search-page, returning the response to user
3. On loading (DOMContentLoaded) make an AJAX request to a servlet that makes the SQL query and returns the result in some form (another JSP?)
4. Result is inserted in Html-div

I've been trying for a while, but haven't been able to do this. Am I thinking this right, or is there another/better way?
>>
>>60756436
Avoid using server side sessions.
Avoid using frames.

Any reason you have these sidesteps?
You could send your search request over ajax directly instead of going over 2 other pages.
>>
>>60756463
Thank you for quick response.

The website is not a SPA, so I have to go via the Server and load the next page. To minimize the waiting times I wanted to make the database query asynchronous and haven't found a better way to do this. Am I overlooking something?
>>
>>60756244
Had the same issue writing a DropWizard app
>>
>>60756562
Why do you have to go via the server?
I've made several non SPA pages at work and still don't let the server render every single page if it just queries data.
Which you already planned to do in step 3.

Your method would work, it's just an antiquated method and makes it hard to use the back navigation in the users browser.
And using a server side session could either make it hard to use a second window/tab at the same time or, when saving it non user specific, pollute your session storage pretty quick.
>>
I need to set permissions for users, so can someone help me
I have table1 and table2.
Table1 is normal users
Table2 is admin/mod users
>They need to be in 2 separate tables, cant have them in one table and just add field like 'level' and use that to determine permissions
Table2 users should be able to add new users into table1 and table2
table1 should be able only to login, not to register

How should i set permission, how do i check on login if user is normal od mod/admin?

Should i just search for user in table1 and if it is not found, search for it in table2?
>>
>>60756833
1. Learn Database normalization
2. Learn Joins
>>
Going to do an internship in a Symphony box. Is it comfy anons? I only have experience with vanilla MVC php.
>>
holy fucking shit just to print hello world with spring requires so much fucking work

am i just retarded or its not worth it? i am not looking into being a web developer i just want to put a search function, set up a database then process the input with java or c++
>>
>>60757085
Avoid Java, it's cancer and no one seriously uses it for web dev
>>
>>60757162

hmm really? it does look redundantly tedious for what it actually does (trying to understand how the fuck they handle redirect requests)

what is your suggestion then? i just want to get a website up and running, i want to work on my search algorithm more than anything.
>>
>>60757162
Remember always do the exact opposite of what /g/ tells you to do, there is a reason why they are here and not at a job working.
>>
>>60757175
What languages do you know?

PHP - Laravel
Ruby - Ruby on Rails
Python - Flask or Django

And what ever JS framework people use on the back end nowadays
>>
>>60757175
why do you need a website to work on a search algo?
>>
hey guys, I'm making a stock managing site just to practice CRUD and webshit. What features/functionality should I put in there? I have the basic, buy/sell apps, quote live prices, see your stock history and that sort of thing. What other cool features could I add?

Btw, I'm mostly focusing on backend, but any ideas for cool frontend features are welcome.

Using Python + Django, just in case anyone's curious.
>>
>>60757213

part of it is just for resume, i want a working example
>>
I'm reading this.
https://developer.mozilla.org/en/docs/Web/JavaScript/EventLoop

How do asynchronous callbacks or time delays fit into this model? Do they just add an event to the queue when they fire?
>>
>>60757309
If you want to do frontend stuff you can implement different types of charts, technical indicators (moving average, boilinger bands, etc.).

For the backend: How about some portfolio management? Obviously simple: What you bought at what price, the development, etc. You can do some risk measures, correlations between securities
>>
>>60757478
Did you work with a boilerplate? If not, search for spring + boilerplate, download and enjoy
>>
>>60757610

i dont even know whats boilerplate is ;..;
>>
>>60757625
>i dont even know whats boilerplate is ;..;

it's all the clutter and shit you have to write just to get your code to run, stuff that is usually copy+pasted, or that already comes in written for you in a nice framework.

It's the standard, ordinary code that every program has to have, not the particular stuff you write in to make your app different from the others.
>>
File: 1493407252042.jpg (1MB, 3888x2592px) Image search: [Google]
1493407252042.jpg
1MB, 3888x2592px
anyone else use base vanilla languages? fuck all these frameworks. I'll use a lib if I get lazy but thats it
>>
>>60757846
Why though? Is what you're doing really special snowflake enough that existing frameworks offer no benefits?
>>
File: william3.jpg (221KB, 560x510px) Image search: [Google]
william3.jpg
221KB, 560x510px
>>60755444
So I got my node server to serve me the html form, now how do I get it back and store it into my sqlite db? A lot of googling shows mentions of using body parser but a lot of the examples are confusing.
>>
>>60757873
https://github.com/expressjs/body-parser
RTFM :3
>>
>>60757873

why do you need node to do db stuff?
>>
>>60756272
use what's appropriate for the task
most of the time unless you're building a big application, jquery/vanilla will do the job

if you need a backend js framework, use node and express

if you need a front-end view framework, choose one of the big four right now:
Angular: https://angularjs.org/
React: https://facebook.github.io/react/
Vue: http://vuejs.org/
Polymer: https://www.polymer-project.org/

they're all different ways of thinking, and in my experience, react and vue are very easy to pick up and just get working with, as they're just libraries. angular is much more structured and will take a bit more time to get going with. no polymer experience, but from what I understand, it's more akin to react and vue, and gaining traction.
consider these sites which will help you compare them via actual applications:
http://todomvc.com/
https://hnpwa.com/
>>
>>60757873
var bodyParser = require('body-parser');

var app = express()
app.use(bodyParser.json());


app.post('/niggers', (req, res) => {

req.body is object with fields from form set

});
>>
>>60757846
That's kind of why I liked learning Node. The server exists inside the runtime, so you can manage a whole server, at a pretty low level, inside one javascript file.

I would probably use a framework like express for things of a larger scale, but it was cool to do everything at a low level, and I learned a lot about HTTP and low level server stuff.
>>
>>60755444
Where should I buy a domain name?
>>
>>60757085
Use spring boot you retard
>>
>>60758001
>if you need a backend js
>backend
>in fucking js
If you are this committed to use the absolute worst tool for the job you might as well code it in CSS while sitting on a vertical stick.
>>
>>60758630
namecheap
>>
>>60758727
thank u anon
>>
>>60758720
why is /wdg/ always full of idiots arguing about dumb shit? the language doesnt fucking matter. go back to your containment thread >>>/dpt/
>>
>>60758727
>>60758630
Also, does it really matter what the .extension is?
>>
>>60758630
I bought my last domain name through AWS route 53, since I was hosting on S3 anyway and it was the easiest thing to do. I pay $12 per year, plus a monthly $0.50 for their DNS hosting.
>>
>>60758771
Generally .com is the most recognizable as a URL for most people. It's also one of the cheaper options (assuming you're registering, and not buying one secondhand).

Country code top level domains are also somewhat common, but they vary in price. Some of them are used just for alternate meanings of their initials, like .tv, .io, .gg, etc.

There are a ton of other domains as well, if you want something cool like .ninja or .dog

Here's a list of all of them:
https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
>>
>>60758752
Its not the language (although js is utter crap but ES2016 is passable).
Its the single-threaded model, the inferior performance and the lack of scalability.
>>
>>60758907
Please research before you spew shit. Thanks
>>
>>60758988
Please enlighten us on the advantages of node backends vs any multithreaded language.
With node at most you can get multiple processes, but then you need IPC to communicate among them.
Node is the absolute worst choice, only useful for hello worlds.
>>
File: G7UWo.gif (64KB, 350x360px) Image search: [Google]
G7UWo.gif
64KB, 350x360px
Is PHP dying?
Can you become a self-sustaining freelancer nowadays, without learning it?
(I have no interest dealing with Worpdress unless it can't be avoided really)
>>
>>60760461

no? php7 is great. Some cloud services are written in PHP

dont let JS memes fool you.
>>
can someone give nice PDO examples tutorials
everything i saw is just stupid written
I want to see how querys work, how do i write them
bindparam and shit
>>
>>60761184
Just use mysql_query("SELECT * FROM users WHERE id = ". $_GET['id']);
>>
>>60755927
GitHub pages.
>>
>>60761226
no
>>
>>60761226

stop posting old shitty php code

no wonder php has a bad rep

>>60761184

i just used this and stackoverflow
https://phpdelusions.net/pdo

you definitely want to use PDO though.
>>
>>60761184
What don't you like about the official docs?

<?php
/* Execute a prepared statement by passing an array of values */
$sql = 'SELECT name, colour, calories
FROM fruit
WHERE calories < :calories AND colour = :colour';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
$red = $sth->fetchAll();
$sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
$yellow = $sth->fetchAll();
?>
>>
What alternatives do I have to nodejs server backend?

It's the only one I've ever used, and it's worked for me, but a lot of people seem to dislike it, so I'm wondering what is better?

Specifically I've been using nodejs + express combo for dynamic web pages.

What to use?
>>
>>60761561
.net core
>>
>>60761579

shoo poo in loo, shoo!
>>
>>60761645
.net is good, java is the main language of pajeets.
They and their fucking annoying "dabeedoo" accent.
>>
>>60757162
Except serious businesses like Fortune 500 companies.
>>
whats the equivalent to npm with other backends like .Net?
I also only ever used Node and npm is an amazing asset.

>>60763013
That's like arguing that COBOL is great, because it's used by a lot of banks.
>>
>>60763260
nuget for .net, composer for php
>>
File: 1487909369871.jpg (30KB, 370x431px) Image search: [Google]
1487909369871.jpg
30KB, 370x431px
Just applied for some jobs. Looking to bump my salary up by 50% and move away from Magento into some JS framework business.

Tell me it's all going to go smoothly and work out, /wdg/.
>>
How the fuck are you supposed to name stuff in a SQL database?
Say I have a table called """"people""""
How do I name the columns?
Do I prefix everything with person_ ?
If I don't prefix then it gets confusing when I JOIN
>>
>>60764796

https://www.w3schools.com/sql/default.asp
>>
>>60764796
table: person
id
name
age
sex

select * from person p
inner join family f on f.id_person = p.id
>>
>>60764859
That makes it confusing when you JOIN tho. You have one giant object with a bunch of fields. What if family had a column called name?
>>
>>60764990
person.name vs family.name
>>
>>60765018
how do I get it to do that?
>>
>>60761561
.NET, Java, Go are great.
>>
>>60765088
It does that automatically, you can just prefix the table name
>>
>>60765114
postgres isnt doing that
>>
>>60763260
Some of the most reliable stuff is written in Cobol.
>>
>>60765145
Just tested it on Postgres with some random data. Works fine: http://sqlfiddle.com/#!15/fbe5ef/1
>>
>>60765327
so it returns 2 name columns. What lets you do person.name and family.name?
>>
>>60765422
You can rename them with AS if you want

SELECT employees.name AS "employee name", department.name AS "department name" 
FROM employees JOIN department ON employees.dept = department.id;
>>
>>60764990
select p.name as person_name, f.name as family_name
from person p
inner join family f on f.id_person = p.id
>>
File: kodeWithKarli.png (1MB, 960x1018px) Image search: [Google]
kodeWithKarli.png
1MB, 960x1018px
so I've been learning React, made a couple trivial single-page apps, but I'm noticing you can only do so much without saving info longterm... which I think means I need to learn about databases.

what should I learn? I see firebase, redux, node, express, mysql, mongoDB when Googling about working with React and databases.

anyone know of good tutorials for someone in my position or want to recommend something?
>>
So what is the difference between <div> and <span>? When is best to use each tags?
>>
How do I learn web dev?
>>
>>60766197
This makes me sick for so many reasons. Like that new fucking university of phoenix commercial.
>>
>>60766210

you can think of divs as logical chunks of code, while spans are used when you want to isolate some small bit of code that doesn't belong, on its own, neatly in anything else. like a navigation bar as a whole could be a div, and each post on this page is probably a div, the footer section is probably a div. a span would be if you just wanted to do something to one sentence of a <p>aragraph or something like that. since that one sentence within a paragraph doesn't have tags surrounding just the sentence itself, you need to find a way to surround it. so you add span tags. hope that made sense. you will see/use divs a ton and spans not nearly as often.
>>
>>60766307

do you have any reason for learning web dev or specific goal in mind?
>>
>>60766474
Well I'm majoring in comp sci and want to learn before interning. I'm trying to learn node js along with the mern stack because someone suggested and it looks good
>>
Alright just before I embarrass myself when I ask my question about the issue I am currently facing, please can someone reveal how to post code on 4chan, if it is not even presented in a neat box automatically
>>
>>60766210
Div is block element, span is inline.
>>
>>60766600
[ code ]
// code goes here
[ /code ]

without the spaces next to the brackets

will look like this:
// code goes here
>>
File: website.png (15KB, 1365x153px) Image search: [Google]
website.png
15KB, 1365x153px
>>60766646
Thanks m8, you're a star

So this is the header section of my website so far, serving as an online portfolio. The menu part (which says "Hello" currently) will house the links to what I have been working on, while the text part (which is beneath and says "opkdsad" currently) will serve as an introductory paragraph to myself and what I do and how I can make the viewer of the website (a potential client) really happy with my skills in web development.

I am new to web development presently. Let me list out how this page is formatted so far.

It is entirely wrapped up in one <div>, id "wrapper". No style values except for "width: 100%".
Menu part (in pic: "Hello") is a <div>:
#menu {
max-width: 30%;
background-color: rgba(255, 255, 255, 0.1);
border-right: 1px solid #000000;
border-bottom: 1px solid #000000;
padding: 2px 0px 0px 5px;
}

Text part ("opkdsad") is another <div>, with style value "max-width: 70%".

I want the text part to 'wrap' around the menu part - so it starts out positioned beside the menu and then, as the menu section ends, the text part returns to its natural place at the far-left side of the page.

Any help would be much appreciated, /wdg/.
>>
File: BB 51203.png (358KB, 713x403px) Image search: [Google]
BB 51203.png
358KB, 713x403px
>>60755444
When you apply for an entry level position, how good are you expected to be?

My fear is that because I only know the basics of front end(HTML/CSS/JS/jquery/boostrap) and back end(mainly node with some mysql) if I get a entry level gig somewhere that they'll throw a bunch of stuff I'm not familiar with at me without a safety net. I have a willingness to learn and I know I'm a hard worker but I don't know how much that will matter to them.

Anyone wanna tell me their personal experience with starting out?
>>
>>60767221

you'll be fine.
>>
File: hyperloop.rb.png (9KB, 179x179px) Image search: [Google]
hyperloop.rb.png
9KB, 179x179px
who /hyperloop/ here?
>>
File: P6Hvu5M.jpg (82KB, 807x537px) Image search: [Google]
P6Hvu5M.jpg
82KB, 807x537px
>>60767329
t-thank you
>>
>>60755697

Did that too, and regret it. Would recommend getting the most out of this month and maybe changing to codeschool or egghead.io or treehouse
>>
>>60764706

The work shouldn't be too hard, you will do well! Godspeed, anon!
>>
File: front-end.gif (967KB, 270x252px) Image search: [Google]
front-end.gif
967KB, 270x252px
>>60755697
Ya'll niggas need some Pluralsight in your life
>>
Do you use clean urls when you are building your project from the ground?
>php
>>
>>60757507
asynchronous callbacks & delays (a delay is another type of async CB) get added to the queue when their asynchronous process calls them. The queue then waits until the stack is empty before it starts executing. Try playing around with setTimeout and console.log and you'll get a better idea of the order of execution
>>
>>60755444
I don't see Perl in there. Where's the inclusion for devs stuck in the 90's?
>>
File: 1491712124143.jpg (10KB, 250x250px) Image search: [Google]
1491712124143.jpg
10KB, 250x250px
is there a good source of basic (static) CSS templates/themes for a single page text-oriented website?
>>
>>60755974
This. I literally doubled a clients database performance by moving it from azure to was even though their application is still hosted on azure.

>>60757193
Laravel is shit. Check out Phalcon. You will actually learn to be a better PHP dev and it's 5x as fast.
>>
>>60767221
As long as you don't lie about your skill level, they must think you have what it takes or they wouldn't offer you the job.
>>
I just assume all Indian recruiters are trying to steal my resume in an attempt to work remotely as me.

Yes they need to do a phone interview.
>get accepted pajeet takes my job
Sorry they didnt accept you.
>>
>>60767221
Every entry-level person usually has one really strong skill.

One guy will know the language very well, one will know another language really well that is sometimes used, another will know linux really well, another will be able to write huge queries that are awesome.

It usually divides up like that.

They don't really expect newbies to know too much since how could they? As long as you have some working examples and can answer a few retarded questions about arrays then you're good to go.
>>
>>60767991
>tfw your resume is garbage so you don't need to worry about anyone stealing it.
>>
>>60767991
>all Indian recruiters

redundant. all recruiters are Indian :)
>>
>>60768946
literally this

im a junior dev and the pajeets wont stop calling my cell number
>>
so what exactly are you supposed to do to learn programming? do i just build websites over and over?
>>
>>60769264
>do i just build websites over and over?

yeah, with increasing complexity. that should work.
>>
>>60769066
same here.

I don't know why companies recruit through these people.

Actually I got requested to send info for a senior-dev postion in the same town where I currently work.

Funny thing is it's the only place there that does development.
>>
File: newWdgOp.png (2MB, 1079x719px) Image search: [Google]
newWdgOp.png
2MB, 1079x719px
>>60767821
templated.co senpai
>>
>>60766197
mongodb is fun and flexible but you can skip it because its become sort of a 1 trick pony. redis would be more practical since it does nosql and is faster and does sql.
>>
>>60769264
If you have to ask this question programming is seriously not for you.

I'm being 100% serious here too. Pick new hobby/profession before you sink too much time into something you clearly will never have a passion for.
>>
>>60769767
thanks im taking you're advice because you sound smart.
>>
I'm new to learning SQL.


Is there a way to automate the INSERT process for inserting new rows? Can I use SQL to take data from somewhere else and insert it into a table? or do I need to use PHP or another language to do that? I have all these ideas of cool shit I can do with SQL, like creating tables of stats for cool weapons and shit.
>>
>>60769767
Passion? That meme not outplayed yet?
>>
Hi, guys.
I'm learning websockets and now i'm trying to make a simple chat from socket.io tutorial. They used jQuery for this, but i don't love jQuery so i writing it on vanilla javascript. Look at my stupid problem please:

Code from tutorial:
$(function () {
var socket = io();
$('form').submit(function(){
socket.emit('chat message', $('#m').val());
$('#m').val('');
return false;
});
});


My equivalent:
;(function () {
'use strict';

let socket = io();
let inputForm = document.getElementsByTagName('form').submit(() => {
let currentMessage = document.getElementById('m').value;
socket.emit('chat message', currentMessage);
document.getElementById('m').value = '';
return false;
});

})();


Is this right? All here is seems good, but i'm not sure about "return false". What is that mean?
>>
>>60771266
I think that's a thing with HTML forms. By default, the submit action will launch a POST request using the data from the fields in the form. The way to override this is to return false from that submit method.

You don't want to do a full HTTP request, since you're handling the transfer of data yourself using websockets.
>>
>>60767544
This
>>
whats a dank website for web devs that showcase cutting edge resources and frameworks? looking at something along the lines of producthunt but for web devs
>>
>>60770444
Automate? And yes. Sounds like RTFM.
>>
Hey guys, I started learning node.js last week, it's a bit challenging but I'm doing alright. My only question is, when am I supposed to take the buttplug out of my ass? Can't seem to find that in any tutorial...
>>
>>60772744
What have you been working on and what have you finished? Just wondering.
>>
I need to start learning laravel because of reasons.
Where to begin?
>>
File: awoo.jpg (79KB, 680x785px) Image search: [Google]
awoo.jpg
79KB, 680x785px
Guys I did a thing!

http://foxpawentertainment.com/

Please congratulate me as this was not easy for me to do.
>>
>>60772441
hackernews?
>>
>>60773724

how did you host the website anon
>>
File: Untitled.png (13KB, 376x346px) Image search: [Google]
Untitled.png
13KB, 376x346px
>>60774540
Via a DigitalOcean droplet and a DNS entry I bought for two years.
>>
Do you use the '*' selector in your main CSS file, /wdg/? Codecademy is saying that I should, but I dunno...
>>
File: 1489759599780.gif (237KB, 496x600px) Image search: [Google]
1489759599780.gif
237KB, 496x600px
>>60773724
what did you do?

it's a near empty webpage
>>
>>60774835
A whole bunch of geeky nerd stuff! I had to set a DNS record, install apache and PHP and then I had to transfer my images to the web server and stuff!
>>
>>60774894
Sounds fantastic. You could have told us you did a whole bunch of back-end work ya dingus. It looks very simple in front-end.
>>
>>60774719
It's saying you should use it for what? I only use it to set everything to box-sizing: border-box
>>
>>60774894
congrats anon

I suggest setting up fail2ban if you haven't already, I get multiple attempts to login as admin a day, mostly coming from singapore and nearby
>>
File: Untitled.png (1KB, 386x32px) Image search: [Google]
Untitled.png
1KB, 386x32px
>>60775042
Do I need to do that even if I use this thing?
>>
>>60775019
margin: 0; padding: 0

I'm just wondering whether it is better to put those declarations into the body selector instead
>>
>>60775123
No you shouldn't do that. ul/ol and other various default tags have margins and paddings for a reason. This is why we moved from a reset css to normalize. You want sane defaults not everything zeroed out.
>>
>>60774894
>apache and PHP
Now try again with nginx and per-user PHP-FPM: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04
>>
What's the best image format for transparency? JPG doesn't permit transparency, WEBP doesn't work on Firefox and PNG/SVG are bloated.
>>
>>60775317
Why?
>>
>>60766197
do learn react with redux
don't bother with firebase, mongo
for a good first db, learn postgres or mysql
>>
>>60775621
PNG
>>
>>60775764
>for a good first db, learn postgres or mysql

MySQL and MariaDB are basically the same db (developed by the same people, only MySQL was sold to Oracle so the guy started his own thing again), you learn one and you know the other one. So learning just MySQL gets you +75% of the market share. If you're trying to become employable, I think the choice is clear.
>>
File: db-share-20141.png (10KB, 835x352px) Image search: [Google]
db-share-20141.png
10KB, 835x352px
>>60775841
forgot the pic
>>
>>60775638
Because nginx is much more flexible and has higher performance which has lead it to replace Apache as an industry standard.

Removing PHP from the webserver itself has also been a very important innovation, so PHP-FPM.

By setting php-fpm and nginx with per-user accounts you can completely isolate sites from each other, even if one site is totally compromised it is running as a different user.

I tell you to do this because you want to learn, this is the best practice, what you've done was best practice in 2008.
>>
File: 1496508856050.png (233KB, 500x544px) Image search: [Google]
1496508856050.png
233KB, 500x544px
Hey,

How do you call that functionality where you can sticky scroll to full-page-size blocks?

E.g. this trash: http://zebre.thememove.com/portfolio-layouts-presentation-2/

I can't seem to find any clues in the source code because I'm an idiot.

Thanks again in advance - one love
>>
>>60767544
>Pluralsight
The shit is free for 3 months and has an insanely large selection of topics which is regularly updated with new stuff.
I have no idea why would anyone waste their money on old shit that can be found elsewhere instead of just using the three free months of Pluralsight to learn almost anything to an "employable" level.
>>
>>60776021
Nevermind - I found the culprit between the 5000 javascript resources: http://www.thepetedesign.com/demos/onepage_scroll_demo.html
>>
>>60773724
Anon, can you explain to me, why a page that only has a single fucking logo on it uses a 3rd-party .css on top of your own?
>>
File: Discord_2017-06-06_20-48-33.png (75KB, 601x669px) Image search: [Google]
Discord_2017-06-06_20-48-33.png
75KB, 601x669px
This is the type of people we've got here on the /wdg/ discord server.
>>
>>60766922
Not sure I understand what you want, but I think it's something like that: https://jsfiddle.net/9f4xg5mc/

There are other ways to do the same, but that's simple enough I guess
>>
hello, newbie java-spark web dev here how do i redirect after a post call? in the example they manually render the page. im sure this is bad practice?
>>
>>60775123
they're better in the body
>>
File: codecademy.png (52KB, 968x523px) Image search: [Google]
codecademy.png
52KB, 968x523px
Never have I endured more autistic shit than this
>>
>>60776546
brought it upon yourself with pro
>>
>>60776368
I don't work with java frameworks - only Rails, but generally speaking, POST requests aren't supposed to redirect you anywhere on their own.
If you're doing POST request via ajax, redirection can be handled by the very script that makes the post request.
Manually posting via a link/form requires handling in the controller action - be it rendering or redirecting.
Rendering a page instead of redirecting is not a bad practice, as long as you understand the difference between these two actions.

So, the main question - can't you just use a regular GET instead of a POST if you want to redirect anyway?

POST-redirect-GET is a tricky pattern in a sense that you will have to work around user pressing "Back" or refreshing the page depending on the way you'll implement the redirection.
>>
>>60776607
Don't you mean
>"bought" it upon yourself
?
>>
File: uJbHTpC.jpg (51KB, 500x333px) Image search: [Google]
uJbHTpC.jpg
51KB, 500x333px
>>60776668
>>
>>60776650

not too familiar with web dev terms but from my node experience the post sequence is like this:

https://helloworld/ -> click post -> https://helloworld/post -> https://helloworld/

and thats redirect right? im not sure how POST is handled actually, im only talking from my experience. So /post is really just a dummy webpage which will then redirect user to the main page
>>
>>60776368

In Python, the normal GET goes like this:

def index(request):
do your shit
return render(request, 'index.html')


and a post would go like this:
def somethingcool(request):
if request.method == 'POST':
some shit here
return render(request, 'whatever.html')
elif request.method == 'GET':
some other shit
return render(request, 'thisisshit.html')
>>
>>60776996

what if after the post you want to return to index.html?
>>
>>60755444
how do i pick a domain
>>
>>60776080
>>Pluralsight
>The shit is free for 3 months

awesome! is it viable to use the free 3 months, and then let that account go and get another free 3 months? Change username, email, maybe use a VPN (which I already have)?

Also, as a backend guy, do I have to do anything with the server itself (Apache, Nginx) other than deploying? I know nothing about servers, would like to learn a bit. Any resources welcome. Thx.
>>
>>60777027
then just put 'index.html' instead of 'whatever.html', no magic tricks there

Or you could cache the page, but I'm a newb and still don't know how caching works. But yeah, I guess caching the index would be faster than rendering it every time. I guess it's time to learn that.
>>
>>60777096

so without caching, i have to implement everything from function index and paste them to somethingcool ??

boy
>>
I need to create simple crud inside my website
Should i make it to be with pure php
Should it be real time crud
What would you suggest me, how should i build it?
>>
>>60777120
ah, I see what you mean. No, not at all. Just do this:

 
def index(request):
do your shit
return render(request, 'index.html')

def somethingcool(request):
if request.method == 'POST':
some shit here
return render(request, 'index.html')
elif request.method == 'GET':
some other shit
return render(request, 'thisisshit.html')


you only implement the index function once, and then any other function can call up 'index.html', which in turn calls the index function.

Somethingcool function returns index.html, which calls up index function, which renders index.html page. Sounds kinda circular but it works.
>>
https://www.w3.org/TR/microdata/#converting-html-to-other-formats

Microdata in HTML6. Useful for converting HTML straight to JSON
>>
>>60772346
Hmm, thanks for explain. So, now i'm sure, my code is the same, but why it does not works?
I mean, if i rewrite it right - it should do the same things. I have no idea where is my mistake then.
>>
>>60777096
I don't know what's going on here or why that guy is giving you bad advice, but here.
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection
>>
>>60776757
I guess I got the stuff a bit backward the first time, sorry for that.

Simply speaking,
>https://helloworld/ -> click post -> https://helloworld/post -> https://helloworld/
is indeed a redirect, but I wonder if you should be really using it.

What happens there is you click on a link that has a
>method="POST"
attribute that sends you to a specific controller action. The action does some backend stuff with the body of your request and then sends a response. Which is, by default, is a redirect to the corresponding view. However, since they want you to go to the other page instead, that "corresponding view" has a script that'll send you elsewhere as soon as it's loaded.

Instead of doing that, you can just handle the redirect event entirely inside of the controller action.
The best option there would be just not to provide any redirects at all if you don't really want the user to go anywhere.
However, there's a possibly undesired side effect in the URL being changed to correspond the executed action:
>https://helloworld/post
This stuff.
If it's strongly undesired - the manual rendering you are seeing in your controller (are you seeing it in your controller?) might be a way to work around that - I don't really see anything wrong with that (if it works, of course).

I have to mention, that the default behavior for what you're using and what I'm familiar with might be very different. For example, Rails will throw an exception if you try to POST to an action that has no corresponding view unless the action explicitly states to render something else - the very same way it would do it for a GET request.

If you want to make a POST request that doesn't redirect you anywhere and doesn't change your URL in any way - just do it via AJAX. It's pretty simple, and you'll have to learn it eventually anyway. It's used precisely for making silent background requests sending data to the server and updating the view correspondingly without throwing the user around.
>>
What is the PHP framework standard?
>>
>>60775621
PNG is the only widely supported web image format that supports true alpha transparency. GIF has a transparent value, but it's either 0% or 100% opaque.
>>
>>60777060
>is it viable to use the free 3 months, and then let that account go and get another free 3 months?
It's one of the benefits given by the Visual Studio Dev Essentials.
A bit over a year ago, I made an account there, used the promo that gave me a free 6 months subscription for Pluralsight, when it expired I used the regular "3 free months" benefit, then I made another MS account and used the benefit from it to activate it once again. When that thing expired, I tried activating it again from the same account (for some reason the "Activate your benefit" button never goes away) but this time around Pluralsight told me it's finally time to stop.
So I forgot about it for about half a year and now I decided to try again with the same accounts I've used previously.

Fuck me, I guess I should watch a bunch of video courses on something in the next three months.
I hope Microsoft won't bite my ass off, as now I have an actual copy of Windows registered on that MS account as opposed to "Activate your copy of Windows, pls" previously.

tl;dr Yeah, it's generally viable. Unless you want to watch it 24/7 and then brag with your account (as it stores your watch history) to the potential employers.

Dev Essentials have a bunch of other benefits including free 3-months subscriptions for Linux Academy, Opsgility, and WintellectNOW. Albeit, I don't know how good are these.

I wish Microsoft was paying me for all this shilling.


>Also, as a backend guy, do I have to do anything with the server itself
I have no idea how that would work in a high-level company but as a front+backend myself, so far I had to setup a CentOS server on a VM, ssh into it, and install and setup a rails server there. I guess, being able to setup firewall for port access is also expectable. And knowing how to setup port forwarding also helps.
>>
>>60776996
>and a post would go like this:
POST/GET branching should be done on the routing level.
>>
>>60755444
I am trying to register a .ch domain but it does not allow privacy protection. That means no place will offer whois protection. What do I do? I'm not putting my real name out there.
>>
>>60777310
Ah, ok, I figured out your issue. It's that .submit() is a jQuery method. You need to use
element.addEventListener('submit', () => {
...
}

where element is that form
>>
>>60771266
>but i don't love jQuery
You should, anon.
jQuery is one of the main reasons JavaScript got so popular. Writing on vanilla JS you're severely cutting down your productivity, especially as a newbie.
Fall back to vanilla JS to optimize some of the heavier stuff on your page, but generally sticking to jQuery is a good idea.
>>
can someone give me some like where i can learn about RESTFul api, for php, up to date
Everything i find is very outdated
>>
>>60778027
Thanks a lot.
>It's that .submit() is a jQuery method
B-but i seen this example
 document.getElementById("myForm").submit(); 

at https://www.w3schools.com/jsref/met_form_submit.asp.
And i thought it should work.
>>
>>60778188
That triggers the "submit" action on the form, which is equivalent to the user clicking the submit button in that form.

jQuery has a different submit method, which takes one argument, a callback function, and I think basically just maps to that addEventListener method.

It's weird that they reused that method name. I wonder if it's pseudo-overloaded to default to triggering the submit action when called with no arguments.

>>60778089 is trying to tempt you to come to the dark side. Do not listen to him.
>>
>>60777408

thanks anon <3
>>
>>60778089
I think it's very reasomable, specially as a newbie. I seen many, many copypast monkeys, that started with jQuery and they don't understand how it really works. They knows only jQuery and without it they can't do anything.
And jQuery is ugly.
>>
>>60755896
>>60755974

AWS or DO?
>>
why the fuck is every single domain taken??????????? WHAT DO I DO
>>
>>60779935
get more creative?
>>
How are you other junior devs getting along?

Put that resume out there.

After 3 months of my first dev job I am getting blown the fuck up daily by recruiters and I only have a highschool diploma.
>>
>>60778287
That's an admirable mindset that could've made you into a great developer were you to start your path at least from mastering ASM.
In reality, however, there's a lot of variable factors such as, but not limited to motivation, deadlines, readability, actuality, and complexity.
The same way as learning assembly becomes a much more interesting and easy task when you start it while having a lot of higher-level programming experience, going back to the vanilla JS becomes less of a hassle when you already have a clear vision of what can be done with jQuery.
Another important aspect for you, as an aspiring developer, jQuery will get your shit done in a much faster and reliable pace, as the vast majority of your possible problems will already have jQuery-dependent solutions to them.
And the differences between "code monkeys" and you are:
1) You are inherently worse, as they have a single way of getting shit done, you so far have zero - you aren't really in a position to talk shit about anyone, anon;
2) It would be trivial for them to find a vanilla solution when required, as jQuery falls back to JS much more often than you would think, while you'll eventually face some sort of a problem that can be trivially solved via jQuery but requires you to write an obnoxious wall of text in vanilla.
3) They are better suited for working in a team, as jQuery is universally more accepted than pure vanilla.

No one forces you to "copy-paste" someone's solutions for your problems. You can analyze them and understand how they work - you even can check the vanilla logic behind them if you want to. It still will be faster for you than always going with vanilla.

>And jQuery is ugly.
You haven't seen enough JS then.
>>
>>60779935
Name it something edgy but unrellated.

Fizzl.com
Flipr.com
Pliky.com
Pogl.com

Retarded shit like that.

In 10 more years you will have to double it up so
Plogpikl.com
Plikyflipr.com

So get the retarded shit now before you have to buy the retarded retarded shit.
Welcome to e-business.
>>
>>60780046
is keywords in your domain important to google anymore. I dont want to take fizzilmybizzle.com if it will hurt me
>>
>>60780101
Yes, but not really.

People will visit if you're cool. DavesOmegleClone.com isnt cool and would have worse PR than something cool like camalot.com
>>
>>60776204
kek
>>
File: Capeqqeeqweqwture.png (55KB, 689x856px) Image search: [Google]
Capeqqeeqweqwture.png
55KB, 689x856px
>>60773724
>http://foxpawentertainment.com/
It's not even responsive. You failed.
>>
File: l7ECE71.png (5KB, 435x123px) Image search: [Google]
l7ECE71.png
5KB, 435x123px
>>60780623
And it's so easy to make it responsive too. This is literally all you have to do.
html {
background: url(../img/logo.png);
background-position: center;
background-repeat: no-repeat;
background-size: contain;
background-color: black;
}
>>
Is it still common to use www. as the prefix of your domain?
>>
>>60780896
it can be important with some CDNs
https://www.netlify.com/blog/2017/02/28/to-www-or-not-www/
>>
>>60780896
Yes.
>>
>>60780945
>>60780946
I see. Do I also need two certificates? One for foo.bar and one for www.foo.bar.
>>
>>60781002
Pick www or no www. Dont do both
>>
>>60781028
But if I only pick www, the browser starts bitching when entering 'https://foo.bar'.
>>
>>60781174
you redirect from the one you don't use, to the one you use
>>
>>60779935
Use a newer generic TLD. I put some examples and a link here: >>60758870

>>60780006
Not that guy, but you seem to be overly infatuated with jQuery. You might not fall into this category yourself, but in my experience, people who highlight their knowledge of jQuery often have no idea how to do anything without it.

And I think maybe you've seen too much jQuery, if you think it's readable and not ugly. It optimizes for brevity and throws readability right out the window.
>>
How do I make frontend webdev feel more like programming and less like document layouting
>>
>>60781706
>you seem to be overly infatuated with jQuery
Nah, I've just started from the vanilla JS (not learning - working) and quickly realized that "man, I should really stick to the roots!" is a really bad mindset when you have a project to work on.
To be honest, I should also start getting into CoffeeScript, but I'm too lazy to spend some time learning its syntax as it's a bigger leap than from JS to jQuery and I didn't yet face a "man, this one can be _easily_ solved via Coffee, but it's hard to do it with JS/jQuery" situation.
I also often fall back to the vanilla JS - for example when I want to work with DOM instead of weird jQuery objects. But the overall proportion of JS/jQuery in my code is like 30/70.

And jQuery is leagues above vanilla in regards of readability - it's one of its main advantages. Brevity equals readability in this context - jQuery allow you just to briefly run your eyes over the code to understand what's going on, you just have to get used to the syntax. It's really simple and intuitive, and the stuff it omits for the sake of brevity is mainly the verbosity that makes JS pain in the ass to look at.

We had an internet lotto site with a big complex JS script running it and this shit was nightmarish to read or even attempt to debug.
>>
>>60781846
all that html/css is just doc layout all the time, but maybe do some js (in whatever flavor you prefer) and it'll go away
>>
File: pexels-photo-219000_1920.jpg (381KB, 1920x1280px) Image search: [Google]
pexels-photo-219000_1920.jpg
381KB, 1920x1280px
>>60782151
>jQuery
>CoffeeScript
just no, anon
This is a waste of your time.

If anything, invest more time in vanilla JS and ES6/ES2015

If you use jQuery for AJAX:
Use fetch() or axios

For DOM updates/manipulation/interfaceshizzle pick any of the hothothot reactive frameworks/libraries:
React, Vue, Angular
(pick Vue)
Same thing goes for mouse&keyboard inputs and events.

relying on jQuery will prevent you from making progress (even though it might feel, that for now it lets you accomplish everything you want to do)


I am a dev noob btw, so feel free to ignore the words above.
anyway, thanks for reading my post
>>
File: pexels-photo-24283.jpg (2MB, 4896x3264px) Image search: [Google]
pexels-photo-24283.jpg
2MB, 4896x3264px
>>60782377
oh, except if you want a job.
Then don't pick Vue, but go with React for startups and Angular for enterprise.
>>
>>60776169
That is a CSS reset. It removes all browser-specific CSS rules, such as the 15pt border Chrome likes to give to the entire webpage.

>>60780623
I dislike this whole "responsive" meme. I am going to make videogames for the PC, not for tablets or memephones.
>>
Wordpress is literally the best platform for writing quick and good enough apps
>>
>>6078287
>such as the 15pt border Chrome likes to give to the entire webpage
Somehow, I didn't need this shit on my site. How about you stop using the shit you not only don't really need - don't really know how it works and why the fuck is it there?
>>
>>60781846
js framework: vue, react, angular
>>
>>60782964
Probably because you use Bootstrap which includes its own version of CSS reset.
>>
>>60782873
>I dislike this whole "responsive" meme. I am going to make videogames for the PC, not for tablets or memephones.
are you implying every PC user uses the same screen resolution?
>>
I started out doing websites for a small design shop then moved on to only front-end with a larger company and more pay. A senior position has opened up but means I'll need to get into ASP razor territory. Not sure if I want to go down that path but I like the company. Anyone else been in this situation? What do?
>>
Recruiter: how long have you been using php?
> 4 years
Recruiter: It says you've only been using PHP at that job for 4 months
>Did your ability to email begin when your job at the recruiting agency started
>>
>>60783191
I am implying that, the days of 4:3 are over, and my website will work on most, if not all widescreen monitors.
>>
>>60783316
>and my website will work on most, if not all widescreen monitors, will not have a mobile version, will not support scaling and user changing the size of the browser window.
In other words - it's already shit.
>>
>>60783316
I know that excuse. Don't become lazy with those things.
You don't need to go as far, as to support IE6, but all the CSS frameworks you have today make it easy as hell to adjust content for any screen size.
>>
File: 1462724269548.jpg (57KB, 420x420px) Image search: [Google]
1462724269548.jpg
57KB, 420x420px
>>60783403
>Use CSS frameworks
>>60776169
>Don't use third party CSS
>>
> Have web development job
> Do full stack
> Do reporting
> Do analyst stuff

Job would be fine if I didn't want more. The projects suck. The technology is date. The people I work with when I work with people aren't motivated or talented at all.

How do I 'pivot' and make myself better so I can land a job out west writing software? I'm really bad at those 'standard programming' problems.
>>
>install mod_pagespeed
>site is unironically faster
wew
>>
File: 1492675302316.jpg (269KB, 1920x1080px) Image search: [Google]
1492675302316.jpg
269KB, 1920x1080px
>>60783423
Don't get what you are trying to say

The other anon stated, that it is out of the ordinary for a page with only a BG image to have external CSS. Not that all external/3rd party CSS is bad.
>>
>>60783492
Why the fuck are you so straight, anon? I was literally typing the same thing the other way around. Are you from London by any means?
>>
File: 1495741412109.jpg (77KB, 518x768px) Image search: [Google]
1495741412109.jpg
77KB, 518x768px
>>60783492
And you are telling me that I need to use a framework to make my page with only a background image responsive for people that aren't my target audience, I personally don't even like, and don't want to spend development time supporting.
>>
>>60782873
>responsive
>meme
It's a basic requirement for modern website. Your site will be viewed on mobile and tablets and if it doesn't work there then It's a failure.
>>
>>60782894
Literally all other mainstream alternatives are better. Not mentioning frameworks.
>>
>>60783522
>Are you from London by any means?

>>60783529
Can you stop being so dense?
Of course I am not, but are you saying, that the only purpose your website will ever have is to display your single image as a background of the page?
>my target audience
anon

So you are developing your "game", but don't even put minimal effort into properly displaying your website to your visitors.
I implore you to reconsider.
>>
>>60783529
He's telling you that you shouldn't be so obviously pussying out because you think making your shit responsive is hard and try to mask your laziness with an "opinion" because there are easy solutions for making your entire project responsive.

Your page was made responsive by changing a single word.
>>
>>60783215
Razor is not much different from other template engines unless they decided to start writing code inside it. Spending day on some quickstart tutorial should be enough to start working.
>>
>>60783631
I don't know what I'm going to do with it yet, but my point stands. My website is intended for the same people as my game. My game will not run on mobile devices. Thus, anyone interested in actually playing my game will be able to access my website. Why should I care about normie smartphone users? I don't even /want/ those shekels to be quite honest. I'd rather a small, tight-knit community than twenty thousand mouthbreathers slapping their fingers against their phones.

>>60783664
>Hard
Webdev in general isn't all that hard. That doesn't mean I'm going to spend more time on it than I absolutely need to.

I am, however, proud of the server stuff that I set up.
>>
I can't get this fucking thing to work. Help? I have my stocks database with attributes name, price, shares, date etc. Then I query that with "Portfolio.objects.filter(user = request.user)" to get all transactions made by the current user, and store that in a variable.

Now, how do I get that displayed on a Django template? I can get a single attribute displayed, but the problem is that I want everything displayed as a table, can't seem to figure out how.
>>
>>60783700
>I am, however, proud of the server stuff that I set up.
Anon, setting up a server is easier than making a remotely half-decent website with at more than a single page.
I'm telling you this as a front + backend developer.
>>
>>60783740
>Django
Wew what year is it?
>>
>>60783700
so, are you working on a game for the browser then or what exactly?
>>
>>60780002
Thanks for the encouragement anon. We're all gonna make it.
>>
>>60783700
You're being obstinate to mask the fact you don't know what the fuck you're doing. I can tell because like >>60783753 implied you seem overly proud of doing something as basic as setting up a server. Stop cowering like your ignorance is a weakness and recognise it as an opportunity to learn something.

>muh community
That community is here on /g/ telling you you're being a child. Put on your big boy socks and learn how the real world works or you've already failed.
>>
>>60777954
Is that the recommended practice? I think code would be far more clear if it looked something like this:

def GET_index(request):
return render(request, 'index.html')

def POST_index(request):
[... code ...]
return render(request, index.html, { context... })
>>
>everything works in testing
>doesn't work for client

WHYYY
>>
>>60784599
I started to include "Press Ctrl + F5, not F5, before viewing" in every email
>>
>>60784431
Why not? Just make the actions names represent the actual actions instead of the means of getting to the action.
For example, you can have an obvious "index" for the GET request to the URL and something different for the POST. Meanwhile, your routing should go along the lines of:
    match "/orders", to: 'orders/orders#index', via: :get
match "/orders", to: 'orders/orders#ipn_listener', via: :post

This particular example is kinda bad, because there's no reason for you not to have a dedicated path for a listener, but I think you should get the idea.
>>
>>60784599
>WHYYY
Your code is shit and isn't universal.
>>
>>60784431
this is the correct way to do it but the names are off as >>60784723 mentioned

let's say you've got a website like https://pastebin.com/
the method that handles GET / could be named just index() or show_index(), and the one that handles POST / could be named add_new_paste()
>>
>>60784723
>>60784874
thanks, I always see methods that use if request.method == 'POST' in tutorials. I thought it was some kind of recommended practice. But functions that use that kind of approach always seem to do too much, and even the simplest one are confusing

>>60784723
by the way, is that ROR/ruby? I'm not familiar with the syntax
>>
>>60772744
Never.
>>
>>60773724
I especially like how it is absolutely unreadable on mobile. Kill yaself
>>
>>60773724

Nice! Did you build this with the MEAN stack?
>>
>>60784941
That's correct. You should strive to have your functions be concise and do one thing only. Adding descriptive names helps with that because it can indicate when to split a function. The need to refactor becomes apparent when you try to name a function properly and the name turns out long and with the word "and" in the middle, e.g. "validate_and_add()".
Many languages take this concept even further with things like guard clauses. Elixir does this beautifully in my opinion:

defmodule User do
defstruct age: 0
end

defmodule Greeting do
def greet(%{age: age}) when 6 < age and age < 12, do: "Hiya"
def greet(%{age: age}) when 12 < age and age < 18, do: "Whatever"
def greet(%{age: age}) when 60 < age, do: "You kids get off my lawn"
def greet(_), do: "Hello"
end
>>
>>60759104
why the fuck do you need IPC for a stateless webserver holy shit
>>
File: save-lane.jpg (222KB, 1574x880px) Image search: [Google]
save-lane.jpg
222KB, 1574x880px
https://stackshare.io/stacks

pretty cool

also mfw dat captcha
>>
>>60756133
It has the most content because it's been around for so long
>>
>>60785948
NOTHING uses php.

I looked through 16 of those.
>>
>>60786338
>search for php it returns 8000
>node only 2700
>>
>>60786338
https://stackshare.io/php/in-stacks
>>
File: csharpjava.png (255KB, 812x644px) Image search: [Google]
csharpjava.png
255KB, 812x644px
>>60785948
what did they mean by this?
>>
>>60785092
No, it runs on a Ubuntu server which has Apache and PHP installed.
>>
I want a better dev job.

I really think not finishing my degree was a bad idea.

I'm getting raises at my first web dev job but no one else will even look at me.

This is why I'm making my own web dev job site. Degrees are stupid.
>>
does anybody know how can I change default error messages of FLASK-WTF?
>>
>>60785948
I can't find 4chan?
>>
>>60785948

howd they know what each company is using? manually asking them? or is it something that can be determined from the webpage alone?
>>
>>60788908
It runs on legacy spaghetti oldschool PHP code https://pastebin.com/4JVjS02b
Unless a total rewrite happened which I highly suspect it didn't.

>>60788938
The information is submitted by the companies themselves.
>>
>>60789321

i dont know php, but is the source code bad?
>>
Guys I need a hand:

I've started "Web Dev" a month ago, since an old friend of mine asked me to run his eCommerce site. After pretty much a week of "I'm not sure I can do this, I don't have experience" and because all of a sudden I really needed the money, he convinced me to work for him.

He's running Prestashop (Modded Wordpress + Bootstrap3) and it looked simple enough.
(Spoiler: It's shit)
Now he's asking me to implement things in the responsive mobile part of the site and I'm not sure how to make them.
How the hell does responsiveness work in Bootstrap? How do I make stuff appear in the mobile part and hide in the full site?

I wanted to ask in the prestashop community forum but, guess what, It's shit (Literally, everything in that site is broken beyond belief)
>>
>>60789782
Responsive is not about different stuff for normal and mobile, it's about making same stuff appear correctly in normal and mobile. Overall RTFM- you can't simply ask for full knowledge in one post.
>>
web assembly is cancer
>>
>>60784941
>by the way, is that ROR/ruby? I'm not familiar with the syntax
Yeah, it's Ruby on Rails. But that particular example is from "routes" file which configures routing.
Code from a controller is not that different from what you've shown:
def index
@no_first = true;
newest = UserBookmark.where(user_id: current_user.id).first[:bookmark_id]

bookmark_id = newest
oldest = UserBookmark.where(user_id: current_user.id).reverse.first[:bookmark_id]
@current_page = UserBookmark.get_next_page_for_user(current_user.id, bookmark_id)
@bookmarks = fetch_products(@current_page, false)
@bookmarks.each do |product|
if product.bookmark_id == oldest.bookmark_id then @no_last = true end
end

end

def next_page
if params[:id].nil? then return redirect_to action: "first_page" end
token = params[:id]
newest = UserBookmark.get_first_for_user(current_user.id)
oldest = UserBookmark.get_last_for_user(current_user.id)
@current_page = UserBookmark.get_next_page_for_user(current_user.id, token)
@bookmarks = fetch_products(@current_page, false)

if @bookmarks.first.nil? then return redirect_to action: "last_page" end
@bookmarks.each do |product|
product.id
if product.bookmark_id == oldest.bookmark_id then @no_last = true end
if product.bookmark_id == newest.bookmark_id then @no_first = true end
end
render action: "index"
end
>>
>>60789782
every responsive framework like Bootstrap,Foundation or Bulma has certain classes for its responsive grid and to hide/show elements on certain screen sizes.

These are 100% listed in the frameworks documentation, so go and read it.
>>
>>60775262
This. I used to use reset, but honestly normalize is just much easier.
>>
>>60789782
I don't know about your particular case, as we've always built our sites from zero in pure HTML/CSS/JS.
Responsiveness doesn't require you to use frameworks - it's just setting the properties of elements in a responsive way - percents for sizes and relative positioning mainly.
About "hiding stuff for mobile", as this >>60789925 anon said - it isn't adaptive design - not responsive.
Adaptive solutions are usually done via @media queries in CSS and JS in HTML.
>>
>>60790150
>it isn't adaptive design
I meant "it is", sorry.
>>
Is it worth buying web development books or do they become outdated quickly?
>>
>>60790323
Anon, it's _maybe_ worth it, but I wonder why would you do that when you have access to The Internet and obscene amount of knowledge regarding the topic.

If you want some actual lessons - go grab the free 3 moths Pluralsight subscription from Visual Studio Dev Essentials and watch them all you want.
>>
>>60790377
problem for me is I can't stand fucking videos, I need to go at my own pace. Also, when you do a vid and then you want to go back and rewatch one specific part, it's impossible to find the right place. Books are self-paced, you can search for specific terms, etc.

>>60790323
I've bought a few books that I know are not gonna go out of date soon (algorithms, Python 3 cookbooks, etc). Bought second-hand they were under $10 each.

But also, go to genesis library and download anything you want for free.
>>
>>60790377
>Anon, it's _maybe_ worth it, but I wonder why would you do that when you have access to The Internet and obscene amount of knowledge regarding the topic.
Simple - I don't want to have to stare at a screen all day.
>>
>>60789979

Your code looks messy and could need some refactoring.

UserBookmark.where(user_id: current_user.id).reverse.first[:bookmark_id]

UserBookmark.find_by(user_id: current_user.id).last.bookmark_id


And why are you saving all those intermediate values? I think you should get rid of some of them..
>>
>>60789979
Is this related to pagination? It could be much cleaner if you rewrote that brosef.
>>
>>60790421
>problem for me is I can't stand fucking videos
Understandable. However, I would still suggest at least considering it, given you might have been unlucky with your previous video lessons experience.
Courses on Pluralsight are divided into multiple elementary lessons normally 3~10 minutes each and there's decent navigation between them.
For me, simply adjusting the speed and pausing the course from time to time was enough for pacing.
And I was referencing a UWP course all the time when I was building my UWP app - that wasn't any harder than looking up stuff in manuals or on SO.
Some of the courses are shit, but usually, you can see that by the rating they have.
>>
If you can't learn by reading a book you shouldnt get into webdev.

fuck all these hold your hand tutorials.
>>
>>60777348

This.

You don't just redirect without actually making it a (real) redirect..

class AnonController < ApplicationController  

def some_custom_action
@anon = Anon.find(params[:id])
if request.post?
redirect_to op_path(id: params[:id]), protocol: 'https://', status: :moved_permanently
end
end

end


I would submit the credentials as parameters and definately use an explixit "redirect" (in this example I'd say HTML statuscode 301 or 303).
>>
>>60790564
>Pluralsight

yeah, I'll give them a try, we'll see how it goes. Some of the courses there look pretty good, and free is about as cheap as it gets, right?
>>
>>60790485
Your code wouldn't work. "UserBookmarks" is a NoSQL DB - you can't just "last" over it.
Of course, you can if you store the query results in server's memory first, but that would murder the performance.
>I think you should get rid of some of them
Storing makes it easier to read and edit. Putting a formula into another formula creates unreadable clusterfuck. It doesn't affect performance or memory usage in any way.
Shorter code does not equal better code most of the time.
>>60790522
Yeah, it is. It's an old commit - some of it is refactored already.
For instance,
oldest = UserBookmark.where(user_id: current_user.id).reverse.first[:bookmark_id]
oldest = UserBookmark.get_last_for_user(current_user.id)

are virtually identical, it's just I didn't incapsulate the first one yet. There are also some debug leftovers.

Most of this ugly shit, however, is required for the pagination to work without killing the performance. Building pagination for Cassandra is a bitch.
>>
I'm trying to figure out Javascript best practices but I'm stumbling a bit around. I'm trying to use objects as much as possible to be consistent (rather than mix 'x :y' and 'var x = y') but I'm having problems setting variables and scopes and such.

module = {

//--------------------
// Global variables
//--------------------

$ : jQuery,
$_DOCUMENT : $(document),
$_WINDOW : $(window),


//--------------------
// Menu
//--------------------

menu : {

//The elements we'll be using in the Menu
elements: {},
el: module.menu.elements,

init: function () {


el.$header = $('header');
el.$myDiv = $('.arrow');

el.$myDiv.on('click', function () {
module.menu.open();
});

},


open: function () {
el.$header.addClass('open');

module.$_DOCUMENT.on('click.nice', function () {
module.menu.close();
});
},


close: function () {
el.$header.removeClass('open');
module.$_DOCUMENT.off('nice');
}
},

somethingelse: {
init: function() {

}
}


};


//--------------------
// DOM Ready
//--------------------


$(window).on('load', function () {

module.menu.init();
module.somethingelse.init();

});


The 'el: module.menu.elements' part in particular is having problems with module not being defined. What do I need to change here?
>>
>>60790788

>Your code wouldn't work. "UserBookmarks" is a NoSQL DB - you can't just "last" over it.

How so?

If you are using something like MongoDB, you want to use Mongoid instead of Activerecord.
And Mongoid does have the ".last" method, see:
>https://docs.mongodb.com/mongoid/master/tutorials/mongoid-queries/


>Shorter code does not equal better code most of the time.

Fair enough, but I still feel you overdoing it and could use more "ideomatic" code sometimes..

For example:
bookmark_id = newest = (...)

return redirect_to(action: "first_page") if params[:id].nil?



The "next_page" action is hard to undersatnd without knowing your data structures, but for exmaple you are saving "oldest" and "newest" as record, instead of saving the the ID as number.

Also I feel like ther should be a better solution to check that. Instead of comparing each record, you could simply search for the ID of the first (and last) record in the subset for the user. Ideally thyt could be done in a single query.

But as I said, I dont fully understand your code, so maybe there are rasons why you can't do this? I'm nto an expert with NoSQL..
>>
>>60791052
I'm also trying to use 'Use Strict' but it seems I'd need to change 'module' from an object into a function.

Should module be an object or a function?
>>
I'm trying to learn Javascript right now but it is all getting a bit much since I've been rushing it so hard. How long did it take you guys to learn Javascript when you first started?
>>
>>60791052
>Javascript best practices
don't use jquery and DON'T EVER PUT A SPACE BEFORE A COLON
>>
>>60791100
>How so?
We're using Cassandra and Cassandra doesn't have "last" method. I also wouldn't be surprised that resorting to the "last" in MongoDB would affect the performance the same way it does in Cassandra (reversing is slow too, it's just storing everything in memory is even slower) as it says there it "adds sorting by id" by default.

Basically, it doesn't have the inherent numbering of an SQL DB. You can't get the "last" field because DB doesn't know which is "last". You can't jump to arbitrary row (LIMIT 10, 20). You can't even count the DB because it itself doesn't know how much shit is stored in there (Actually, there is a "count()" method in Cassandra, but it's slow because it actually counts the DB instead of just returning a number representing the size). Even the "next()" functionality has to be done in code.

>For example:
Yeah, this particular case is excessive and unnecessary - it wasn't present in the other actions and I was working with them.

>you could simply search for the ID of the first (and last) record in the subset for the user
Yes, this is a more adequate solution that isn't there because I was just trying to get the thing to work.

What you're talking about is absolutely correct, but while I wasn't spending my time refactoring shitty code - I was writing another shitty code and making another working feature. We were short on time and while refactoring can wait, client - can't.
This shouldn't be an excuse to write shitty code, to begin with, but as I said, making that pagination was a bitch (including coming up with the idea how it should work) so I was more focused on making it work instead of making it good.
>>
>>60791456
>don't use jquery
Anon, don't be a fag.
>>
>>60789321
>>60789459

Several 4chan forks and clones that you can't name here got boners to a "rewrite 4chan in modern code" and blogged extensively about the way it shat itself at scale and couldn't handle load the way the original spaghetti code could.
>>
File: netscape.gif (38KB, 60x60px) Image search: [Google]
netscape.gif
38KB, 60x60px
>>60777060
The've used to give longer trail periods (like 6 months) which I've exploited for over a year using different identities. Finally I've decided to subscribe during their promotions. If you have a trail account, wait till it expires and, after about, couple of weeks you bound to receive some kind of a promo deal from Pluralsight like I did.

I also have TutsPlus account but canceled it this year since I'm no longer interested in Front-end and Design stuff they mainly concentrated on. Still TutsPlus is a great resource worth checking out. P.S. Sometimes they post some great courses that are HARD to find anywhere else (so keep an eye on that one).

If you are into PHP and Laravel you MUST check out Laracasts. They give some great promotions once a year (like 90 usd/year), usually during Black Friday sales. P.S. Jeffrey Ways is a great teacher.

Lynda is, IMHO, usually outdated and pretty dry. I don't even bother downloading their torrents anymore. Also, search for "Lynda.com free account" work around/hack online. I've had a 6+ month pro account for nothing thanks to it (it was disabled eventually).

Team Treehouse - they have a great concept of "Learning paths" that later been adopted by Pluralsight. You can learn a fair amount from them too. Had a paying year account when I was a front-end dev. Not really worth it since there is Pluralsight IMHO (love the instructors tho).

Udemy - hit and miss kinda deals. You can "fool" it to give you courses for like 10, 15 bucks instead of their "normal" prices (which are waaay higher then they should be).

All in all. Right now I only have 1 active account that I pay for and that is Pluralsight.
>>
>>60791052
>>60791456
>>60791517

 var menu = {

//The elements we'll be using in the Menu
elements: {},
el: this.elements,


init: function() {


el.$header = $('header');
el.$myDiv = $('.arrow');

el.$myDiv.on('click', function(e){
e.stopPropagation();
menu.open();
});

},


open: function() {

el.$header.addClass('meeem');


The outer 'module' is now a function, and I have things set up like this now. However, el: this.elements doesn't work. How do I get the 'menu.elements' to be available as a variable to all the functions within 'menu'?
>>
>>60777427
>What is the PHP framework standard?
Symfony.

Laravel is built on top of it, so is Drupal.
Both are amongst the "most used" PHP frameworks/CMS's.
>>
>>60791503

>We're using Cassandra and Cassandra doesn't have "last" method.

Oh, it seems like you are correct after all.

I just looked and 'cequel' (the most popular Cassandra ORM for Ruby, it seems) and they were also using "reverse"..


>Basically, it doesn't have the inherent numbering of an SQL DB.

Thanks for the explanation. Really interesting stuff, one day I will take a look at Cassandra. Maybe to evaluate shiposts on 4chan or something like this..


>so I was more focused on making it work instead of making it good

This is a valid point. I thought that you weren't experienced and wanted to give some hints for better coding. But I didn't know that you were doing funky NoSQL stuff. Turns out I was the one getting schooled today.. :)
>>
What are some good projects to embark upon for a beginner web developer looking to build up a portfolio of work /wdg/? HTML, CSS and Javascript are how far I have gotten so far.
>>
>>60791637
>Turns out I was the one getting schooled today.. :)
Well, save for a niche Cassandra part you simply didn't know - you were right about the refactoring, so that's good.
I still have a long way to go before I'll start writing good code right away, so pointing out my flaws is a good thing - thanks for that.
>>
>>60791915

Decide on a web framework, then actually work on it. That'll show em
>>
Is it best practice to use getters and setters for all properties in Javascript objects?
>>
>>60792193
in C# it is, I'd say in Javascript probably too
>>
>>60791522

..can't be named here? what the hell?
>>
how do people actually handle storage? do they just store the files alongside the source code or is there a cleverer ways of storing -user- files in general?
>>
>>60755444
What would happen if I took icons from flaticon and didnt credit the author?
>>
>>60792378
>do they just store the files alongside the source code
They do.
>is there a cleverer ways of storing -user- files in general?
There are. Many of them.

There are multiple solutions for automatizing the process of storing a file from a user and later fetching it when requested.
For example, in our RoR project, we use CarrierWave gem to store uploaded files (images of products in particular) while saving links to these files in the DB. The links later processed to retrieve the files.
Where exactly the files are stored is up to the configuration. You can store it in a dedicated folder on your webserver. If you want to have a dedicated file server - sure, why not? Set it up,
configure it and the gem - voila, it works.
Of course, there are similar solutions for other frameworks. Or you can even implement your own if you really want to.
>>
This crap doesn't work. Helperino pleaserino.
 success: function (data) {
var list = [];
for (var i = 0; i < data.length; i++) {
list.push("{ id: " + 0 + ", title: " + data[i] + "},");
}

var $select = $('#select-regime').selectize({
maxItems: null,
valueField: 'id',
labelField: 'title',
searchField: 'title',
options: [
//{ id: 0, title: list.title },
list,
],
create: false
});
}
>>
>>60792479

so they are really just a bunch of dummy computers/servers set up for the sole purpose of storing data?
>>
>>60792495
list.push({ id: i, title: data[i] });

Must have unique IDs and be objects.
>>
File: 1491602858176.png (314KB, 1919x1124px) Image search: [Google]
1491602858176.png
314KB, 1919x1124px
Need help with CSS.

Trying to auto-hide specific element but leaving 1px of it so I can use on "hover" transition through "height".

.guilds-wrapper {
width: 1px !important;
transition: width 0.2s !important;
-webkit-transition-timing-function: cubic-bezier(0.0, 0.0, 0.2, 1) !important;
transition-timing-function: cubic-bezier(0.0, 0.0, 0.2, 1) !important;
}
.guilds-wrapper:hover { width: 70px !important;}


The problem is that the specific element has a child with "before" and the element is white therefore it can be seen through my 1px leftover:

.guilds-wrapper .guilds .guild.selected:before, .guilds-wrapper .guilds .guild.unread:before



What can I do here?
>>
>>60792632
>through "height".
through width //fix
>>
>>60792592
Still doesn't work, but definitely a step ahead, thanks!
>>
>>60792495
options: list,

It's already an array. As you say [ list ] is an array where the first item is a new array.
>>
>>60792535
I've seen a commercial project (online shop, we've dismantled and remade it) that was entirely stored on a single AWS VM - web server, database, files.
And I once worked on a project that had all of its databases stored on separate free VMs in Azure.

So, both ways are acceptable - it depends on your budget and expected workload. Performance-wise a dedicated file server is always better than storing everything on your web server, but this only means something if you need that extra performance.

Image servers are also a thing - 4chan uses them for instance.
>>
>>60792681
Fixed. It's working now. thank you =)
>>
Is setting element dimensions as % shit?
>>
>>60792735
No, anon, it's the main way you're supposed to do it unless you're making unresponsive shit.
>>
>>60792735
not if you need it as x% of its parent element.
That's what it is there for. What did you think?
>>
>>60792767
>>60792791
I dunno maybe it should be em or vh or whatever other shit (((they))) came up with. I'm coding a website for myself and I wanna know how to do it right.
>>
>>60792632
Eh. Make the whole wrapper transparent if you don't want to see its contents? Offset the contents and fix it in :hover?
>>
>>60792838
rem/em is based on the root or parent font size
vh/vw is based on the window dimension
% is based on the parents dimension

They all have their proper use.


new thread btw.
>>60792883
>>60792883
>>60792883
>>
>>60792861
How I'm supposed to use hover if I offset it? Hover won't work because element displaced
>>
So I'm building a client in java that will request many text files from a server and I don't want to send too many requests at a time. Do I just put in some Thread.sleep(x) between every request? What's a good sleep time?

And yes, I've talked to the guy that made the server and he says I shouldn't do too many requests
>>
>>60792838
"em" and "rem" are font-size dependent.
Normally you use ems when you want the thing to store text and to be easily resizable to fit this text.
"vw" and "vh" are viewport dependent. They are pretty cool but tricky to use and usually used not for the layout but for the making font-size dynamic.

Percentages are simple, intuitive and they work.

>>60792909
Offset the contents of the wrapper, not the wrapper itself. Add some padding or something.

For example https://jsfiddle.net/d0r3gzeb/
>>
File: 1496344319279.png (82KB, 439x400px) Image search: [Google]
1496344319279.png
82KB, 439x400px
>>60793118
>Offset the contents of the wrapper, not the wrapper itself. Add some padding or something.
>
>For example https://jsfiddle.net/d0r3gzeb/

mein negrid
>>
>>60767899
Phalcon is garbage
>>
File: 29489827489.jpg (28KB, 601x508px) Image search: [Google]
29489827489.jpg
28KB, 601x508px
do manga hosting website simply stores the image file or are they more clever than that?

since most manga pictures are blank white pixels wouldn't it be a waste to store them as is? instead just store where the black dots are and populate a canvas with it

even better use huffman compression
>>
>>60793884
You can encode an image as grayscale or indexed. And you know PNG uses Huffman compression, right?
>>
>>60794230
>>60794230

i dont

again, i get BTFO'ed by years and years of previous people working on shits

;...; i feel useless

previous pic related
Thread posts: 332
Thread images: 37


[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.