[-] zlatko@programming.dev 1 points 4 days ago

That still doesn't look like a very heavy workload. My older box was older then your 6700k and was fine running such stuff.

Perhaps your limit isn't the CPU. What storage and ram setup do you have, did you look at that?

I'll be honest and say that when I replaced my old crap with 7900x I did feel improvements on occasion, mostly when I really burden the pc. Plus I think having 64 gigs of ram helps there, at my old system I hit the limits sometimes. Not often, but sometimes. Now my new box just laughs at anything I try to do to it.

[-] zlatko@programming.dev 3 points 1 week ago

I think a lot of the relevant stuff is written on the blog post:

https://deno.com/blog/v2.0

[-] zlatko@programming.dev 19 points 1 year ago

Sure -> I'm not smart enough to explain it like you're five, but maybe 12 or so would work?


The problem

The problem here is that you're not adding 1 + 2, or 0.1 + 0.2. You're converting those to binary (because computers talk binary), then you're adding binary numbers, and converting the result back. And the error happens at this conversion step. Let's take it slow, one thing at a time.


decimal vs binary

See, if you are looking at decimal numbers, it's kinda like this:

357 => 7 * 1 + 5 * 10 + 3 * 100. That sequence, from right to left, would be 1, 10, 100, ... as you go from right to left, you keep multiplying that by 10.

Binary is similar, except it's not 1, 10, 100, 1000 but rather 1, 2, 4, 8, 16 -> multiply by 2 instead of 10. So for example:

00101101 => right to left => 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8 + 0 * 16 + 1 * 32 + 0 * 64 + 0 * 128 => 45

The numbers 0, 1, 2, 3..9 we call digits (since we can represent each of them with one digit). And the binary "numbers" 0 and 1 we call bits.

You can look up more at simple wikipedia links above probably.


bits and bytes

We usually "align" these so that we fill with zeroes on the left until some sane width, which we don't do in decimal.

132 is 132, right? But what if someone told you to write number 132 with 5 digits? We can just add zeroes. So call, "padding".

00132 - > it's the same as 132.

In computers, we often "align" things to 8 bits - or 8 places. Let's say you have 5 - > 1001 in binary. To align it to 8 bits, we would add zeroes on the left, and write:

00001001 -> 1001 -> decimal 5.

Instead of, say, 100110, you would padd it to 8 bits, you can add two zeroes to left: 00100110.

