12 ms·
If it doesn't work without Javascript enabled, then it's not a CSS solution. I was quite excited by the title, but alas the project doesn't live up to the title
by bgdam 5y ago
If it doesn't work without Javascript enabled, then it's not a CSS solution. I was quite excited by the title, but alas the project doesn't live up to the title.
- 3np 5y agoA more old-school but no-JS solution would be point image/font URLs to endpoints that queries a DB on GET requests. With enough contortions and breaking GET idempotency you could probably do a whole CRUD app with just that.
- danbruc 5y agoIn which case you are connecting to a web server that connects to a database, you are not connecting to a database.
- falcor84 5y agoTo be pedantic here, you're never connecting directly to a database, but rather to a DBMS, and it's nowhere set in stone that the DBMS must not offer a web interface.
- BeefWellington 5y agoThat's not entirely true. You can absolutely load underlying data structures into your own application, and in fact this is how a lot of older database tech used to be. Stuff like dBase, Access, etc., used to be literally "load database into program memory" or "read database format from file" - similar to what SQLite does now. I wonder if CSS could implement sqlite...
- danbruc 5y agoBut even in that case you are - at least usually - still interacting with some kind of DBMS. I am not really familiar with the examples you named but with SQL Server Compact you are essentially just loading and running the DBMS in your process. But as I said in my other reply, at some point the distinctions become blurry.
- BeefWellington 5y agoI'd propose the litmus test for this is "can it initiate action on its own, or does it require your code to do so." In this vein, SQLite is not actually a DBMS while Postgres is. The actual Management System parts are things that handle backup, replication, auth, logging, etc. The database parts are dealing with areas that must have some triggering action (calling a stored procedure, running a trigger, selecting a resultset, that kind of thing) for anything to happen. The lines are blurring, yes. What's interesting is the 4GL systems which do the reverse (colocate your apps with your data for speed).
- danbruc 5y agoI think that definition is way to narrow, the management in DBMS refers to managing the data, keeping it consistent, laying it out on disk and in memory, reading, updating and deleting it. To address the things you named, DBMSs are not required to support backups or replication, authentication and logging happens during actions you initiate.
- danbruc 5y agoI mostly use database instead of DBMS because nobody calls it a DBMS, at best a database or SQL server. And I actually wondered for a short moment whether there is any DBMS with a web server. But I would probably still argue that you are connecting to a web server that just happens to be integrated into the DMBS. But admittedly at some point this turns into a matter of point of view and personal preference how to slice the system and label the components.
- mindcrime 5y agoAnd I actually wondered for a short moment whether there is any DBMS with a web server. I don't know if it's still the case or not, but Oracle had the option to run a web-server as part of the database at one time. Back in the Oracle 8 or Oracle 9 era, as best as I can remember. EDIT: OK, here we go. https://docs.oracle.com/en/database/oracle/oracle-database/18/adfns/web-applications.html#GUID-86F73FF3-70CC-4BB5-AA55-F69720149430 https://docs.oracle.com/en/database/oracle/oracle-database/1... You can use an embedded version of the PL/SQL gateway that runs in the XML DB HTTP Listener in the database. It provides the core features of mod_plsql in the database but does not require the Oracle HTTP Server. You configure the embedded PL/SQL gateway with the DBMS_EPG package in the PL/SQL Web Toolkit. Some advantages of using the embedded gateway instead of mod_plsql are: You can invoke PL/SQL web applications like Application Express without installing Oracle HTTP Server, thereby simplifying installation, configuration, and administration of PL/SQL based web applications.
- sophacles 5y agoYou never connect to a DBMS. Everything you're doing to interact with it, or a web server is mediated by your OS. You just open sockets and the connection is handled by TCP or IPC or whatever.
- vilaca 5y agoI've seen a few DBs accessible through a REST API.
- berkes 5y agoSeveral are only accessible through a HTTP REST API, even. E.g. I'm not aware of an, out of the box, elasticsearch interface that is not the HTTP API.
- danbruc 5y agoThis is pure five-minutes-of-serching knowledge, but it seems that Elasticsearch is not a database but a search engine build on top of Lucene.
- ruined 5y agoim pretty sure that's just called an api
- myfonj 5y agoExactly, was thinking along the same lines. While I appreciate the "shipostedness" in fulfilling the task "connect to DB in CSS" by cramming whole SQL database into CSS custom property and working with it using paint worklet (this would probably not even remotely cross my mind ever), with more pragmatic approach I don't see requirement of having actual database in the CSS in the original tweet, so single boring URL endpoint reading the SQL query from parameter and responding with CSS à la `:root { --result: 'whatever'; }` should accomplish given task as well, without those Houdini's stunts: @import "sql.css?query=Robert')%3B%20DROP%20TABLE%20Students%3B--" body::before { content: var(--result); } (I guess browsers do URI encoding anyway, so probably no need to encode it by hand). Or perhaps even more simple with render to image (like `<!..><svg ...><text>whatever</text></svg>`. body::before { content: url(sql.svg?query=...); } That paint worklet does something similar anyway, but instead of `background: paint(…);` this would be `… url(…)`. If JS and/or strictly static server-side is a must, the sql.css / sql.svg could be handled by a service worker with that sql-asm.js at disposal.
- OJFord 5y agoI saw an HN comment recently saying that CSS is Turing complete; this sort of example makes me wonder if there's a formal model of side-effects and ability to do things like interface with I/O including NICs in order to make web/db/etc. requests? Or maybe it doesn't even need (a separate) one, because all a Turing machine needs is some other 'networking machine' to be looking at some designated area on tape (I'm describing DMA essentially, I suppose)? And maybe what else happens externally in response to what's on the designated tape area is uninteresting/completely arbitrary and doesn't need to/inherently can't be formally modelled?
- erk__ 5y agoOne idea a bit in this direction I have heard about is if a language is "Pacman-Complete" that is it can be used to implement Pacman
- SamBam 5y agoI thought Doom was the standard game people try to get working on all manner of ridiculous devices. So Doom-complete.
- colonwqbang 5y agoThe tape machine model is one way of looking at it. Another is the type of functions (expressions) that can be computed. A turing complete process can compute general recursive functions. I think of this very informally as having not only for() loops with fixed bounds on the loop index, but also while() loops where you don't know beforehand how many loops it will take to compute something. Alternatively you can express the same thing in terms of recursion. One characteristic is that it's possible to describe computations that never finish. Another is that you cannot always tell from looking at a particular program if it will ever finish. Exactly how or if the result of a computation becomes apparent to the outside world, I think is not part of the theoretical description.