Programming thread

From CLRS.
BLEACHED? More like FILTERED.COM :trump:
 

Attachments

  • Screenshot_20210120-162326.png
    Screenshot_20210120-162326.png
    287.6 KB · Views: 133
  • Screenshot_20210120-162418.png
    Screenshot_20210120-162418.png
    577.1 KB · Views: 131
  • Screenshot_20210120-162524.png
    Screenshot_20210120-162524.png
    1.1 MB · Views: 119
  • Screenshot_20210120-162602.png
    Screenshot_20210120-162602.png
    789.8 KB · Views: 123
  • DRINK!
Reactions: Yotsubaaa
From CLRS.
BLEACHED? More like FILTERED.COM :trump:
Goddamn, it's been a while since I looked at Intro to Algs but I didn't think it was that bad.

Geez, why wouldn't they just say "Let N denote the length of the sequence A" at the top, so the math didn't look so fucking gross? Surely this thought had to have occurred to whatever poor bastard was typing up the TeX for it.
 
  • Like
Reactions: Marvin
Goddamn, it's been a while since I looked at Intro to Algs but I didn't think it was that bad.

Geez, why wouldn't they just say "Let N denote the length of the sequence A" at the top, so the math didn't look so fucking gross? Surely this thought had to have occurred to whatever poor bastard was typing up the TeX for it.
I actually find this notation a lot easier to read than heavy name aliasing. Often times in math/logic books, the authors will go to such extreme lengths to get the expression as short as possible that you have to build a lookup table and manually expand it out yourself before it starts looking like anything but a spilled can of alphabet soup.

BLEACHED? More like FILTERED.COM :trump:

As somebody who has been through all this, my advice is:

1) Take frequent breaks. Cut up studying in between 40 minutes and then go play games for 20. Just whatever you do make sure that your mind is completely OFF of the task. When you stare at a page too long, your mind will start going in circles and get stuck. Removal of the topic from your focus will help break that.

2) try not to sit there and bang your head against the exact terminology. Book authors are not always the best at stating things clearly and often times an alt perspective or outside visual illustration can lead to an "OH, DOI WHY DIDN'T YOU JUST SAY THAT" moment.

3) Don't feel bad. They are TRYING to filter you. If it wasn't hard, the degree wouldn't be worth anything.
 
Last edited:
  • Feels
Reactions: BLEACHED.COM
Thanks! Will give it a try
Just a word of warning, he teaches C11, which is the newest C standard, but lots of stuff doesn't support it, so some of the stuff he pushes (like [static 1]) won't work. In addition so much shit is written for ANSI C that you'll have to end up learning the differences between that and the newest standard, and you'll lose a surprisingly large amount of features if you need things to work in it (like declarations anywhere, array initializes, compound literals, etc.) There was also a time a fifth of the book was his wishlist of shit he wanted in the standard, which thankfully he cut out because it was useless.
 
Just a word of warning, he teaches C11, which is the newest C standard, but lots of stuff doesn't support it, so some of the stuff he pushes (like [static 1]) won't work. In addition so much shit is written for ANSI C that you'll have to end up learning the differences between that and the newest standard, and you'll lose a surprisingly large amount of features if you need things to work in it (like declarations anywhere, array initializes, compound literals, etc.) There was also a time a fifth of the book was his wishlist of shit he wanted in the standard, which thankfully he cut out because it was useless.
Thanks for the info, any recommendation for older C standard book?
 
Just a word of warning, he teaches C11, which is the newest C standard, but lots of stuff doesn't support it, so some of the stuff he pushes (like [static 1]) won't work. In addition so much shit is written for ANSI C that you'll have to end up learning the differences between that and the newest standard, and you'll lose a surprisingly large amount of features if you need things to work in it (like declarations anywhere, array initializes, compound literals, etc.) There was also a time a fifth of the book was his wishlist of shit he wanted in the standard, which thankfully he cut out because it was useless.
Yeah, I should have mentioned that I’m reading it mainly to write new code targeting modern compilers.
 
I actually find this notation a lot easier to read than heavy name aliasing. Often times in math/logic books, the authors will go to such extreme lengths to get the expression as short as possible that you have to build a lookup table and manually expand it out yourself before it starts looking like anything but a spilled can of alphabet soup.



As somebody who has been through all this, my advice is:

1) Take frequent breaks. Cut up studying in between 40 minutes and then go play games for 20. Just whatever you do make sure that your mind is completely OFF of the task. When you stare at a page too long, your mind will start going in circles and get stuck. Removal of the topic from your focus will help break that.

2) try not to sit there and bang your head against the exact terminology. Book authors are not always the best at stating things clearly and often times an alt perspective or outside visual illustration can lead to an "OH, DOI WHY DIDN'T YOU JUST SAY THAT" moment.

