Programming general

Learning a language edition. Let's talk about our troubles and successes.

Attached: nenewithbook.jpg (1191x670, 84.3K)

Other urls found in this thread:

aliencoders.org/content/person-who-founded-c-and-unix-dennis-ritchie-no-more/
rust-unofficial.github.io/too-many-lists/first-push.html
actix.rs/
chromium.googlesource.com/chromiumos/platform/crosvm/
github.com/intel/cloud-hypervisor
en.wikipedia.org/wiki/Differentiation_rules#Elementary_rules_of_differentiation
arxiv.org/abs/1902.01906
dzone.com/articles/how-to-handle-checked-exception-in-lambda-expressi
twitter.com/SFWRedditVideos

I couldn't get passed the borrow checker while trying to write a doubly-linked list in Rust. This is how I'm a brainlet and the Rust language is too smart for people like me.

Attached: mp550x550glossfffffft3u2.jpg (550x545, 41.26K)

write better op

What's wrong with it?

Rust is so good they fired their shills.

Attached: hmmm.jpg (881x585, 35.86K)

I want to learn C because Dennis Ritchie invented programming.

I can’t even imagine that I would get a job if there would be no UNIX, no Linux, no Windows, no graphical application, no sound driver, no GUI based tools, no programming languages and still we would be struggling with binary and machine level language. There would not be computerized electronic gadgets no iPhone, iPad etc.
aliencoders.org/content/person-who-founded-c-and-unix-dennis-ritchie-no-more/

Everything. If you want to start a discussion you have to start it yourself, not just make a thread and tell people what to discuss. This is not a homework assignment for us.

I've rarely used C++ since college, but I'm starting the EOS.IO developer courses soon and will have to dust it off. Not rly looking forward to it, tbqh

struct Node { prev: *mut Node, next: *mut Node, value: T}
Wow. So hard.

How do you produce these bad boys with the keyboard in pic related? The symbols on the keys in blue look like them, but shift and alt/alt gr don't do the trick.

Attached: layout.png (847x304, 353.43K)

You use english US layout in software. You do know how to touch type, right user?
I actually use a keyboard with german layout at work, even though I never use that layout. It was the best keyboard there, but nobody used it, probably because nobody here even speaks german.

rust-unofficial.github.io/too-many-lists/first-push.html
Baiting aside, I don't get why a linked list has to be so contrived. The guy's introducing functions (mem::replace) that you don't even hear of in the "nice" tutorials that don't go over linked lists. What the fuck is your language if you can't even give me a clear set of primitives with which I can accomplish all I need? Either the language is incredibly stupid, or I am for not "grokking" it. And I'm too autistic to tell the difference with certainty.

Attached: self_powered_wojak.jpg (200x313, 10.75K)

Attached: fd3.jpg (680x487, 39.82K)

Nigger, linked lists aren't hard. You learn how to do those in your first semester at university. After that you never use them again because they suck.
What the fuck are you even trying to say?
?????????????????
Your image is an accurate depiction of yourself.

Is there any inherent performance difference between calbacks and promises in node.js?

const fs = require('fs-extra')// Async with promises:fs.copy('/tmp/myfile', '/tmp/mynewfile') .then(() => console.log('success!')) .catch(err => console.error(err))// Async with callbacks:fs.copy('/tmp/myfile', '/tmp/mynewfile', err => { if (err) return console.error(err) console.log('success!')})

No difference. Both perform like shit.

Read the post nigger. I've written (both simply and doubly)linked lists about 100 times in C and C++. What I couldn't manage to do is write one in Rust without triggering the borrow checker.

You literally posted a link to a tutorial on how to write linked lists in Rust.

t. luddite

Why are you having issues learning a programming language? Learning languages is the easiest part of software development.

Why is Rust such an unpopular general-purpose programming language?

Attached: 1557438844.png (1200x635, 40.55K)

Rust wants to steal both the memory safety crowd and C++ programmers, but they think pandering to C++ fags lets them get away with a messy language and awful compile times. This disgusts memorysafety fags and C++ fags aren't interested in another fat language with glacial compilation, so Rust is stuck with a small but very loud group with much lower standards: hipster webdevs.

Is such a thing possible bois

I genuinely don't know

Go seems to be everywhere all of a sudden but I much prefer Rust

I think it still has the reputation of "don't use this, it's not mature enough" even though it's probably fine

The majority of users are diversity hires and third world labor, that's who it was designed for, real programmers don't need the language to hold your hand to the extent that Rust does.


Maturity has nothing to do with why you shouldn't use Rust.