Think of it as a thousands separator - we would not write down a million dollars like this: $1000000. We would more frequently write it down like this: $1,000,000, right? (Europe and America do things differently with thousands- and fractions- separators, so 1,000.00 vs 1.000,00. Don't ask me why.)

So we group groups of three numbers usually, to have it easier to read large numbers.

E.g. 8487173209478 is hard to read, but 8 487 173 209 478 is simpler to see, it's eight and a half trillion, right?

With binary, we group things into 8 bits - we call that "byte". So we would often write this:

01000101010001001010101010001101

like this:

01000101 01000100 10101010 10001101

I will try to be using either 4 or 8 bits from now on, for binary.


which system are we in?

As a tangential side note, we sometimes add "b" or "d" in front of numbers, that way we know if it's decimal or binary. E.g. is 100 binary or decimal?

b100 vs d100 makes it easier. Although, we almost never use the d, but we do mark other systems that we use: b for binary, o for octal (system with 8 digits), h for hexadecimal (16 digits).

Anyway.


Conversion

To convert numbers to binary, we'd take chunks out of it, write down the bit. Example:

13 -> ?

What we want to do is take chunks out of that 13 that we can write down in binary until nothing's left.

We go from the biggest binary value and substract it, then go to next and next until we get that 13 down to zero. Binary values are 1, 2, 4, 8, 16, 32, ... (and we write them down as b0001, b0010, b0100, b1000, .... with more zeroes on the left.)

  • the biggest of those that fit into 13 seems to be 8, or 1000. So let's start there. Our binary numbers so far: 1000 And we have 13 - 8 = 5 left to deal with.

  • The biggest binary to fit into 5 is 4 (b0100). Our binary so far: b1000 + b0100 And our decimal leftover: 5 - 4 = 1.

  • The biggest binary to fit into 1 is 1 (b0001). So binary: b1000 + b0100 + b0001 And decimal: 1 - 1 = 0.

So in the endl, we have to add these binary numbers:

` 1000 0100 +0001

b1101 `

So decimal 13 we write as 1101 in binary.


Fractions

So far, so good, right? Let's go to fractions now. It's very similar, but we split parts before and after the dot.

E.g. 43.976 =>

  • the part before the dot (whole numbers part) -> 1 * 3 + 10 * 4 = > 13
  • the part after it (fractional part) -> 0.1 * 9 + 0.01 * 7 + 0.001 * 6
    Or, we could write it as: 9 / 10 + 7 / 100 + 6 / 1000.

Just note that we started already with 10 on the fractional part, not with 1 (so it's 1/10, 1/100, 1/1000...)

The decimal part is similar, except instead of multiplying by 10, you divide by 10. It would be similar with binary: 1/2, 1/4, 1/8. Let's try something:

b0101.0110 ->

  • whole number part: 1 * 1 + 2 * 0 + 4 * 1 + 8 * 0 (5)
  • fractional part -> 0 / 2 + 1 / 4 + 1 / 8 + 0 / 16 -> 0.375.

So b0101.0110 (in binary) would be 5.375 in decimal.


Converting with fractions

Now, let's convert 2.5 into binary, shall we?

First we take the whole part: 2. The biggest binary that fits is 2 (b0010). Now the fractional part, 0.5. What's the biggest fraction we can write down? What are all of them?

If you remember, it's 1/2, 1/4, 1/8, 1/16... or in other words, 0.5, 0.25, 0.125, 0.0625...

So 0.5 would be binary 1/2, or b0.1000

And finally, 2.5 in decimal => b0010.1000

Let's try another one:

13.625

  • Whole number part is 13 -> we already have it above, it's b1101.
  • Fractional part: 0.625. The bigest fraction that fits is 0.5, or 1/2, or b0.1. We have then 0.625 - 0.5 = 0.125 left. The next fraction that fits is 1/8 (0.125), written as b0.0010.

Together with b0.1000 above, it's b0.1010 So the final number is:

b1101.1010

Get it? Try a few more:

4.125, 9.0625, 13.75.

Now, all these conversions so far, align very nicely. But what when they do not?


Finaly, our problem.

1 + 2 = 3. In binary, let's padd it to 4 bits: 1 -> the biggest binary that fits is b0010. 2 -> the biggest thing that fits is b0010.

b0001 + b0010 = b0011.

If we convert the result back: b0011 -> to decimal, we get 3.

Okay? Good.


Now let's try 0.1 + 0.2.

  • decimal 0.1 => 1 / 10.

How do we get it in binary? Let's find the biggest fraction that fits: 1/16, or 0.0625, or b0.0001 What's left is 0.1 - 0.0625 = 0.0375. Next binary that fits: 1/32 or 0.03125 or b0.00001. We're left with 0.00625. Next binary that fits is 1/256
... etc etc until we get to:

decimal 0.1 = b0.0001100110

We can do the same with 0.2 -> b0.0011001100.

Now, let's add those two:

` b0.0001 1001 10 +b0.0011 0011 00

b0.0100 1100 10 `

Right? So far so good. Now, if we go back to decimal, it should come out to 0.3.

So let's try it: 0/2+1/4+0/8+0/16+1/32+1/64+0/128+0/256+1/512+0/1024 => 0.298828125

WHAAAT?

[-] zlatko@programming.dev 3 points 1 year ago

Yep, that was my intention. First, it's low power, so it can be always-on with only a small impact on the power bill. Second, it's only gonna serve a few things - my photography hobby and media library, and maybe a service or two will come with time. If I need other services, I put them on a Hetzner box and they're much better taken care of.

I've done my share of sysadmin work and even a bit of server-room maintenance, I don't want a full-time, or even a part time job. This is mostly gonna sit in the corner, and be quiet. If the prices matched, I would have probably just gone with QNap or Synology, but this way I get the NAS and the disks for the same price.

[-] zlatko@programming.dev 2 points 1 year ago

Yes, it didn't inspire confidence when it arrived so, but it's actually a tiny PSU, it's essentially all bolted onto the power connector :)

102
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.

[-] zlatko@programming.dev 4 points 1 year ago

One thing to add that I haven't seen is that for big projects, there's often nobody that could understand it all. People either get their individual components it they understand how stuff interacts, it's very rarely expected that new people in the project, even if very experienced, can just understand everything at once.

What you said that maintainers know every single fob is very frequently not the case at all! But since they get the big picture, they know in which part to look, and with their experience, they'll know what to look for in that part, it may seem to you like magic. It's not, it's just experience.

Don't get discouraged though!

Getting into big open source projects as a junior -level can be difficult, but often isn't that hard - a lot of projects often need help and will take anything they can get. And if your experience already partially aligns with what you're getting into, even better. If you reach out and be upfront about it, you'll usually get pointed in some way.

Now, you seem to only have worked on your own, with smaller code bases. That means, you don't have a problem of code organisation. So you can't understand a solution if you don't know what the problem is.

So how would you go about it?

My suggestion is to maybe get the. 10,000ft overview. Also, understand the project workflow. Projects usually have specific ways of doing things - how to build, test, run things. Try to figure out how to build and run the software on your own. If you make it, that's a great step!

Then dig into one specific component/module/part. After a bit of study, you may be able to understand that component and find a simple thing that you can change about it. If you get this far you're golden, you're doing more then a majority of users that software.

Now if you're interested, you can dig more, or reach out to devs, saying what your experience is and how far you got, and ask them if you can help. And take it from there.

39
Sunflower (programming.dev)

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

[-] zlatko@programming.dev 6 points 1 year ago

even if it is an earlier, yet undeteced bug, whoever found it (in this case, the cowboy), should at least log it, if not open a separate PR to fix it.

[-] zlatko@programming.dev 4 points 1 year ago

I think it is a bit more than that.

You point out two things:

  • the "fuck it" algorithm
  • the hidden DNS request.

So, now, obviously if you wrote the "fuck it", then well, you fix it. If you found the DNS library problem - find a better lib or something.

But if you take the stance "fuck it, there's always something", you don't even have a chance of finding out. If you had a test suite running 10 seconds, and suddenly it's up by 10 more, you would notice. If you had tests running for 10 minutes, you would not.

If you had a webapp or something that always opened "fast", then suddenly it gets doubly slower, you'll notice it. But if you already started slow, you won't notice (or care, or both), when it gets even worse.

I think that's the point of the article. If we all dug in and fixed a little bit, eventually we'd have fast apps or tests or whatever. If you accept that things suck, you'll make it tripply worse. It is a conscious effort to be fast.

[-] zlatko@programming.dev 2 points 1 year ago

Yeah, there was a bit of discussion about that on Lobsters :)

[-] zlatko@programming.dev 2 points 1 year ago

I agree, there are several good starting points. But I think it's more important what the OP said about his understanding of it. I think this is a lot more important - WHY do you use plugins, HOW they help you, WHAT can they do. Like, autoimport like vscode does? Autohighlight problems? Check. Check. Autofix linting issues? Check. Find files? Check. Search the project? Check. There's a lot of things that can make your experience way better. Look up some videos. E.g. this one (if you can ignore some twitch memes, I found them mostly fun or tolerable).

Also, when you give up on vim, come back again. It's something that can take many iterations to really "get". Even if things don't work out, try again in a few years.

Also, as an alternative to VSCode, try some native editor. I personally used sublime - for weak machines, it's way better on resources then VSCode and it's electron baggage.

[-] zlatko@programming.dev 15 points 1 year ago

It's not a monopoly, but it's still an oversized influence on the market. I think the poster is arguing that: when have you heard a recruiter ask you for your bitbucket account? But they will look at github.

[-] zlatko@programming.dev 6 points 1 year ago

I largely agree with this statement. I think the original question is very widely scoped. It's like asking, "what's the best tool for hammering nails, chopping wood, cutting wood, cutting glass, polishing floors, and building skyscrapers, and the tool is used by all builders anywhere and any time in the human history?" Different people, different skills, different problems.

8
submitted 1 year ago* (last edited 1 year ago) by zlatko@programming.dev to c/hardware@lemmy.ml

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 ›

zlatko

joined 1 year ago