3) Don't feel bad. They are TRYING to filter you. If it wasn't hard, the degree wouldn't be worth anything.

Also i would like to add.

A piece of a paper and pen. Try and draw the thing that happens. To get a basic overview.
 
  • Agree
Reactions: Bongocat
If you pick up C, and then C++, everything else will seem pretty easy. But I mean really pick them up - do a basic project in C, like a redis module, and then move to something more complicated like a toy OS, a very basic relational DB, or a basic clone of apache or NGINX. Make sure to do C before learning C++. C++ has a lot of conveniences like std::string that will cause problems if you don’t have an idea of what they’re doing under the hood.
What is a great idea for a redis module?

I want to follow omnihitler advice and try to do a simple redis module to try to improve my c skills, what are the best ideas that don't need a prior knowledge of databases or the need for a preexisting database?

Right now i have a very basic knowledge of the c language, with a more nuanced use of all the functions, i want to improve my c skills to do a toy OS.

Just say a good project that can be good to learn redis modules while at the same time being scalable.
 
From CLRS.
BLEACHED? More like FILTERED.COM :trump:
CLRS is a great reference, but it's tough reading as an actual introduction to algorithms. When I was going through this stuff I was recommended the Algorithm Design Manual by Skiena, it's actually comprehensible as a beginner while still being rigorous enough and has a lot of advice on applying datastructures and algorithms in practice.

Whatever you do though, make sure you practice implementing the things you read about rather than just trying to absorb everything from the book. I can't count the number of times I've heard someone talk as if he's mastered the theory and then be unable to write a single line of code.
 
This is going to read like an advertisement for tranny garbage. I maintain a webscraper program. The program parses out some peace of json from a script tag in side a page. It's always a pain to validate the json in the document. Once it's working it doesn't matter, but the page changes maybe once or twice a year and on such an occasion it usually takes 3 or 4 hours to get the json working correctly again. If you have experience with this then it's no surprise who annoying it can be to take json, which does not need to have any consistent formation, and turn it into something that can be reliability used in your program. Usually I would have to settle in for a few hours of fighting with the thing to get all the edgecases caused by json. Instead I used serde-json. Using serde turned 4 hours into 30 minutes. All I did was create a struct that matched the json in the page and add serde to the project. I did all the validation with the struct and didn't need to actually work with json at all.

Serde lets you create structs and marshal and unmarshal json or any other supported format in and out of program data. It's instant. You don't have work with all the edge cases of json (or your format or choice). In your struct you wrap the data with Option<your_type> and it automatically does the validation for you. Once back as program data, you can work with the data like anything already in your program. I really don't care if it could be said to make things easier because it makes things faster; more maintainable.
 
Last edited:
I've had some free time recently and thought that maybe it's about time I stop playing so many vidya and work on one of my own. I haven't done any game development at a serious level so I knew it'd be a heap of learning, but what the heck, something new to put on the CV. I didn't consider Unity at first because I thought it was one of those all-encompassing things that would force me to use its built-in IDE rather than one I already use and am familiar with, but after doing some research and realizing that wasn't the case, I downloaded it and gave it a try.

Now what happens when you launch Unity? Well, Unity doesn't launch. Instead, Unity Hub launches. Unity Hub is a separate app to manage Unity projects and it looks like this.

unity-shit-1.png

Now as a web developer, I recognized the look of this immediately. It's Material Design, the "design language" that Google uses in most of its sites as well as Android on the whole. But putting aside the fact that they have a separate app for project management rather than just including it in the base app, why the fuck is it Material? They didn't even go out of the way to customize the colors or anything; it looks like something Google would have made themselves. Is this not an actual app and instead some Electron garbage using Google's Material CSS assets (which they provide as FOSS) to quickly hack together a UI? Was this built in Android and then ported to desktop using one of those converter systems? mystery.gif

Well, whatever. I create a new project and follow along with a tutorial, but I'm finding that even though Unity isn't forcing me to use it as an IDE, it's still apparently assuming I'm going to be doing a lot of work in this Unity program itself. And just like with Adobe's recent garbage, Unity completely forgoes using standard UI elements and has its own implementation of even the simplest form widgets for no apparent reason. Is Unity itself written in Unity? There's this massive list of properties and sliders and stuff to edit attributes of the sprites and stuff in the project. I don't know, perhaps it's possible to change all these attributes in code, but the newbie-level tutorials I was finding weren't going to teach me how to do that. I started to wonder how pros could really stand to build full-fledged AAA games in this thing.

This is where I lost it, though.

unity-shit-2.png

If you're a Mac user, you already know what is wrong with this window. If not, feel free to compare it to the previous screenshot, which at least managed to implement the title bar correctly.

