/wdg/ - Web Development General

What you making /wdg/? Better be good, or else.

Previous thread:

Attached: web-developer-anand-lagad.jpg (719x304, 20K)

Other urls found in this thread:

codl.dev
overreacted.io/making-setinterval-declarative-with-react-hooks/
wiki.php.net/rfc/jit
wiby.me/chat
developer.chrome.com/extensions/xhr
twitter.com/SFWRedditGifs

>no links and pasta
U fucked up bud.

Attached: 1554577577015.jpg (600x532, 42K)

You mean you want to show the cart modal on every route, right? Do it like you would do it with a header, wrap your routes around a view which has the navigation bar and the modal.

cursed thread

Look at this baby that needs to be spoonfed

>no links and pasta
fuck the links and fuck you too, this is just advertisement for shitty hosting companies

i've finished my react/redux course, what should i learn now? i don't want to get into mobile dev yet.

Thanks for making my user interfaces that depend on my backend, you retarded low IQ stack overflow pasting monkey retards!

*smokes cigar in 200k starting*

Attached: golan.jpg (554x554, 30K)

?

Google based shits are prohibited on Jow Forums, dude.

Redpill me on vue

what kind of maths do i need to do web developmement?

shit OP
make a new one

prenatal math

It's pretty neat.
What are you interested in?

vue

what is a good language for backend? I know perl, c, c++, and a bit of php. I've always heard php is the best for webdev but does anyone else have experience working with the other ones?

mate, you just want someone to read you the Vue introduction from the website?
It's a frontend framework like React, but with some difference. Be more specific.

Attached: evanyou.jpg (500x500, 69K)

Modern PHP is decent, but you have to deal with vast amounts of online advice and examples being tailored towards earlier versions and/or made by utter pajeets in the worst sense. Also the old stuff is still in the standard library and you may still have to deal with it.
It honestly depends what you're doing. Simple CRUD app? Something like nodejs or flask can allow extremely fast prototyping, but it's shit for long term maintenance. Typescript is better, but it shares shitty performance with the above. PHP is interpreted too, though, mind you.
I've never done C++ web dev, but it might be a great option if you want performance and maintainability IF there are good libraries for HTTP handling. Take a look and decide.

You'll get any language recommended here.
I would guess that as a solo dev, JS and PHP are the most common.
Personally I like the whole fullstack JS deal, but as long as you like a language and it has at least some kind of established webdev ecosystem you can go for it.
JS, PHP, Python, C#, (Java), (Go?) all have an established presence in webdev.
I have the impression, that C# and Java are often a bit more on the enterprise-y side, but don't take that as a negative if you like using it.
JS and PHP always get a lot of hate, so you got to deal with that as well...

>the evan guy is here again

Anyone know how to listen messages from a server, using socket.io and socket.io-client and react without using componentDidUpdate()?
What I mean is
>Sever uses socket.io
>Client uses socket.io-client and react
>Client does something, that changes a list on the server
>Server receives the message from the client, and updates its own list
>Server then sends out the update list to all of the connected clients
>Clients list doesn't get the updated list because there isn't anything actively listening
>Client's list doesn't get updated until something client-side changes, making them ask the server for an update on the list
Feel like a real brainlet right here.
The only solution I can think of is to use componentDidUpdate to actively make sure to catch messages from the server, but the downsides to doing that don't make it worth it.

Still working on codl.dev

Lots of features to implement...God I hate React!!!

Attached: 1533354471579.png (245x261, 103K)

From my experience, C# can be pleasant to write, if you like OOP. Java makes me want to kill myself every time I touch it without exception.
Go is extremely opinionated to the point of being insulting. Maybe worth a try but unless you end up agreeing with it on everything, don't bother.
The rest are really up to preference.

>Clients list doesn't get the updated list because there isn't anything actively listening
What do you mean here?
If you are using sockets, doesn't the client listen for server messages?
And then when you receive the message, you simply update your state so your UI gets re-rendered?

Attached: evanyouu.jpg (500x500, 61K)

>What do you mean here?
Kinda like if you're subscribed for a newspaper, it arrives at your door, but because you aren't staring outside nor have some kind of alarm, you don't get the paper until you actually open your door.

guys I cannot access DOM of iframe from chrome console without manually switching context in UI because of cross origin security how come? will it work as browser extension? I need to manipulate recaptcha iframe

Attached: 1558668846665.png (405x430, 284K)

