/t/ - Technology

Discussion of Technology

Index Catalog Archive Bottom Refresh
Mode: Reply
Options
Subject
Message

Max message length: 8000

Files

Max file size: 32.00 MB

Max files: 5

Supported file types: GIF, JPG, PNG, WebM, OGG, and more

E-mail
Password

(used to delete files and postings)

Misc

Remember to follow the rules

The backup domain is located at 8chan.se. .cc is a third fallback. TOR access can be found here, or you can access the TOR portal from the clearnet at Redchannit 2.0.

Please be aware of the Site Fallback Plan!
In case outages in Eastern Europe affect site availability, we will work to restore service as quickly as possible.

WE ARE PLANNING THE 2.8 SITE UPGRADE FOR THIS WEEKEND, MONDAY EVENING 6-27. DOWNTIME WILL BE BRIEF, AND THEN WE HUNT FOR BUGS.
(Estamos planeando la actualización del sitio 2.8 para este fin de semana, del lunes 6 al 27 por la tarde o por la noche en CST. El tiempo de inactividad será breve y luego buscaremos errores.)


8chan.moe is a hobby project with no affiliation whatsoever to the administration of any other "8chan" site, past or present.

Board Nuking Issue should be resolved. Apologies for any missing posts.

Programming Thread: Up and Running Edition Anonymous 04/27/2020 (Mon) 19:03:16 No. 9
Hey Anon, Learn to Code! There's a bunch of free resources for learning to program. Come here to ask for advice or to discuss current projects. Download the complete Gentooman's Library: https://g.sicp.me/books/ Visit MIT OpenCourseware on (((YouTube))) https://www.youtube.com/user/MIT Or take one of these free online courses being offered by universities right now: https://www.freecodecamp.org/news/free-courses-top-cs-universities/
Edited last time by codexx on 05/04/2020 (Mon) 00:54:19.
>>3442 >I want to have a couple of alternate notations available (i.e. non regular staffs/notes/symbols/etc.) Damn. I can't into notes beyond the basics. Fuck. I would have liked those thousand dollars. >LISP is cancer Yes but it's simple.
(106.35 KB 1200x675 C4iv_loUoAAcN-5.jpg)

