Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

Yes but how do you go about defining an ORM model without an app init class?


I hanen't touched Django in some time, but something like this should work:

    from django.db import models
    from django.db import connection

    class MyModel(models.Model):
        name = models.CharField(max_length=255)

        class Meta:
            app_label = 'myapp'


    with connection.schema_editor() as schema_editor:
        schema_editor.create_model(MyModel)

    # from django.core.management import call_command
    # call_command('makemigrations', 'myapp')
    # call_command('migrate', 'myapp')


A lot could be said about it, but the first thing that comes to mind is that not every application uses a db.

And not every application that uses a db needs an ORM.

You probably can build an ORM into the single file. But I'm not saying every application should be developed as a single file forever. I just like that you can start with one and expand later.


Then you don't need django, flask and fast API already does all that withing a single file.

What makes django useful is the admin, auth, session and so on that are all built around the ORM.


You never know into what a project will develop. So it is nice to know you can expand it into anything, even when you start simple.


I love this trend, every time they fail, it costs them a lot of money, and then I make bank after a few years of destruction because they look for a safe bet.

Then the cycle restarts.


It's embedded in the browser now.


I can't see big technical limitations resulting in slow QRCode scanning. We manage to detect fast cars going 120mph to fine them, we can read fingerprints instantly through a screen. We can take pictures of galaxies light years away.

30 years ago you could kill ducks with the NES guns instantly and it worked by detecting pixels.

I'm sure we can figure out how to analyze black squares and turn them into a number under 50ms.


Lol, that's the joke.

QR Codes were invented by Denso (automaker own) / Toyota. For high speed assembly line processes. Lul.


In 1994, no less.

I don't think people realize how limited the hardware was at the time.

They think because their phone is slow at scanning QR codes, that's how it must be. But the phone is not a dedicated device for QRCode scanning.

It's like someone saying they get blurry pics of cars on the highway so clearly speed limits are not possible to check automatically.


Touch x against y versus line this weird printed shape up at just the right angle in good lighting conditions. I feel like NFC is much easier to tell older folks how to use as well.

I'm all for the "we have technology why tf don't we use it, why aren't we better at it" argument, but the truth is that a lot of tech/systems in transport & other areas are retro af and new stuff gets shoe-horned in with all the caveats of a shoe-horning in.

Stuff doesn't get upgraded often, because it's expensive, because all of us vote for politicians that grant expensive/overpriced gov contracts putting money into them and their mates' back pockets. We'd be able to refresh public use tech all the time if it was non or low profit, never gonna happen tho.

Look at how much it cost Wales to change 30mph signs to 20mph: 34m£! And that's just for a few small areas, not everywhere they wanted to do. How in the f u c k, do you spend 34m taking down and putting up some signs? Those are ludicrous prices & all of us just completely ignore it bc we're too busy arguing about skin colour, which sex the person I sleep with is, or trans people being in the bathroom they want to be in, etc. Honestly.


> weird printed shape up at just the right angle in good lighting conditions

None of that matter. QR code can be read on any angle because of the 3 position detection patterns it comes with, by design.

Lighting conditions are not a problem on tickets (which is what the article is about) because you can illuminate the paper from the camera.

QRCode were fast on assembly lines two decades ago. They were invented in the nineties, at a time where we had slow processors and shitty cameras.


Actually, they do matter.

Assembly lines give you GREAT control over where the code is located, how it's lit (consistently), and what you do on read error (can't shunt off the passenger to a read error bin, so they don't hold up the line). Rotational angle doesn't matter, perspective skew does. And then - it's a leaf of paper, so you get folds and obscured parts (yes, correctable...up to a point).


Assembly lines are dirty, full of parasites and with broken lights all the time.

We can create live deep fakes or detect complex objects in live feeds of random webcams.

We certainly can correct a few shadows and distortions on a flat piece of paper we formatted, showing a basic symbol we designed and printed, pushed against a sensor we control, on a device we can light and shape the way we want.

NFC fails as well, you can fold the ticket just and it will break the antena.

Of course if it's a reusable ticket on a rigid medium, it won't happen. But neither for QRCode.


You speak about reader sourced illumination but there's a reason that phone screens go to full brightness when trying to scan a digital barcode.


The Stockholm Metro and public transport uses QRs, but on phones, and it's awful. The huge variance in people's shitty broken, dim phones make it take 3-4 tries sometimes. Infuriating! The scanners themselves are brilliant though, but nobody wants to stand in line for some printer machine and need to carry a flimsy bit of paper around.


The article talks about tickets with chips in it, which means you could provide the same ticket with qr code, only cheaper and less polluting.

No variance.

People can then use nfc with their phone, which doesn't have the pollution problem.


When I was there they also had NFC readers you can tap your credit card or phone on.


I would use redbean, from the same author, and use HTML.


>> I would use redbean, from the same author, and use HTML.

Wait... Could we build Solvespace web version and bundle it into that and have a completely portable CAD program that runs locally but in the browser?


Impressive stuff. Unfortunately, Lua. From a user point of view (well, at least this user), TypeScript would be a better fit.


What are your misgivings about Lua?


Not OP, but having written some Lua, I can make some guesses:

- Relatively obscure language, so potential contributor base is limited from the start

