/wdg/ - Web Development General

>Díscord
díscord.gg/wdg

>IRC Channel
#Sup Forumswdg @ írc.rízon.net
Web clíent: rízon.net/chat

>Learníng materíal
codecademy.com/
bento.ío/
programmíng-motherfucker.com/
gíthub.com/vhf/free-programmíng-books/blob/master/free-programmíng-books.md
theodínproject.com/
freecodecamp.com/
w3schools.com/
developer.mozílla.org/
codewars.com/

>Useful Youtube channels
derekbanas
thenewboston
learncodeacademy
funfunfunctíon
computerphíle
codíngraínbow

>Frontend development
gíthub.com/dypsílon/frontend-dev-bookmarks

>Backend development
en.wíkípedía.org/wíkí/Comparíson_of_web_applícatíon_frameworks
[Gíst] backendDevelopmentBookmarks.md

>Useful tools
pastebín.com/q5nB1Npt/
líbraríes.ío/ - Díscover new open source líbraríes, modules and frameworks and keep track of ones you depend upon.
developer.mozílla.org/en-US/docs/Web - Guídes for HTML, CSS, JS, Web APIs & more.
programmableweb.com/ - Líst of publíc APís

>NEET guíde to web dev employment
pastebín.com/4YeJAUbT/

>How to get started
pastebín.com/pDT82mQS
pastebín.com/AL6j7GEE

>cheap vps hostíng ín most western locatíons
lowendbox.com
dígítalocean.com/
línode.com/
heroku.com/
leaseweb.com

Other urls found in this thread:

flask.pocoo.org/
btdig.com/search?order=0&q=node js
docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create
jsfiddle.net/2uygL2v5/
twitter.com/NSFWRedditVideo

First for Django

how do I bind my svg's in my doc to pieces of d3 data so I can
target them seperately with click events?

how do i achieve this
tyvm

$attempt = new Attempt();
then goes into my Vue
vue passes it back
$attempt = $request->attempt;
then I try to modify it like $attempt->body = 'x';
and error
Attempt to assign property of non-object
so how do I pass an unsaved thingy between functions in Laravel?

and to add
this is what $attempt is but still throws the error
Object { task_id: 9, session_id: 55, task: Object, session: Object }
and the $request is working properly and all
i dun get it

I have a bunch of small flask web services that will be all served under the same domain.

Is it better to make a single flask app or somehow use a reverse proxy? The second option seems better to me (and more practical), but I'm not sure how to set up something like nginx to do it.

Wtf is attempt?

it's a self-made model

I suspect you are misunderstanding basics but it's hard to say without seeing code.

I suspect so too
public function attemptStart(Request $request)
{
$attempt = new Attempt();
$attempt->task()
->associate(Task::find($request->task));

$attempt->session()
->associate(Session::find($request->session));

$attempt->count = 55;
$attempt->body = '[';
$attempt->correct = false;

return response(['thing'=>$attempt],200);
}


public function attempt(Request $request)
{
try{
$attempt = $request->all();

// $attempt->count = 11;
$attempt->body = '11';
// $attempt->correct = false;
// $attempt->moi = 'moi';
// $attempt->body = $request->body;
// $attempt->correct = $request->correct;
// $attempt->count = $request->count;
// $attempt->fill($request->except('attempt'));

// $attempt->save();
}
catch(\Exception $e){
return response(['dbAnswer'=>$attempt],200);
}
return response(['dbAnswer'=>'$e->getMessage()'],200);

how should I do the attempt function? how do I complete the Attempt I 'new'd in attemptStart?

if you had separate services running under the same path you could proxy the request by using something like:


listen ROUTE_NAME {
proxy_pass local_flask_route/command
}


hopefully that worked, otherwise using one flask app and multiple routes is much simpler/easier since you can just expose flask to 0.0.0.0 and proxy to the port from nginx for all routes. Or if you're in AWS land just use lambda and API gateway.

>1GB file
>sublime text uses 3.7GB of ram

i wonder what kind of representation text editors use

thanks!

here's the vue part

axios.post('/attempt/start', {
task: this.tasks[this.current].id,
session: this.sessionid
})
.then(response => {
this.attempt = response.data.thing;
console.log('rd ', response.data);
console.log('ta ', this.attempt.count);
})
.catch(error => console.error('attempt create err: ', error));

and
//register the attempt
axios.post('/attempt',
{
body: answer, correct: wasCorrect, count: this.tries,
attempt: this.attempt,
})
.then(response => console.log('attempt', response.data.dbAnswer))
.catch(error => console.error('attempt: ',error));
the latter fucks up.
some of this is obviously just for debugging

Pretty sure request doesn't give you back model but generic representation of data.

then how do I turn it into that model? I need the created_at timestamp there.
Is there a way? theres no model(continue) or something?

RTFM? Seriously finding that kind of info is part of developing and you should be able to do it.

just a no will do next time ty

>tfw too lazy to setup LAMP so I can learn PHP
>tfw Django looks like a cluster fuck

Any good flask tutorial?

yes. flask.pocoo.org/
learning from there right now

just use xampp for linux

UI/UX designer here. I'm tired of being a wageslave so I'm planing to learn iOS programming and get self-employed by building my own apps/games. I have all the background I need to bring good apps to the market that have a good usability and a modern design.

Anyone doing something like this? Is it worth? From what I read it takes years to master a programming language. I have some basic skills though, for example I did some coding in framer.js (coffee script).

What is the best paid learning resource on line for PHP?
Has anyone tried Lynda.com?

Basically I am able to has my work to get them to pay for a few courses online and other things, so am looking at my options.

Also has anyone bought code online just to look at how they are doing something and then adapting it for a different use? I'm really tempted as it's difficult to work out what professional code looks like while trying to teach yourself for free online.

Are models and views even efficient?

It seems requesting a fuckton of joined data in a view then selecting just what you want in the model is a giant waste of resources.

Maybe it's just how my company uses them. For some reason it's ok to join 15 tables in a view then use only 5 columns from it.

It seems like the better option would be to get exactly what you need with a custom query in the model.

Am I thinking about this all wrong?

I would go with vendors like Zend - it's at least recognizable

Best and easiest way to password protect a page?

If you have just a few users the easiest is probably .htaccess Auth

cheers senpai

Thanks buddy, I'll look into it.

>every single XML prettifier online doesn't accept malformed XML

why

How do i get download link for youtube video?
I need that for my script

function refill1() {
var a = document.getElementById("1");
if(a.getAttribute("fill")=="red"){
a.setAttribute("fill","blue");
}else{
a.setAttribute("fill", "red");
}
}
function refill2() {
var a = document.getElementById("2");
if(a.getAttribute("fill")=="red"){
a.setAttribute("fill","blue");
}else{
a.setAttribute("fill", "red");
}
}
function refill3() {
var a = document.getElementById("3");
if(a.getAttribute("fill")=="red"){
a.setAttribute("fill","blue");
}else{
a.setAttribute("fill", "red");
}
}
var el = document.getElementById("1");
el.addEventListener("click", refill1, false);
var el = document.getElementById("2");
el.addEventListener("click", refill2, false);
var el = document.getElementById("3");
el.addEventListener("click", refill3, false);


I'm obviously reusing the code like an idiot not sure how functions or callback functions would work for this situation

Model-View design is only efficient, if the model is kept in memory. Yes, they are doing it wrong.

Haha you guys aren't real computers lol learn to technology losers haha

I would use youtube-dl for the task. Why? You don't have to reinvent the wheel and it's regularly updated You can use a wrapper or do the calls yourself.

Just a stupid question. If I understand the structure of this code and how it works, is it a good sign? Am I doing good in learning programming?

eh i guess its a good sign if your just starting out, it's very basic atm it's just changing the color of a circle every time you click.

trying to stop repeating the code so when I have hundreds of elements i wont have to write all the function calls for each ID manually

function refill() {
if(this.getAttribute("fill")=="red"){
this.setAttribute("fill","blue");
}else{
this.setAttribute("fill", "red");
}
}
var el = document.getElementsByTagName("circle");
el[0].addEventListener("click", refill, false);
el[1].addEventListener("click", refill, false);
el[2].addEventListener("click", refill, false);

shortened it down but still repeating the el[i] tried using a for loop to use the event listener for each child circle of the svg element but it wouldn't work

>mysql update fucks up page by setting strict mode on
>need to change one line via ssh to fix
>root login with public key authentication required
>guy who built my page has the key but doesn't answer me
How fucked am I?
Please tell me that there's another way

>root login
if you set that server too, it is probably hackable too

this works







var theParent = document.querySelector("#shapes");
theParent.addEventListener("click", refill, false);
function refill(e) {
var el = e.target;
if(el.getAttribute("fill")=="red"){
el.setAttribute("fill","blue");
}else{
el.setAttribute("fill", "red");
}
e.stopPropagation();
}

>want to use the typescript playground page to quickly test something
>search for "ts playground"

why is the join method on strings and not on arrays in python? seems weird

lol

should've look for "sandbox"

well yea the account of the webprovider is mine
its just the rootlogin of the ssh that I need to get.
>hacking
I hope don't need to spend weeks for this

Just ask your webhoster if they can reset the root password

that's a good tip, thank you for that

MySQL keeps updating out of the blue almost every day taking the screen like this wtf

what is wrong with this anons:
shell_exec('youtube-dl -o \"'.$this->path.'%(title)s-%(id)s.%(ext)s\" '.$this->url);

error:
sh: -c: line 0: syntax error near unexpected token `('

So that it can't be misused or its function misinterpreted. It will always produce a string.

A lot of shit. Look up how shell_exec() works and how to properly escape and use arguments.

i used it many times in this way, just with ffmpeg

If you use single quotes you don't need to escape double quotes

i tried different ways but i always get same error
shell_exec("youtube-dl -o \'".$this->path."%(title)s-%(id)s.%(ext)s\' ".$this->url);

error sh: -c: line 0: syntax error near unexpected token `('

does the same thing to me, once a day or so I think. Should we be worried?

You did exactly the same thing as before but changing single and double quotes kek

try this:

shell_exec('youtube-dl -o "'.$this->path.'%(title)s-%(id)s.%(ext)s" '.$this->url);

i got it already, i left "/", after deleting it it works

is there a such thing as freelance sysadmin that works from home? I mean could I get freelance work maintaining servers from my bedroom?

>start project that should take 20 minutes at most
>takes five hours

As long as you learned something worth the time

What's the fastest way to shit out single page static website? Like, a landing page for a single product. Wordpress?

Probably buying a landing page theme with a builder.

not him but what sites do I look for shit like this?

Does anybody know of very stable language/framework suitable for very low maintenance. I'm sick of PHP pajeets changing APIs with releases that then break my application, which I don't have time to fix. Is C with cgi or fastcgi a good choice?
>inb4 django
Only 3 years of support with LTS release. I'm looking for 5+ years.
Page gets 1-2 visitors per day, just simple image gallery with content stored in database and gets updated regularly.

This is from themeforest which I used quite a lot. There's also templatemonster

##this is all inside a for-loop:
article = {"url": url, "score": score, "country": 0, "length": length_article} #dict

add_Article(db_article) #call funct
##end of loop

def add_Article( a): #def funct
p = Article.objects.get_or_create()[0]
p.urlId = a['url']
p.feels = a['score']
p.date = time.strftime("%c")
p.length = a['length']
p.save()
return p


Using django, I have a list of dicts, from where I take said dicts one at a time, populate them and then try to save them to my database with the save() funct. It all goes alright, except for the save part: the only dict saved is the very last one. Any help pls?

Is article and db_article the same?
Did you try calling add_Article twice in a row with different dicts?

i am considering to pay for a video tutorial series at udemy so i can learn node.js properly. cost almost nothing and looks like it covers everything a beginner needs to know.
thoughts?

>Is article and db_article the same?
yeah, they are the same, just messed it up when pasting it onto the code box here.

so I found part of the problem: the [0] index (I think) makes it overwrite everything onto the same slot in the database (always the first slot). I have checked and as I run the script the dicts are being written one on top of each other, and at the end only the last one is left, of course. So I need to get rid of that [0] in the add_Article def, but if I just delete it, there's an error. Ideas?

btdig.com/search?order=0&q=node js

It's a long time since I worked with django but you could try this:

p, _ = Article.objects.get_or_create(
urlId = a['url'],
feels = a['score'],
date = time.strftime("%c"),
length = a['length']
)
p.save() # no idea if you need save
return p

nah, that won't even run, but thanks anyways

Did you fix the indentations so it works with your code? It's pretty much what the doc says:

docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create

alright, I'll take a break and give it a shot. Burnt out already from dealing with a lot of previous shit to get to this point. thanks again, I'll read the docs carefully this time.

...

is this true?

idk i look exactly like the guy on the left and im full stack

get at me

Did anything noteworthy happen after the Opera what was it, 12.15? source code was leaked?

i have not extensively researched the topic but i haven't heard of anything

it's probably super illegal to use the leaked code and there are better alternatives that won't get you sued to hell

Well damn, that's a shame. I suppose it isn't anything worth getting sued over though. Thank you.

fuck that crap. i paid just now

Swift developer here. Used to be into php and laravel, if I were you I'd check out laracasts.com

uhh, no. If anything it's the opposite. Front end is stacked with young guys, back is olds

Anyone has a copy of From Newbie to Ninja with Node js?

Is it possible to do Web deving entirely using Wincuck

That title is everything wrong with webdev
Let me guess, some '''''code artisan''''' wrote it? Fuck

yeah, alright, now it's working, thanks dude. I'm following another book, and trying to adapt the book's example to the project I want to do. Guess I fucked up somewhere in the process.

I really don't care about code artisans or people in general I just want to learn.

How do i remove that white border color?
jsfiddle.net/2uygL2v5/

border: none;

>border: none;
ty

What's the simplest php engine out there? I am tired of pure html

Just got off a phone interview for my first webdev job (was a network engineer prior), they liked the tech I used and liked my apps but obviously were concerned that I hadn't worked a dev role previously. The guy was interested in bringing me in on a 90 day contract and was going to propose this to HR. would you guys work on contract for your first job?

yeah, if it's the only offer you've had in a while, go for it. If you think something better is just around the corner, wait a bit. But me, I'd take it. You trust you can show them you're actually worth something in those 90 days, right?

And maybe you can even impress them and go for a raise after the contract is up...

is pastebin down?

pastebín is down
pastebin is not

sorry for spoonfeed

thank you

lol OP needs to get his shit together!

yeah I'd take it assuming I'd satisfy them and get a job out of it but that they'd lowball me when bringing me on full time so I'd stay 6 months and get a job elsewhere for more money

It's a test.
A good webdev should pay attention to tiny details 24/7.