[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 326
Thread images: 34

File: 1487154092710.jpg (325KB, 2136x3216px) Image search: [Google]
1487154092710.jpg
325KB, 2136x3216px
What are you working on, /g/?


Previous Thread: >>58962817
>>
>>58967869
negotiating a raise from 20 to 24 tendies a week
>>
I went to a coding boot camp 6 months ago and completed about a month ago. A few of my classmates got jobs right out, but I wasn't so lucky. And I think it's for a good reason. The more and more I program stuff for my resume, the more I realize I am having trouble with coding fundamentals. I was wondering if /g/ could point me in the right direction on how to actually learn how to code. It's baffling, I was taught things like clean code and unit testing, but not once did we discuss algorithms, or methods to manage memory in C.
>>
>>58967912
andd that is the problem with those coding boot camps

you don't learn the most important things to code
>logic
>problem solving
>algorithms
>data structures
>working with databases

etc
>>
File: tumblr_ofryyks6HB1u0z65io1_500.png (249KB, 500x687px) Image search: [Google]
tumblr_ofryyks6HB1u0z65io1_500.png
249KB, 500x687px
Writing a book on Golang
>>
File: 1472052670379.png (384KB, 1024x768px) Image search: [Google]
1472052670379.png
384KB, 1024x768px
>>58967912
>It's baffling
not for anyone with even a basic set of reasoning skills
>>58967948
Include anime in it.
>>
>>58967973
>not for anyone with even a basic set of reasoning skills

>posts sicp an outdated meme book which will not help new programmers
>>
File: 1384218766952.png (1MB, 1280x720px) Image search: [Google]
1384218766952.png
1MB, 1280x720px
>>58967978
>meme book
this retarded reddit way of using "meme" is pretty much all I need to discard your opinion on any subject.
>will not help new programmers
where exactly did I state that this was my intention? I couldn't care less about those sorts of plebs.
also, why do you space your posts in such a retarded fashion?
>>
>>58968034
He's right, though--you're a fucking retard. Stop posting anime images and being a cunt. You're adding zero value to this discussion, you autistic loser.
>>
>>58968034
Ah, you're so superior than us plebians. Cunt.
>>
>>58967948

congrats
>>
File: 1361223539194.png (176KB, 494x468px) Image search: [Google]
1361223539194.png
176KB, 494x468px
>>58968046
he didn't write a single true statement in his post besides quoting my obviously true sentence. how does that the same as being right? that's some pretty warped view of reality you've got going there
>Stop posting anime images and being a cunt.
Stop visiting an anime website if you hate it this much. there are much better places for you kind. i recommend "9gag" and "reddit", your fellow plebeians seem to enjoy them a lot.
>You're adding zero value to this discussion
I see, that'll surely stop me then.
>>58968052
If you think a "coding boot camp" isn't a retarded idea, then yeah, I am indeed superior to you. Cunt.
>>
>>58968104
>he didn't write a single true statement in his post besides quoting my obviously true sentence
Stop reading here. You are autistic and not very intelligent. Sorry, but you need to get over your giant ego and learn a thing or two, kid.
>>
File: 1481833364101.gif (134KB, 340x340px) Image search: [Google]
1481833364101.gif
134KB, 340x340px
>>58968153
>Stop reading here.
Any pleb would do the same. it's a pretty good defense mechanism when you are too weak to see the truth
>You are autistic
I didn't claim I wasn't.
>and not very intelligent
I didn't claim I was.
>you need to get over your giant ego
If being able to identify basic facts about reality constitutes a "giant ego" then I can't even begin to imagine what kind of self esteem issues you're going through right now. Is that the reason you feel the need to make these stupid posts? If so, then don't take my insults too seriously. I know you were born this way so you aren't really to blame here. Your parents are retarded though.
>>
>>58968034
>>58968104
>>58968200
>le I watch anime and I am smug may may
>>
File: MOCKERY.jpg (91KB, 731x960px) Image search: [Google]
MOCKERY.jpg
91KB, 731x960px
>>58967912
>boot camp
>>
File: 1421139415594.jpg (112KB, 1358x765px) Image search: [Google]
1421139415594.jpg
112KB, 1358x765px
>tfw Rust
>>
>>58968200
didn't even read your post you autistic loser
>>
>>58968216
she's kinda cute
>>
>>58967978
What parts about SICP are outdated, and why?
>>
File: 1421072953104.jpg (80KB, 598x632px) Image search: [Google]
1421072953104.jpg
80KB, 598x632px
>>58968210
who are you quoting though?
>>58968235
Yes, I know. If that makes you feel any better then I'm all for it. Wouldn't want to traumatize you even further. who knows what you might do to yourself.
>>
>>58968241
how can someone who hasn't read it answer your question?
>>
>>58968253
lisp is lacking oop
>>
>>58968260
https://en.wikipedia.org/wiki/Common_Lisp_Object_System
>>
>>58967912
you don't learn algos or memory management at a boot camp because they teach you web dev, none of that matters in web dev
>>
>>58968260
OOP is how you design stuff, it shouldn't be dependent on the language.
>>
>>58968285
This exactly.
C isn't called an object-oriented language but it is definitely possible to write object-oriented C code and many people do so.
>>
>>58968260
it's trash, but you can still have it in lisp.
>>
>>58968282
>none of that matters in web dev
much like web """"dev"""" itself.
>>
>>58968326
hey i was trying to be nice
>>
Since C++ has concepts like Iterator, Destructable, and Allocator, how can I make it so functions will only take objects with a given concept as an argument?
>>
Reading interview material, practicing my data structures, and trying to work up the courage to send out a resume
>>
>>58968497
not implemented yet, try Haskell
>>
>>58968509
>practicing my data structures
Any good recommendations for study material? I need to do this as well.
>>
>>58968513
>yet
is it in the works?
>>
>>58968523
well there's a TS but it's not in C++17
on some compilers you can
>>
>>58968530
>well there's a TS
link?
>>
File: Untitled.gif (192KB, 1052x592px) Image search: [Google]
Untitled.gif
192KB, 1052x592px
>>58967869
turing machine
>>
>>58968497
>>58968523
Just stop using that shitty language.
Go learn Rust, Haskell, or something with half decent generics.
>>
File: Screenshot_3.png (37KB, 603x240px) Image search: [Google]
Screenshot_3.png
37KB, 603x240px
Is the big O of this O(n^2)?
>>
File: 1310651906838.jpg (26KB, 460x276px) Image search: [Google]
1310651906838.jpg
26KB, 460x276px
>>58967869
Was coming up with a way to transfer files over LAN and then got stuck reading WPF documentation for 2 hours.
>>
>>58968531
http://en.cppreference.com/w/cpp/language/constraints

just learn haskell in the mean time

>read :: Read a => String -> a

>template <Read a> a read(string);
>>
File: 924835.gif (837KB, 640x360px) Image search: [Google]
924835.gif
837KB, 640x360px
>>58968226
I hate myself for not being good enough to learn Rust
>>
>>58968557
reeeee
>>
>>58968516
All I'm really doing is implementing them as best I can from memory.
>>
>>58968544
Yes.
>>
>>58968516
>>58968577
w-what is a data structure? how do i build one, senpai?
>>
>>58968590
>w-what is a data structure?
A structure for data.
>>
File: tumblr_nz3y1kaQDe1s21xzoo1_540.gif (768KB, 540x720px) Image search: [Google]
tumblr_nz3y1kaQDe1s21xzoo1_540.gif
768KB, 540x720px
>>58968590
A data structure is a specialized format for organizing and storing data. General data structure types include the array, the file, the record, the table, the tree, and so on. Any data structure is designed to organize data to suit a specific purpose so that it can be accessed and worked with in appropriate ways.
>>
>>58968537
>python
please remove that anime from your wallpaper.
>>
File: 1484497759155.png (156KB, 1000x1000px) Image search: [Google]
1484497759155.png
156KB, 1000x1000px
>>58968569
>I hate myself for not being good enough to learn Rust
Don't feel bad.
Most of us are too stupid for Rust.
>>
So I'm having alot of trouble with nested loops.

I'm taking a C++ course and I have a couple assignments coming up that require using nested for loops. Problem is, I just can't seem to get it. I spent a couple of hours on a simple program to make an hourglass shape from a user input like this:
######
####
##
####
######


I've managed somehow to make a loop produce the top half of the hourglass but I'm completely at a loss as to run the same loop backwards.

Is there anything I can read or maybe some free online practice work that I can do to "get" this shit?
>>
>>58968604
what form does a tree take? is it a data type in most languages? is a tree an array or something else?
>>
>>58968604
thank you akarin
>>
File: ;^).jpg (67KB, 403x403px) Image search: [Google]
;^).jpg
67KB, 403x403px
>>58968606
nope
>>
>>58968604
>the array
Some might argue that this is not a "true" data structure.
>the file
That is not a data structure.
>the record
That is not a data structure in itself, but it used to create data structures.
>the tree
Be more specific. There are lots of kinds of trees.
>>
>>58968582
>>58968544
what's a good way of figuring these out? I can't come up with a standard procedure to figuring these out.
>>
@58968626
oh, so it's a redditor. i see.
>>
File: reLr4K3.png (978KB, 1366x768px) Image search: [Google]
reLr4K3.png
978KB, 1366x768px
>>58968614
What book?
>>
>>58968537
Now write a program to determine if it will halt. Preferably in the turing.txt itself
>>
>>58968513
Literally in gcc 6.2, -fconcepts