>>3444 I posted the books and I'll echo the previous response. SICP is a book that teaches you computer science and uses LISP as a vessel to do so (there is also a Python version Berkeley used as the basis for their intro courses). The other books, including the beginner's guide to C I posted, are aiming to teach you C. There's an additional complication, which is that C is a procedural language and LISP is functional. That makes them diametrically opposed in philosophy and composition. As stated above, it helps keep newfags motivated when they can immediately see the result of their code. This is why "coding bootcamps" do some kind of JavaScript to build webpages, often with a ton of libraries preinstalled. It helps keep their students engaged when tweaking one line changes a visual element on a webpage. A lot of computer science is not that. It's the opposite. It's reasoning about how to compose a problem via a series of described steps to get an accurate result. Bugs are the result of issuing improper commands with unintended side effects. This is why neither C nor LISP rank highly on lists of "good beginner languages": neither one does enough of the work for you to give that immediate rush. You will have to do a lot by yourself for any payoff. But that's exactly the point. >>3442 It doesn't look too bad, pending the particulars of how it actually draws shapes. Why not save the cash and write it yourself? Surely LISP is not that big of a barrier.
>>3442 Your best bet would be to contact the authors or maintainers of Lilypond, they know the code the best and it´s going to be the easiest for them. What does Lilipond even do? From the looks of it you just write LaTeX and it generates a PDF of the music sheet. If I knew anything about music I would give it a try, but I would have an easier time deciphering hieroglyphs than a music sheet.
When is it better to use procedural programming versus object oriented programming?
>>3480 >When is it better to use procedural programming versus object oriented programming? OOP is inherently more complex than procedural. As with every kind of complexity, the answer is "when you lose less due to complexity than you gain from OOP". For short applications that do one thing and do it well there is generally little benefit from OOP. If you want to write large bloatware applications then OOP can help you structure and organize your code better. Especially if you want to unit-test it heavity (with small applications there is usually no need for unity-testing, you can just jump ahead to integration testing). The idea of OOP is not classes and inheritance, it is about interfaces and objects exchanging messages. You structure your application as a graph of objects and they communicate among each other by sending messages (calling methods). The kind of message an object can receive depends on its interface (i.e. usually its class and the protocols it implements). I don´t mean interface in the way Java uses it (which should be called protocol) but the public methods it exposes. Now here is the important part: you can swap out one object in the graph for another with the same interface and the rest of your application will not notice it. This allows you to change the way your code works at runtime and you can contain behavior inside data. So for example instead of massive if-statement like if (some_condition) { // lots of code here } else if (another_condition) { // another wall of code here } else { // you get the idea } you can have one handler object variable and simply change the value of the variable when some global condition happens: var handler = new WorkingHandler(); handler.handle(clientRequest); // Something happens and we need a handler that always rejects a reques handler = new RejectingHandler(); handler.handle(clientRequest); So the ultimate question is, which is easier to write in your case. If you have a long running application that needs to adapt to changes and have a lot of features, then OOP might be a good fit. I also want to mention functional programming which can also produce flexible applications without all the mental overhead of classes.
>>3480 I like procedural programming because it gives me a lot of freedom and it doesn't force me to conform to doing things the way the language wants me to, but ultimately you end up reinventing the wheel because things usually fall in line with how OOP organizes things in classes anyway. That is, you end up with a structure (object) and several functions (methods) that receive the structure as a parameter (this pointer) and operate on it, possibly declaring the structure as an opaque type to force the user to only access it through the interface.
>>3480 Have to agree with some key points made in >>3482. Inheritance is far less important than textbooks and people at job interviews give it credit for. Controlling access to data and grouping the data via a common interface is the real meat of it. If you don't need to organize data and control access to it, there's really not a massive need for objects in your code. There is a case for inheritance, of course, especially as you move to large programs. Especially those with GUIs. And factories can help with abstraction. It's nice to be able to generate an object as needed and be able to interact with it using the same interface for all the children without regard for the underpinnings. But it's also a lot of preparation. The worst thing is developers who worship Object Oriented as though it were a god. Absolute brainlets who think a 50 line script is improved by 300 lines of handlers to abstract something you set once. It could have been a variable. No harm is done. No additional validation is needed. If you're that concerned, add a check or an assert. Adding objects where they're not needed just adds complexity for no reason. If you look at a big block of spaghetti, or worse, multiple blocks of repeated copypasted spaghetti, and you say "it would be easier just to track each of these and manage them with basic rules", it's time to use an object. Segregate the data, mark how to handle it, and then have that function handle it properly for that subtype. You just condensed spaghetti into one line and it probably cost you 50 in boilerplate, but you never have to worry again. >>3487 Procedural is fine and great for scripts, but there does come a point when sifting through data or trying to ensure certain variables comply with rules is just easier to do with objects. Procedural has some severe limitations when it comes to tracking state over the long term. Like you said, you end up reinventing the wheel more often than not. Sometimes you really just want a linked list, and writing one in C is a lot of extra work with a lot less guarantees. This is one reason I use C++ even for programs that would be fine in C: it's nice to just include existing data structures and run with them. >
I haven't tried using Rust, but from what I read and (try to) understand, the "safety" of Rust comes from not allowing raw memory access with pointers outside of unsafe blocks?
>>3599 The compiler has an element called a "borrow checker". This is basically the same as smart pointers in C++, where references to an object are counted and tracked. The difference is, they still make you clean it up and have syntax to specify you're passing ownership of the memory from wherever, and then the borrow checker looks it all over and verified everything created was freed by its owner. Unsafe blocks basically just disable the checker for that region. Rustfags are just mad other languages gives you tools to handle memory instead of having the language scream in your face constantly.
(40.48 KB 474x592 op.jpg)

Any opinions on this book? Should I pick Modern Operating Systems or another one as my first OS book instead? https://libgen.is/book/index.php?md5=7312960D0FB110104EA01347F30CC98A >>16 >If you have something specific in mind, post a request and I'll dig up some resources. Coding malware, especially bots, rootkits and spyware. Maybe something to do with AI in the future. (lol I know, I'll have to study a lot for that). I`ll take a look on OP resources anyways to help me survive in the modern market. I hope having read half of a C book and knowing some basic python will help me understand. (I had some knowledge on complex variables calculus, which I guess would help, like any math does, but that was like 10 years ago, already forgot almost everything lol)
>>3442 >A music engraver grabs text and transforms it into a nice looking page of music. >I want to have alternative notations Why not use LaTeX MusiXteX for this? Output the lilypad and then edit the tex file to get what symbols you want. Am I missing something? https://texdoc.org/serve/musixtex/0 http://tug.ctan.org/info/latex4musicians/latex4musicians.pdf There seem to be multple packages which do something like you're saying but I don't know specifically what your goals are.
Why the fuck am I forced to take discrete math for my computer science degree?
>>7828 Because computers are discrete machines, and a decent discrete math course will teach you about how mathematical problem solving. That said, most discrete classes fucking suck because they are basically remedial or just formalize things already taught in college math. If you spend all semester learning about sets, functions, series/sequences, and propositions like it's the first time you have ever been taught it, yeah you're in a shit class. The cool things in discrete worth learning are where number theory and cryptography intersect, where probability and combinatorics can be used to accurately understand algorithmic complexity, graph/tree modeling, and finite-state machines -> theory of computation sort of stuff.
>>7836 That makes sense, shame my current prof is known as one of the worst in the building >>7836 >>7836
discrete math a fuckin nightmare from what people have told me
>>7836 ive seen that fucking garbage when I was writing a regex engine and holy shit, its fucking oop but x999999 more retarded, what fucking imbecile comes up with this shit its complete bullshit and the worst way to understand code execution, like yeah wow look a fucking conditional jump look how complicated it is, fucking grow up, its literally just a fucking jump in the code this is what happens when no one understands assembly anymore, computers are super fucking simple, stop creating bullshit complexities that DO NOT EXIST
(31.08 KB 1300x642 state_machine_diagram.png)

>>7854 Are you complaining about the state machines for checking whether a string matches a regex? Like these or pic related? https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton https://en.wikipedia.org/wiki/Deterministic_finite_automaton I thought the whole point of this is that this can be done by something simpler than a computer (Literally a finite state machine). And then other problems like matching parentheses requires a stack
>>7861 yes this is absolute fucking autism lingo for regex directed and text directed matching ie. while ( regex[i++] != '\0' ) { match( regex[i], text ... } while ( text[i++] != '\0' ) { match( text[i], regex[j] ... }
(153.87 KB 446x457 1343800725619893.png)

>>7854 Discrete Math/Theoretical CS is less about computers and computation so much as it is about teaching sophomores how logic works, because otherwise they will spend all of their lives cuntpasting from stackoverflow instead of ever thinking about the machine state. Most kids don't have an understanding of algorithmic problem solving which is agnostic of a specific coding language, and maybe 30% of those I've seen actually shouldn't be there because they will never develop an internally consistent model of how a anything works despite lecturing. "Johnny can't code" stands especially today because many zoomers have spent most of their lives in (web)app-world instead of anywhere close to the machine. >no one understands assembly anymore The same people who went out of their way to learn asm in the 80s and 90s still eventually learn asm now: a small vanguard of auto-diadacts who do so because they wish to program at a low level. You're not wrong, but you are not the intended audience.
>>7863 But isn't that what the regex / text directed matching is doing underneath? It compiles the regex to some representation of the graph, and then tries to match the text to it. The abstraction isn't supposed to help you understand the "code execution." The code execution is derived from the abstraction.
>>7884 no youre a fucking idiot the graph doesnt fucking exist, all engines are fundamentally only doing one fucking thing and thats comparing the current match count with the total required to get a full match its just setting flags for each individual condition in the regex and when all flags are 1 it returns the position and size of the match, heres a simple fucking regex directed sequence for matching literals matchN=strlen(regex); while ( text[t] != '\0' ) { match=0; r=0; while ( regex[r] != '\0' ) { if ( text[t+r] == regex[r++] ) { match++; } else { break; } } printf(";%d;%d\n", t, t+r ); if ( match == matchN ) { return t; } t++; } every other feature is just a different evaluation of the match condition, like lazy quantifiers it would change if ( text[t+r] regex[r++] ) to while( text[t+r] regex[r++] ), or a fucking dot which would change it to if ( text[t+r] != '\0' ) its the same with text-directed but with no backtracking on failure, isntead it just slowly builds a map of the entire text piece by piece getting all permutations of regex[i] at once instead of sequentially and then when you actually compile it and disassembly it you wont even see any loops or fucking state bullshit, just a shit load of xor, not and 'and' because most of theses comparisons can be be done completely branchless using bit operations like xoring the bits of every character to an accumulator and shifting left which would literally tell you every single position of the character in the string without making a single comparison or loop ie. [000010000111000] which are indexes (3,4,5,9) none of youre abstract bullshit is real not on a code level or the physical level inside the actual cpu it has NOTHING in common with reality
<it can be compiled to jumpless bit-fuckery <for my super special regex engine (special like me) <so state machines are not real
(57.13 KB 633x729 011734520943.png)

>>7887 >magic box
>>7887 believe me bro I wrote a lisp compiler in haskell that uses a data flow model to compile with fully automatic paralellization to verilog and runs on FPGA and does everything in O(1). I haven't released it because the CIA might kill me. Quantum is a jew hoax.
>>7901 how hard it is to write a compiler? :0
>>8185 Depends. Is it your own language? How fully-featured do you want it to be? If you just want to write a simple compiler for an easily parsed language then it's not so bad. You could also start with an interpreter first. Here's an example you can follow if you'd like: https://www.youtube.com/watch?v=eF9qWbuQLuw
based
the SICP book is not 10$ :/ ....
Is PajeetScript really that much on demand? I don't wanna use it, but it feels like everyone is telling you to do so.
>>8511 If by PajeetScript you mean Javascript then yes, yes it is if you work in webdev (which is most of programming jobs).
Honestly, I recommend starting with Python or something. >https://automatetheboringstuff.com/#toc
Has anyone ever made a webscrapper for collecting images under a tag/hashtag on twatter/oixiv/some booru? How would you go about doing such?
Bump this awesome thread. I'm learning prog from scratch, whish me luck.
>ctrl + f >"the art of programming" not found contempt.png


Forms
Delete
Report
Quick Reply