-
38 votes
-
JavaScript bloat in 2024
51 votes -
Build your own web server from scratch In Node.JS
6 votes -
Node's "Single Threaded, Event Driven" programming model seems highly deceptive and farcical
The more I think about it, the more I'm convinced of it. The biggest selling point of Node folks has been the "single threaded, event driven" model, right? Unlike JavaScript, other languages work...
The more I think about it, the more I'm convinced of it.
The biggest selling point of Node folks has been the "single threaded, event driven" model, right? Unlike JavaScript, other languages work on a "blocking" basis i.e. you run a statement or command and the program "waits" until the I/O is complete. For example, you issue
open('xyz.txt', 'rb').read()
in python and the program waits or blocks until the underlying driver is able to read that whole text file (which could take arguably long time if said file is too large in size).But with the Nodejs equivalent, you just issue the statement and then pass the "event handler" so that your program is never in the "waiting state". The whole premise of Node/JS event-callback is that "you don't call us, we will call you".
This is all nice in theory but if this were indeed true then Nodejs scripts should be blazing fast compared to Python and even Java considering that most programs we write are I/O heavy and 99% of time, they're just waiting for an input from a File/URI/User? If this event callback model indeed worked as effectively as claimed, Node would have been the numero one and only language being used today?
I think I'm starting to understand why that isn't the case. This whole "single threaded, event driven" thing is just a farce. You can also replicate the same thing that Node.js is doing in your Java or Python too by applying multi-threading (i.e. one thread just "waits" for the I/O in the background while the other keeps doing its job). All you've done here is just handed or delegated that complexity of multi-threading to Node.js?
Realistically, it's impossible to wait or block an I/O request while at the same time also letting the other part of the code engage in other tasks, that's the very definition of multi-threading. Doing "async" is impossible without multiple threads in that sense. Node must have a thread pool of sorts where one of them is engaged in the wait/block while another is running your JS code further. When the wait is over, the control is then passed to the "event handler" function it was bound to in that other thread.
What Node is selling as "single threaded" applies to application or business logic we are writing, node itself can't be single threaded. I feel it's better to just implement multi-threading in your own code (as needed) instead of using something convoluted and confusing like Node.js. What say you?
8 votes -
With Focus you can search the web you want
21 votes -
The Block Protocol
10 votes -
Web Environment Integrity - A Google proposal for general web drm
47 votes -
Is it possible to build a sustainable image and video hosting service?
The history of the web is littered with with many a dead image/video hosting service. Echos of their existence plague older forums in the form of broken links and images. It seems like they all...
The history of the web is littered with with many a dead image/video hosting service. Echos of their existence plague older forums in the form of broken links and images. It seems like they all follow the same path, starting up as the new "simple" service that just hosts images, no fuss. But then as interest grows, so do costs, and the service owners have to scramble to monetize. Generally this is done by stuffing the place full of ads until everyone leaves. Alternatively the owners are stubborn and stick to their guns, until they inevitably have to shut down due to drowning in costs. When they do shut down, millions of assets are lost and the graveyard of broken images across the web grows some more.
https://gfycat.com/ is the latest notable victim of this.
With all the recent social media turmoil, there as been lots of exploration of alternative sites, and all of them have to overcome the problem of hosting media in one way or another.
Tildes obviously does this by avoiding it entirely which, while a very effective solution, is just handballing the problem elsewhere. Users will still want to post images and videos but they will just have to find alternative hosts. Over time those hosts will die and Tildes posts will be filled with dead links.
Mastodon has similar problems,the biggest cost of hosting a mastodon instance is the storage and bandwidth required to facilitate media posts. And there's a real danger of an instance incurring high costs if a particular post becomes popular and is hotlinked on a big centralised social media site.
It seems like a really tricky problem to solve, something peer-to-peer could sort of solve the costs created by traffic peaks but has problems when there is many small files viewed by few individuals each.
Are there any other solutions out there? Web3, IPFS? Or is it just not that much of a problem, do we accept that media on the web is ephemeral and will be lost after a while?
80 votes -
Good resources for accessibility in web design/development?
Hey there! Any web developers/designers out there that have resources on creating websites that are fully accessible? I am getting back into web development after a decade away and want to learn...
Hey there! Any web developers/designers out there that have resources on creating websites that are fully accessible? I am getting back into web development after a decade away and want to learn the correct way. Thanks for any tips!
16 votes -
How can you have the img's src attribute point to a web page itself instead of an image?
Consider the strange case of this reddit preview page for example: https://preview.redd.it/uhomipyb8kp71.jpg?width=575&auto=webp&v=enabled&s=b0e044ddd8a83774e0453cb7607ef681444c4c37 If you inspect...
Consider the strange case of this reddit preview page for example:
If you inspect the primary
<img>
element on the page, you'll find its src attribute not pointing to any image file but (behold!) that link itself!Through this mechanism, they've effectively hidden the direct link to that image, isn't it? How is this even possible? Is this a new phenomenon or way in web development?
7 votes -
The Website Obesity Crisis
39 votes -
Noticing when an app has servers in different regions
4 votes -
The ideal backend language to write web apps in 2023?
I know quite a controversial and opinionated question, one that might easily get blasted with downvotes on a site like StackOverflow or even Reddit! Nevertheless, one which I believe is still...
I know quite a controversial and opinionated question, one that might easily get blasted with downvotes on a site like StackOverflow or even Reddit! Nevertheless, one which I believe is still relevant to ask and useful one even in 2023.
The problem with backend web technologies is that we are overwhelmed with choices. Whilst getting spoilt with choices seems like a useful thing sometimes, it might easily be an impediment in decision making too. Based on my experience, there are a bunch of useful stacks and I will work on any of them if you pay me to work as a freelance coder. Each has its own pros and cons but I'm yet to find the ideal one which according to me is something that should be easy to code and deploy while also better performing at the same time.
- ASP.NET: C# is the language I started coding web apps with in my last company and ASP.NET web forms was quite the rage back then. PHP was also gaining traction in the open source world and the webdev was mostly divided between the Enterprisey .NET aristocrats of Microsoft world and the poor PHP peasants of the FOSS world! One good thing about ASP.NET was performance. Since MS controlled the whole stack, they also put great efforts at making it work faster. The bad thing, of course, was dependence on a closed tech stack and a closed black box that generated JS functionality on its own.
- PHP: When I resigned from that company and started freelancing, I came to know about open source, linux, XAMPP, etc. That was when I realized that my own attitudes and thinking was more attuned to the FOSS peasant mindset than the wealthy aristocrat's! I didn't earn quite as much in freelancing with WP, Drupal, SuiteCRM, CodeIgniter, etc. but I found great happiness and contentment in being part of the open source process. Till date, PHP remains my favorite language for backend development and most of my web projects involve CodeIgniter or even pure PHP.
- Python: Flask is what got me interested in Python web development. The sheer minimalism and flexibility of that framework is what I found quite remarkable and quite a rarity in the frameworks world. And jinja2 template system was just fantastic. The other framework called django is more popular I think and I've worked on that too but Flask still remains my favorite. Flask is good in performance dept. too but I think it gets tricky once you start scaling with too many users.
- Java: I've never really bothered with Java web development except a few tutorial experiments on the Apache TomEE server. The multi-layered approach that Java takes not only has very steep learning curve but unless you're a very gifted programmer, it's practically impossible to beat the performance of interpreted PHP/Flask!
- NodeJS: Again, not much work here except brief hobby projects like http-live-simulator. The npm packaging system really turned me off initially with so many packages and issues with that system in the earlier days. Nowadays, I've heard that it's much usable but I've never gotten into it.
And now, we also have the evolving languages like Golang, Rust, etc. taking their baby steps towards web development too! Are any of them worth giving a try? If someone were to ask you for a backend tech stack recommendation while giving equal weightage to performance, developer productivity and ease of deployment, which one will you suggest?
23 votes -
How I made my web pages load 10x faster
16 votes -
I just discovered a free, accountless graphic design web-app, in the vein of Canva and Crello
4 votes -
How can I push/inspire myself to learn JavaScript and Node?
I'm a full stack dev and my current use of JavaScript language is limited to making the best (read trivial) use of jquery for DOM manipulation in my web apps which primarily use PHP or Python...
I'm a full stack dev and my current use of JavaScript language is limited to making the best (read trivial) use of jquery for DOM manipulation in my web apps which primarily use PHP or Python (Flask/Django) as backend.
Now, have you watched that popular thriller movie called Inception which is based on a radical sci-fi concept that an idea or thought can be implanted into someone remotely?
Just like that, I often find myself facing this strange idea that JavaScript is supposed to be just a toy running inside the web browser. No idea where exactly this idea came from! Each time I try to learn JS or think of getting deeper with things like npm, react, etc., this idea just pops up and kinda stops me from doing anything!
Is there any way to get rid of this idea somehow?
9 votes -
"API first" apps are the future
6 votes -
What advice would you give to someone who has coded in jquery for years and now wants to gracefully switch to modern js?
Title says it all. Bootstrap+jquery has been my default route and path of least resistance when it comes to web development. Perhaps because I'm coding since a long time and belong to the old...
Title says it all. Bootstrap+jquery has been my default route and path of least resistance when it comes to web development. Perhaps because I'm coding since a long time and belong to the old school when modern libraries like react weren't yet invented yet?
I had tried to meddle with Angular.js 1.0 back in those days but was soon disillusioned! It was cool and cutting edge but highly opinionated. It tried to do so many things under the hood that I soon quit the effort and the word "Angular" was stigmatized in my mind ever since! I don't know how different today's typescript based Angular is but that stigma or phobia prevents me from even looking at that direction!
React is another cool technology which everyone is talking about and I'm sure it has some merits. But I'm not sure exactly what React brings to my development workflow which jquery doesn't already do. Can you tell me some specific advantages or pros of react over jquery which can motivate me to learn the former and let go of the latter? What should I do?
7 votes -
Browser Session vs JWT tokens for authentication system for an app?
I'm working on an app idea, it's going to be "API first" in design which means there is a clear separation between the backend and frontend. Former will be accessible through a REST API and the...
I'm working on an app idea, it's going to be "API first" in design which means there is a clear separation between the backend and frontend. Former will be accessible through a REST API and the latter can be simple HTML without me having to delve too much on it. The idea is that the end users or clients will write their own front-end interacting with this REST API in future.
Firstly, I want to know where to start. Writing a REST API seems quite easy and simple for me as a backend engineer but I've never implemented a "pure API" app in practice. Do you just validate the headers, do the crunching and return back a JSON response? What all must you take care of here?
Finally, authentication and session handling is something very important here, isn't it? If I make use of session feature in the REST API (like PHP sessions or Django sessions, for eg), authentication will be pretty easier. I don't have to worry about encryption as SSL/TLS would be already doing that for me through the browser. But then what is the downside of this method? Why do so many people use JWT tokens then?
Coming to JWT tokens, is that the only way of encrypting/validating REST APIs, or are there others? My biggest concern here is scaling and performance. I'm willing to implement the most efficient path here, the one that gives the most performance using least resources.
3 votes -
What is the present state of NPM Packaging System?
As I recall, about 2-3 years ago I had experimented with what is called the npm install xyz through some tutorials, etc. The objective was to improve my tooling or toolchain at least with things...
As I recall, about 2-3 years ago I had experimented with what is called the
npm install xyz
through some tutorials, etc. The objective was to improve my tooling or toolchain at least with things like css/js minification, etc. along with Bootstrap customization. The idea was to then move on to other newer learnings like react, etc.But I was soon disgruntled by the whole process! Neither bootstrap turned out to be an easy horse to tame, and NPM was like this astronomical universe of packages that keep on downloading into your folders! I soon lost taste of the whole thing and kept using my tried and tested stack of PHP scripts and using stock Bootstrap through CDNs.
But today, I want to give it another shot. Has NPM improved than earlier days? What is the best way to go about building a toolchain using it? Are there any useful guides that make the whole process easier to digest?
6 votes -
Mastodon's dubious crawler exemption
4 votes -
The smartest website you havent heard of
11 votes -
Rendering Markdown at the Edge
5 votes -
AdminLTE vs Pure Bootstrap for a new web project?
I'm primarily a freelance backend dev and for the first time venturing on full-stack development of a non-trivial web app on my own, hence I needed some guidance. I've got all the backend stuff in...
I'm primarily a freelance backend dev and for the first time venturing on full-stack development of a non-trivial web app on my own, hence I needed some guidance.
I've got all the backend stuff in php/mysql covered, I just want to know what's the best way to create a dashboard (with left sidebar) considering various aspects like long-term code maintenance and support, robustness, etc. Looks don't matter that much as it's a CRUD app but obviously, better is more appreciated.
Based on my research until now, AdminLTE seems to be the most popular way of doing it among most devs although a few others like material and coreui also seem to have some street cred.
But another approach I'm considering apart from AdminLTE is to just use pure bootstrap and fiddle up my own sidebar using something like this. That way, I won't be tied to just one Bootstrap version which is used by AdminLTE (v4.6) and troubleshooting will be much easier through google search and StackOverflow. What do you guys think is the right approach?
5 votes -
Help me decide what technology should I use for this project
I’m a solo freelance programmer and want to write an app for internal project management, somewhere I can add projects, milestones, tasks, etc. and track them as I work on them, occasionally...
I’m a solo freelance programmer and want to write an app for internal project management, somewhere I can add projects, milestones, tasks, etc. and track them as I work on them, occasionally remind me of things like take a break, lunch time, etc. and over time I can track on which category I worked how many hours, etc.
I’m actually confused between whether to build this as a Web or Windows Desktop app. I’m considering latter because it can run efficiently on my laptop in the system tray using least memory and resources, web-based on the other hand will force me keep running an apache server too which will be an overhead (unless I host it on Google Cloud or someplace which might be an option?)
The only reason for considering web-based is that eventually I’m planning to make this tool open source and with web-based, many others can find this useful too (including OSX/Linux users). At that point, I may consider expanding its schema to include multi-user connectivity, client login, etc. but that’s going too far at this point!
The idea is that this tool should be useful not just for me but other freelancers, students, etc. who might be in my shoes. From that perspective, what do you think is the right technology to use? Web based or Windows based?
(I’ve extensively worked on C#/WinForms projects before and I’m thinking Visual Studio Express for desktop development. If web-based, it’ll be php/mysql based)
5 votes -
The Clear-Site-Data HTTP header
8 votes -
Two types of privacy
6 votes -
Common Crawl: an open repository of web crawl data
9 votes -
Analyzing Seated's restaurants by reversing their API
6 votes -
Tailwind CSS v3.0 is released
9 votes -
Building an OpenTable bot
4 votes -
Spiders
Is anyone here familiar with crawling the web? I’m interested in broad crawling, rather than focusing on particular sites. I’d appreciate pretty much any information about how this is usually...
Is anyone here familiar with crawling the web? I’m interested in broad crawling, rather than focusing on particular sites. I’d appreciate pretty much any information about how this is usually done, and things to watch out for if attempting it.
10 votes -
A reality where CSS and JavaScript don't exist...?
8 votes -
Remote code execution vulnerability in the cdnjs Javascript CDN run by Cloudflare, which could have enabled tampering with over 10% of all websites
18 votes -
[Google IO 2021] A high-level overview of how Excalidraw works and the browser APIs it uses
8 votes -
A modern boilerplate for Vite, React 17, and TypeScript 4.3
2 votes -
TeXMe Demo: Self-rendering Markdown + MathJax documents
6 votes -
Misinformation about Permissions Policy and FLoC
8 votes -
What features do you want to see in a userscript manager?
I'm currently developing a minimal userscript manager who's main goal is to be fully auditable by any user in only ten minutes or so - my prototype uses less than 300 lines of javascript, and I'm...
I'm currently developing a minimal userscript manager who's main goal is to be fully auditable by any user in only ten minutes or so - my prototype uses less than 300 lines of javascript, and I'm trying to keep it that way.
To get the codebase this small, however, I have to be very picky with what features I implement - most notably, the code editor has to be very barebones. Are there any features that I'd be shooting myself in the foot by not including?
For example:
- syntax highlighting
- cloud sync
- regex url matching
- fullscreen editor (currently, it's just a browser popup - the intention is that you write code elsewhere and paste it in)
Any feedback is greatly appreciated!
7 votes -
Perl.com domain stolen, now using IP address tied to malware
14 votes -
A closer look at font rendering
5 votes -
A case study on vanilla web development
10 votes -
makesite.py - Simple, lightweight, and magic-free static site/blog generator
7 votes -
Cool URIs don't change
6 votes -
The future of online identity is decentralized
11 votes -
State of the Keybase.io website
8 votes -
Godot Editor running in a web browser
8 votes -
Min: a minimalist web browser
20 votes -
moderncss.dev - A series examining modern CSS solutions to old CSS problems
15 votes -
The reckless, infinite scope of web browsers
17 votes