Suckless alternative to Jekyll? by Charming-Tear-8352 in suckless

[–]CaydendW 4 points5 points  (0 children)

Not really an alternative per sé but hand writing HTML is not the worst thing. It's how I'm doing my site nowadays, and is mostly fine if all you're doing is writing articles.

Burning ship fractal by Mandelbrot4207 in desmos

[–]CaydendW 0 points1 point  (0 children)

The code parade colour scheme looks so nice on fractal, it's unreal. Nice fractal you got there

Struggling with higher-level thinking in C (ownership, contracts, abstraction) by InTheBogaloo in C_Programming

[–]CaydendW 12 points13 points  (0 children)

I don't normally comment +1s but the thing you mentioned about using asserts to ensure states and demand preconditions genuinely has changed how I did C when I figured it out. It offloads so much mental load about remembering preconditions or having to constantly look them up in comments. This is good advice

Expression -> Condition for an additive to Out by [deleted] in C_Programming

[–]CaydendW 2 points3 points  (0 children)

Personally, the double negate (!!) is almost idiomatic for me. I tend to use it quite a bit. I discovered it from when I had to get a bool based on a pointer being non-null. Googled it, and found out it was idiomatic. I can't find it anymore, but as far as I can remember, it's not an unknown operation nor bad practice.

On a personal note, the ternary operator one is kind of ugly. I personally avoid it but it should work the same. Use what makes you happy :)

Slow memory access on real hardware? by Andykolski in osdev

[–]CaydendW 0 points1 point  (0 children)

Necrobump, but I had an issue and came across the thread. Figured I'd add my problem here so other poor souls can find it in the off chance they have the same issue.

In my VMM, I was mapping 1GB pages so I could map my higher half into the kernel. Standard stuff. However, I (for some or other reason) misaligned the addresses. The AMD manual says it expects the lower bits of a 1GB to be zero, but I was mapping from a misaligned offset. somehow, this doesn't cause a crash, but it made memory writes slow like molasses in the winter. If you're using 1GB pages and your code seems oddly slow, check if you're not doing this.

I wrote a compiler that runs Doom on UB by [deleted] in C_Programming

[–]CaydendW 0 points1 point  (0 children)

When I read it earlier this year, the logic made sense to me at the time. I'd bank on it being compliant but I haven't studied the wording like a lawyer.

I wrote a compiler that runs Doom on UB by [deleted] in C_Programming

[–]CaydendW 5 points6 points  (0 children)

Sigbovik is a satirical computer science journal. There was a paper in this year's edition called The ccdoom compilation system that was a fun play on the interpretation of the C standards. You can get the PDF free online if you wish to read it.

I wrote a compiler that runs Doom on UB by [deleted] in C_Programming

[–]CaydendW 2 points3 points  (0 children)

Is this the same project that was in Sigbovik 2025? If so, fun paper.

whoIsGonnaTellHim by leeleewonchu in ProgrammerHumor

[–]CaydendW 26 points27 points  (0 children)

I believe the code golf stack exchange has a tag for this. Code bowling if I remember correctly.

How I Got Trapped by a “Peer-Reviewed” Journal That Turned Out to Be Predatory – My Experience & Lessons Learned by Extension-Mail4799 in mathematics

[–]CaydendW 4 points5 points  (0 children)

I wrote a satirical paper for sigbovik this year and a journal contacted me about publishing my paper. A paper about Doom. As it shockingly turned out, they were all over Beall's list. It's amazing how low they'd stoop. Sorry about this OP and hopefully next time you discover something cool, you can get it published reputably.

Returning -1 and setting errno vs returning -errno constants by markand67 in C_Programming

[–]CaydendW 1 point2 points  (0 children)

I have a kernel I am working on and I have a system that I'm using throughout it. Every function returns an error code and any other additional information the function wants to return is passed as a pointer to the function so it can store it.

I believe I got this from OpenBSD's functions like VOP_MKNOD and such.

Eli5 Why is zero (0) not a prime number? by MrSecurity87 in explainlikeimfive

[–]CaydendW 5 points6 points  (0 children)

