From 92a7870ce697922974e410343a3bf3a971041a44 Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Sun, 5 Nov 2023 22:10:49 +0100 Subject: [PATCH] Update --- aliasing.md | 2 +- assembly.md | 7 +++++-- c.md | 2 +- copyleft.md | 9 +++++---- fuck.md | 3 +++ regex.md | 7 +++++++ 6 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 fuck.md create mode 100644 regex.md diff --git a/aliasing.md b/aliasing.md index a3a7dd3..f7f529c 100644 --- a/aliasing.md +++ b/aliasing.md @@ -52,7 +52,7 @@ Of course this doesn't only happen with perfect sine waves. [Fourier transform]( Aliasing is also a common problem in [computer graphics](computer_graphics.md). For example when rendering textured 3D models, aliasing can appear in the texture if that texture is rendered at a smaller size than its resolution (when the texture is enlarged by rendering, aliasing can't appear because enlargement decreases the frequency of the sampled signal and the sampling theorem won't allow it to happen). (Actually if we don't address aliasing somehow, having lower resolution textures can unironically have beneficial effects on the quality of graphics.) This happens because texture samples are normally taken at single points that are computed by the texturing algorithm. Imagine that the texture consists of high-frequency details such as small checkerboard patterns of black and white pixels; it may happen that when the texture is rendered at lower resolution, the texturing algorithm chooses to render only the black pixels. Then when the model moves a little bit it may happen the algorithm will only choose the white pixels to render. This will result in the model blinking and alternating between being completely black and completely white (while it should rather be rendered as gray). -The same thing may happen in [ray tracing](ray_tracing.md) if we shoot a single sampling ray for each screen pixel. Note that [interpolation/filtering](interpolation.md) of textures won't fix texture aliasing. What can be used to reduce texture aliasing are e.g. by [mipmaps](mip.md) which store the texture along with its lower resolution versions -- during rendering a lower resolution of the texture is chosen if the texture is rendered as a smaller size, so that the sampling theorem is satisfied. However this is still not a silver bullet because the texture may e.g. be shrink in one direction but enlarged in other dimension (this is addressed by [anisotropic filtering](anisotropic_filtering.md)). However even if we sufficiently suppress aliasing in textures, aliasing can still appear in geometry. This can be reduced by [multisampling](multisampling.md), e.g. sending multiple rays for each pixel and then averaging their results -- by this we **increase our sampling frequency** and lower the probability of aliasing. +The same thing may happen in [ray tracing](ray_tracing.md) if we shoot a single sampling ray for each screen pixel. Note that [interpolation/filtering](interpolation.md) of textures won't fix texture aliasing. What can be used to reduce texture aliasing are e.g. by [mipmaps](mipmap.md) which store the texture along with its lower resolution versions -- during rendering a lower resolution of the texture is chosen if the texture is rendered as a smaller size, so that the sampling theorem is satisfied. However this is still not a silver bullet because the texture may e.g. be shrink in one direction but enlarged in other dimension (this is addressed by [anisotropic filtering](anisotropic_filtering.md)). However even if we sufficiently suppress aliasing in textures, aliasing can still appear in geometry. This can be reduced by [multisampling](multisampling.md), e.g. sending multiple rays for each pixel and then averaging their results -- by this we **increase our sampling frequency** and lower the probability of aliasing. **Why doesn't aliasing happen in our eyes and ears?** Because our senses don't sample the world discretely, i.e. in single points -- our senses [integrate](integration.md). E.g. a rod or a cone in our eyes doesn't just see exactly one point in the world but rather an averaged light over a small area (which is ideally right next to another small area seen by another cell, so there is no information to "hide" in between them), and it also doesn't sample the world at specific moments like cameras do, its excitation by light falls off gradually which averages the light over time, preventing temporal aliasing (instead of aliasing we get [motion blur](motion_blur.md)). diff --git a/assembly.md b/assembly.md index ea5c4e7..074b88e 100644 --- a/assembly.md +++ b/assembly.md @@ -4,6 +4,8 @@ Assembly (also ASM) is, for any given hardware computing platform ([ISA](isa.md) **Assembly is NOT a single language**, it differs for every architecture, i.e. every model of CPU has potentially different architecture, understands a different machine code and hence has a different assembly (though there are some standardized families of assembly like x86 that work on wide range of CPUs); therefore **assembly is not [portable](portability.md)** (i.e. the program won't generally work on a different type of CPU or under a different [OS](os.md))! And even the same kind of assembly language may have several different [syntax](syntax.md) formats which may differ in comment style, order of writing arguments and even instruction abbreviations (e.g. x86 can be written in [Intel](intel.md) and [AT&T](at_and_t.md) syntax). For the reason of non-portability (and also for the fact that "assembly is hard") you shouldn't write your programs directly in assembly but rather in a bit higher level language such as [C](c.md) (which can be compiled to any CPU's assembly). However you should know at least the very basics of programming in assembly as a good programmer will come in contact with it sometimes, for example during hardcore [optimization](optimization.md) (many languages offer an option to embed inline assembly in specific places), debugging, reverse engineering, when writing a C compiler for a completely new platform or even when designing one's own new platform. **You should write at least one program in assembly** -- it gives you a great insight into how a computer actually works and you'll get a better idea of how your high level programs translate to machine code (which may help you write better [optimized](optimization.md) code) and WHY your high level language looks the way it does. +**OK, but why doesn't anyone make a portable assembly?** Well, people do, they just usually call it a [bytecode](bytecode.md) -- take a look at that. [C](c.md) is portable and low level, so it is often called a "portable assembly". + The most common assembly languages you'll encounter nowadays are **[x86](x86.md)** (used by most desktop [CPUs](cpu.md)) and **[ARM](arm.md)** (used by most mobile CPUs) -- both are used by [proprietary](proprietary.md) hardware and though an assembly language itself cannot (as of yet) be [copyrighted](copyright.md), the associated architectures may be "protected" (restricted) e.g. by [patents](patent.md). **[RISC-V](risc_v.md)** on the other hand is an "[open](open.md)" alternative, though not yet so wide spread. Other assembly languages include e.g. [AVR](avr.md) (8bit CPUs used e.g. by some [Arduinos](arduino.md)) and [PowerPC](ppc.md). To be precise, a typical assembly language is actually more than a set of nicknames for machine code instructions, it may offer helpers such as [macros](macro.md) (something aking the C preprocessor), pseudoinstructions (commands that look like instructions but actually translate to e.g. multiple instructions), [comments](comment.md), directives, named labels for jumps (as writing literal jump addresses would be extremely tedious) etc. @@ -25,11 +27,12 @@ There are also no complex [data types](data_type.md), assembly only works with n Instructions are typically written as three-letter abbreviations and follow some unwritten naming conventions so that different assembly languages at least look similar. Common instructions found in most assembly languages are for example: - **MOV** (move): move a number between registers and/or main memory (RAM). -- **JMP** (jump): unconditional jump to far away instruction. -- **BEQ** (branch if equal): jump if result of previous comparison was equality. +- **JMP** (jump, also e.g. BRA for branch): unconditional jump to far away instruction. +- **JEQ** (jump if equal, also BEQ etc.): jump if result of previous comparison was equality. - **ADD** (add): add two numbers. - **NOP** (no operation): do nothing (used e.g. for delays or as placeholders). - **CMP** (compare): compare two numbers and set relevant flags (typically for a subsequent conditional jump). +- ... ## How To diff --git a/c.md b/c.md index 9bea0f8..ac00b59 100644 --- a/c.md +++ b/c.md @@ -2,7 +2,7 @@ { We have a [C tutorial](c_tutorial.md)! ~drummyfish } -C is an [old](old.md) [low level](low_level.md) structured [statically typed](static_typing.md) [imperative](imperative.md) compiled [programming language](programming_language.md), the language that's currently mostly used by [less retarded software](lrs.md). Though by very strict standards it would be considered [bloated](bloat.md), compared to any mainstream [modern](modern.md) language it is very bullshitless and [KISS](kiss.md), so it is also the go-to language of the [suckless](suckless.md) community as well as most true experts, for example the [Linux](linux.md) and [OpenBSD](openbsd.md) developers, because of its good, relatively simple design, uncontested performance, wide support, great number of compilers, level of control and a greatly established and tested status. C is perhaps the most important language in history, it influenced, to smaller or greater degree, basically all of the widely used languages today such as [C++](c.md), [Java](java.md), [JavaScript](javascript.md) etc., however it is not a thing of the past -- in the area of low level programming C is still the number one unsurpassed language. C is by no means perfect but it is currently probably the best choice of a programming language. +C is an [old](old.md) [low level](low_level.md) structured [statically typed](static_typing.md) [imperative](imperative.md) compiled [programming language](programming_language.md), the language that's currently mostly used by [less retarded software](lrs.md). Though by very strict standards it would still be considered [bloated](bloat.md), compared to any mainstream [modern](modern.md) language it is very bullshitless and [KISS](kiss.md), so it is also the go-to language of the [suckless](suckless.md) community as well as most true experts, for example the [Linux](linux.md) and [OpenBSD](openbsd.md) developers, because of its good, relatively simple design, uncontested performance, wide support, great number of compilers, level of control and a greatly established and tested status. C is perhaps the most important language in history, it influenced, to smaller or greater degree, basically all of the widely used languages today such as [C++](c.md), [Java](java.md), [JavaScript](javascript.md) etc., however it is not a thing of the past -- in the area of low level programming C is still the number one unsurpassed language. C is by no means perfect but it is currently probably the best choice of a programming language (along with [comun](comun.md), of course). { Look up *The Ten Commandments for C Programmers* by Henry Spencer. ~drummyfish } diff --git a/copyleft.md b/copyleft.md index 0c02b7b..9a19f60 100644 --- a/copyleft.md +++ b/copyleft.md @@ -1,6 +1,6 @@ # Copyleft -Copyleft (also share-alike) is a concept of allowing sharing and modifications of intellectual works (such as pictures, music or computer programs) on the legal condition that others will share it under the same terms (i.e. that they will also allow the work's further free sharing and modification etc.); it was created by the critics of [copyright](copyright.md) as a "more sane" take on sharing. Copyleft is widely utilized by some proponents of [free (as in freedom) software](free_software.md) and [culture](free_culture.md) to legally ensure this software/art and its modifications will always remain free, however other camps of freedom proponents argue that copyleft is still to restrictive and share their works under [even more relaxed](premissive.md) legal conditions. Copyleft kind of [hacks](hacking.md) [copyright](copyright.md) to de-facto remove copyright (the monopoly it creates) by its own power. +Copyleft (also share-alike) is a concept of allowing sharing and modifications of intellectual works (such as pictures, music or computer programs) on the legal condition that others will share it under the same terms (i.e. that they will also allow the work's further free sharing and modification etc.); it was created by the critics of [copyright](copyright.md) as a "more sane" take on sharing. Copyleft is widely utilized by some proponents of [free (as in freedom) software](free_software.md) and [culture](free_culture.md) to legally ensure this software/art and its modifications will always remain free, however other camps of freedom proponents argue that copyleft is still too restrictive and share their works under [even more relaxed](premissive.md) legal conditions. Copyleft kind of [hacks](hacking.md) [copyright](copyright.md) to de-facto remove copyright (the monopoly it creates) by its own power. Copyleft has been by its mechanisms likened to a virus because once it is applied to certain software, it "infects" it and will force its conditions on any [descendants](fork.md) of that software, i.e. it will spread itself (in this case the word virus does not bear a negative connotation, at least to some, they see it as a "good virus"). @@ -15,8 +15,9 @@ In the great debate of copyleft vs permissive free licenses we, as technological - It **burdens the reuser of the work by requiring him to do something extra** -- while a public domain and many permissive licensed works can simply be taken and used without taking any extra action, just as it should ideally be, a work under copyleft requires its user to take an action, for example copying the license file (and then forever making sure it doesn't get lost), giving credit etc. While one may think this is not such a big deal, it's a form of friction that can get in the way of creativity, especially when combining many works under possibly different copyleft licenses which suddenly becomes quite cumbersome to handle. - By adopting copyleft one is **embracing and supporting the copyright laws and perpetuating the [capitalist](capitalism.md) ways** ("marrying the lawyers") because copyleft relies on and uses copyright laws to function; to enforce copyleft (prevent "disallowed" use) one has to make a legal action (while with permissive license we simply basically give up the rights to make a legal action). Copyleft chooses to play along with the capitalist bullshit [intellectual property](intellectual_property.md) game and threatens to [fight](fight_culture.md) and use force and bullying in order to enforce *correct* usage of information. - In a way it is **[bloat](bloat.md)**. Copyleft introduces **legal complexity**, [friction](friction.md) and takes programmers' [head space](head_space.md) (every programmer has to study a bit of copyright law nowadays due to such BS), especially considering that copyleft is also probably largely ineffective as **detecting its violation and actual legal enforcement is difficult, expensive and without a guaranteed positive outcome** ([FSF](fsf.md) encourages programmers to hand over their copyright to them so they can defend their programs which just confirms existence and relevance of this issue). The effort spent on dealing with this is a wasted human time. Sure, corporations can probably "abuse" permissive (non-copyleft) software easier, but we argue that this is a problem whose roots lie in the broken basic principles of our society ([capitalism](capitalism.md)) and so the issue should be addressed by improving our socioeconomic system rather than by bullshit legal techniques that just imperfectly and many times completely ineffectively try to cure the symptoms while strengthening the system's mechanisms. -- **The scope of copyleft is highly debatable, introducing doubt/uncertainty** (which is why we have different kind of copyleft such as *strong*, *weak*, *network* etc.). I.e. it can't be objectively said what exactly should classify as violation of copyleft AND increasing copyleft scope leads to copylefted software being practically unusable. You may say "so what", but in law clarity is extremely important, it may also discourage people because they don't really know what they sign up for, commercial use may also be discouraged by this for the same reason which may have a similar effect to a non-free license that downright disallows commercial use. Consider this **example**: [Linux](linux.md) is copylefted which means we can't create a proprietary version of Linux, nevertheless we can create a proprietary operating system of which Linux is part (e.g. [Android](android.md) in which its proprietary app store makes it de-facto owned by [Google](google.md)), and so Linux is effectively used as a part of proprietary software -- the copyleft is bypassed. One might try to increase the copyleft scope here by saying *"everything Linux ever touches has to be free software"* which would however render Linux unusable on practically any computer as most computers contain at least some small proprietary software and hardware. The restriction would be too great. -- **Copyleft drags people into activism, leaving less place for actual creativity** -- one of the best examples is [Richard Stallman](rms.md) and his [GNU](gnu.md) project, who were quite active in programming at their beginning but soon turned more or less just into a into a political activist group, spending time on petitions, propaganda, certifications ([RYF](ryf.md), ...) and generally just the same kind of bullshit [fights](fight_culture.md) that capitalists like (often attacking even those who make free software, e.g. the *GNU boot* project for infringing on the name GNU without permission). Stallman himself said "he no longer programs because he has more important things to do". Maybe you say this has nothing to do with copyleft, but it's not a coincidence, copyleft is a mindset of constantly having to "protect" (as opposed to "letting go", the permissive mindset), for example once web applications appeared, the GNU people were suddenly all about having to make new licenses such as [AGPL](agpl.md) to [update](update_culture.md) to the newest trends in technology and society. Any time a new technology or kind of legal abuse emerges, they have to update their licenses. Choosing copyleft really means choosing to be this kind of warrior and guard of right and wrong, which of course takes away some of your creative potential, with many people just giving in completely. -- **Copyleft licenses have to be complex and ugly** because they have to strictly describe the copyleft scope and include lots of legal [boilerplate](boilerplate.md) in order to make them well defendable in court (copyleft is really about preparing for a legal war) -- and as we know, complexity comes with bugs, vulnerabilities, it makes it incomprehensible to common people and imposes many additional burdens. Indeed, we see this in practice: the only practically used copyleft licenses are the various versions of GPL of which all are ugly and have historically shown many faults (which is again evident from e.g. looking at GPL v1 vs v2 vs v3). This introduces great license compatibility issues, headaches for programmers who should rather be spending time programming and other similar bullshit. Permissive licenses on the other hand are simple, clear and well understandable, they aren't as much preparing for a court battle as trying to give other hackers a peace of mind and make them free of legal worries. +- **The scope of copyleft is highly debatable, introducing doubt/uncertainty** (which is why we have different kind of copyleft such as *strong*, *weak*, *network* etc.). I.e. it can't be objectively said what exactly should classify as violation of copyleft AND increasing copyleft scope leads to copylefted software being practically unusable. You may say "so what", but in law clarity is extremely important, it may also discourage people because they don't really know what they sign up for, commercial use may also be discouraged by this for the same reason which may have a similar effect to a non-free license that downright disallows commercial use. Consider this **example**: [Linux](linux.md) is copylefted which means we can't create a proprietary version of Linux, nevertheless we can create a proprietary operating system of which Linux is part (e.g. [Android](android.md) in which its proprietary app store makes it de-facto owned by [Google](google.md)), and so Linux is effectively used as a part of proprietary software. **So copyleft can really be bypassed** (see e.g. [bloat monopoly](bloat_monopoly.md)). One might try to increase the copyleft scope here by saying *"everything Linux ever touches has to be free software"* which would however render Linux unusable on practically any computer as most computers contain at least some small proprietary software and hardware. The restriction would be too great. You may of course try to combat the giants further until eternity, but then you are wasting your life being a shitty laweyer rather than doing useful programming. +- **Copyleft drags people into activism, leaving less place for actual creativity** -- one of the best examples is [Richard Stallman](rms.md) and his [GNU](gnu.md) project, who were quite active in programming at their beginning but soon turned more or less just into a political activist group, spending time on petitions, propaganda, certifications ([RYF](ryf.md), ...) and generally just the same kind of bullshit [fights](fight_culture.md) that capitalists like (often attacking even those who make free software, e.g. the *GNU boot* project for infringing on the name GNU without permission). Stallman himself said "he no longer programs because he has more important things to do". Maybe you say this has nothing to do with copyleft, but it's not a coincidence, copyleft is a mindset of constantly having to "protect" (as opposed to "letting go", the permissive mindset), for example once web applications appeared, the GNU people were suddenly all about having to make new licenses such as [AGPL](agpl.md) to [update](update_culture.md) to the newest trends in technology and society. Any time a new technology or kind of legal abuse emerges, they have to update their licenses. Choosing copyleft really means choosing to be this kind of warrior and guard of right and wrong, which of course takes away some of your creative potential, with many people just giving in completely. +- **Copyleft licenses have to be complex and ugly** because they have to strictly describe the copyleft scope and include lots of legal [boilerplate](boilerplate.md) in order to make them well defendable in court (copyleft is really about preparing for a legal war) -- and as we know, complexity comes with bugs, vulnerabilities, it makes it incomprehensible to common people and imposes many additional burdens. Indeed, we see this in practice: the only practically used copyleft licenses are the various versions of GPL of which all are ugly and have historically shown many faults (which is again evident from e.g. looking at GPL v1 vs v2 vs v3). This introduces great **license compatibility issues**, headaches for programmers who should rather be spending time programming and other similar bullshit. Permissive licenses on the other hand are simple, clear and well understandable, they aren't as much preparing for a court battle as trying to give other hackers a peace of mind and make them free of legal worries. - **Copyleft prevents not only inclusion in proprietary software but also in permissive FREE software.** I.e. as a consequence of denying code to corporations collateral damage is done by also denying code to ethical free software that wishes to be distributed without copyleft conditions. Similarly to how proprietary software forces free software programmers to reinvent wheels by rewriting software as free, copyleft forces permissive free software programmers to reinvent wheels and rewrite copylefted code as permissive. In this way copyleft [fights](fight_culture.md) not only proprietary software, but also other kinds of free software. +- **There are currently no nice copyleft licenses** -- this of course isn't argument against copyleft itself but it's a practical argument nevertheless. Copyleft nowadays basically means GPL and GPL has a shitton of burdening stuff like requiring credit etc. If you want pure copyleft without anything on top, good luck looking for a license (keep in mind that making your own license or using some obscure, legally untested license is mostly a bad idea). - ... diff --git a/fuck.md b/fuck.md new file mode 100644 index 0000000..ecc1092 --- /dev/null +++ b/fuck.md @@ -0,0 +1,3 @@ +# Fuck + +FUCK \ No newline at end of file diff --git a/regex.md b/regex.md new file mode 100644 index 0000000..1b8e99a --- /dev/null +++ b/regex.md @@ -0,0 +1,7 @@ +# Regular Expression + +Regular expression (shortened *regex* or *regexp*) is a kind of mathematical [expression](expression.md), very often used in [programming](programming.md), that can be used to define simple patterns in [strings](string.md) of characters (usually text). Regular expressions are typically used for searching patterns (i.e. not just exact matches but rather sequences of characters which follow some rules, e.g. numeric values), substitutions (replacement) of such patterns, describing [syntax](syntax.md) of computer languages, their [parsing](parsing.md) etc. (though they may also be used in more wild ways, e.g. for generating strings). Regular expression is itself a string of symbols which however describes potentially many (even [infinitely](infinite.md) many) other strings thanks to containing special symbols that may stand for repetition, alternative etc. For example `a.*.b` is a regular expression describing a string that starts with letter `a`, which is followed by a sequence of at least one character and then ends with `b` (so e.g. `aab`, `abbbb`, `acaccb` etc.). + +**Regular expressions are computationally weak**, they are equivalent to the weakest models of computations such as **[finite state machines](finite_state_machine.md)** -- in fact regular expressions are often implemented as finite state machines. This means that **regular expressions can NOT describe any possible pattern**, only relatively simple ones; however it turns out that very many commonly encountered patterns are simple enough to be described this way, so we have a [good enough](good_enough.md) tool. The advantage of regular expressions is exactly that they are simple, yet very often sufficient. + +TODO \ No newline at end of file