Is there a way to make a disabled checkbox look like a normal one instead of grayed-out?

but when the socket handler receives a message it just passes it to a function, that can then do anything with it.

Just like when a user clicks a button, which calls a function, that can have any kind of effect, here the socket handler calls a function, that can also do anything.
Does this make sense?

Also, are you using hooks?
That makes working with sockets a bit more tricky compared to class components.
Kinda like what's explained here. The issue is the same.
overreacted.io/making-setinterval-declarative-with-react-hooks/

this is what i do with my class components. haven't started using function/hooks yet
class SocketComponent extends Component {
// ...
componentDidMount() {
this.socket = io.connect()
this.socket.on('message', handleMessage)
}
handleMessage(data) {
this.setState( // do something with update )
}

>screenX/Y, clientX/Y, pageX/Y, offsetX/Y, layerX/Y

Attached: pit.jpg (523x523, 22K)

Modern Java using Micronaut.

bump

almost the second archive in a day

Attached: 1553552250661.gif (1200x1300, 416K)

laravel question
so i have a user table in which i have also stored user role. i want to have routes only specifically for a certain user role i have created a middleware which check if user role is same as mentioned in the route and then does other shit.
Is this implementation ok? everything i found on the web was some gates and policies shit. is that necessary?

Nah famerlam, php 7 is jit.

Yeah alright, after hours of digging and testing I finally found out what the problem was
socket.emit() is not what you want if you want to send to multiple people at the same time. Its only good for client.
To send to all clients at all times, I need to either have the server do io.emit() or socket.broadcast.emit()

not yet
php8 will be
wiki.php.net/rfc/jit

bampu

Any of you get any work on upwork?

function* Range(floor, ceil) {
if (ceil == null) { [floor, ceil] = [0, floor] }
if (floor < ceil) { for (let i = floor; i < ceil; ++i) yield i }
else { for (let i = floor; i > ceil; --i) yield i }
}

const array1 = [...Range(-5)] // 0, -1, -2, -3, -4, -5
const array2 = Array.from(Range(5), checkPrime) // false, false, true, true, false

for (let i of Range (5, 10)) {
console.log(i) // 5, 6, 7, 8, 9
}

Having a native Range support in JS seems such a no brainer, why isn't this a thing yet?

what does /wdg/ use for client side templating? I used to use underscore but I need something that doesnt use eval.

How do you get text to align center on the y-axis? I know align-items: center works for elements.

Doesn't matter if I put the text in a or not. Can't figure it out.

Have you tried Handlebars?

I just finished creating a service. Time to make a website that allows customers access.
Any tips/advice for ASP.NET Core 3 is appreciated.

Testing out my primitive chat server again if anyone wants to try it. Can join it at wiby.me/chat

Attached: ghostchat.png (572x380, 10K)

Anyone knows why my form is so spaced between the titleand the the bottom of the modal. When I change the windows size the form stays at the same size, only the padding gets smaller.

Create Product




Name

Description

Price




and the css is


.form-title {
margin: 20px 20px 10px 20px;
}

.horizontal-line {
margin: 35px 20px 10px;
border-color: #000;
}

.form-left-part {
display: flex;
width: 90%;
flex-direction: column;
justify-content: flex-start;
}

Attached: problem.jpg (1680x1874, 258K)

Anyone here integrate Google Sign-In to an app? For some reason my sign in button shows up for a brief moment then disappears.

elixir is easy, performant and scales to infinity.

flexbox (or grid), anything else is archaic and poorly designed and should be avoided like the plague.

So what's the best way to go about starting a long-running task from ASP.NET Core? It can take up to an hour to run. I made the actual task in C# as well, so I can either invoke it from code or run it as an external process.

Graphql or rxjs

Do Vue then

what web things (frameworks / languages / etc) let you write single page apps somewhat similarly to conventional GUIs?

I'm aware of:
- Apache Flex (formerly Adobe Flex)
- Wt (C++, similar to Qt, server side app that merely renders itself on the client)
- jWt (Java version of above)
- Smart Mobile Studio (Delphi-esque apps for the web, pure client side)
- GWT
- ?

Any other oddball projects out there? I'm looking for something to use for a client who is really old and rigid and wants nothing to do with modern web stuff.

Working on a media server in PHP so that I can share my move/TV/anime hoard with my pals.

don't use inline styles, also it's hard to tell since you are using those custom mat-grid-tile elements.
Your browsers dev tools will show you the padding and margins of elements and which css rule they come from.
plain HTML and plain JS? Don't know how you could go more basic.
But even with frontend frameworks you still write 'plain HTML', you just generate some elements via some functions, so..
Does your client know that it's going to be much more difficult to maintain something like that in the long run?
Lets say you find some weird GUI creation tool, that creates your interface and translates everything to HTML. He might have a hard time finding people able or willing to work on it.

Honestly that guys attitude seems like a red flag, that you will constantly have to fight those arbitrary constraints of not using 'modern web stuff', unless it's defined in such a way as 'can use anything, but has to run on IE 11' I guess.

I appreciate the friendly concern but I've known this guy for a long time and he's the opposite of a bad client. I guess I should have worded it differently but I was preemptively trying to avoid having to explain the "why" since I know how web purists feel about these kinds of things.
legitimately just looking for information - I know what I'm getting into.

Who does everyone host thorough?
How much do you pay for your own address?
I'm only using a free host with "website.000webhostapp.com" at the moment.

Attached: 22025187.jpg (320x240, 25K)

You mean the domain names? Prices vary a lot depending on the TLD.
I'm hosting myself, but if I had to go to a company then probably OVH.

You can get very cheap shared webspace hosting though with many of them already including multiple domain names for like 5 euros a month.

gat

How can like C# but not Java?

Serious question here. What distro do you guys in /wdg/ use?

>The requested resource could not be loaded because the server returned an error:
502 Bad Gateway (?).

>if (ceil == null)

isn't ceil undefined if don't pass the 2nd args?

stock ubuntu

I haven't written C# in like eight years but right off the top of my head: properties, which make data in classes so extremely concise to write and use, compared to the need to write two entire functions in Java for the getter and setter and then the need to call myobject.getThing() or setThing() rather than just myobject.thing. That's just one thing which makes a huge difference to the experience.

it's probably written by some C# faggot

No, that's JS. Undefined and null are equivalent, you can use double equals to check both are once.

Huh, this isn't the general..??

"Talking about stuff in general:):)"!

anyone doing ios dev?
ive done some at my job, but extremely small apps.
I dont know if i like it, does it ever get less awkward? It feels like pretty apps are hard to design and harder to build.
Feels like im using a silly amount of time and code just to animate and place an expanding textfield.

And how do more complex apps work? Do i just do most of the work on backend and do API calls?

>Undefined and null are equivalent
uhhhh

> null === undefined;
false


You're not one of those people that use "==" in Javascript, are you?

>compared to the need to write two entire functions in Java for the getter and setter
Nobody does this irl. Just use Lombok.
>the need to write two entire functions in Java for the getter and setter and then the need to call myobject.getThing() or setThing() rather than just myobject.thing.
You can do that in Java too, it's just considered bad practice.

You can do that in a browser extension, as long as you request permission.
developer.chrome.com/extensions/xhr

You can detect the disabled state using either an attribute selector like .my-checkbox[disabled]. But there's also a pseudo class, so you could do .my-checkbox:disabled. I'm not sure if there are any scenarios where they would be different (e.g. an input getting disabled some other way, or browsers not supporting that pseudo class), but I think your best bet is to just use both.

So the selector would be:
input[type="checkbox"]:disabled, input[type="checkbox"][disabled] {
/* styles go here */
}


But I don't know what styles actually control the grayed-out look of the checkbox. Chrome's user agent stylesheet sets a couple styles on disabled inputs, but apparently not the part that does the graying. You might be able to fuck around with filters to disable it, or just rebuild the checkbox with your own CSS.

function *range(a, b) {
"use strict";

a |= 0;
b |= 0;

const c = a > b ? -1 : 1;

if (a^b)
do { yield a; } while(b^(a += c));
}


Compared to above code is ~1.6 times faster in Firefox, but roughly on par in Chrome. I've had similar results in the past, where using bitwise (obviously limiting arguments size from "only" (-1) * 2^31 to 2^31 - 1) operations in FF yielding huge performance gains but doing fuck all in Chrome.

I'd probably still go with the other method just for readability. Pretty sure this is fast because the bitwise stuff forces the engine to use 32 bit numbers for the math which has a better optimization path in some implementations. I think you were alluding to that though.

Sometimes you have to if shit returns "undefined" rather than undefined

What's a free html widget for contact form, should have upload too?? One that works with gmail

Attached: 1553810173084.jpg (600x903, 137K)

Shit should never return "undefined" because that is retarded.

>when even chrome API returns undefined undefined
>asking for standards
>in JS
kekity kek

Where does the chrome API return the string "undefined"? Nothing wrong with returning undefined the value, but string undefined is retarded (unless you mean typeof)

damn this thing is polished. it even helps you setup keyboard shortcuts without having to search the mpv documentation.

also, has built in subtitle download support (no need for some custom python scripts)

I bet linuxtards are just jealous of it.. someone took their great player and made it better on a proprietary OS.

Attached: Screenshot 2019-06-02 at 19.40.11.png (2582x1222, 2.12M)

Bitwise operations in general require fewer cycles. In fact, when setting registers to 0, on most modern CPUs it's actually faster to do

xor eax,eax


as opposed to

mov eax,0


>because the bitwise stuff forces the engine to use 32 bit numbers
It's not so much the forcing javascript to work with int32 that speed things up, but rather the limiting of variables such that they can never be anything other but numbers. It allows the engine to skip certain checks and perform other optimizations.

I'm quite curious as to why Chrome doesn't do this. (At least not to the same apparent extent.)

>I'd probably still go with the other method just for readability
I think it's perfectly okay for utility functions you'll thrown in a /lib or /include and never look at again to be slightly less readable.

forgot to mention, preview thumbnails..

Attached: Screenshot 2019-06-02 at 19.46.10.png (1326x280, 421K)

Daily reminder that web dev is not real programming and all you do is copy code from Stack Overflow to make flashy cookie cutter websites.

I recommend C++ if you really want to call yourself a programmer.

sorry, wrong thread...

How many programming socks do you own?

Attached: 1507851105118.jpg (431x450, 37K)

>You can do that in Java too
And have control over access (e.g. exposing fields as read-only) or provide special access logic (e.g. bounds checking when setting)? Really?
If so, then good on Java for finally modernising a bit, but I am almost certain that wasn't a thing as far as Java 7.

That's fair. I guess the degree I'd care it depends how much I'd call the function. My understanding was that the optimization was due to the 32bit thing, but it sounds like you know what you're talking about. Perhaps V8 is able to optimize it regardless, since perhaps it performs better analysis? I'd be interested in seeing if the performance degrades at >2^32-1.

What's the easiest LIGHTWEIGHT way to enter an arbitrary date in javascript? I want it to be as unpozzed as possible.
Failing any good answers here, my plan is just three textboxes and a "set" button, where I'll do some basic validation on the values (and show an error if necessary) then construct a Date object to better ensure it's an actual valid date (in particular that the day number is valid for the month, since I don't wanna do that by hand).

This is for a simple helper app I'm making for an acquantaince, it's meant to be ran locally and won't be publicly available on the internet and likely won't be used by more than one person. Needs to work on modern-ish Chrome mostly.

>What's the easiest LIGHTWEIGHT way to enter an arbitrary date in javascript?
what did he mean by this?
> then construct a Date object
so the problem is solved?

I was just checking if there might be a small library (without a bunch of dependencies or megabytes of super fancy calendar selection) or maybe a best practice to do this.
If my manual method isn't strictly inferior to some common way, then I'm happy

definitely smaller and faster

What's smaller and faster than what

manual method

Modern Java using vert.x
Scales better than elixir

Optimal laptop for learning webdev.
What do you recommend?
In before >laptop

>notebook

Honestly you don't need much in the way of specs to do web dev. When I started I was using a Macbook air with 4gb of ram, and that was perfectly capable of running a local dev server (apache or node or rails or whatever) plus a browser or two. I would recommend something with an SSD though.

Personally I would recommend MacOS or Linux (ChromeOS might be ok, I'm not sure), but if you're more comfortable with Windows that's ok.

For webdev you really need screen space more than for other types of dev, because JS being dynamic you really want debuggers and shit open. If you can't comfortably fit a webpage alongside the chrome console (inb4 >chrome: chrome is pretty much standard for webdev, but you can use FF and it's the same shit anyway), you're gonna have a painful time.
From experience, 1080p on a 14'' T480 with no scaling is usable. Not optimal, but usable. Less than that, in either size or resolution, and I would start suffering. A 15'' or more would be better.
As for specs, you don't need shit as long as you don't buy ancient pre-2010 memes, my X220 can do webdev (when I dock it to some bigger screens).

javascript.info vs Eloquent Javascript, which is better?