So fuck Unity. I've got a couple Cocos2d-x tuts open in some tabs and I'm going to give them a deeper look tomorrow; Cocos2d-x has a GUI tool like Unity, but it's entirely optional and it is apparently still possible to just use it as just a code library. If anyone has other suggestions, I'd appreciate it. (Requirements: Sprites and preferably tilemaps, at least Mac and Windows compatibility, free or with a reasonable free tier, preferably usable from C++, Swift, or C or C# as last resorts (no JS or Lua, please). Physics not necessary.)
 
From CLRS.
BLEACHED? More like FILTERED.COM :trump:
Sigma is a for-loop. The number at the bottom is init and number at the top is the limit that stops the loop when reached.
For example:
A.length
∑ = K(1-p)^{a.length} // if it's not clear, a.length is an exponent.
K = 1
Now the same thing in JavaScrpit:
JavaScript:
function myloop() {
    var p = 3; // Your p will be different.
    var k = 1;
    var a = [4, 2, 4, 5]; 
    // Let's pretend a is this; doesn't have to be.
    
    for (k;k<=a.length;k++) {
        var equation = Math.pow((k * (1 - p)),a.length);
        console.log(equation);
        // Of course you don't actually need to log it.
        // You might want to append equation to 
        // array and return the array.
    }
}
Frankly schools should drop the Greek notation and just teach it as programming syntax. The West has spent the last 100 years creating computers and programming so that you can look at cat memes and share gossip on the net, but explaining maths to normal people is not possible? (pressing f in chat)
 
I've had some free time recently and thought that maybe it's about time I stop playing so many vidya and work on one of my own. I haven't done any game development at a serious level so I knew it'd be a heap of learning, but what the heck, something new to put on the CV. I didn't consider Unity at first because I thought it was one of those all-encompassing things that would force me to use its built-in IDE rather than one I already use and am familiar with, but after doing some research and realizing that wasn't the case, I downloaded it and gave it a try.

Now what happens when you launch Unity? Well, Unity doesn't launch. Instead, Unity Hub launches. Unity Hub is a separate app to manage Unity projects and it looks like this.

View attachment 1875006

Now as a web developer, I recognized the look of this immediately. It's Material Design, the "design language" that Google uses in most of its sites as well as Android on the whole. But putting aside the fact that they have a separate app for project management rather than just including it in the base app, why the fuck is it Material? They didn't even go out of the way to customize the colors or anything; it looks like something Google would have made themselves. Is this not an actual app and instead some Electron garbage using Google's Material CSS assets (which they provide as FOSS) to quickly hack together a UI? Was this built in Android and then ported to desktop using one of those converter systems? mystery.gif

Well, whatever. I create a new project and follow along with a tutorial, but I'm finding that even though Unity isn't forcing me to use it as an IDE, it's still apparently assuming I'm going to be doing a lot of work in this Unity program itself. And just like with Adobe's recent garbage, Unity completely forgoes using standard UI elements and has its own implementation of even the simplest form widgets for no apparent reason. Is Unity itself written in Unity? There's this massive list of properties and sliders and stuff to edit attributes of the sprites and stuff in the project. I don't know, perhaps it's possible to change all these attributes in code, but the newbie-level tutorials I was finding weren't going to teach me how to do that. I started to wonder how pros could really stand to build full-fledged AAA games in this thing.

This is where I lost it, though.

View attachment 1875023
Yeah, Unity is like that. Really seemed to discourage doing things through code, a lot of bits of the api only seemed to only work in editor, and with the way the serializer is structured, it's challenging to write any data types in a coherent way. Example, I made a spline type in unity a couple years ago, but the recommended way of writing editor scripts basically required me to rewrite all of the spline functionality in the most retarded way possible —through SerializedObject, so I ended up just writing a reflection script to unroll and update the contents of arbitrary SerializedObjects, because fuck that. The other thing that really turned me off was their UnityEvent type, which at the time had no scriptable api, meaning you could ONLY interact with it through the editor interface, at which point I simply wrote my own with reflection because jesus fucking christ, these mongoloids!

Oh and only now in the year of our lord 2020 is it possible to serialize generics. Cool unity, you've caught up with 2006.

If you're a Mac user
DISGUSTING
 
  • Informative
Reactions: Least Concern
Frankly schools should drop the Greek notation and just teach it as programming syntax. The West has spent the last 100 years creating computers and programming so that you can look at cat memes and share gossip on the net, but explaining maths to normal people is not possible? (pressing f in chat)

I disagree along the way having sigma is easier when you are working with math formulas. After all how i handle the loop can be very different.
 
  • Agree
Reactions: Yotsubaaa
To add something retarded, does learning BASIC in 2021 help with advancing to different languages, or is it simply a dead language at this point. Been trying to bring myself to learn shit on a C64 outside the needed commands.
 
Back