Every fucking time i tried to learn android i would stop at Fragments. Good thing they removed it in the Android 9 update.

Attached: goodbye_joe.jpg (640x480, 49.12K)

Try different combinations of Shift, Fn and Alt Gr. That's probably the solution, but I don't know for sure.

Shift + >
t. äöå

It's alt gr plus the < key. Figured it out a while ago.

Attached: rjrjrj.jpg (177x561, 42.76K)

Besides mastering a language and learning some stuff about networks and databases, what else is there to software development? Problems become solvable when you know what you're doing.

Learn how to sleep at your desk. Learn how to spend 6 months writings a minimal CRUD app in PHP. Collect a fat check and produce little to no value. Outsource 95% of the job to consultants for 5-10x reasonable development costs. Use JQuery UI in 2019 for your SPA.

That's been my experience with software "engineers"


Learn Perl6. Trust me.

heh

fug

It's most likely more dependant I the specific callback/promise than is measurable objectively. I imagine in the post you made it'd be negligible, no?

oh user I am disappoint


I'll do it!

Now do Nim, you fag.

Attached: 1557606266.png (1173x634, 40.13K)

Rustfags BTFO

Those ISO keyboards/keyboard layouts are an abomination. Just get an ANSI (US) physical layout keyboard, and use a "US-International" logical layout if you need regional characters.

(OP)
Nene's a clever girl.

Attached: rsjk.jpg (1076x1200, 151.94K)

Shit.
Don't know why I said shift instead of alt.

How do you put your code in a fancy window like that?

Press Alt+F4 to open a secret Zig Forums text editor.

BASIC was the first language I learned. I learned that from a tutorial series on YouTube. It's an easy language but there are ton of different version of BASIC all with slightly different syntaxes. So looking up code examples I was often finding it hard to get things to work and not understanding why it didn't work when I followed tutorial to a t.

Visual BASIC 2010. Since I had a handle on QB64 I figured I was jump in to VB. It was easy to pick up and as long as I was looking for VB2010 tutorials or code examples I was doing fine.

Gets interesting. I switched to Linux and back then there wasn't much support for BASIC. So I learned C++. C++ is great for creating fast fast binaries but getting libraries to work always seemed to be a pain in the ass and I wanted to learn network programming.

Started learning Java. Did several series of tutorials on Java. Progammed in Java for a while. Got further into networking and got into security. Started learning to hack. Started working with penetration testing tools. Most of them were written in C. So I started learning C. Fucking hated it. Learned enough to look over a program and see how it worked. Other than that fuck it.

Picked up a Ruby book and learned Ruby. Never used it again after that.

Had a friend who was working on cryptocurrency project. Customized a wallet for him based on the world coin wallet. C++/Qt already knew C++. Crash course in Qt/QML made wallet look fucking cash. Have forgotten everything I learned about Qt/QML since then. Never used it ever again.

Had a friend who suggested I learn C#. Downloaded C# books and started trying to learn C#. Could never find a tutorial where the code actually worked. Didn't want to fuck with shit I didn't understand Fuck C#.

Wanted to learn MySQL. Decided the manual was 5000 pages of bullshit and the syntax changes for nearly every major version you have to look things up but you always find an answer that is different syntax than the version you are using. Fucking gave and used flat files.

Learned some PHP and PHP/MySQL applications development because I wanted to build my own search engine. PHP as a language sucks donkeyballs and I've already mentioned PHP sucks. If it install from CentOS and Cpanel or there's an install script that does everything unattended I'll use it. Otherwise it's static HTML or just enough PHP to include headers, footers, navbars, etc so I don't have to repeat code and I can just template pages with some includes.

Javascript. Wrote some shit in Javascript. It's an easy language to learn. It's C like in many regards but more like C++ and Java rather actual C. So the syntax is easy to pick up if you've learned a C like language in the past.

Kept coding in C++ for a long time. Realized I could just use system calls to do a lot of shit. Realized I don't really need C++ when I have a lot of Linux tools that will do exactly what I'm trying to do with C++. Learn BASH scripting and get good it. Coding in BASH a lot.

Friends start sending my python scripts. Look at this. I'm like dude, I'll get around to learning python later. Once you have time invested in learning something and getting good at it you just want to work in that language because it's just more efficient. But I eventually got a python book and learned python. Started using python more and more. Use it a lot now.

Wanted to learn real hacking and maybe earn cash on bug bounties rather than working for the man. I picked up some books on X86_64 and started learning assembly. Did some crash courses in bug hunting, exploit development, and writing shellcode. Low level programming is alright and I'm sure I could have got good at it if I would have spent the time. It takes time to learn. You're not going to learn assembly overnight. It takes time. Must leverage time effectively.