This c++ fud needs to stop
>>
>>58968639
>I can't come up with a standard procedure to figuring these out.
Most of it is just intuition and gut feeling.
Almost nobody actually rigorously proves that their algorithms are in some order.
Is there a loop dependent on the size of the input? Probably O(n).
Is there a nested loop, both dependent of the size of the input? Probably O(n^2).
Does the algorithm halve, or divide the input in some way? Probably O(log n).

>>58968618
A leftist tree can be implemented in an array, but that's not what defines a tree.
A tree can have n many children, each of which are also trees.
Probably one of the most basic ways to represent trees would be something like this C snippet:
struct binary_tree {
int data;
struct binary_tree *left;
struct binary_tree *right;
};

Although this generalises to any number of children.
Usually, a null pointer to used to indicate that there is no child.
>>
>>58968679
Yes, I said some compilers.
It's not in the language, and unlike Haskell, C++ doesn't have a de-facto compiler
>>
>>58968697
>de-facto compiler
Haskell doesn't have that either. Because it's simply impossible.
>>
>>58968712
GHC

and regardless, type classes are standard Haskell
>>
>>58968696
>Probably one of the most basic ways to represent trees would be something like this C snippet:
Thanks, can you give me a Python example, too?
>>
>>58968639
>what's the standard procedure for finding the convergence of a discrete series
I'm afraid there is no "standard procedure" for the general case. An entire branch of Mathematics (called analysis) is dedicated to it. But for simple cases you just look at the largest depth of nested loops (for example in this case, there are two nested loops of depth two) and raise N to the power of that. But there are all sorts of reasons why it might converge quicker than O(n^x).
>>
Why do retarded people indent their code with spaces? When will science find a cure for this brain disease?
>>
>>58968722
GHC isn't a "de-facto compiler" because such a thing is simply impossible in the English language.
Maybe you meant "de facto standard compiler"?
>type classes are standard Haskell
I know, but how is that relevant here?
>>
>>58968606
what is wrong with python?
>>
>>58968742
>(a language)'s de facto compiler

and concepts are basically type classes
>>
>>58968755
the fuck dude
>>
>>58968755
It's impossible for something to be a "de-facto compiler". The language doesn't even play a role in determining this.
GHC is definitely the de facto standard compiler, I don't think anyone will argue this.
>and concepts are basically type classes
I didn't even say anything about that. Why do you think I disagree with this?
>>
>>58968739
Same reason programmers use fixed-length fonts.