- Lua shares PHP's "One datatype to rule them all" design, which works but feels ugly. In PHP it's "arrays", in Lua it's "tables", but either way you have all the attendant problems and weird edge cases to learn

- Expanding on above point, Lua's APIs for working with tables are, uh, idiosyncratic. Slicing a "list", last I looked, was an unintuitive monstrosity like `new_table = { table.unpack(old_table, start_index, length) }`

I could keep going, but I have other things to do during my brief time in this universe.

To any Lua aficionados out there, my apologies if I've misrepresented it. Corrections to my misunderstandings will be appreciated.


> Relatively obscure language

Lua is among the most used languages in existence.

It's probably the most used language by under-21-year-olds, and almost certainly so for under 16. Roblox is absolutely enormous.

It's the usual choice of embedded scripting language, so a great number of programmers who don't use it as a daily driver, nonetheless learn it to modify this or that program. Being a very simple, minimalist language, this is easy to do.

It's true that it's missing some affordances which you'll find in larger (and frequently less efficient) languages. You'll end up doing more iteration and setting of metatables. That bothers some people more than others. These are the tradeoffs one must accept, to get a 70KiB binary which fits in an L1 cache while being multiples faster than e.g. Python or Ruby.


Lua is too bare bones. It's a carefully considered tradeoff for the project goals of being a very small & easily embeddable language for C projects, but it means you need to implement too much load-bearing functionality yourself. Each lua project ends up being an ad hoc framework composed of C bindings and standard lib extensions, but it doesn't have an ecosystem that makes this straightforward or consistent.

A lot of people like lua from using it on very small projects, or like, spiritual reasons related to its implementation simplicity. But having used it quite a lot professionally, in practice it ends up being a slog to work with.

All that said, lua is closely tied to C, and embedded in a C project is both its intended use and the place where it fits best. So while I don't really like lua and would almost never choose it myself, this is one of the rare exceptions where I think it's a good choice.

A lot of people want redbean to use TS or python instead, and imo either would make it much bigger, more complex, for relatively little benefit. It would definitely benefit from a more full-featured language, but I think a weirder one that is still intended for embedding in C would be best. Something out there like janet or fuck it, tcl. But lua has a lot of allure for a lot of programmers and I think gives the project a feeling of "old school cool" while still being pretty accessible. So is probably the best choice in the end.


None in particular, except that all the code I am currently writing is in TypeScript. Especially if it comes together with HTML files.


You don't need the file to be named "hello.py". You can name it just "hello", with the right shebang it will work fine.


Even if you don't want to limit yourself to the stdlib, you can still use a zipapp : https://docs.python.org/3/library/zipapp.html


You need to introduce a build and release process then to do this then which still detracts from it being simple or the selling point being it's already installed.


With cpan it's the same, you need to install deps somehow.

You don't need it if it's just a python script with stdlib, just like with raw perl.


In fact, that's true for Python if you use a zipapp and no c extension: https://docs.python.org/3/library/zipapp.html

You can happily copy the zip of your scripts and all deps in the server.

You still do have to mind your versions, as always with python.


It's a social filter:

- it brings the attention of people liking the tech

- it associates the tool with the values that come with the language and community

- it's a shortcut for explaining things you know most people will assume about the stack


They are in Europe, and heavily criticized on HN everytime they regulate.

I love GDPR, yet so many complain about it for cookie banners, which are not even what the law requires: There Is No Cookie Banner Law (https://www.bitecode.dev/p/there-is-no-eu-cookie-banner-law)


Reading through this thread as an user of Windows from the EU most of the issues I see mentioned here are just non-existent, like OneDrive nagging that has never happened to me


> just non-existent

You have just been lucky. Nothing more.

A classic case of it doesn't happen on _my computer_ so it must be a lie.


I have been lucky on multiple installs on multiple computers? I'm not saying what people are complaining about are lies, I'm saying the issues don't seem to exist in EU installs on Windows. For example the only ads I've seen were during the initial setup screen and pre-installed apps/shortcuts that are gone in a minute of work, and OneDrive can be uninstalled in two clicks.

The only issue that is still here would be bing in start search but that's trivial to disable compared to the configurations I had to do on my linux desktops, so while it is bad and shouldn't be a thing I don't see it as a big issue when comparing to linux.


Windows is literally different in the EU and the rest of the world.

https://blogs.microsoft.com/eupolicy/2024/03/07/microsoft-dm...


Author says what I'm repeating since day one when GDPR and these so-called banner with "preferences" were introduced: this should be handled by the browsers.

The idea was good but the interpretation and implementation of this law failed - the banners, cookies aren't as permanent and universal as browser sending the header.


Only problem with GDPR is that while the spirit/intention of the law is great (and it even prohibits malicious compliance such as consent prompts that make it more difficult to decline than accept), enforcement is significantly lacking which means it's still more profitable to breach it than respect it.


I would say the problem is rather that companies are becoming too big to cares. Meta has been fined several times, in total for more than 2 billions. Amazon ? 746 millions. Tik tok? 345 millions. And yet it's a small price to pay for them


did cookie banners exist without the law? largely not, which is why people perceive it to be a "cookie banner law" no matter what is technically written in it.


Sure, you can also blame condoms for increasing the safety of people cheating on their spouses.


> did cookie banners exist without the law?

Yes!? They existed long before GDPR was even passed.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: