/t/ - Technology

Discussion of Technology

[Index] [Catalog] [Archive] [Bottom] [Refresh]
Mode: Reply
Options
Subject
Message

Max message length: 8000

Files

Max file size: 24.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.
Upgrade success! 8chan.moe is now running on the LynxChan 2.4 engine with our custom frontend. Please report bugs on /site/.

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

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.
>>697 Do you mean the concept of derivation? Or the computational method behind it?
>>697 What >>698 said; what are you trying to learn to do? Do you already know calculus? If so, why are you reading "calculus made easy" and struggling with a concept like infinitesimals? Or, in summary: we can't answer a question you haven't asked. Try asking a question.
>>699 It's not a question. It's a cautionary tale.
>>700 On the contrary, I think you just need to learn the conceptual basis of calculus.
>>697 only the first (or maybe second) chapter is math heavy. you wont really understand calculus if you don't understand logic and proof methods. You can easily be trained to do derivation of polynomials much like algebra, but still essentially blind to the logic. If you serious enough to read SICP why read "calculus made easy"? "Calculus" by Spivak is similar to SICP in how it demands a precise understanding of the underlying theories before even touching the core subject. Learning calculus the easy way is like learning programming by copying and pasting python snippets from a "recipes" book.
>>499 >>511 >>528 I am a seething turbo-autist with ADHD who can't do college because I am total shit at academia and I can't do homework or pay attention in "lectures", but I've been programming ever since I was in elementary school and I know for fact that I could do a good job if I was hired. What's the best course of action for me?
(59.65 KB 400x468 1446041466326.jpg)
>>703 Your only real option is building a solid portfolio. Either by getting some kind of job, joining an open source project, or starting your own project and actually making something of it. If you can walk in to an interview with an entire github/gitlab full of repos demonstrating solid understanding of material then you can theoretically get hired. The first job is the hardest one because you have no track record or "real" experience. After that, the first company can vouch for you to the second. Normally I'd never recommend books like "Cracking the Coding Interview", since I think companies that hire that way are asking for trouble, but you will be at a disadvantage since they are quizzing prospective hires on common Computer Science homework material. It's an attempt to verify you know the theory. This will be your biggest struggle, so either give up on these jobs entirely or pirate that book and work through it. For what it's worth, SICP also covers a lot of that stuff and it's more coding focused. The only issue is probably that it's functional and not object-oriented like most jobs are looking for. So once again, a post here comes down to "work through SICP". You basically need to be able to say which sort algorithm is best for a scenario, draw a binary search tree, and tell them the runtime complexity of some arbitrary code. There's entire classes on this material being taught, and you'll need to go toe-to-toe with diplomafags. The good news is that most of them suck at these questions and fail because they just crammed the material without understanding it.
Speaking of jobs, what does everyone's resume look like? Do you use one of those newer templates full of colors and retarded shit like star ratings for language and technology knowledge? Or do you still have something more old school with no colors and only one column? I still have the latter and I feel a bit left behind but I do not like the newer style. I'm gonna need to remodel my resume soon so any resume advice welcome. Might not be the right thread but it's moderately on topic. >>688 That's pretty cool. On closer inspection it seems gcc favors XMM instead of the x87 FPU and always uses XMM, which I didn't think it would.
>>705 I think the latex thread became the de facto resume thread, at least for a bit. Obviously everyone is really apprehensive to actually post their resume, which makes it hard to share examples. Maybe we should have a resume thread For mine, I basically eliminated the margins, stuck all the personal/contact info in a centered header at the time. I follow that with an objective (required by some HR departments) and a "skill cloud", which is basically a table (lines hidden) containing my top skills. After that, I have job experience from my top 3-4 jobs. Each of those has bullet points with descriptions of my duties. Numbers are really good, for example "optimized code which led to a 50x speed-up in common task". I was hesitant to do bullet points, but my friend in HR at [well-known corporation] insisted and now I'm used to it. I stick education and some volunteer work in as an afterthought, just to keep it there. My trick is that the template follows the format of a "one column" resume, but because I eliminated the margins I have room to play with. So I use right-justified text on the same line as other text to cram more information into a tighter space. For example, the line with my title will also have the dates I worked there on the right. This avoids wasting lines for trivial information that is immaterial to the work and lets the highlights be my skills and duties, which is what should be put forward to begin with.
>>706 Ah, I'm doing something similar to you. One column, very small margins, skill summary with bullet points, job descriptions in bullet points and specific descriptions that have numbers with a different type of bullet. Unfortunately it still looks dated and it makes it looks like a boring wall of text. I might have to remove some stuff, but I have no idea what. >I was hesitant to do bullet points, but my friend in HR at [well-known corporation] insisted and now I'm used to it. I mixed a little bit, to be fully honest. The bulk of the description for each position is in bullet points but I do have 1 or 2 lines telling what the company and job were about in general terms.
Let's say that I'm working on a library that's going to expose a C++ class, and I want to avoid leaking implementation details (private types, private member variables, private methods, etc.) on the interface header file. How is this supposed to be done? This is easy in C but it's giving me headaches in C++. Here's an example class: #include <someOtherClass1.h> #include <someOtherClass2.h> class library { public: enum class returnValues { ok, not_ok, definitely_not_ok, }; library(){} ~library(){} returnValues pub1() { return returnValues::ok; } private: enum class action { action1, action2, do_barrell_roll }; returnValues priv1(someOtherClass1 &c){} //someOtherClass1 defined in someOtherClass1.h returnValues priv2(someOtherClass2 &c, action a){} //someOtherClass2 defined in someOtherClass2.h } Here the class has an internal type (action), and uses 2 other classes defined in 2 other header files. The latter is specially annoying because it forces me to distribute more header files with my library, header files which are of no use whatsoever to whoever consumes it. Searching around I found that people recommend the PIMPL idiom to fix this issue, and while it looks like yet another workaround to the issues created by OOP, it seems like it would do the job, however this technique goes a bit too far and doesn't allow me to expose the things I do want to expose (public types like returnValues for instance)! What now? None of the examples I've found contemplate this, they always do the piss easy example of a class that has 1 method receiving and returning void. How would you approach this? I have a few ideas but none are very good.
>>721 First, it's a bad idea to use c++ as anything other than a header only library as the ABI changes from version to version and isn't standardized, so you'll need a .lib for each compiler and version you want to support, but ignoring that, PImpl does solve your problem, for you don't need to stick your entire class inside of it. Expose what you want to expose in library and forward declare the Impl class. Library doesn't need to see the definition of Impl to hold a pointer to it, only a declaration, so you can define Impl in some cpp that includes library and make use of its members. class library { public: enum class returnCodes { ok, not_ok, definitely_not_ok, }; library() {}; ~library() {}; returnCodes Foo() { return returnCodes::ok; } private: class Impl; // Defined somewhere else. Impl* _impl; }; Cppreference has a page on PImpl https://en.cppreference.com/w/cpp/language/pimpl. I recommend bookmarking the site if you haven't already as it's a very good resource on c++ and its standard library in general. It's basically one step removed from the standard document, but it at least attempts to include examples and explanations alongside its jargon.
If I want to render environments and objects other than text-based things, am I the best off with learning C++ and use openGL? I cannot find good tutorials for using C and openGL.
>>733 As far as I know it's written in C, but generally game developers (and those doing 3D graphics) tend to use C++ so I imagine most guides will cover that. It's much easier to stick things in objects that just automate tasks rather than relying on passing stuff through functions. I'd recommend learning C++ anyways. Unless you have to work without a standard library or are writing an operating system there's generally little benefit to sticking to C. That said, you should probably consider learning Vulkan instead of classic OpenGL, which is effectively deprecated. If you need any resources on C++ I can recommend a few books. I can't say I know any OpenGL (or Vulkan) resources, but I can dig through my collection of PDFs and try to find something if you need it. But I imagine it will use C++.
>>734 I see - will consider. Sure, it'd be appreciated!
>>728 >it's a bad idea to use c++ as anything other than a header only library Now that doesn't really sound believable, does it? >you'll need a .lib for each compiler and version you want to support I already took that for granted, happens with C too, though I don't know to how much of an issue there is from one version of a compiler to another. >you can define Impl in some cpp that includes library and make use of its members. I thought of doing that, but isn't having that kind of circular dependency terrible form? I mean, library would depend on impl, and impl would depend on library. The headers wouldn't depend mutually because of the forward declare but it still smells stinky. >cppreference Yeah, I use it as a reference sometimes, but man the information written there is written with such complexity. I realize there might not be another way because the language itself has gotten really complex, but that doesn't make things any easier to understand. >jargon This is something that I've wondered for some time. How much of the jargon and complex language functionalities does the average C++ programmer understand and use daily? Am I the only one that thinks the language has gotten absurdly complex? For example, would an average C++ programmer already know what >std::experimental::propagate_const<std::unique_ptr<impl>> pImpl; means? When you read what it does it's reasonable, but I had never come across propagate_const before, and this is just the first thing you see on the linked page, I find that cppreference continually pulls std jargon out the ass and I have no idea how there can always be more!
>>738 I should have specified C is definitely much better as an interface than C++. The lack of name mangling and function overloading allows for a much more stable ABI which can be compatible between different versions of the same compiler or, more specifically, different versions of the standard (a program compiled with C++11 can call c functions in a library compiled with C++20). Once you start using C++ things in the interface you've basically locked yourself in to that compiler version, and it's why you hear stories of companies sticking to C++11 while C++20 is out: they use libraries which they can't recompile. I worked at a place where we didn't switch off of C++14 because no one wanted to recompile boost. > isn't having that kind of circular dependency terrible form? It's terrible form in the sense that it isn't sanctioned OOP design, but strict adherence to a paradigm is for academics. Sometimes the pragmatic solution to a problem won't jibe with the language at hand, and you can either spend hundreds of hours re-architecting a system or just go with what works. In this case, the forward declare could be avoided if you use a void*, but then you'd need to cast it back anytime you want to use it. >>jargon >This is something that I've wondered for some time. How much of the jargon and complex language functionalities does the average C++ programmer understand and use daily? Am I the only one that thinks the language has gotten absurdly complex? For example, would an average C++ programmer already know what >>std::experimental::propagate_const<std::unique_ptr<impl>> pImpl; >means? When you read what it does it's reasonable, but I had never come across propagate_const before, and this is just the first thing you see on the linked page, I find that cppreference continually pulls std jargon out the ass and I have no idea how there can always be more! It really depends on what you mean by average. If you're writing, reading, and reviewing C++ for 8 hours a day, you start to pick up a lot of the esoteric things pertaining to what you're doing. I'd say most of my peers know what templates are and can write simple ones (maybe even a little SFINAE); know about vector, map, set, sort, pair/tuple, string, iostreams, smart pointers, lambdas, iterators, numeric_limits, and maybe filesystem; are capable of looking up most of the language they'd find out in the wild (advanced templates being the thing most would have trouble with); and know some of the surface level jargon of the standard (declare, define, undefined behavior, etc.). Beyond that, you need to have an interest in the language itself to start picking up more stuff. As for if average C++ programmers would already know >std::experimental::propagate_const<std::unique_ptr<impl>> pImpl; I'd say they could look at it and understand what it meant. Most people have probably never used anything in experimental save for filesystem when it was in there, so I'd doubt that anyone could say they've used it out in the wild, but my first intuition is that it would make the pointed to object const if its containing object was const which, from my understanding of cppreference, is the case. The fact that cppreference likes to stick new and strange things into their examples is why I like it so much. You can click on most things that come from the library right from the examples, and their usually simple enough to understand without having to look up everything new. I might be biased, but I like learning about the new and strange stuff, so I don't mind their inclusion. If you really want to get into the jargon, all the papers from the standards committee are posted online at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/ and the working draft itself is posted at https://github.com/cplusplus/draft. I mostly watch the papers for future features and the read the draft if I come across some questionable code.
>>749 >I should have specified C is definitely much better as an interface than C++. I got what you meant anyway. While the lack of name mangling in C does make things a lot easier and might be one less point of failure when linking, ultimately mixing binaries compiled with different compilers is bad idea and might not always be guaranteed to work. You'll link them for sure, but the whole thing might crash at runtime. Hell, if I remember correctly on Windows you can crash your program at runtime even if everything is compiled with the same compiler because they have different underlying runtimes for different compilation configurations. I personally had to work on a (C) project that was being compiled with quite an old GCC toolchain and I needed newer compiler switches not available in that version, but when I tried compiling the code with a newer GCC it would first fail to compile the project and when that got solved, it would randomly crash during execution and not perform predictably. Ultimately I think it's always a good idea to thread carefully around different compilers. >I worked at a place where we didn't switch off of C++14 because no one wanted to recompile boost Did the new compiler really fail at linking with the old libs? Is it really that common for newer compiler versions to make breaking changes to the mangling? And isn't boost kinda easy to compile? >I like learning about the new and strange stuff It's a bit too much for me sometimes. It's interesting stuff, but barely any of it is useful, and I feel a bit peeved that I sometimes have to dig into the language so much when I feel other languages don't require such a big effort and deep knowledge. Anyway, thanks for your answers, they're interesting. I don't get the speak with a lot of other C/C++ devs unfortunately and I lack a ground reference.
(40.31 KB 600x746 how.jpg)
I don't understand memory alignment errors in C . How can one unintentionally end up dealing with misaligned memory? Can you give me a real world example?
>>767 Pointer aliasing for example. In lots of applications, serial numbers are 4 bytes long, or 8 bytes long, or less. Using a 32 bit int or a 64 bit int is very handy to do operations against the serial number (such as comparisons), but using a buffer composed of several 8 bit integers is very useful to store them and transmit them, so what could happen is that the storage is 4 integers of 8 bits each for the aforementioned purposes, and then it's casted to an integer of 32 bits of size to do some other operation, and although this is valid according to the standard it is an unaligned access.
>>767 When you assume sizes/offsets of structs you can run into issues. On 386 Its completely valid to read a DWORD at any byte offset, which can make errors subtle. Its generally not something you run into unless you're trying to be clever. related: http://www.catb.org/esr/structure-packing/ I've had issues while working with structs and binary formatted files. here the file is manually packed, but read with assumed packing, this is a stupid example but I remember doing something similar when I was new. #include <stdio.h> typedef struct { char fugg; int benis; } spurdo; void read_spurdos(spurdo *S, int n, char *fn) { FILE *fp = fopen(fn, "r"); fread(S, sizeof(spurdo), n, fp); fclose(fp); } void write_spurdos(spurdo *S, int n, char *fn) { int i; FILE *fp = fopen(fn, "w"); for (i = 0; i < n; i++) { fwrite(&S[i].fugg, sizeof(char), 1, fp); fwrite(&S[i].benis, sizeof(int), 1, fp); } fclose(fp); } void debug_spurdos(spurdo *S, int n) { int i, j; for (i = 0; i < n; i++) { printf(":%c B", S[i].fugg); for (j = 0; j < S[i].benis && j < 40; j++, putchar('=')); printf("D\n"); } } int main() { spurdo sparde[] = { { 'O', 9 }, { 'D', 6 }, { '(', 1 } }; spurdo gondola[] = { { '?', 0 }, { '?', 0 }, { '?', 0 } }; write_spurdos(sparde, 3, "fugg"); read_spurdos(gondola, 3, "fugg"); debug_spurdos(sparde, 3); debug_spurdos(gondola, 3); return 0; }
>>770 Ebin
>>770 That's a good link and one of my favorite reads. I remember adding attribute(packed) to my first attempts at packed structs, because I didn't trust I was doing it right. Once I realized it was doing nothing and potentially introducing performance penalties, I stopped. Newbies really underestimate the performance penalty of unpacked, misaligned data. They also forget that fitting data into the size of a cache line is immensely beneficial. I've seen benchmarks which stall because you add a single extra unpacked char to a struct.
(12.11 KB 220x280 stupid australian cunt.jpg)
Whats a good resource for learning JCA/JCE and Bouncy Castle? I don't necessarily need to know the mathematics, I am just having trouble understanding the completely autistic class structure. I bought pic related without realizing it's from 2005, so I need something up-to-date. Also, why was the Java Cryptography Architecture designed by a team of severely autistic chimpanzees?
>>784 >Also, why was the Java Cryptography Architecture designed by a team of severely autistic chimpanzees? Because everything about Java was designed by a team of severely autistic chimpanzees. Java is what happens if you take C++, which is an awfully designed language, and remove the C parts, which was the justification for the awful design. You end up with an awfully designed language for no good reason.
>>836 >which is an awfully designed language, and remove the C parts Java is more comparable to C# but it eats more memory do to wanting to be faster just for the sake of claiming to be fastest. >programming languages don't have performance >only implementations do >you can't say that C is faster than Java!!!!!!!11111111111111 >performance doesn't matter, only programming time does because when I sell it, I won't be the one looking at the loading screens all day >rubs hands
(265.06 KB 997x879 eggnog.jpg)
>>838 >performance doesn't matter, only programming time does because when I sell it, I won't be the one looking at the loading screens all day
>>838 >Java is more comparable to C# C# was modelled after Java, but without the burden of backwards compatibility with ancient Java code, which is why it does a few things better. It's still mostly the same OOP Pajeet tier shit, which is intentional by design.
On the topic of C#, is it mostly constrained to Windows platforms on the field or is it also used for Linux to a good degree?
>>850 Mono allows you to compile and run C# and .NET applications (I believe) on Linux.
>>851 I know, but the question was more oriented towards if companies actually do C# development on Linux, as with it being originally a Windows framework I imagine that's the platform most of the development takes place on. I feel I should learn a higher level language but my experiences with Java haven't been great. C# looks a lot like C++ but if people only use it on Windows I don't think it's the language I should go after either. Wish C++ was more popular.
>>852 Ah damn I completely read over the last part. Microsoft is trying to push cross platform with .NET Core, and usage of it is growing in the (loonix) server space. The traditional .Net framework is still focused on Windows development. About C++ development, you shouldn't feel discouraged about learning it if you don't feel there is demand. There certainly is but its likely less than times past since the current programming world has a heavy lean to web development.
>>852 From what I have seen in job postings, C# programmers are also expected to work with various Microsoft Windows technologies. I don't remember the names of those technologies, but I did not even bother applying to those jobs, because I figure they would also make you use Windows as your work OS. I am working as a Java Pajeet, but at least they let me set up my own computer myself.
(134.91 KB 1059x778 wt.png)
Someone on another thread mentioned wt, a C++ library to create webpages. I decided to give it a try and I ended up making a very simple imageboard proof of concept to learn the ropes. It's very interesting though still a bit constrained in some regards, I really hope they continue improving it. One thing I noticed and was surprised by is that somehow this thing does not need javascript to update the DOM. I can make a post and the post is appended to the page correctly even without javascript enabled. Also because of how the library works a thread update timer would not be necessary because the server could just update your browser's page in realtime when a new post is submitted. Overall kind of exciting man. Wish I had a server to play around with for shenanigans. >>868 What's the typical setup for Java development on Linux? What programs are required and what's the typical workflow?

[Index] [Catalog] [Archive] [Top] [Reply] Posts: / UIDs: / Files:
Delete
Report

no cookies?