Since most of the programs I write about 100 lines of code and I don't care about optimizations I try to use scripting languages as much as I can. Python or shell scripting is really where it's at for me.

Regex really comes in handy but it's basically a language of it's own. But grep and python's re are pretty fucking useful if you want to sort a larger data set for just a few statements like a phone number, email address, or IP. I would suggest learning it or at least have some idea what it can do and have a cheat sheet. It will come in handy at some point.

Once you know one language it's easy to learn another and if you know programming in general it's easy to write a program in a language you don't even know just by looking each thing up on a search engine as you go like how do I declare a variable in X, array in X, print statement in X, system call in X, and that makes it easier to understand how other people's programs work.

I had thought about learning go or rust at some point just because people are always saying learn X but really who has time for all of that. I don't code for a living and I wouldn't want to work for someone else just because I tend to get really pissed when I can't figure things out and make something behave the way I want so I would probably have a cussing fit at the office and fired my first day.

Attached: nobulli.png (799x896, 395.69K)

lmfao

I'm working on a big open source C project and the garbage collector written by another guy makes no fucking sense and has little documentation and I have no idea how to use it. There are some subtleties with freeing objects that are somehow shared confusing the fuck out of me, and though I have some experience with manual memory management this is a new confusing hell for me.

Attached: 2DEGARBAGE.jpeg (960x795, 197.93K)

Manual memory management isn't hard, chances are it's even harder to use whatever garbage collector you're using and it comes with a performance penalty as a reward too.

Objects are registered with GC at creation and just freeing them at the appropriate time causes segmentation faults. I guess I will have to make all new allocation and free methods for the objects I am using to avoid this headache

That syntax is worse than vomit.

That's just like you own opinion fam

Hi, I've recently started learning Guile scheme.
Things I know already are basic data types, conditionals, procedures and simple I/O from and to console, creating and reading a file.
Is there something cool I can do on this level to test myself? A certain kind of game, program? My mind is so empty.

fug my shit up

Learn how to integrate Guile into a C program.

There is a tiny problem, I can't C yet. Tried a bit C++, but guess it's not the same. I'm looking for a scheme-only task.

How much of the specialized lessons can you ignore and still be a well-rounded java programmer?

Attached: javatut.PNG (2426x1077, 257.19K)

Anti Rust shills always resort to this because they don't actually know enough about Rust to post legit criticism.
pathetic


Skip everything except Generics and then look at popular Java libraries.

Even the security and network stuff?

There's no such thing as an anti-Rust shill. Nobody would give a fuck about that abomination if Steve Klabnik didn't brigade
Every HN thread where Rust is ever mentioned
Check Zeming Yu's paper on Rust on arxiv. Rust's safety is a lie. You're only safe from memory bugs in trivial use cases that could have been discovered with a decent static analysis tool. Or you could use a GC language because 95% of use cases don't actually need that small performance boost of manual memory management (and borrow checker and lifetime annotations literally everywhere is not actually less work than manual memory management).

Ask yourself, why are there NO large scale Rust projects on GitHub? Redox is a failure. Nobody uses Servo. Firecracker VM is riding on Amazon's name. Rocket is full of retarded emojis and is less performant than Node and Go. The stars of the Rust world are rewrites of GNU coreutils. Fucking wow. Grep was really holding me back until now.

Oh, there are large scale Rust projects out there, they're still compiling.

Attached: DMmAPqbWkAAE69G_cropped.png (344x337, 157.44K)

actix.rs/
chromium.googlesource.com/chromiumos/platform/crosvm/
github.com/intel/cloud-hypervisor

iNtEl iS a sMaLl CoMpAnY tHeY dOnt cOuNt

Nobody is actually shipping actix. Have you tried to write any non-trivial application? No? Here's a preview: Imagine your helloworld server had 80+ dependencies and takes more than 10 minutes to compile on retail hardware.

The federated reddit that has yet to implement federation does use actix. So we have one vaporware application where some huehue copied an AngularJS shitshow and used bots to upvote himself.

Cloud Hypervisor is an experiment with its first commit just this month. Give it a couple years. It will be abandoned. You might notice Nemu is written in C.

Remember Iron, Nickel, and Gotham? Remember how they were going to be the hotness in web frameworks with impeccable safety and concurrency? Weird how those projects all seemed to start fast and then fizzle within 18-36 months. Why is that? Could it possibly be that Rust is a fucking trainwreck of a language where literal homosexuals just wrote every feature they thought was "cool" on a white board and then proceeded to haphazardly "stabilize" these features into their language. All the mistakes of design by committee are personified in the Rust language. It is a cautionary tale of letting hipsters be in charge of anything at all.