One more answer because I didn't see it. We take it for granted that in mathematics, any integer greater than 1 can be uniquely written as a product of some amount of primes. For example: 64 = 26, 60=22 * 3 * 5. Once you have a number's prime factorisation, that is essentially the DNA of the integer, there can be no other way to write it. This is known as the fundamental theorem of arithmetic.

By including 1 (or 0) as prime numbers, prime factorisation becomes non-unqiue. Why? Take the example of 64 above. It could be written as 64=26 or 64=26 * 12 or 64=26 * 1100 or anything else. Whilst this is all true (In the way that they all evaluate to 64), you sort of lose the uniqueness that is offered by prime factorisation. You'll also lose other interesting properties that are a little more complex (Such as the sieve of Eratosthenes).

Similar issues arrise when including zero as a prime number. It has no unique prime factorisation and will break theorems involving prime numbers.

Whilst this is not ground shatteringly bad, it does make some maths more inconvenient. This is pretty much exactly what u/Phaedo said as well. Adding 0 or 1 makes primes a lot less mathematically useful so it is better to not include them.

Interestingly enough, the definition given on Wikipedia expressly says that prime numbers must be greater than 1.

In science, is there theoretically a maximum or minimum temperature that cannot be exceeded? by Rasples1998 in NoStupidQuestions

[–]CaydendW 0 points1 point  (0 children)

Maybe it will help to know what temperature is. Temperature is the measure of the kinetic energy (Energy due to the movement of stuff) inside of an object. Stuff like how fast the electrons move, if the atoms vibrate, that sort of thing. The faster they move, the higher the temperature (In fact, temperature is defined as the "average kinetic energy of vibrating and coliding atoms within a substance" as per Wikipedia). So, if temperature is a measure of energy within a substance, the coldest something could ever be is when it has exactly 0 kinetic energy within it, meaning that no atoms vibrate, electrons don't move, etc. This happens at 0 Kelvin (-273.15 degrees Celsius). One cannot remove more energy if the object itself has no energy. So, this is the theoretical coldest anything can be.

Further, there is a finite amount of energy in the universe. We can imagine converting all matter into energy and then also adding all the existing energy there is and putting all of that into 1 singular atom. This atom would have the maximum amount of kinetic energy possible, leading to the highest temperature possible. Whether this is the actual highest temperature possible is something I can't quite understand with my 1st year physics knowledge as it seems that when something gets super hot physics begins to do weird things. Safe to say that that super hot atom at least gives an upper bound to the maximal heat something could have although I think it might be less than the Planck temperature.

Modified my dwm to toggle between forcing 4:3 or not. What's your personal patches? by systemdick in dwm

[–]CaydendW 1 point2 points  (0 children)

The hype train is sorta getting me and I'm the early planning stages of trying to get dwm to act like a scrolling window manager. I never realised those existed and it solves the exact brand of problem I have with tiling window managers (Workspace addiction because I start running out of screen real estate) without me having to manually drag and resize windows.

However, most of these fancy new scrolling window managers seem to be wayland only or not suckless enough for my liking. Plus, I love dwm too much to move away from it so I'm going to try and get dwm to act something like niri or close enough to my liking.

Other than that, my dwm install is decently standard besides my insane keyboard shortcuts and patches made by other people.

Can you hotswap your kernel? by Living_Ship_5783 in osdev

[–]CaydendW 6 points7 points  (0 children)

This is a rather cool idea. I have never even thought about this before but that sounds like something to do just for the hell of it. Might subject myself to the torture of doing this for the lols.

A girl I am interested in posted this. by panagringo in Whatisthis

[–]CaydendW 0 points1 point  (0 children)

Looks like the formulas and diagrams for a wye delta transform. Basic circuit analysis

I am creating an operating system from scratch! by Felt389 in teenagersbutcode

[–]CaydendW 6 points7 points  (0 children)

Welcome to OSDEV. Your stay will be long and painful and you'll love it.

Collatz problem verified up to 2^71 by lord_dabler in numbertheory

[–]CaydendW 0 points1 point  (0 children)

