zlatko

joined 2 years ago
[–] zlatko 2 points 2 days ago (1 children)

Not that simple. You have several moving parts just in your frontend. But all of your frontend is still accessible. E.g. if you run ng build, the output javascript will contain links to your module:

/ src/app/app.routes.ts
var routes = [
  {
    path: "no-match",
    canMatch: [noMatchGuard],
    loadChildren: () => import("./chunk-2W7YI353.js").then((m) => m.NoMatchComponent)
  },
  {
    path: "no-activate",
    canActivate: [noActivateGuard],
    loadChildren: () => import("./chunk-JICQNUJU.js").then((m) => m.NoActivateComponent)
  }
];

So whoever wanted to see what's in those separate files and just load the code in those components directly.


And of course, you have the backend completely separately anyway. Those two lazy-loaded modules - whether protected by guards or not - will contain links to your /count. If they're called or not is not relevant, whoever is interested can read the code and find the URLs. Someone can just call your /count without even looking at your code.


See if this lil image of the moving parts helps:

[–] zlatko 4 points 4 days ago (1 children)

shaking my (trademark) head?

[–] zlatko 2 points 5 days ago (3 children)

Hey all, I just spotted the question by accident. I'll try to answer it in case you're still wondering, or for some future concern.

The difference is that canMatch is being evaluated first, runs before you even look into the URL. Imagine that canMatch guard is only allowing admins in.

That means you can e.g. prevent even attempting to load the routes (e.g. lazily) if you know your current user is an admin. They try to open /site-settings or /users page or similar - and you just nope them back.

CanActivate, in contrast, will first go load the remote route, then try to match the user.

Now, you also asked why. Well, the difference is usually tiny, but it might make sense. Let's say you have some data loading, some actions being performed, some background sync operations running when you load a lazy route /admin. Example, you have /admin page, but when you load it, canActivate router needs to go back to server and ask if this particular admin can administer this particular tenant. If you use canActivate, some of these are running always. And if you know your user is not an admin at all, you don't even try to load the module, and you save that time.

Tiny bit of difference, but it can help sometime.

[–] zlatko 2 points 2 months ago

So, send'em a dicpic and you're in :)

[–] zlatko 2 points 3 months ago (1 children)

considering where the garbage came from, maybe we should stop shitposting :)

[–] zlatko 1 points 3 months ago

(sorry for the late response, I have to get in the habit of checking my Lemmy account)

No, I get that - a stylesheet denotes a class by having a dot. A JavaScript API for adding a CSS class omits this redundancy.

I was saying that the author might not be wrong to want to avoid the redundancy in rust example as well (since it explicitly mentions CSS classes).

[–] zlatko 3 points 3 months ago (2 children)

I mean, it is not embarrassing for you. In the browser, the CSS's "native platform", you add classes, via the JavaScript API, without the dot. It's not a stupid assumption.

To have to add the dot in the CSS class name seems a bit of an oversight in the gtkrs API.

[–] zlatko 2 points 3 months ago

Actual programmer

[–] zlatko 1 points 3 months ago

I wonder if JJ anonymous branches would be something that solves this. I've only read about it, have not used JJ yet.

[–] zlatko 2 points 3 months ago

Or meet old ideological dogs like me :P

[–] zlatko 4 points 3 months ago (1 children)

Much better integrated refactoring support. Much better source code integration support. Much better integrated debugging support. Much better integrated assistive (but not ai) support.

Vscode can do many things IntelliJ can, but not all, and many of them require fiddling with plugins.

Usually, JB is also faster (if your dev machine can run it, but in my experience most devs have beefy machines).

[–] zlatko 1 points 3 months ago

Zed is also lightspeed fast compared to either vscode or JetBrains' stuff.

109
DIY NAS build in progress (programming.dev)
 

I'm building a NAS for the first time on my own, so I wanted to share the story so far here.

I'm not a stranger to custom builds, in fact I don't think I ever bought an assembled PC (not counting second hand 386 box a million years ago). But this is my first small, low power build, so it's not perfect, I already ran into a wall (more later).

I base the build on an AsRock mini-ITX board, the CPU is included, it's passively cooled, low power consumption but still powerful for a NAS. I'm sticking it into a Node 304 Fractal Design case. Here's the full list of parts I got:

  • AsRock J4125-ITX board with a Celeron 4125 (4-core CPU)
  • 8GB DDR4 RAM (a Crucial kit)
  • a 500GB NVMe SSD (which I can't use)
  • a couple of Seagate IronWolf 4TB drives
  • 90W PicoPSU and some no-name power brick
  • Fractal Design Node 304 mini-ITX case.

I planned to have an SSD for OS, these two disks for my photography and media, and then later on expand with more storage (preferably SSD, when I can afford it).

As mentioned, I messed up: the M2 slot on the motherboard is a "Key E" slot. I never bothered with these keys before, so I didn't know that a Key E slot does not have a SATA protocol, it won't take my SSD.

Another thing, the PicoPSU is a 20-pin power supply, and the board has a 24-pin slot. It should still be fine, the specs say that this is still okay, but I'll have to see. According to my back-of-the-napkin calculations, 90 Watts should be enough power for the mobo and CPU, the SSD and the two spinning disks.

Anyway I'll get a regular SATA SSD tomorrow and see how it's shaping up. Let me know if you want me to post more on my progress/end result or if you have any questions.

44
Sunflower (programming.dev)
submitted 2 years ago by zlatko to c/[email protected]
 

Taken for the 52frames.com challenge last week. I have a few more shots on my (relatively new) photo site.

8
submitted 2 years ago* (last edited 2 years ago) by zlatko to c/[email protected]
 

What would be a good investment now? I want no-frills Linux support, good CPU, lots of RAM, decent screen. If I'm actually working, I'm almost always docked, but when not, I would not mind a good battery as well. I want this primarily for personal use. I don't mind upgrading parts myself (if that's still possible), like getting a stronger SSD or something.

I used to own a T420 (and some other ThinkPads as well, but this one was used). It was an incredible investment at the time, used laptop price, build quality and feature on par with laptops 6, 7, 8 years younger. I wonder if this is still something you can get away with.

view more: next ›