>(((Intel)))'s VMM is in a very early state and relies on someone else's VMM crates to do the heavy lifting
Wow, you sure showed everyone.

Attached: 1447803221846-2.png (716x720, 220.84K)

LMAO
Link pls. Better yet: uploaf PDF here
Except for those you mentioned right after that sentence?
LMAO. That absolute state of anti Rust shills.


Did Steve Klabnik rape your mother? Calm down, nigger.


Dropbox and Cuckflare are also using Rust in production.
Kys, LARPer.

Hello. Newfag here. I also dont know shit about programming or technology and i have been interested in programming languages for audio/music production

I have been questioning if i should learn Pure/Purr Data or SuperCollider

btw i use Windows lol

Not learning C (or at least the C subset of C++) and skipping directly to a high level-language can lead to bad programing habits. C beats into you how the machine works, so even when you learn to use high-level abstractions and languages you won't abuse them to write bloated inefficient code. So be careful .
Here's a fun one:
Write a symbolic derivatior for dx:
Eg: you give it a string "x^3+y*x" it should give you something along the lines of "3*x^2 + y" .
If you know the language well it shouldn't take more than a day.

Here's an outline of how to do it:

First you transform the string into a flat symbol-list, (x ^ 3 + y * x) then into a scheme-like expression-list-tree (+ (^ x 3) (* y x)) (trough parsing), then apply the derivation rules, then simplify maybe, then transform it back into a string
en.wikipedia.org/wiki/Differentiation_rules#Elementary_rules_of_differentiation

arxiv.org/abs/1902.01906

I work in Java right now. Tired of NullPointerExceptions and the pain of checked exceptions, I suggested we move a bunch of our code to Kotlin, which was approved by the project lead. Learned a bunch of Kotlin, worked through the Koans, and built some sample stuff, and then actually moved a bunch of our code to Kotlin. Things were cleaner and more succinct, I was able to eliminate tons of the null checks. We were using lambdas everywhere, which with checked exceptions looks a lot like this:

try { try { optional.ifPresent((Type item) -> { try { // This throws a checked exception item.doSomething(); } catch (CheckedException e) { throw new RuntimeException(e); } } } catch (RuntimeException e) { if (e.getCause() instanceof CheckedException) { throw e.getCause() } }}catch (CheckedException e) {}

Thanks to no exception checking, Kotlin makes it look something like this:

try { optional.ifPresent { item -> item.doSomething() }}catch (e: CheckedException) { throw e.getCause()}

Our code was way nicer, way safer, and easier to maintain.

The Project Manager (over the Project Lead's head) denied the merge because nobody in the company knows Kotlin except me. I insisted that our Java developers could easily learn Kotlin in a day or two, but he mumbled something about maintainability and went back to his office.

Fucking shit working on a team sucks sometimes.

Doublepost. Just to add, Java's checked exceptions are fucking garbage. On their own, they are an okay feature that force more safety, but Oracle fucked up the design by making them completely not fucking work with lambdas, and by not properly extending types like Runnable to throw Exception (or at least fucking giving a CheckedRunnable type or something for backwards compatibility), making you have to wrap all your fucking checked exceptions in tons of goddamn cases and unwrap them on the outside. All types being nullable by default is also shit.
Working with Java for the past year. It's better than Python or Ruby, but I'll take any fucking language with non-nullable types if I can get it. Even Rust. I actually quite like Rust, and a lot of the nicer bits of Kotlin resemble Rust quite a lot.
Java is the only goddamn language I've seen that makes Lambdas more painful to use than just creating a goddamn callable class.

Don't worry I've learned C++ enough and I'm not all green about computers. I'm learning scheme, because Guix System uses it and because of my autism - I was tired of C-like syntax.
Sounds cool, will check it out, thanks. Maybe I'll post the code.

i see a single design flaw and i declare the entire language shit so i cant learn it.
AndWhatTheFuckIsThisC#();

Attached: c#.png (1920x1112, 3.41M)

Parsing infix notation is really the hardest part. If you need a tip, here is an algorithm that can do it: shunting-yard algorithm

Been writing Java for over 10 years and whole-heartedly agree. I was so excited when Java 8 came out, only to be disappointed when I ran into what you're describing (as well as the insanely convoluted stack trace). I simply don't use checked exceptions for my custom exceptions these days. It's a shame your company won't move to Kotlin; it's such a better language. Almost all Kotlin jobs are Android development (bleh).

Since you're stuck with Java, you could create some utility interfaces to abstract away the re-throw, as described here: dzone.com/articles/how-to-handle-checked-exception-in-lambda-expressi

Just don't write code that fails. What's so hard about that?

This, if you write code that has errors or bugs then you're literally no better than niggercattle.

You are unworthy to quote St. Terry

based


unbased

The only language I like and I'm comfortable with is Lua. The problem is, it doesn't have the kind of community and support other languages have. I sometimes actually have to read documentation and figure out my own solutions. Of course there's probably no employer looking for a Lua programmer either.

Just curious, how did it come to be that you only use Lua? I see it used as a supplementary language paired with something else, so I find it odd.

I wanted to make games, so I started with pygame since everywhere you look people recommend python to inexperienced programmers, but I didn't like it. I didn't care for the space-sensitive syntax, and there seemed to be this tug-o-war going on between python2 and python3. I ended up using Love2D after looking for an alternative and I just found Lua easy to work with.

Read M Timm Jones's books on Linux development. Shit will make more sense.


Is there a fun programming book to learn Rust? Like hacking with Rust or game programming with Rust or just sick and tired or boring dry programming books. I've read hundreds of thousands of programming books. You know what they need? Fucking dank Pepe memes and shit that makes you laugh. And autism jokes.

Zig Forums we should start a b& and do some open source collaborations. It could be fun.

Sorry meant to say hundreds of thousands of pages.

There are very few actual programmers on this board.

Attached: oop.png (1948x858, 151.76K)

Rust is not a productive use of your time.


There are a few git-* repos that we can be found in. Nntpchan is a good start. Pleroma if you're OK with Lains.

Programming in Ada 2012 already has that.

Attached: ada - pure_white.png (1068x196 146.94 KB, 38.22K)

Attached: ada - wedlock.png (666x546, 88.26K)

Oh no, the humanity. user, you're not going to learn anything by copy-pasting Stack Overflow, reading the documentation is the normal thing to do.

I got a .txt file input. The first line contains 2 numbers say n and p. The other lines are pairs of some persons IDs which belong to the same group. n in the first line is the total number of persons and p is the number of lines that follow the first line of the .txt file.
One person can not be part of more than one group. I have to find how many pairs of persons I can make with the condition that they're not part of the same group.
What's the most efficient way to do this time complexity wise? Use graphs or something?

Pic related is a simple example

Attached: 2019-05-16 16_51_27-.png (580x411, 37.21K)

Pretty ironic since Ada was created by a Turkish Jew; John Ichabod.

A graph seems like overkill.
Here's one way to do it that calculates the result dynamically (because I was too lazy to store the groups in a list and "clean" the list when 2 groups are "merged". That's probably how a normal coder would do it.)

#include #include using namespace std;int main(){ ifstream myfile; int n,p; int **st; //st[s] states which groups the student s is in; //the value (*st[s]) contains how many students are in st[s]. myfile.open("input.txt"); myfile>>n>>p; st = new int*[n]; //here is where a nice coder would use a list of the group pointers int result = 0; // we calculate it dinamically; int tStudents = 0; // total number of students so far for(int i=0;ia>>b; if((st[a]==NULL)&(st[b]==NULL)){ st[a] = new int; st[b] = st[a]; *st[a] = 2; result += tStudents*2; tStudents+=2; continue;} if((st[a]==NULL)){swap(a,b);} if((st[b]==NULL)){ result += tStudents - (*st[a]); st[b] = st[a]; *st[a]+=1; tStudents+=1; continue;} if(st[a] != st[b]){ result -= (*st[a])* (*st[b]); (*st[a])+= (*st[b]); delete st[b]; st[b] = st[a];} } myfile.close(); cout

Ignore that. This code is wrong when multiple people belong to the st[b] group.

O(n) Don't think you need any special data structures.

Happy late birthday to Princess Kylie!

Attached: Kylie--681x1024.jpg (681x1024, 90.33K)

was bored so I solved it in O(n):
from itertools import accumulatefrom operator import *def c(it): F = {} R = {} for a, b in it: F[R.get(b,b)] = F.get(a,a) R[F.get(a,a)] = R.get(b,b) F[a] = b R[b] = a n = [] while F: A = next(iter(F)) i = 0 while A in F: i += 1 A = F.pop(A) n.append(i) return sum(map(mul, n[1:], accumulate(n, add)))

Yo I love writing Rust! Even though I am shit at it right now

based

One more question about this parsing thing.. It should be done by using operations on strings?