jsfiddle.net - Use this and post a link, if you need help with your HTML/CSS/JS 3v4l.org/ - Use this and post a link, if you need help with PHP/HackLang
why do we need a promise here? function getCanvasBlob(canvas) { return new Promise(function(resolve, reject) { canvas.toBlob(function(blob) { resolve(blob) }, 'image/jpeg', 0.9) //mime, quality. can be image/png or image/webp also. }) }
Asher Watson
Python or Ruby?
Xavier Watson
>make a website >and a twitter account to promote my website >my twitter account is very popular and has many thousands of followers >my website only has 2k uniques per month sigh
Samuel Gutierrez
What kind of site it is? And is the Twitter account purely just advertising?
What are some Laravel books for beginners? From what I found in google: >Beginning Laravel: A beginner's guide to application development with Laravel 5.3 >Laravel 5.1 Beauty: Creating Beautiful Web Apps in Laravel 5.1 >Laravel: Up and Running: A Framework for Building Modern PHP Apps >Laravel Application Development Cookbook >Laravel Starter >Laravel 5 Essentials >Learning Laravel’s Eloquent Which one Jow Forumsents?
are you being forced to use laravel by your company ? if not, learn something else.
i explained why laravel sucks before , you can see it in the previous thread :
Brayden Morris
>>are you being forced to use laravel by your company ? if not, learn something else. Well not really, I'm at an apprenticeship and I have to design a kinda CMS where a user gets their info from other databases, makes documents, fill out forms and has views (configurations by administrators for regular users documents) and to keep their data well structured and move away from excel and paper. I thought PHP and Laravel would be nice to learn since I'm starting to see job postings and fuzz about it.
if you would like to use modern javascript framework ( such React or VueJS ) , i suggest you use the api platform ( api-platform.com/ ), its built on top of symfony and have a really nice documentation and tutorials.
note, if you learn symfony very well, it would be easy for you to learn laravel in few days, laravel is symfony but oversimplified to the point where it sucks.
>Switching to Python with all the SJW bullshit happening recently Just learn Go or Kotlin
Juan Lewis
Can someone explain me about design patterns in PHP (I am still a learner)? I thought it was about UX stuff but it's actually something entirely different. >Singleton >Factory >Observer
Easton Moore
I'm not even joking, i was writing a detailed explanation for each of these design patterns, till somehow the fucking browser window closed
is any of this stuff applied in small/big projects? Honestly it looks complicated
Blake Nelson
>is any of this stuff applied in small/big projects? >its literally used in all frameworks and that's why people should stop thinking CS degree is a meme please kys ty
Zachary Barnes
don't forget about sololearn.com you can learn a bunch of shit off of there for free
>is any of this stuff applied in small/big projects? yes, every framework nowadays apply those patterns, if you ever used zend expressive you'll notice it makes a high use of factories and you need to create a factory for each class
>Honestly it looks complicated actually its not, at the beginning yes, it does but after a while you'll have a batter understanding of these patterns and you'll be applying them yourself in your next project. i don't have a CS degree
I just got put on a new project and I am wondering if I should use a front end framework like Bootstrap or if I should just man up and learn the new CSS3 stuff. what do you guys recommend?
Do i need to learn how and when to use all of them?
Gabriel Morgan
yes
William Evans
please don't die.
not like this thread !
James King
I use as few as possible. Also you should have a good CSP so potential malicious frontend dependencies can't exfiltrate users' data from your web app.
That's for security vulnerabilities found in innocent code, is referring to intentionally malicious code hidden in what seem to be innocuous dependencies.
So far I only understood the singleton and factory patternbut have no idea in what cases do you use these patterns at all
Luis Hernandez
factories and singletons belong to the "Creational" design pattern >In software engineering, creational design patterns are design patterns that deal with object creation >mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object >creation could result in design problems or added complexity to the design. Creational design patterns >solve this problem by somehow controlling this object creation. - designpatternsphp.readthedocs.io/en/latest/Creational/README.html
go there and read more, its explains it in details with examples, i'm really busy rn, sorry UwU
Lincoln Peterson
PHP: If testing an empty string returns false (eg. using if statements), why should I use isset()? Is it only used for _POST/_GET?
Xavier Reyes
this is how you should check if a string is empty :
if ('' === $string) { // $string is empty :) }
why use isset ? isset is used to determine if a variable is set and is not NULL. mostly used on '$_GET', '$_POST' to check if the field is set example: if (isset($_GET['attr'])) { $attr = $_GET['attr']; } else { $attr = 'default'; }
// since php 7, you can do this instead : $attr = $_GET['attr'] ?? 'default';
another use of isset is to check if a variable is set :
i would recommend using zend diactoros ( symfony is great too ) cause it implements the PSR-7, which is used by so many php frameworks / projects, that means if you start later using any framework or library ( that have something to do with requests/responses you will likely find it using a PSR-7 implementation, so you can give it a zend diactoros object ) that implements PSR-7 in no time.
I have a server with limited memory and I want to serve large files to a web browser, is there a way to send a file in chunks instead of loading the whole thing to memory before sending the http request? do browsers support getting files in chunks? is sending big images and web pages in such a way supported?
Blake Parker
>tfw want to learn Angular and have been trying to learn it for nearly a month, but still can't manage to get a basic UI for a CRUD app up. Meanwhile It only took me 2 days to do it in Vue.
Is this fate /wdg/? Should I abandon Angular and join the chinks
yes you can use this for php, but i recommend you use zend diactoros or symfony http foundation, they handle it way much better, but i found this in stackoverflow, i fixed some issues with it and it should work fine : 3v4l.org/KeUdg
usage : $response = new StreamResponse('path/to/file.mp4'); $response->stream();
for PHP i recommend using PhpStorm, nothing comes close to it, but its not cheap.
Christian Moore
$response->send();**
Blake Gonzalez
I worked through `Full-stack Vue,js 2 and Laravel 5` and found it really good, it took me ~22 hours over a weekend and it really made a lot of things click around modern front end and back end (basically an API and and SPA), while also covering the basics of Larvavel (it didn't go too far in detail). Now I work with Django and React and a lot of knowledge carried over from that book.
You mean that meme going around about the guy changing a couple of words in the documents? Most of those changes were better metaphors, for example changing master to server in the ssh section, master makes no sense w.r.t ssh.
Or is there some real SJW shit happening with Python? (Seriously I would like to know, I work with Python)
Thomas Roberts
python removed master/slave terminology because it was "offensive"
its maintained by absolute faggots, just use perl.
* Have they made any changes to Python code (not documentation) because it was 'offensive' ?
* Have they changed master/slave to any worse metaphors?
Personally I agree with the Redis maintainer's views on this (antirez.com/news/122), we shouldn't have to change our work because it offends someone. That said even he is changing Redis slowly to move away from master/slave, it seems to be something hard to get away from.
On one hand I support the whole diversity thing in principle, I don't just want to work with white dudes. And I don't really care about words becoming 'not allowed' that happens, words are attached to emotions, you can't say nigger without stirring up people we all know that. But what does really bug me about the master/slave thing is Americans pushing their world view on the rest of us, like I get slave is a more emotive word in their country but they cannot grasp that it doesn't have that history anywhere else.
Thanks for the invite Herr PHP, but if I'm going to switch it'll be to Go
Justin Collins
pls respond
Robert Smith
Don't use fucking CSS frameworks period. What are you, a codemonkey brainlet?
Christopher Allen
And while I'm on the topic, master slave is a terrible metaphor most of the time it's used. A slave DB doesn't obey the master, it replicates it and steps up if the master goes down, primary/replica makes much more sense. Sometimes master/slave is used instead of server/client, also wrong.
I automotive brake systems (and most hydraulics) you have a master and slave cylinder, this explains their relationship perfectly, the master creates some sort of control signal (hydraulic pressure in this case) and the slave does the work, one is useless without the other. I can think of no better words.
Serious question, I'm self taught and missed all that important CS stuff. Are there any software relationships that are best described by master/slave?
**This post is not an endorsement of changing thing because people are offended, offended people can fuck off and we should do the opposite of what they want. I just like talking about the words we use.
Bentley Lee
The problem isn't the words itself. It's the motive.
They tried to remove master/slave entirely for political reasons, which should fuck right off as that has nothing to do with software development.
Carson Murphy
Don't use Chrome or FF you brainlet, write your own browser.
Depends on the project, I'm working on a big project with 7 devs and a designer, the designer wants things a certain (custom) way, there would be little benefit to using a framework, so we write from scratch and it's extra work and cross browser testing.
Bootstrap 4 without JS (or Bulma) is a great framework, not too big and reasonably customisable (through sass or their online tool). It will help you get more done faster, it will push you towards helpful conventions, it has great documentation and examples. But it might not be the right tool for your project But it probably is, because you're probably not making anything groundbreaking, what you're doing has been done before (more or less) and that's okay, don't reinvent the wheel, do it simple and do it well.
Leo Reed
I disagree with you slightly, banning words should be avoided but I think it's important to make people feel included and safe where reasonable.
If CS had developed earlier and had actual racial slurs in code, not some bs trigger word, like imagine if master/slave was white/nigger.
> "the white server has gone down, it's got a Trojan Kike, switch to a nigger server" > "oh shit, the nigger server's down too" > "dammit Dave I told you not to lock those niggers in the basement and forget about them, you have to check they're working every day"
That would be bad, there's a limit.
Most people seem to get into software because they ideological, they want to work on new things, push the word towards a better place. I wish we could redirect that energy to some actual positive change instead of arguing about words.
Brandon Wilson
yo js zoomers, the php boomer need help
i'm using uikit css framework, it have the "countdown" component ( getuikit.com/docs/countdown ) which seems nice, in this project i'm not using vue or any other js frameworks and trying to minimize the use of js, beside uikit.
after the user registration , he's being redirected to '/welcome' a page where it says "welcome {{ username }}" and some other shit, anyways, i wanna redirect the year to the home page after few seconds from landing on "/welcome", is there a way to do that using the countdown component from uikit ? it seems like a i need to pass a time to the attribute and i don't wanna do that in the backend using twig cause the i wanna redirect the user after 5 seconds from the page being fully rendered, not since the server sent the response ( the page may take more than 5 seconds to render after the server sent the response in cause the user have a slow internet connection ), what i'm trying to say, can i insert the 'date' attribute using java-script ? how do i add an event listener to redirect the user after the time is over ?
Jack Cooper
this is the "welcome.twig" file : {% extends '@layout/default.html.twig' %}
{% block title %}Welcome{% endblock %}
{% block css %}
{% endblock %}
{% block content %}
Welcome {{ user.getUsername() }}
Lorem ipsum dolor sit amet, cons.... You'll be redirected after ( this is where it should go )
Why would someone put an expressjs application behind ngix?
Anthony Taylor
just use bulma sweetie its the only sane css framework if you truly want to use as little JS as possible
Grayson Bell
nginx is being used as a load balancer?
Luis Sanders
i'm gonna need js later anyways, its not like i'm trying to avoid it at all, for now, i'm trying to solve this problem, how can add the date parameter with js !
Hudson Sanchez
I was writing a detailed example but my computer crashed, having hardware issues recently, ugh.
Basically just use history.pushState inside a setTimeout, look it up on Mdn its hella simple
Nathaniel Reed
Or now that I think about it maybe this is the sort of page you don't want to go back to, in that case use history.replace so the page they're being navigated from isn't saved in their history
Hunter Gutierrez
ended up doing this ( the text says you will be redirected after few seconds ) : let seconds = 5; const countdown = function () { seconds = seconds - 1; if (seconds < 0) { window.location = "{{ path('home') }}"; } else { window.setTimeout(countdown, 1000); } };
countdown();
Gabriel White
fuck this, i hate js i'm going to sleep
Zachary Long
Same but simpler
let seconds = 5; function countdown() { window.location = "{{ path('home') }}"; } setTimeout(countdown, seconds * 1000);
trying to do something simple through a framework is so absurdly silly like come on now
Connor Russell
>visit website >it's broken in some way Nearly every time.
Justify your existence to me, please. Why shouldn't there be capital punishment for webfags?
Thomas Cook
So you just said that you dislike active record and you like the repository pattern. That's like, your opinion, man.
Jordan White
20 layers of abstraction and weird unmaintained frameworks backed by a bunch of hipsters.
Jacob Kelly
You should use something like Nginx to serve static files instead. If you want to do authentication or handle other logic you can do it like this:
Nginx location /protected/ { internal; alias /data/files/; }
PHP (or any other language) header("Content-Type: video/mp4"); header("X-Accel-Redirect: /protected/the_file.mp4");
Austin Perez
>>it's broken in some way >Justify your existence
My websites do what my customers' want them to do and they work in the browsers specified at the start of the project (usually IE11 and the main 4). Either you're on shithouse websites or the site wasn't made for your autistic browsing stack
Luis Hughes
I'm trying to add a font I made to my website but it is only shown to people who already have it installed, Here is my code : @font-face { src: url('css/duf-webfont.woff2') format("woff2"), url('css/duf-webfont.woff') format("woff"), url('css/duf-webfont.ttf') format("opentype"); font-family: "duf"; }
What's the issue here?
Sebastian Butler
no i'm gonna change the text every second, so ... why would i use a framework just to do a countdown, jeez
that's not how you send big files with php
Gabriel Reed
>want to learn Ionic >can't find a complete tutorial
brainlet here, use the thingy that is triggered on page load onjs. So on page load >countdown, on countdown > page switch
But I'm a brainlet maybe someone else has a better idea bout that.
Nicholas Adams
I can myself see the font because I have it installed on my pc so I don't have any errors
Leo Young
Please teach me how to use 206 Partial Content, I'm reading an image file line by line and sending it, how should I format the http header?
Jonathan Cruz
Why you niggers keep using ES6 if that means it isn't going to be compatible with IEedge anyways? it's not the time for it yet, or am I missing something?
Brayden Anderson
>implying i give a fuck if it doesn't works on ie or edge
Nathan Allen
so try with another font that you don't have installed
Tried with google font and it worked, now where does this gets me? Is there something wrong with my font?
Hunter Perry
it might be the url that is fucked up
Daniel Bailey
do the following, pick a font that has all the different formats like the first example in don't install it in your browser, if it doesn't work you are messing the url, usually you put the fonts in a font folder which would be something like./fonts/myfont.extension