Also spaces can hide inside tab characters which is just awful in every way. IDE's could fix this problem, but they never do.
>>
>>58968774
>how is this relevant here
what is with all these word games
>>
>>58968751
other than it being complete garbage?
>>
>>58968751
Nothing. People just look down on Python cause it is more accessible to others. For a scripting language, Python is 100% fine.
>>
>>58968791
I look down on Python because of its retarded design decisions and cultish userbase.
>>
>>58968785
You just said something impossible and I felt the need to correct it.
>>
>>58968791
I would KILL for the web to run on Python instead of JavaScript. Just point me to the person.
>>
>>58968817
Yourself.
>>
>>58968789
do you have an actual argument?
>>
>>58968791
>People just look down on Python cause it is more accessible to others.
nice strawman
>>
>>58968815
>You just said something and I felt the need to contradict it.
fixed
>>
>>58968823
if a language being garbage isn't an argument for you then I don't know what to offer
>>
>>58968827
Please explain why Python is garbage then
>>
>>58968840
Me correcting it would imply contradicting it as well. What is this retardation?
>>
Any android devs here?
Learning Dagger 2 atm. Kinda awkward at first but holy hell this makes my tests so much easier to write. I didn't realize how shitty java was without dependency injection until recently.
>>
>>58968849
Why would I do that?
>>
>>58968823
Significant whitespace.
Dynamically typed.
Python 2 vs Python 3 fiasco
Stupid "tries to be like English" syntax
Terrible performance
Class attributes
"import solution" mentality
__this_shit__
>>
>>58968616
Outer Loop 1:
Inner Loop 1:
//print whitespace
Inner Loop 2:
//print # sign