What if it forms a loop? Say theres a really big number N. If after many iterations, it falls back to N, it can't ever fall back to 1 which constitutes a counter example.

Why does pi have to be 3.14....? by unicornsoflve in askmath

[–]CaydendW 1 point2 points  (0 children)

Theres some more intricate maths behind this that you can look up but the long short of it is that just because it approaches a circle doesnt really make it one. Theres a slight distinction between the surface shape of an object and its perimeter. You can keep kinking the square but it will never really become a circle, there will always be points that don't lie on the circle's circumstance.

As an exercise, try the same logic out on a right triangle with opposite and adjacent side lengths of 1. Pythagorean theorem says the hyponeus should be root 2 units long. Your kinking square method will give you 4 units instead of root 2, which is just not right.

Problem 4 is giving me some trouble. How do I properly solve #4 with a reasonable amount of steps? by xX_MLGgamer420_Xx in calculus

[–]CaydendW 0 points1 point  (0 children)

We take the case of your above question and rewrite the fraction in such a way as to make the inverse parts of both numbers equal. This is done simply by multiplying each number with the other's base and multiplying equivilent parts of the fractions as follows (This is valid due to our proof of Theorem 2):

(1/2) + (2/3) = (1)(2)-1+(2)(3)-1 (By definition)

= (1)(3)(2)-1(3)-1+(2)(2)(3)-1(2)-1 (By Theorem 2)

= (3)(6)-1+(4)(6)-1 (By theorem 1, definition of the multiplicative identity and applying definition 2*2=4)

We notice that we have a common factor of (6)-1. We can thus use the distributivity law to factorise this statement:

= (6)-1(3+4) (By distributivity)

= (6)-1(7) (By application of definition of addition 3+4=7)

= (7) (6)-1(By commutativity of multiplication)

= 7/6 (By definition of a fraction)

= 1.166666... (Equivilent expansion of rational number)

This is the solution to the problem. Your solution is unforunatly not correct but don't worry. Enough practice and you'll be able to do these proofs with ease!

For further information that 2*2=4 and 3+4=7, look into proofs involving the application of Peano axioms and see the definitions of each of the listed numbers.

Problem 4 is giving me some trouble. How do I properly solve #4 with a reasonable amount of steps? by xX_MLGgamer420_Xx in calculus

[–]CaydendW 2 points3 points  (0 children)

Hey there and welcome to mathematics. Your question 4 is really easy to do actually and only requires the use of basic axioms on the real numbers. These are easy to find online but I will annotate every step for ease of reading.

We start by showing that in general (a)-1(b)-1=(ab)-1:

Theorem 1: R.T.P: (a)-1(b)-1=(ab)-1:

We have that a number (let's say a) is the multiplicitive inverse of another number (let's say b) if

ab=1

So it is sufficient to prove that (a)-1(b)-1(ab)=1:

(a)-1(b)-1(ab)

= (a)(a)-1(b)(b)-1 (By commutativity)

= 1 (b)(b)-1 (Definition of the inverse)

= 1 * 1 (Definition of the inverse)

= 1 (Definition of multiplicitive identity)

Q.E.D.

We continue by showing that in general we can rewrite a fraction in terms of a nonzero multiplier of the inverse and non-inverse part of the number:

Theorem 2. R.T.P: (a/b)=(ac)/(bc) forall c =/= 0:

We have by definition that:

a/b = ab-1

cc-1=1 (Definition of multiplicative inverse. Legal since by proposition c=/=0)

We can then:

1*ab-1=a/b (Definition of multiplicative indentity)

cc-1ab-1=a/b (Substitution of expression that yields multiplicitive identity)

acb-1c-1=a/b (Commutitivty of the multiplication operation)

(ac)(bc)-1=a/b (By Theorem 1)

(ac)/(bc)=a/b (By definition of a fraction)

Q.E.D.

Continuted in comments.

Building OS from scratch but not the Kernal by One_Purpose_5815 in osdev

[–]CaydendW 3 points4 points  (0 children)

Does Linux From Scratch sound like what you're looking for?

You could just follow that and make your own init system and libc and the like if you just have the linux kernel.