What are you confused about?
>>
>>58968789
then what language should I use?
>>
>>58968874
>Class attributes
explain
>>
>>58968903
pretty much anything which doesn't hit most of the points here would be fine or at least better >>58968874
>>
>>58968908
I don't understand them
>>
>>58968908
Hidden mutable global state.
>>
File: Capture.png (50KB, 737x960px) Image search: [Google]
Capture.png
50KB, 737x960px
>>58968731
Saw that guy wasn't gonna post an example so I wrote one up.
>>
>>58968935
>Arm's-length recursion
You're a terrible, terrible programmer.
>>
>>58968935
what's up with this "this." syntax? is this python 3?
>>
>>58968935
forgot to use the walk_left and walk_right methods, silly me
>>
>>58968945
Not him but they "self" keyword is arbitrary.
You can call it "animegirl" too if you want
>>
>>58968952
mind=blown
>>
>>58968941
Only newfags are too retarded for """arm's length""" recursion.
>>
>>58968961
>>58968941
what is arm's-length recursion and why is he complaining about it? I understand recursion in general (took a basic compsci 101 class) just not "arm's length" or why this is supposed to be bad or complicated
>>
>>58968961
Wasn't sure what level of cs student I was writing for. Pretty basic shit desu.
>>
>>58968972
>why is he complaining about it?
Because he is a first year undergrad and he can't follow """arm's length""" recursion, he's probably a future NEET
>>
>>58968972
It's just very poor style, and shows that the person does not understand recursion properly.
It can also be called "short-circuiting the base case".

So instead of writing
void walk_tree(tree *t)
{
if (t == NULL)
return;

do_thing(t);
walk_tree(t->left);
walk_tree(t->right);
}
;
they write
void walk_tree(tree *t)
{
do_thing(t);
if (t->left != NULL)
walk_tree(t->left);
if (t->right != NULL)
walk_tree(t->right);
}
>>
>>58968983
>he's probably a future NEET
believe me, NEETs wouldn't complain about that
>>
>>58968999
trips says it all

top is at least how I was taught in university
>>
>>58968999
I see, but isn't that just a basic stylistic difference? Both appear to do the same thing to me. Obviously the top is superior but otherwise I don't see why this is so bad. Sincerely curious / trying to learn

thanks
>>
>>58968999
You are right.

I tend to avoid recursion in my code. Good catch though.
>>
>>58968972
https://en.wikipedia.org/wiki/Recursion_(computer_science)#Short-circuiting_the_base_case

Your code is efficient but it makes some butthurt faggots cry
>>
>>58968226
>>58968569
>>58968614
Rustman, please stop samefagging. Your language requiring 6 lines of code just to get standard input is not a "safety feature". Just learn to actually code and you won't have stack overflow issues. The issue with C is it's syntax is made for a time when typing one extra character actually added significant delay to your coding speed, the same reason Ed is outdated. The issue with C is not it's design. C is plenty fine for abstracting away low-level coding.
>>
>>58968999
isn't the limit on stack size much smaller than the limit for the heap?
Wouldn't using recursion be a bad idea?
>>
>>58969052
>>
>>58969030
Yes, they are almost identical (the bottom doesn't work if t is NULL).
That example might not do it perfect justice. Arm's length recursion can lead to much messier code.
Another example, summing the elements a binary tree.
struct tree {
int data;
struct tree *left;
struct tree *left;
}

void sum_tree(struct tree *t)
{
if (t == NULL)
return 0;

return t->data + sum_tree(t->left) + sum_tree(t->right);
}

void sum_tree(struct tree *t)
{
int res = t->data;

if (t->left != NULL)
res += sum_tree(t->left);
if (t->right != NULL)
res += sum_tree(t->right);

return res;
}

The top one is much more elegant.
>>
>>58969056
Trees are generally traversed via recursion.
>>
>>58969068
yeah, but what if the tree gets too big?
>>
>>58969056
Recursion works well for some cases, especially if a tree structure is involved.
For a stack overflow to occur with a binary tree, you would literally need over hundreds of gibabytes or more of data.
>>
>>58968999
That's really stupid. While it might make sense to put the conditional at the recurring level instead of at the branching level for complicated conditions so that you prevent spreading the code out, when it's just a simple null check all you're doing is adding an extra stack.

Performance-wise the bottom should be superior (if the compiler is too stupid to translate the top into the bottom) and style-wise saying the top is better is far too much of strong-arm.
>>
>>58969074
Try to traverse the data structure left-most node to right-most node non-recursively.

I will wait.
>>
>>58969085
each node will just have a reference pointing to its parent node

EZ
>>
>>58969097
Scale that to a terabyte of data and you have just wasted a lot of disk space.
>>
>>58969064
I meant to put "right" for the third element of the struct.

>>58969076
>recurring level instead of at the branching level
What the hell do you mean by this?
>when it's just a simple null check all you're doing is adding an extra stack.
A single stack frame is nothing to get worked up over.
>Performance-wise the bottom should be superior
Not necessarily. It would require a benchmark, but it would probably be extremely marginal, and possibly immeasurable. The CPUs branch predictor complicates is situation quite a bit.
The function would already be in the instruction cache, so we don't need to worry about that slowing things down.
>>
>>58969057
Ah shit dude, you've totally proven yourself to me! No way you're samefagging now!

Protip: If there was more than one of you, more than one of you would have posted proof.
>>
>>58969103
>saving the tree to disk
lmao just sort it back into the tree when reading from disk
>>
>>58969076
>Performance-wise the bottom should be superior
And correct you are
>>
>>58969119
Took you a while to edit
>>
>>58969097
>Requires a parent/previous pointer
You must be a terrible computer scientist.
>>
>>58969130
Yeah, I took a bit to crop it because I used the keybind for a selected window instead of a selected screen rect. Inspect Element is quick and easy though.
>>
>>58969135
>doubly linked lists are bad

>Computer "Scientist"
>>
>Rust
Rust keeps the C/C++ retards away by being too hard. If you are programming in Rust I would automatically assume your Rust code is better than 97% of /g/ toddlers anytime and anyday.

C/C++ is a beginners' language.
Rust is not.
>>
>>58969141
And that took you 4 minutes, reply to me and add (xxx) within 120 seconds, I'll wait
>>
>>58969146
C is my favourite programming language, and I also know Rust.
Don't kid yourself with "too hard". A lot of programmers (especially novices and C++fags) don't have a clear concept of pointer ownership, so they struggle with Rust.
>>
>>58969064
so is a tree generally implemented as a struct?
>>
>>58969144
I can't think of a situation where a doubly-linked list is the correct solution.
A singly-linked list is almost always enough, or else you would use something different.

>>58969160
Usually, but using an array is possible with certain types of trees.
>>
>>58969159
That's what I said

C/C++ is a beginners' language.
Rust is not.
>>
>>58969177
Compared to C, C++ is extremely difficult

C is the beginners' language
>>
>>58969167
What are trees actually used for in real life? Let's say I'm working on some run-of-the-mill Android app--when would I use a tree?
>>
>>58968309
It's not trash. It's a bread and butter toolkit.

However, since everyone has to use it, retards will use it, and retard-code becomes the problem.

Since the retards all use OOP, OOP is seen as a problem.

Before OOP it was structured procedural programming.

Personally, I put the test for not being a retard on you understanding more than one model. If you understand say, C# and Java, you're probably an idiot, because you only get OOP.

Learning Python won't change that.

If you know say, Java/C# AND SQL, you're probably an enterprise programmer, but you're probably not an idiot. Because you can think in both relational terms and objective terms. (I had to resist calling it Objectional terms, because /g/ no longer has a sense of humour. Sad!)
>>
>>58969184
bait
>>
>>58969194
how am I wrong?
>>
>>58968253
If he hasn't read the book, how can he know that it's an outdated meme book?
>>
>>58969186
Friend of mine made a simulation where two bots play chess against each other.

Each bot had a setting where it would limit the size of possible step tree.

So you could run 1000 simulations of a 12 step ahead bot vs a 11 step ahead bot.
>>
>>58969177
Stop grouping C and C++, you fucking retard.
Anyone who does this clearly knows nothing about either language.

>>58969186
All sorts of things. Really, that question is too open to give a reasonable answer.
Although, a common usage of trees is an efficient way of storing and sorting data, and being able to look it up quickly.

>>58969196
C requires several concepts that is unquestionably beyond "beginner" to be able to write good programs.
C++ is just a clusterfuck, so you can't consider it a language for beginners nor skilled programmers. It's a language for retards and crazy people.
>>
>>58969184
C is one of the best descriptions of what an abstract machine can be. Pretty much every computer architecture sticks to this abstract model. That's the secret of C success.
>>
>>58969217
C(++)

Does it make you mad, you autistic trash?
>>
File: 16387950.jpg (46KB, 480x456px) Image search: [Google]
16387950.jpg
46KB, 480x456px
The generic dilemma is this: do you want slow programmers, slow compilers and bloated binaries, or slow execution times?
>>
>>58969217
>C requires several concepts that is unquestionably beyond "beginner" to be able to write good programs.
How come I was able to learn C at age 12 as my first language?
>>
>>58969279
Are you programs of high quality?
>>
>>58968616
import java.util.Arrays;
import java.util.Scanner;

public class Star {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner keyboard = new Scanner(System.in);

System.out.print("How many lines: ");
int numLines = Integer.parseInt(keyboard.nextLine());

// Let's start with creating a blank line.
char[] blanks = new char[numLines];
for(int i = 0 ; i < blanks.length; ++i) {blanks[i] = ' ';}

// Now, we'll have loop, so we can print row by row.
for(int row = 0; row < numLines; ++row) {
// Now each row will be a blank line except for 2 stars.
// So we make a copy of the blank line we have for each row, so we can write to it.
char[] line = Arrays.copyOf(blanks, blanks.length);

// There are two stars, one goes to the right, and the other towards the left, one step per iteration, and they start at each their end.
int star1Pos = 0 + row; // star 1 start at 0.
int star2Pos = (numLines-1) - row; // star 2 starts at the end.

// Now that we know where the stars are supposed to be, we just put them there.
line[star1Pos] = '*';
line[star2Pos] = '*';

// So now we have all the data we need, so now we just need to print it.
System.out.println(new String(line));
}
}
}

Here's a pedantic explanation for how it works.
Translate it yourself. You should be able to get how it works from this.
>>
>>58969285
I'm not programs, no.
>>
>>58969279
He's just a fucking retard that probably doesn't even know something as simple as C
>>
>>58969290
I consider myself to be very proficient in C.
>>
>>58969276
>2034
>150 GHz CPU
Ahah, more like 128-core 4 GHz CPU.

C and the likes are getting obsolete on the desktop and the web because it was thought in a single-threaded, flat memory model. That's for the same reason it is still prominent on embedded systems.

Now, tell me which languages could blow your dilemma out of the fucking water while fitting to the upcoming dominant machine model? I have my own opinion on this, but I let yourself do your own research.
>>
>>58969420
Are you seriously implying that C can't into multi-threading?
>>
>>58969420
Golang
>>
>>58969434
No, I'm not. But it's very tedious to make a C program scalable.
>>
>>58969449
Why? Just because you're free and easy with your shared mutable state, it doesn't mean that everyone else is.
Even then, C isn't the worst language is this regard. You have shit like pajeetlang which propagates shared mutable state all over the place (thanks OOP), which makes it scale with threads effectively extremely difficult.
>>
>>58969464
>which makes it scale with threads effectively extremely difficult.
I changed part of that sentence after I wrote it, and it doesn't make sense. Lets give that another go:
*which makes scaling it with threads extremely difficult.
>>
>>58969464
On the other hand, I find it easier on C++11 to avoid the problems with shared state across threads, but it involves having to create local context for each thread before invoking them.
You can do the same thing on C of course, but the language itself nor its standard library brings little syntactical facility to achieve that. C11 threads feels just like using pthreads in the end, and it's not a compliment.
>>
>>58969528
>having to create local context for each thread before invoking them
What?
Passing some shit in as argument?
_Thread_local?
I'm not really sure what you're even going on about here.
>>
>>58969551
My concerns are only of syntactical order. All you can do in C++ you can do in C, I concur.
I want to spawn a thread executing a specific function, I create a thread object on the fly with the function pointer and its arguments, whatever the number of arguments and their types. The function can be used exactly the same way whether in single or multi-threaded context.
You can't do that in C without relying on hacks such as casting void * arguments and using helper functions if you want to use your functions in both contexts. C11 threads have exactly the same problems as with pthreads in that regard.
>>
>>58969681
>hacks
>casting void * arguments
How on earth is that a "hack"? It's completely well-defined, and even expected behaviour.
You're seriously complaining about the most minor shit.
>>
what would cause my program to crash a i close it?
>>
>>58969782
Invalid cleanup code.
>>
>>58967912
http://www.ccs.neu.edu/home/matthias/HtDP2e/
>>
>>58968497
This is the closest you can get to concepts: http://en.cppreference.com/w/cpp/types/enable_if
>>
>>58969276
>1980
>1 MB of RAM
Holy richfaggorty, Batman.
>2001
>24 MB of RAM
Holy poorfaggorty, Batman.
>>
Tell me /g/

Im student and i want to start working but there is one thing that interest me

Im CS student on faculty of science and mathematics and most of thing we done has to do with math more then programming, only one java project and one php project

In most of job offers they say to send them show them your projects so what do i do?
Should i create some apps and push them to github and show them that shit?
>>
>>58969901
Yes.
>>
>>58969911
what type of apps would be preferred?
>>
File: questionsbigo.png (54KB, 617x181px) Image search: [Google]
questionsbigo.png
54KB, 617x181px
anyone have any idea on the big o of these? I think the 1st two are O(n), 2nd cause it's how binary search works and that's o(n).
>>
>>58969951
Ops, missed one:
1. O(log n)
2-4. O(1)
5. O(n)
>>
>>58969959
so safe to assume returning a value in an array is constant?
>>
if a c++ class holds a pointer to a function, do i need to delete that pointer in the destructor and then set it to null?
>>
>>58969992
>class
stopped reading right there.
fuck off with this communist bullshit.
>>
>>58969992
No, you're not allocating memory for it on the heap.
>>
>>58968544
its more than n^2
>>
>>58969988
Only if you know exactly at what index it is, otherwise you have to locate it, and that's not constant anymore.
>>
Not really a programming question but it's on Netbeans.
I don't know really how to ask this in English but I'll try: how do I change Netbeans to not do this (pic related), I don't want the end of the line to show below.
What should I search for in the Netbeans menus?
Thanks in advance
>>
>>58969420

>C and the likes are getting obsolete on the desktop and the web because it was thought in a single-threaded, flat memory model
C runs fine in a multi-threaded model. Want evidence? Your fucking kernel. Want more? Apache. Yeah, C's managing all of that parallelism on your machine and not shit from anyone.

The reason C isn't being used as much isn't because of poor capability for parallelism. In fact, given that Node.js and Python are rather popular these days, both of which being confined to a single thread by design, it would seem performance isn't the name of the game; ease of use for rapid application development is. You can't get the average moron programming in C, and you probably shouldn't let them do so either... at least not in production code. Computers and smartphones are fast enough that companies are less concerned about "will this program run well on the client's machine?" and more concerned about getting the product out as fast as possible, with as few bugs as possible, for the lowest cost possible.

The reason C is still prominent on embedded systems is because there isn't much choice there. Most micro-controllers are poor in resources and may not have an operating system managing everything behind the scenes. C thrives in these sorts of situations, and there are very few languages that can say the same. Of those, not all are able to support various architectures used for embedded programming.
>>
if i'm using a c library in a c++ program and i create a c thing using new, do i have to delete that thing with free() or delete?
>>
>>58970082
delete, but you probably want to look into smart pointers instead
>>
File: 1485473684854.png (408KB, 824x792px) Image search: [Google]
1485473684854.png
408KB, 824x792px
>>58970099
>smart pointers
>C++ at all
Get a load of this fag.
>>
>>58970106
It's just a language.
>>
>>58970111
A terrible language.
>>
>>58970082
When using sepples you should limit yourself only to subset of the language (basically C) at least that what every sepplesfags will tell you.
So don't use new you noob use malloc.
>>
>>58970112
And a lot of people use it, meh.
>>
>>58969420
>Now, tell me which languages could blow your dilemma out of the fucking water while fitting to the upcoming dominant machine model? I have my own opinion on this, but I let yourself do your own research.
Forth - used to program Green Array's 144 node chips.
>>
>>58970117
Why on earth wouldn't you just use C then?
There is none of that stupid C++ cruft to go along with it.

>>58970120
And a lot of people are religious.
That doesn't mean that it's not stupid.
>>
>>58970126
i don't know how to program without classes, i can't use c
>>
>>58970169
So you're an OOP baby?
I feel sorry for you.
>>
>>58970169
stop using this thread and go back to wherever you came from.
>>58970177
>I feel sorry for you.
why would you feel compassion for an animal which is not only mentally ill, but is actively trying to pass its illness onto others?
>>
>>58970034
Pls help me
>>
>>58970034
don't have long lines
>>
>>58970177
there is nothing wrong with oop
>>
>>58970034
Preferences > Editor > Formatting > All Languages > Right Margin. Set to 0.
>>
>>58970212
We've been over this many times in these threads.
OOP is fundamentally flawed.
>>
>>58970212
as long as "nothing wrong" means "it's garbage based on false premises" then sure
>>
I successfully brainwashed myself into reading every occurrence of POO as POO.
>>
>>58970238
k
>>
>>58970238
>OOP
>POO
>OOPS
>Java
>Pajeet

How could God make it any more obvious that it's a completely and thoroughly shit programming paradigm?
>>
>>58969146
My problem with Rust was that interfacing with C libraries is a terrible chore. Call me when Rust can parse C headers.
>>
I saw an employed Haskell programmer today
Took this pic
>>
>>58970263
Call me when Rust is actually supported on other platforms than Windows/Linux on x86. Which will be never, because it's fundamentally not portable.
>>
>>58970553
How? Newbie here.
>>
>>58970553
>fundamentally not portable
Mind explaining further?
>>
>>58970553
Sure, it won't work on CHAR_BIT != 8 or non-twos complements computers, but I don't see how it's fundamentally tied to x86.
>>
>>58970564
>>58970569
Look on their platform support page, everything below "tier 1" is "it MIGHT work here but we've never tested it or built any binaries"
>>
>>58970580
you said fundamentally though, as in the language itself prevents it being ported
>>
>>58970580
>fundamentally
Learn to use your words correctly, idiot.
>>
>>58967893
The more legal tendies the better, amiright?
>>
>>58970580
That page implies that they simply have not put effort in to support them. "Fundamentally" implies that they can never be supported.
>>
>>58970213
Thanks for responding, but this options don't exist
>>
>get a bug report
>spend 4 hours shitposting and playing vidya
>write down "could not reproduce error"
best feeling
>>
>>58970661
>get fired
>>
>>58970588
>>58970605
The standard library contains assumptions that aren't true outside of desktop platforms. It can't be used on systems without heap allocation, systems where you can't abort the current process, or filesystems where there's no such thing as directories.
>>
>>58970661
it's technically true though. assuming you didn't even try
>>
>>58970676
That's why they have their "core" version (analogous to freestanding C, I suppose), but yes: Rust loses a lot of its usefulness outside of desktop platforms.
>>
>>58970676
that's just the standard library though
>>
Learning basic coding like CSS, HTML and JavaScript for university but I can't for the life of me get the hang of it.
Are there any sites you can recommend?
>>
>>58967869
HM type systems are deficient.
>>
>>58970715
Fuck off, retard.
>>
>>58967869
thank you for using an anime image.
>>
File: anime.png (786KB, 1000x1300px) Image search: [Google]
anime.png
786KB, 1000x1300px
>>58970715
Wrong thread

>>58970851
You're welcome
>>
>>58970715
do """""people""""" really go to uni for this kind of crap?
>>
>>58970872
Yes.
>>
>>58970715
>>>/g/wdg/
>>>w3schools.com

Also I recommend you to never step back here ever again.
>>
File: contemplate.gif (957KB, 500x418px) Image search: [Google]
contemplate.gif
957KB, 500x418px
I'm getting tired of these piss-easy programming assignments in my class. The goal was to create a multithreaded program to do matrix multiplication. This is what I'm thinking of turning in.

from threading import Thread as e
from Queue import Queue as q
def m(q,r,c,x,y):
q.put([r,c,x[r][0]*y[0][c]+x[r][1]*y[1][c]])
a,b,c=[[1,4],[2,5],[3,6]],[[8,7,6],[5,4,3]],[[0,0,0],[0,0,0],[0,0,0]]
h,f,p=q(),None,"obfuscate"
for i in p:
t=e(f,m,f,(h,p.index(i)/3,p.index(i)%3,a,b))
t.daemon=(f==f)
t.start()
for i in p:
n=h.get()
c[n[0]][n[1]]=n[2];
print c


Any suggestions for additional obfuscations I can add to be even more annoying?
>>
>>58970872
being a shutin aspie doesn't = a job, people need certification

appreciate all the mad a simple question has caused though
>>
>>58970896
Install OpenMP.
>>
>>58970896
>Any suggestions for additional obfuscations
write your own language and write this program in it. make it very similar but with subtle and annoying differences
>>
>>58970896
Write it in Haskell.
>>
>>58970896
Write a DSL and implement the program in that.
>>
>>58970905
>CS(?) degrees are programming "certifications"
Jesus fucking christ. You would probably do better if you went to one of those cancerous """coding""" """""bootcamps""""".
>>
>>58970936
Oh yeah... I have all of them under control. do it
my people will be watching
>>
>>58970932
>>58970936
You forgot 1381228285622.jpg.
>>
>>58970912
If only I was good at Haskell. Not afraid to admit I'm still pretty new to functional programming.

>>58970909
>>58970933
This sounds like fun. We were allowed to write in any language we wanted, so that would be allowed.
>>
>>58970905
>appreciate all the mad a simple question has caused though
As for anything 4chan-related, lurking is required for knowing the customs of such and such board or general thread culture.

/dpt/ is supposed to hate on /wdg/ and anything web-related, because of the implications of the rise of web applications in the IT industry. Whether you care or not about these implications, it's a way to express your affiliation to such or such group of people.
>>
File: 1439648511159.jpg (116KB, 469x469px) Image search: [Google]
1439648511159.jpg
116KB, 469x469px
>>58970948
I couldn't be bothered waiting for the full minute to delete then repost it.
I'll post a cute anime picture instead.
>>
>>58970952
Haskell is pretty easy, you could learn it quite quickly
>>
>>58970979
I suspect it's also because:
1) he used the word 'coding'
2) programming language hierarchy shenanigans, both because he mentioned JavaScript and that his post could lead one to infer that HTML+CSS is a programming language
>>
>>58970979
Javascript is not a programming language
>>
>>58970933
>>58970909
How's this for a language?

matrix A
┏ ┓
┃ 1,4 ┃
┃ 2,5 ┃
┃ 3,6 ┃
┗ ┛

matrix B
┏ ┓
┃ 8,7,6 ┃
┃ 5,4,3 ┃
┗ ┛

USE threads TO multiply A and B store IN C
output C to THE CONSOLE
>>
>>58971048
10/10 would multiply matrices in
>>
>>58971048
Too readable
>>
>>58971048
Needs more parentheses.
>>
>>58971048
Do it with shaders
>>
>>58970896
Good luck getting a zero on the assignment

>>58971048
http://docs.racket-lang.org/2d/index.html

>>58971042
Wrong
>>
>>58970979
this board is more of a glorified subreddit than anything else.
>>
>>58971087
(You)
>>
>>58970991
Haskell is a noisy mess of a language with an inferior type system. It isn't even total.
>>
>>58971096
>It isn't even total.
You want a language that isn't Turing complete?
>>
>>58971100
Why are you replying to him?
>>
>>58971100
Totality > Turing-completeness
>>
>>58971110
Because I love PLT shitfests.

>>58971115
Not an argument.
>>
>>58971117
>Because I love PLT shitfests.
He's just here to shitpost you idiot.
Why do you think he's complaining about Haskell in a thread where someone brought up Javascript?
>>
>>58971117
You want code that isn't provably terminating?
>>
>>58971124
>He's just here to shitpost you idiot.
What do you think a shitfest is? I just like my shitfests to be PLT-centric.

>>58971129
See >>58971117
>>
>>58971124
Haskell is fucking garbage though. Good luck with having the language cuck you by not terminating
>>
>>58971137
You have a narrow view of what an argument is my friend. You have the evidence right in front of you, but you're too stupid to comprehend it.
>>
File: 1462666392038.jpg (57KB, 415x440px) Image search: [Google]
1462666392038.jpg
57KB, 415x440px
>it's another "my favourite language barely anybody uses is better than your favourite language that barely anybody uses because even less people use it" episode
>>
>>58971157
See >>58971137
>>
File: 14593473170160.jpg (55KB, 296x475px) Image search: [Google]
14593473170160.jpg
55KB, 296x475px
Is undecidability even real? Show me a single piece of code which demonstrates it. Real code. And make it short and simple so I can actually understand.
>>
>>58971176
Write antivirus software that can check if every program in existence is a virus or not.
>>
>helloworld.exe
>60kb

am i doing something wrong here?
>>
>>58971207
>.exe
Found your problem.
>>
>>58971176

The simplest demonstration is this:

#!/bin/bash
time $1


Now, imagine this program:
#!/bin/python2
while 1 == 1
print "CAN'T STOP WON'T STOP"


and this program:

#!/bin/python2

print "Stop!"
print "Hammertime!"

Since I can give the first program ANY argument, how long will the first program take to run?

You just won't know.
>>
>>58971168
Confirmed for totality > Turing-completeness. Anyone else want to argue about it?
>>
>>58971225
See >>58971117
>>
>>58971190
I'm not a "hacker" so to speak. I just don't quite buy this undecidability bullshit. Could you please show me some code?
>>58971219
Could you rewrite it in a non garbage language? If not, then I guess I'll have to read your post. I just don't want to infect my brain with it if I don't need to.
>>
>>58970204
its called 'text wrap' search google
>>
>>58971232
(defun print-when-stopped ()
(progn
(loop)
(print "Done.")))
>>
>>58971271
I can see that you have more code blocks in the previous post. Are you trying to trick me?
>>
>>58971282
Yes, you are being tricked!
>>
>>58971282
Confirmed for tricked.
>>
File: 1478758463017.png (15KB, 300x300px) Image search: [Google]
1478758463017.png
15KB, 300x300px
>>58971288
>>58971295
I don't want to be friends with you anymore
>>
>>58971364
>>>/g/
>>
i will now attempt to move file loading onto a different thread so my program doesn't lock up if i load big files
>>
File: tcl.jpg (41KB, 1024x768px) Image search: [Google]
tcl.jpg
41KB, 1024x768px
Why can't Lua have a decent standard library like Tcl?

Why can't Lua NOT be split into incompatible variants that compete with one another?

Tcl is the one true cutescript.
>>
So I'm working on some lab-equipment DSP software that I'm connected to via USB to a winshit computer (thus C on the DSP, C# on the winshit machine).

I want to be able to print from the DSP, how is this typically done? Currently I'm thinking of just making a ring-buffer on the DSP and periodically reading from it from the C# code, but this is massive AIDS. The DSP is a TMS320C6454.
>>
>>58970896
import the entire python standard library
>>
>>58972338
what kind of data do you want to transmit? what are you going to do with it?
easiest on the dsp would probably be to just send it when it's ready and let the C# program buffer it.
If you only rarely need to get data or sending it is expensive I'd do it request based
I'm only a hobbyist tho so take my advice with a grain of salt
>>
>>58972675

Strings for debugging. Your approach is pretty much what I'm doing, but reinventing wheels is error prone.
>>
>>58968200
>>58968104
>>58968034
>>58967973
>>58968247
Anon please, this is an inclusive board where we try to help people
>>
>>58968628
Yes anon, we all know that arrays are really just tables. It doesn't change how useful they are or the terminology involving them.

>Tree isn't specific
Just assume everyone is talking about some derivative of the B-tree
>>
>>58972730
I didn't see a CoC that says this
>>
>>58972710
I don't understand where you're reinventing wheels here.
but yeah for that I'd just send them and let the PC handle them, or do you have something more elaborate where you want to query the device for debugging info?
>>
>>58970896
>Any suggestions for additional obfuscations I can add to be even more annoying?
http://docs.hylang.org/en/latest/
>>
>professor asks us to create a project that implements an algorithm for solving a maze
>creates the instance fields, constructors, and methods
>doesn't allow us to change them

I'm fucking confused mates. Why are most unis so fucking bad at teaching programming?
>>
>>58973013
Who are you quoting?
>>
File: debug.png (112KB, 1522x1040px) Image search: [Google]
debug.png
112KB, 1522x1040px
So, I sort of minimized my problem. The get() method advances the tellg pointer by a lot more than one byte. What gives? This is not true for a different input file.
>>
>>58973093
oh nevermind I'm retarded
>>
>>58969279
>I was able to learn C
there's no need to lie on the internet
>>
>>58973113
I did too btw, first language after mIRC built-in script engine
>>
>>58969309
>very proficient in C
but you're literally retarded tho
>>
>>58973113
BASIC shortly after I learned to read
C at 12
x86 assembler at 15

I would teach my own child Assembler before C.
>>
>>58973113
C is very simple language.
>>
if i end my program while it's working it crashes
>>
>>58973101
idk but maybe try get(&b,1); ?
>>
>>58973163
>x86 asm
retarded, learn amd64 att assembler.
>>
>>58970592
you mean literally?
>>
>>58973206
>retarded, learn amd64 att assembler.
AMD64 did not exist in 1995, when I was 15.
>>
>>58973206
>att
kys please
>>
>>58973229
Learn in now, and teach your child.
I think before asm you should learn binary.
>>
>>58973264
>teach your child.
I wrote
>>58973163
>I would teach my own child Assembler before C.
not "x86 Assembler".

Reading comprehension 0/10.
>>
>>58973235
>2017
>learn intel dialect
Pajeet please.
>>
>>58973125
>I did too btw
no, you didn't, no need to lie
>>58973163
>C at 12
nope
>>58973180
yes
>>
Will I be able to use any skills I get from .NET development for Unity (if I want to become a game dev in the future) or should I just stick to java web dev?
>>
NEW THREAD!

>>58973326
>>
File: debug2.png (58KB, 758x1008px) Image search: [Google]
debug2.png
58KB, 758x1008px
>>58973204
get(&b,1) does not do it, method will add a \0. So I did pic related. No change.
>>
>>58973290
>no, you didn't, no need to lie
autismo is alive

I wanted to do LE VIDYA XD
So I learned along the tracks of SDL 2D games and basic OpenGL stuff (I even remember which course it was), at 13 I could make Qt GUI DLLs for mIRC, what's so fucking unbearable for you, that even at 33 years old and single you can't grasp Python, yet alone C ?
you come here and shitpost and help requests get drown in your shitposting, I'll fuck off to reddit or stackoverflow soon enough, I'm tired of these fucking threads you filthy manchildren, yes I'm mad
>>
>>58973369
>I learned along the tracks of
so you haven't actually learned C, as I was saying :^)
>>
>>58973422
Sure, I was able to pull off 3D OpenGL animations with free camera and lighting and textures, a Mario clone in SDL but I did it with GeekMagic lol those guys rock at making programs with Magic Right ?? fucking nerds xD

fuck off
>>
>>58973507
>Sure
called it!
>>
Whenever I look up a C++ problem I'm having, none of the advice I see uses
using namespace std;


and instead always has shit like

std::cout << std:: endl;


Is there a reason for that? It seems like such a waste of time to have to put std:: in front of every command.
>>
>>58973288
AT&T is an eyesore
>>
>>58973800
not to mention it makes absolutely no sense at all
>>
>>58973963
>I'm to dumb for att
>>
>+300
We need a new thread now!
>>
>>58973783
There are tons and tons of different things in the std namespace and its better to have to write a few characters (which isnt a big deal and if you if verbosity is stopping you from programming well then grow up), than to have global namespace conflicts.
Also "using namespace std" is an asshole thing to do in .h files because if anyone #includes the file then the global namespace gets immediately flooded with no way to prevent it.
>>
>>58973783
By using
using namespace std;
you're introducing a whole lot of stuff to the global namespace. In most cases it won't cause any problems, but it's a bad practice. Definitely never use this in headers others might include!

The technical reason for why this is bad is that you might have defined a function foo, and then one of your includes gives you the function
std::foo
, except now it can be referred to as just foo. Congratulations, you've got yourself an ambiguity.
>>
>>58973999
>leal 16(%edx,%eax,4), %eax
what the literal fuck
tell me how that makes any sense vs
>lea eax, [edx+eax*4+16]
>>
>>58974032
We have a new thread already

>>58973326
>>
Guys im trying to learn C and i'm having lots of difficulties. I really need something like a dictionary for C that features and explains all the things in it. All statements like "if" to minor things like the "++" thing, for example. Does that exist?
Thread posts: 326
Thread images: 34


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.