[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: 333
Thread images: 33

File: hach style.jpg (53KB, 416x480px) Image search: [Google]
hach style.jpg
53KB, 416x480px
OBJECT-ORIENTED PROGRAMMING DISCO

NO MULTIPLE CLASS INHERITANCE

STATIC TYPING

RESTRICTED TYPE INFERENCE

NO USER-DEFINED OPERATOR OVERLOADING

PASS-BY-VALUE ONLY

JAVA FOR THE LAVA
>>
PREVIOUS THREAD >>52652503
>>
>>52658863
How much are different c# gui clasess vs java?
>>
>>52658863
J A V A
A
V
A
>>
PYTHON MASTER RACE
Y
T
H
O
N
>>
>>52658893
android or desktop? on android it should be the same
>>
>Java for the lava
Does that mean we should print out Java programs and throw them into an active volcano, as they are unworthy of even being placed in a dump, or being recycled?
>>
Reminder that:

Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!
>>
>>52658962
kill yourself
>>
>>52658940
Doesn't ruby overload?
>>
Please use hot nazi women for future /dpt/'s. thank you.
>>
File: Massimo-DAlema2.jpg (36KB, 450x322px) Image search: [Google]
Massimo-DAlema2.jpg
36KB, 450x322px
>>52658962
>cout >> justFuckMyShitUp >> endl;
>Beautiful
>>
>>52659050

Ruby does not allow function overloading. One name, one function. Functions are allowed to have optional or variadic arguments, however.
>>
>>52659084
wrong way around senpai
>>
these threads just get shitter and shitter
>>
>>52658940
It's not that they are unworthy of the dump, they aren't. It's more that they are so horrible that nobody wants to risk any human ever seeing them again. Also nobody want to live near a dump that's used for Java code.
>>
MEMES
>>
O C A M L
C
A
M
L
>>
>>52659100
Yeah but at least he's looking at the post content now.
For some reason flipping the image made it 50% larger too, why is jpeg so shit?
>>
>>52659154
>Different name.
What do you mean?
>>
File: 1453585862256.jpg (66KB, 360x480px) Image search: [Google]
1453585862256.jpg
66KB, 360x480px
>>52659056
>Please use hot nazi women for future /dpt/'s. thank you.

Ok, like this?
>>
>>52659181
>tfw no gf
>>
File: 1453933648387.jpg (105KB, 540x475px) Image search: [Google]
1453933648387.jpg
105KB, 540x475px
>>52659181
Or this
>>
>>52659105
>mixing sideeffects with sideeffect-free code
What about it?

I can read your ocaml just fine thanks. printf is not what you wrote, and doesn't new line.
>>
Although... actually, wait, it does have operator overloading. Operators are just methods with a special priority or associativity. Adding numbers a and b is actually sending the message :+ to the number a, with the parameter b. To demonstrate...

> irb
irb(main):001:0> 1.send(:+, 2)
=> 3
>>
JΛVΛ
Λ
V
Λ
>>
File: 1453585392954.jpg (91KB, 604x567px) Image search: [Google]
1453585392954.jpg
91KB, 604x567px
>>52659203

Or this
>>
>>52659181
gril on the right is a qt3.14
>>
>>52659086
Oh, my bad, I was thinking of optional arguments.
>>
>>52659211
>being this bad at programming
should be a criminal offense 2bh family.
>>
>>52658932
Desktop. I have a task to build simple asp.net using c#, but i've only used java on linux, i'm not sure hot to setup anything on win
>>
File: 300k_starting.jpg (24KB, 400x267px) Image search: [Google]
300k_starting.jpg
24KB, 400x267px
>PhD in ocaml
>any job I want
>300k starting
>>
File: tumblr_o0xnon9AR41umayn6o1_1280.jpg (110KB, 1092x960px) Image search: [Google]
tumblr_o0xnon9AR41umayn6o1_1280.jpg
110KB, 1092x960px
>>52659203
fugg i don't really have a foot fetish but i love this

both the pose where they have their toes on the ground and arching like crazy and when they have the foot lying upside down with their soles all wrinkly
>>
>>52659261

So you don't have a foot fetish, but you go on to describe why you DO have a foot fetish.
>>
>>52659249
>You're bad at programming, I don't have to explain why.
ocamlfags make me chuckle.
>>
Where should I go to learn C++?
>>
>>52659261
>I don't have a foot fetish
>but the first thing I look at when I see a girl is the feet
>>
>>52659268
Nowhere.
Don't learn C++
>>
>>52658962
>There is no emotion, there is peace.
>There is no ignorance, there is knowledge.
>There is no passion, there is serenity.
>There is no chaos, there is harmony.
>There is no death, there is the Force.
>>
>>52659263
>>52659274
i almost never fap to feet directly. i care much more about tits, ass, legs, face and the woman as a whole generally speaking
>>
bump for answers >>52659275
>>
>>52659308
>being this much in denial
>>
Rate my absolute value program, deepeetee
unsigned abs(unsigned x)
{
if ( ! ( x > 0 ) )
{
return x * - 1 ;
}
else
{
return x;
}
}
>>
>>52659317
>being this much of a retard
>>
>>52659327
just a beach type situation like this pic with these types of poses might trigger it i guess since you see a lot of feet walking by hundreds of sun bathers

i wouldn't even mind having a foot fetish but i don't consider it a fetish, like i can admire nice feminine hands too or a neck for instance but it doesn't mean i have a hand/neck fetish
>>
>>52659225
√∧∨∧
∧∨∧∨
∨∧∨∧
∧∨∧√
>>
>>52659342
It is called partialism. You have multiple fetishes anon.
>>
>>52659366
>Partialism is sexual interest with an exclusive focus on a specific part of the body other than the genitals.
>exclusive focus on a specific part of the body other than the genitals
>exclusive focus
>exclusive
>>
>>52659330
Why did you use !(x>0) instead x<0?
>>
>>52659390
It's more explicit.
>>
>>52659330
>unsigned
If you're going to be retarded with your typing, the function is equivalent to
unsigned abs(unsigned x)
{
return x;
}
>>
>>52659442
Holy shit, this is so much better than mine. Thank you anon! Gonna show this to my boss, maybe I'll get a raise.
>>
File: 1452126561832.jpg (102KB, 450x429px) Image search: [Google]
1452126561832.jpg
102KB, 450x429px
>>52659408
>>
>>52659268
C++: an octopus made by nailing extra legs onto a dog

Learn C++ only if you really need it. As a language is basically a bag of ideas duct-taped together.
>>
>>52659462
confirmed for jobless pyfag
>>
I was looking in code academy and it doesn't teach you C#. where is a good website where I can learn c# ? I'm up for books and stuff as well.

Thanks Family
>>
File: google why are you this creepy.jpg (60KB, 399x629px) Image search: [Google]
google why are you this creepy.jpg
60KB, 399x629px
>>52659330
88/88
>>
>>52659483
>confirmed for jobless pyfag

Anon I started with C
>>
>>52659268
cppreference
>>
>>52659390
>not using less than, which is universally understood in mathematical bounds like 0 < x <= 10
Not sure if retarded or just pretending.
>>
>>52659514
>I started with C
there's your problem
>>
>>52659258
>ocaml
Wasted so much time in college where you could've made millions
>>
>>52659530
>there's your problem

Enlighten me
>>
>>52659516
Less-than is an abstraction, which is best avoided in low level languages such as C.
>>
>>52659561
>>
>>52659566
It's true. Less-than is nothing more than syntactic sugar for not and greater-than.
I mean really,
x < 0

is the same as
(!(x > 0) && !(x == 0))
>>
>>52659561
>Less-than is an abstraction, which is best avoided in low level languages such as C.

Some people use arrays when they could use a base pointer + offset.
It's so much faster on my PDP11.
>>
>>52659561
The entire C language is an abstraction.
I don't think you understand what a compiler is for.

Almost every for loop in existence uses a less-than or less-than-equals condition.

2/10 made me reply
>>
>>52659594
This is true. Pointer syntax is much safer than array syntax, as well, because there's no chance for compiler error.
>>
>>52659497
Msdn ffs
>>
>>52659566
They're referring to the fact that most instruction sets only have a greater than opcode.

>>52659589
Are you retarded? It would resolve to a GTE opcode.
>>
>>52659330

Linus had recommended that you take a copy of the GNU style guide and burn it. Why didn't you listen?

Also, abs for unsigned numbers is just the identity function. Consider having two separate functions, one for signed, and one for unsigned (or, realistically, just one for signed). As an example:

template <class T>
T abs(std::enable_if<std::is_signed<T>::value>::type n)
{
if (n < 0) return -n;
else return n;
}

template <class T>
T abs(std::enable_if<std::is_unsigned<T>::value>::type n)
{
return n;
}
>>
>>52659655
>class
might as well be using clojure
>>
>>52659614
>This is true. Pointer syntax is much safer than array syntax, as well, because there's no chance for compiler error.

There are faggots programmers who use languages with automatic bounds checking, can you believe that?
>>
>>52659723
Wtf? That's almost as bad as automatic memory reservation.
How do these people even call themselves programmers? They're just mashing buttons on a screen, like web developers.
>>
File: Bait.png (114KB, 955x957px) Image search: [Google]
Bait.png
114KB, 955x957px
>>
>>52659390

!(x > 0) is equivalent to (x <= 0), not (x < 0)

>>52659745

Garbage collection is fine in non-systems languages, so long as one is willing to accept that performance is not something they care about. In systems languages, RAII is the only acceptable means of automatic memory management.
>>
File: sp4.png (8KB, 453x389px) Image search: [Google]
sp4.png
8KB, 453x389px
I started rewriting SPP for fun, and decided on SPPPP, or SP4.

What I decided to do differently right away was make all the functions work in instant mode, so they take values rather than ""registers"".

That had the interesting side effect of allowing things like this to happen.
>>
>>52659745
>Wtf? That's almost as bad as automatic memory reservation.
>How do these people even call themselves programmers? They're just mashing buttons on a screen, like web developers.

Don't let me started on those High Level Language guys! C is all I need.
All the abstractions I need can be built trough the use of pointers.
C is the most powerful language in the world.
Abstraction is evil, it steals precious cpu cycles.
>>
>>52659545
Don't worry, he can't.
>>
>>52659820
>Don't let me started on those High Level Language guys! C is all I need.

C is a high level language, though.
>>
>>52659799

GTP, is this your waifu?

https://www.youtube.com/watch?v=V-MixcXotj8
>>
>>52659820
These days I don't even use most of C's more abstracted features, I just use syscall() and the occasionaly __asm__() call.
>>
>>52659831
>C is a high level language, though.

Ahahaha, good one
>>
>>52659832

I don't watch animu, but if you want it to be, then sure.
>>
That said, I do have 3DPD nigfus.
>>
>>52659883
saw her last night. garbage. more qt freckled red heads.
>>
>gcc uses AT&T syntax for inline assembly
The worst
>>
Hey DPT, what is an O(ack(n, 0)) algorithm?
>>
>>52659929
gcc also compiles to AT&T if you tell it to compile to assembly.
>>
>>52659799
why you not usin' vim? >:c
>>
>>52659938
An algorithm with a speed of (ack(n, 0)).
>>
File: a-book.jpg (38KB, 399x500px) Image search: [Google]
a-book.jpg
38KB, 399x500px
Are books still the best way to learn a programming language in 2016?
>>
>>52659832
doesn't even look like a nigress. Looks like they just drew a standard cute anime girl and use brown paint.
>>
>>52659915
>saw her last night. garbage.

Absolutely rude!
>>
>>52659953

Sublime jest werks.
>>
the
>smug *language* weenies
meme is older than i thought

http://stackoverflow.com/questions/3040276/when-did-people-first-start-thinking-c-is-portable-assembler
>>
>>52659966
Yes.
>>
>>52660087
Every time I see "C" and "designed" in the same phrase I die a little inside.
>>
>>52660087
http://patricklogan.blogspot.com/2005/01/smug-lisp-weenies.html
>Python was the subset of Lisp that was understandable by C++ programmers.
the battles of the ancients
>>
>>52660191
>Python was the subset of Lisp that was understandable by C++ programmers.

That's a bit harsh
>>
>>52659938
An algorithm that is no longer tractable starting at n = 3, and barely tractable above n = 0.
>>
File: GOZjDnS.webm (973KB, 720x404px) Image search: [Google]
GOZjDnS.webm
973KB, 720x404px
What exactly is a hackathon? As in, what am I meant to do, from arriving at the venue?
>>
https://css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/

>the fizzbuzz meme is real
holy shit
this cannot be real

lmao
>>
>>52660241
you're supposed to hack some shit together within the allotted time frame and then a winner gets chosen based on how good everyone's shit is
>>
who are those semen demon?
>>
>>52660256
It's real. I was asked once in an interview. /dpt/ had me well prepared.
>>
>>52660271
Are you meant to go with a premade team?
What if you don't have a full team?
Or a team.
>>
>>52660305
it depends

the specific hackathon event should have information about things like that on their website
>>
>>52659330
it sucks
int abs(int x)
{
return x & sizeof(x) * 8 - 1;
}
>>
>>52660256
females suck
>>
>>52660348
>8
>Not CHAR_BIT
It sucks.
>>
>>52660348
>8
>using magic numbers

Is char always 8 bits, my C is crusty
>>
>>52660439
>any type
>constant size
>C
>>
>>52660475
Thanks Dennis, that was a wonderful design choice.
>>
>>52660407
>>52660439
got me there, but that's okay, i'll rewrite it when i get a computer that's so hipster my bytes are 17 bits
>>
>>52660523
>got me there

Don't worry, it's fucking C.
It just wants to fuck with you.
>>
>second year math/cs double major
>already seeing applications of rings and fields in programming

holy SHIT my boner is so huge right now

so glad i picked these subjects
>>
>>52660509
Dennis is a fucking hack. Everything he did contributed to ruining computing just a bit more, except C, which plunged it back into the dark ages. The computing world is just starting to recover nowadays.
>>
>>52660509
C is from a time when non-8 bit byte computers were more commonplace.
>>
File: 1452635429762.jpg (67KB, 416x508px) Image search: [Google]
1452635429762.jpg
67KB, 416x508px
>>52660568
>>
>>52660568
>recover
>more and more software is written in 90% overhead, 10% actual work languages
yeah, no
>>
Dennis Ritchie did nothing wrong
>>
>>52659330
>that indentation
kill yourself
>>
>>52659831
just because it's not asm doesn't mean it's a high language.
>>
>>52660597
Suck his cock more, I'm sure it'll make him less dead.

>>52660602
That's why I said "starting" you fucking retard. People are finally rediscovering functional programming thanks to parallelism. They're also finally seeing the value in strong, powerful static typing discipline but also type inference.

At the same time, the remnant of the C crowd moved on to creating the worst languages known to man beside C itself (like python and java).

>>52660610
Dennis is the reason the space shuttle crashed due to mismanaged units. He's the reason therac-25 happened.
>>
>>52660602
or in python's case, 99% overhead, 1% lazy pre-fab shit
>>
>>52658863
Haha wtf am I looking at
>>
>>52660568
>Dennis is a fucking hack. Everything he did contributed to ruining computing just a bit more, except C, which plunged it back into the dark ages. The computing world is just starting to recover nowadays.

I'm not the most knowledgeable low-level guy out there, but shouldn't bounds checking be done in hardware by now?
Any reasons why not?
>>
>>52660256
> I kind of thought I was a unicorn. They'd be lucky to have me.
Bitch couldn't even fizzbuzz
>>
>>52660638
Actually that's literally what it means. Also, some assembly languages are high-level languages.
>>
>>52660649
First reason is that hardware is adapted to C. C has no bounds checking so hardware doesn't either. Second reason is that it would be expensive GIVEN that C doesn't bounds check anyway. If instead we had kept using lisp machines, we would have had hardware bounds checking long ago (like there were hardware first/rest ops).
>>
>>52660649
The hardware has no concept of what's going on above it.
All it sees is a massive array of bytes. It may be possible to shoehorn that kind of shit in there, but it would make it the hardware way more complicated.
>>
>>52660639
>That's why I said "starting" you fucking retard.
>functional meme
i hope you don't write serious software in that, family
>>
>>52658940
If Java had decent garbage collection, all programs would delete themselves on execution.
>>
>>52660677
I reached the same conclusion as you. I wonder how much faster HLL would be with proper hardware support.
>>
This must be written in MySQL.

I have a master table that has one item per line:
item:
------
A
B
C
D
E
...(could be more)


Now I want to make combinations of each item, one combination per row like this:
Combinations of 2:
item1: item2:
-------- --------
A B
A C
A D
A E
B C
B D
...

Combinations of 3:
item1: item2: item3:
-------- -------- --------
A B C
A B D
A B E
A C D
A C E
B C E
...



I figured out how to do it with join statements like this:
SELECT DISTINCT A.item ,B.item ,C.item FROM mastertable AS C 
LEFT JOIN (SELECT DISTINCT item FROM mastertable) AS B ON C.item != B.item
LEFT JOIN (SELECT DISTINCT item FROM mastertable) AS A ON B.item != A.item AND C.item != A.item AND C.item != B.item
ORDER BY A.item ;


The problem is that things like this happen:
Combinations of 3:
item1: item2: item3:
-------- -------- --------
A B C
A B D
...
B A D
...


How should I change the query so that it avoids making things like (B,A,D) if (A,B,D) will already be made? I'm OK with filtering out repeated permutations after creating the join tables.
>>
>>52660693
>The hardware has no concept of what's going on above it.
>All it sees is a massive array of bytes. It may be possible to shoehorn that kind of shit in there, but it would make it the hardware way more complicated.

By your reasoning MMU are supefluous.
Supporting High Level Features in hardware could be beneficial.
>>
>>52660745
Yes, I over simplified a bit. The MMU doesn't cause nearly as much complication as a hardware bounds checker would.
For a process, memory pages don't change that often, and most programs would only need a few of them (assuming large pages) and they wouldn't need to change that often.
With bounds checking, you would need to update the table of "known arrays" EVERY time you enter a function which has a array, leave a function that has an array, allocate something with malloc(), and use free(). You would spending ages just constantly updating the table.
>>
Okay DPT, which is better?

#define BITSIZE(T) (sizeof(T) * CHAR_BIT)


Or

template<class T>
struct bit_size {
const static size_t value = sizeof(T) * CHAR_BIT;
};
>>
>>52660886
>With bounds checking, you would need to update the table of "known arrays" EVERY time you enter a function which has a array, leave a function that has an array, allocate something with malloc(), and use free(). You would spending ages just constantly updating the table.

So the software implementation of bounds checking does all that things? I thought it was a bit simpler.
>>
>>52660924
the first one, because it doesn't require a C++ compiler
>>
>>52660924
I dont use C++, what's the meme preventing you from writing a function?
>>
>>52660924
Definitely the first.
The second is so fucking meme'y I can't even imagine using it.
>>
>>52660639
>People are finally rediscovering functional programming thanks to parallelism.
It's more like people are forgetting why functional programming was a bad idea in the first place.

Professors still teach these obsolete memes as if nobody tried them instead of teaching that people tried them for decades and they were inferior to what they wanted to replace.

The only reason FP even exists today is because Java doesn't have first-class methods. OOP (everything is an object) was meant to unify the "paradigms" we use today.

Closures (procedural, not purely functional) were around since the late 60's. People preferred objects because an object can be serialized and copied. The representation of a closure depends too much on machine code and compiler optimizations.
>>
>>52660938
That retard is full of shit. You just put a canary at the end of the table in memory.
>>
>>52660987
> functional programming
>bad idea in the first place.
t. /dpt/ cmen who can't tell the difference between an array and a pointer.
>>
you guys just mad at Java because you don't have a qt gf. Pathetic.

Java is actually a pretty good language still.
>>
>>52660924

The latter.
>>
>>52660996
If I have an array of unsigned integers, EVERY possible bit-pattern in valid. What would you use for the canary?
>>
>>52661019
>he doesn't know how arrays work!
>>
>>52660954

The idea is to determine the bit size of a type, not a variable. In C++, the standard way to deal with type -> value functions is with an empty struct with a single static member.

>>52660951

Yeah, but day we're assuming the use of C++?

>>52660969

You don't like memes?
>>
>>52661019
>in valid
is valid*
>>
>>52661016
There's better
>>
>>52660987
yeah you know what else can be serialized and copied? any data in purely functional languages. closures can't be serialized with FP just like how methods can't be serialized in OOP languages.
>>52661034
i was trolling :^) if you're planning on taking advantage of any other C++ features, do the second way hands down
>>
File: calling.png (8KB, 497x380px) Image search: [Google]
calling.png
8KB, 497x380px
woohoo
>>
>>52661042
If you need to make stuff that does really complex things like AI and machine learning, Java is actually really nice. You can relax a lot of things without losing very much efficiency.
>>
>>52661070
Nobody uses java for AI. Python, on the other hand, or even lua.
>>
>>52660924
You really cant pass a variable into sizeof? It has to be a type? What happens if you dont know the run-time type?
>>
File: apply.png (6KB, 440x327px) Image search: [Google]
apply.png
6KB, 440x327px
this is phun.
>>
>>52661176
Looks gay
>>
>>52661118
https://www.youtube.com/watch?v=kHyNqSnzP8Y&list=PLUl4u3cNGP63gFHB6xb-kVBiQHYe_4hSi&index=13

these are java programs
>>
>>52661121
you can use RTTI or templates (template <typename T> something(T x) { ... } -> something<>(the_thing) will allow you to capture T and then you can use template magic to sizeof the type).
>>
File: gayness.png (7KB, 388x337px) Image search: [Google]
gayness.png
7KB, 388x337px
>>52661185

It is.
>>
>>52661191
So? That's like saying that people use javascript for ML. No they don't. They write demos backed by a server in python (which actually calls back to C and CUDA).
Not to mention that nobody has been using genetic algorithm or any form of genetic programming for the past 20 years or more, let alone for AI tasks. No, simulating genetic mutations is not GA or GP. Using a system based on evolution to perform optimizing computation is GA or GP. And no, that one guy in his basement who tried to use GA and ended up with results 1/10000 times as good as backprop doesn't cout.
>>
>>52661249
https://www.youtube.com/watch?v=q0pm3BrIUFo

this is java too at the end.
>>
>>52661295
See >>52661249
>>
>>52661325
this is a neural net though, not GA like you were ranting on for some reason. He teaches the entire course with examples from experiments done in java.
>>
>>52661295
>>52661191
The only relevant AI toolkit is weka, and it's a fucking toy even beside the fact that it doesn't even come close to the likes of caffe, torch, theano, {blocks, pylearn2 (which are dogshit)}, tensorflow, keras, lasagne, CNTK etc.
>>
>>52661346
Part of the argument is with regard to GA/GP in particular, part of it relates to your using random undergrad AI class videos. By that logic, people write business applications in javascript since that's what's taught in many colleges as the language for the SE part of CS.
>>
File: g dpt c patrician language.png (13KB, 1138x82px) Image search: [Google]
g dpt c patrician language.png
13KB, 1138x82px
>>52658863
still top dog

you mad, OOP cucks?
>>
>>52661379
i've never heard of anyone doing js in university lol, unless you're in a web dev course or something.

That's not a random undergrad. That's MIT undergrad by the famous AI researcher Patrick Winston.
>>
>>52661402
Kek'd.
>>
File: ANSI_logo.jpg (16KB, 252x149px) Image search: [Google]
ANSI_logo.jpg
16KB, 252x149px
Friendly reminder to only use programming languages with ANSI standards.

Thank you.
>>
File: 002 - JnLQYW7.png (59KB, 200x206px) Image search: [Google]
002 - JnLQYW7.png
59KB, 200x206px
>tfw spent a lot of time customizing my IRC client
>tfw no IRC friends to speak with
>tfw no friends
>>
>>52661420
>murrika fuk ya
>>
>>52660723
can't you use a cross join ?
>>
>>52661420

I use C, which has an ANSI standard, but I relegate myself to C11 only wherever possible.
>>
>>52661456
>I relegate myself to C11 only wherever possible.

I like this. No homo.
>>
>>52659497
Do you know any C++ or Java already?

https://msdn.microsoft.com/en-us/library/ms228358(v=vs.90).aspx
>>
>>52661428
I've never seen someone this autistic before.
>>
File: wake me up1.png (226KB, 468x345px) Image search: [Google]
wake me up1.png
226KB, 468x345px
>27 year old goatee'd lardass with a BS in math in my stats class going for a CSCI BS since apparently he found out the 300k starting was a meme the hard way
>always bragging about how easy calculus is to him (seriously)
>always asking stupid questions that demonstrate he has a basic understanding of the fundamental concepts being discussed that didn't need to be asked at all and wasting class time
>is a total dumbass when it comes to designing algorithms and gets mad at the professor when he sketches out the algorithm for him but does it in psuedocode instead of C++


>submits a sorting algorithm or some shit for an entry level data structures that takes time n! and talks about how he's going to take it to the dean because he got an F on the project and thinks the teacher has a grudge against him, because "IT WORKED! IT WORKED THO, BRO! YEAH YOU HAD TO TAKE A MINUTE TO WAIT FOR IT BUT IT WORKED DUDE! TOTAL BULLSHIT!"
>>
>>52661553
n! hahahahaha fuckin' nub
>>
>>52661553
>>submits a sorting algorithm or some shit for an entry level data structures that takes time n!

Post this mean n! hog here and let's take a gander at it.
>>
>>52661579
you might be trying to meme but you're right. i don't have anything against nubs but they shouldn't act like they're hot shit and everyone's just out to get them
>>52661586
i don't have the program, i was merely forced to sit through 15 minutes of him whining about his ordeal before class
>>
>>52661472

It is both because I like _Static_assert, and because I would like it to not compiler in MSVC.
>>
>>52661654
>and because I would like it to not compiler in MSVC.

Why not?
>>
>>52661586
> Post this mean n! hog here and let's take a gander at it.
I can think of two ways to get a O(n!) sorting algorithm: one is to enumerate every possible permutation until you find one where all elements are in order, the other is bogosort (generate random permutations until you find one that's in order).
>>
File: oh wow, it's nothing.png (7KB, 407x323px) Image search: [Google]
oh wow, it's nothing.png
7KB, 407x323px
I wish I actually cared about my coursework.
>>
>>52661763
The same reason every readme file uses newlines instead of carriage return & linefeed: winbabbies confuse so easily
>>
File: wedding-horse-carriage-609678.jpg (57KB, 600x400px) Image search: [Google]
wedding-horse-carriage-609678.jpg
57KB, 600x400px
>>52661840

If you've already stolen the carriage, why would you return it?
>>
>>52661837
post niggresses you fucking faggot.
>>
File: output.webm (1MB, 1920x1200px) Image search: [Google]
output.webm
1MB, 1920x1200px
How do I fix screen tearing, /dpt/?

I don't want to move back to Windows. ;_;
>>
>>52660924
template <class T>
constexpr size_t bit_size()
{
return sizeof(T) * CHAR_BIT;
}
>>
http://strawpoll.me/6660009
best /dpt/ poll
>>
File: 900x900px-LL-cc2dddc2_image.jpg (85KB, 900x900px) Image search: [Google]
900x900px-LL-cc2dddc2_image.jpg
85KB, 900x900px
>>52661893

They are not programming related, though.
>>
>>52661840
>carriage return
Is that still a thing?
>>
>>52661949
windows still uses \r\n
>>
>>52661942
don't give a shit.
want to fap.
>>
>>52661949
Notepad thinks so.

Pretty much the only stuff I can actually read in Notepad anymore is text files I've made myself.
95% of any text files I come across just use \n
>>
>>52661479
is C++ and java required to learn c#?

I thought I could just dig in c# and learn it right off the bat
>>
>>52662032
>I thought I could just dig in c# and learn it right off the bat

You can.
>>
>>52662032
you can
>>
>>52661949
Actually what's really stupid is that they don't even follow their own rules, since \n on it's own should return the cursor to the beginning of the line without moving down.
If you open a text file with LF and no CF in notepad, it should only actually show the last line, the rest of the file should have been overwritten by each following line up until the end.
>>
>>52662039
>>52662044
Oh well that's a relief, any of you know any books or websites that can teach me c#?

I saw some stuff on Github that had alot of books on programming but sadly github is down atm
>>
>>52662068
>but sadly github is down atm
It werks for me
>>
When to use LINQ? Half of the answers to stack overflow questions about LINQ are "just use for each"
>>
>>52662068
was it this? http://learning.lafon.info/

also i liked head first c#, but then again it is the only book i've read on c#
>>
>>52661912
is it really that much of an issue ffs?
>>
>>52662056
> since \n on it's own should return the cursor to the beginning of the line without moving down.
Wrong way around. \r (CR) moves the cursor to the beginning of the line, \n (LF) moves it down a line.

But Notepad is a text editor, not a terminal emulator.
>>
File: 250px-VisualBasicLogo.gif (11KB, 250x118px) Image search: [Google]
250px-VisualBasicLogo.gif
11KB, 250x118px
MY NAME IS VISUAL BASIC, AND THIS IS A STICKUP. YOU WILL NOT FORGET ME. I AM ALSO A HIGH-LEVEL PROGRAMMING LANGUAGE.
>>
>>52662056
No, that's \r. \n should move down a line, with or without going to start of line.
>>
>>52662135
Dim ThisGuy As Single
>>
>>52662068

Apparently Head First C# is good.
>>
>>52662106
>>52662161
Head first looks informative, it's pretty long though so I might actually have to buy a paperback on amazon because I can't read too long on my monitor since it hurts my eyes after a while.
>>
>>52662244
reading anything in pdf format is shit
>>
>>52662281

Reading anything lengthy on the computer is terrible. When people bring their laptops into CS classes, that's how you can tell they aren't cut out for it.

Pencil & paper might be the world's greatest inventions.
>>
>>52661763

Encourage people to use a real compiler.
>>
>>52662387

Very funny, ruby.
>>
>>52662384
spoken like a true dropout.
>>
>>52662217
post some cute teen shit.
>>
File: 0553742212.jpg (2MB, 2448x3264px) Image search: [Google]
0553742212.jpg
2MB, 2448x3264px
>>52662457

Here u go fambly

>>52662443

I haven't dropped out. I've just noticed the further I get into CS, the fewer people there are cocking about on their laptops.

That shit really pisses me off. If you don't want to be in class, don't come.
>>
>>52662384

I have using my laptop to take notes in class... But that's mostly because my keyboard is failing, and the USB keyboard I have been using in its place is... rather noticeable. Fine for using my laptop in bed, but not so much in a classroom.
>>
>>52658863
#include <cstdio>
using namespace std;

int main()
{
bool fizz;
for(int i = 1; i <=100; i++)
{
fizz = false;
if((!(i%3==0)) && (!(i%5==0)))
{
printf("%i", i);
}
if(i%3==0)
{
fizz = true;
printf(" fizz");
}
if(i%5==0)
{
if(!fizz)
{
printf(" ");
}
printf("buzz");
}
if(i<100)
{
printf(", ");
}
else
{
printf(". ");
}
}
return 0;
}
i only know C++, but will this compile in C? can someone give me a quick rundown on what i need to know to write C coming from C++?
>>
>>52662495
Dropout confirmed. As expected of a niggerlover.
>>
>>52662387
Also, hi Ruby!
>>
>>52662564
>Dropout confirmed

Sure thing, cochise. whatever makes you feel better.
>>
>>52662495
What's her name? also where the hell do you find all these nice booty black females?
>>
>>52662384
saw some dude in my math lecture taking notes on his laptop, was almost funny watching him try and type algebraic expressions
>>
>>52662563
http://people.cs.uchicago.edu/~iancooke/osstuff/ccc.html
>>
Are there any online classes that teach c# ? like code academy or ruby on rails for example, I like books and all but I feel like a class will help me more.
>>
>>52662613
La'quisha. I find them at the zoo.
>>
>>52662654
>! are removed from names now
Absolutely no fun allowed. Fuck you, hiroshima.
>>
>>52662654
lmfao
>>
>>52662649
https://www.youtube.com/playlist?list=PL0EE421AE8BCEBA4A
>>
>>52662068
https://wiki.installgentoo.com/index.php/Programming_resources

or learn straight from microsoft, it's pretty informative but dry:
https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx
>>
is GCC's download website a troll? i remember it took me ages to download it last time and now i need to download it on my virtual machine and it's sending me in circles
>>
>>52662613
>What's her name?

No idea.

> where the hell do you find all these nice booty black females?

I wish I knew, because then I'd have an irl nigfu.
>>
File: 0FdG9uP.png (272KB, 500x431px) Image search: [Google]
0FdG9uP.png
272KB, 500x431px
>>52662748
Embarrassing
>>
>>52662739
git clone https://gcc.gnu.org/git/gcc.git
>>
>>52662739
apt-get install build-essential
apt-get install gcc

:/
>>
>>52662758
How to computer? T_T
>>
C++ still blows my mind sometimes. It feels wrong that I'm allowed to do something like this to change a char in a string:

std::string foo = 'dog';
char *c = &foo.at(0);
*c = 'b';


I'm starting to get some kind of feel for pointers, but it didn't occur to me that I could get a pointer of a return value and have that point to the actual variable in the class.
>>
>>52662704
>2010

Isn't this outdated ? I thought there is a 2015 version of c#

If I learn the 2010 version will I be set ?
>>
>>52662832
>I'm starting to get some kind of feel for pointers

They're pointy. This would probably be a good time to learn about references.
>>
>>52662832
The doc explicitly says that you get a reference to the character:
http://www.cplusplus.com/reference/string/string/at/
>>
>>52662840
new features may be available in the 2015 version but the information in those videos will still be valid they wouldn't want to break backwards compatibility
>>
>>52662773
>>52662778
i figured it out. i wasn't the root
>>
>>52662873
He is confused because he doesn't grasp the concept that a = &b makes a point to the same data as b, and thus modifying the value pointed to by a also modifies the data as accessed under b intuitively.
>>
>>52662904
Remember, sudo will solve probably 70% of your errors on Linux
>>
>>52662915
I grasp it for variables and for passing parameters, but I didn't know it applied to return values as well.
>>
>>52662917
it wouldn't let me sudo tbph
>>
Finally got around to teaching myself JavaFx using some online tutorials and an ebook I pirated.
Swing just seems so uninspiring now.
>>
File: template-code.png (30KB, 845x558px) Image search: [Google]
template-code.png
30KB, 845x558px
Is it autistic to make sure that all of your divs 'n shit line up in the source code? Is it good coding practice, or does it not even matter really matter as long as it works?
>>
i wana be hackur man n tha nex bill gae how can I be ?

thank for help be careful ya hear?!
>>
>>52662974
It doesn't matter since all that shit gets gzipped before sending to the client anyways, and it doubly doesn't matter since a script can do it all for you.
>>
>>52662996
HOL UP
>>
>>52659938
What >>52660237 said. Google Ackermann function.
>>
I want to mess around with OpenCL, but clinfo can't find any devices.
>>
>>52663070
ruby is a cs grad student, i think he just wanted to wave his dick around
>>
>>52663143
nevermind I'm a fucking dumbass lol
the kernel module wasn't loaded
>>
>>52663176
>tripfag
>graduate
physically impossible.
>>
>>52661912
That doesn't look like screen tearing
>>
>>52661912
Stop using a meme WM
>>
>>52663201

It's true. Crazy, but true.
>>
>>52663206
Whatever it is it's triggering my autism.
>>
>>52663201

I am indeed a graduate student in computer science, Anon. And yes, I was waiving my dick around because someone brought up the Ackermann function in another thread, and I was wondering if any algorithms might exist with a runtime complexity of the Ackermann function.

... Except for maybe the Ackermann function itself, since it's recursive and feeds itself into its own recursive call.
>>
>>52663288
>lying to yourself this hard
>2016
Tripfags have become even more pathetic over the years.
>>
>>52663313
I honestly don't think it's that impressive that a good chunk of people on here probably have their masters.
>>
>>52663329
Sure, but nobody smart enough to not flunk high-school could possibly unironically be tripfagging. It's a scientific fact.
>>
>>52663392

I'm seeing it, boss.
>>
>>52660723
Add conditions so that
A < B
B < C

This will only work if the values are unique.
But I don't know SQL well, so there may be a better method.
>>
http://strawpoll.me/6660589

My apologize in advance if I neglected your favorite.
>>
>>52663329
i saw a dpt strawpoll a few months ago that indicated most people here are undergrads
consider also 90% of the homework that gets posted here is cs101 stuff, and the vast majority of threads on this board are programming-related, not cs-related
>>
>>52663556
>no D
You better be sorry
>>
>>52663288
what's a good book from which to learn ruby
>>
>>52663570

Why's poignant guide to Ruby.
>>
File: aww-board.png (138KB, 1152x758px) Image search: [Google]
aww-board.png
138KB, 1152x758px
Can anyone tell me if this idea will work? (pretty sure this idea already exists and i must have got it from somewhere, but honest, i thought i came up with this myself)

In this situation, 2 people exist. Both people have computed a priv/pub key-pair used to decrypt/encrypt messages. The 2 people know each other, thus, they both shared their pub key with each other.

So now, person A and person B have the following.
>their own private key
>their own public key (derived from priv key)
>the other person's pub key

person A wants to send a message to person B.

the idea is that person A encrypts the msg with his own priv key, takes the encrypted message, and encrypts that with person B's pub key.

person A sends the double layered msg to person B.

person B gets the message and starts decrypting the message. he takes his priv key and decrypts the encrypted message. he now gets person A's priv-key encrypted message and used person A's pub key to decrypt the message. volia, the message is decrypted and person B can read it.


is this idea good? is there any vectors a person can use to hack or otherwise compromise this system?


picture related, it should explain better.
>>
>>52663610
isn't that just PGP?
>>
>>52663649
I knew it. I knew this idea was too simple for someone to walk away from.

Yes, checking PGP on wikipedia shows a similar structure.

Oh well.

At least I now know how PGP works. Didn't understand it before.

Thanks anon.
>>
>>52663600
haha that is the last thing i thought you'd recommend
i started it but couldn't get past chapter 3, and i am in that book's target demographic (ie, stupid hipster)
the non-ruby bits were way too distracting, i wanted something that got down to business and plowed through the language
does it get better? is it worth it?
>>
>>52663718
Learn Ruby the Hard Way?
>>
>>52663724
that's the ticket, good looking out anon
would still like to hear from ruby
>>
>>52663752
Sure thing, anon.

Enjoy.
>>
>>52663718

95% of everything I know about Ruby comes from just programming Ruby and reading the documentation. The book just covers syntax, really. Everything else is just easiest done by writing it. Sometimes it helps to use the repl. Want to know all the things you can do on an array or string?
[].methods
"".methods
>>
>>52663826
>Everything else is just easiest done by writing it
very true
thanks for the input
>>
How do i resize an ncurses menu?
The only way I've found is
unpost_menu(menu);
set_menu_format(menu, new_y, new_x);
post_menu(menu);

But this loses my selection, I want to resize without losing selection, I know it can be done because htop and ncmpcpp don't have this problem.
>>
>>52663863

Anything weirdly complex that you aren't likely to use much unless you're writing a DSL or trying to intentionally break the language, like instance_eval or method_missing can generally have interesting descriptions on people's blogs, btw.
>>
>>52663937
do you have a link to such a blogpost?
>>
>>52663556
>other
DEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>C faggots have never heard of zero-cost abstraction
>>
>>52664103
Yes I have
>>
>>52663826
True. Ruby is a language you can learn almost accidentally.
>>
>tfw zero-cost "defensive programming" using Curry-Howard
>>
>>52663969

I do not have any bookmarked, so I'm not sure if there are any particular blogs I can recommend.
>>
File: Capture.jpg (65KB, 1278x567px) Image search: [Google]
Capture.jpg
65KB, 1278x567px
I'm a retard, and I don't understand the class in java. How do I pass this?
>>
>>52664377
>>tfw
What is the feel?
>>
>>52663610
Hey, if you came up with this yourself you're probably pretty smart. Congrats :)
>>
>>52663649
> isn't that just PGP?
Sort of. Except:

a) the sender only encrypts with the recipient's public key; the sender's keys don't come into it (the sender doesn't even need to have their own key).

b) you don't encrypt entire messages with asymmetric ciphers (they're too slow). You generate a random key for a symmetric cipher such as AES, encrypt the message with AES, encrypt the AES key with the recipient's public key, and include the encrypted key with the message.
>>
>>52662563
>using
No, it won't compile. Hell, the compiler will probably complain about cstdio too.
>>
>>52662563
Removing
using namespace std;

Do
#include <stdio.h>
instead of <cstdio>
Every #include <cXXXX> in C++ is identical to #include <XXXX.h> in C.
Add
#include <stdbool.h>
because the bool type is not part of the C standard. That, or use "int/1/0" instead of "bool/true/false" (respectively).
It should work for C99 but if you're using an older version of C, you have to declare "int i" outside of the for:
int i;
for (i = 1; i <= 100; i++) ...
// instead of
for (int i = 1; i <= 100; i++) ...

You'll get compiler errors that will make this pretty clear.
>>
>>52664405
insert
public Dog() {

}

above your main method.

Basically it works like when you do
Dog dog = new Dog("Ruffy")


and if the constructor is like this
public class Dog {
String name;
public Dog(String name) {
this.name = name;
System.out.println("Created a dog named "+ name);
}
}


and it would print
Created a dog named Ruffy
>>
>>52660568
Try harder, kid.
>>
>>52664544
>the bool type is not part of the C standard
You don't know anything about C. Do your homework, then come back.
>>
>>52664544
>because the bool type is not part of the C standard
>what is _Bool
>>
File: 1426249403467.jpg (129KB, 1124x1024px) Image search: [Google]
1426249403467.jpg
129KB, 1124x1024px
>>52659442
>-1 now returns as 4294967295
real shmart senpai.
>>
>>52662563
that fizzbuzz is prettyyyyyyyyyyyyyyyyyyy autistic

for(int i=1;i<=100;++i){
if(i%15==0)printf("FizzBuzz");
else if(i%3==0)printf("Fizz");
else if(i%5==0)printf("Buzz");
else printf("%i", i);
}
>>
>>52664614
>>52664633
I'm not aware of the "bool" type existing without <stdbool.h>, and gcc seems to agree.
Do people actually write with "_Bool" in their code?
>>
>>52660663
>Also, some assembly languages are high-level languages.

See, this is why I should shoot myself in the balls before reading /g/. It would be a less painful experience.
>>
>>52664638
stdbool.h is standard, dummy.
It's a C99 feature.
>>
>>52664637
>not using braces
>int isn't unsigned
>using printf instead of puts
>not using spaces between operators

D-, see me after class.
>>
/!\ A L E R T /!\

New thread

>>52664670
>>52664670
>>52664670


/!\ A L E R T /!\
>>
>>52664658
Ya so I'm telling the kid to include it. What's the big deal? Why so fucking nit-picky?

>>52664649
LLVM is arguably very high-level.
However, this discussion is pointless. "high level" will always be subjective. You could even say that C "was" high level (comparatively), but now it is low level.
>>
>>52662636

This is slightly old, and assumes the user will be writing C89. Although a good C programmer should be able to work with C89 if necessary, it is ideal to be working in C11, or at least C99.

>>52662563

1. cstdio, cstdint, cstdlib, and other common C++ headers that start with 'c' do not exist in C. They are C++ wrappers around C headers that allow C functions to be used in the context of a C++ namespace. In C, these files are stdio.h, stdint.h, stdlib.h, etc... This applies even for many headers that do not have "std" in the name. For example, C's time.h is ctime in C++.

2. C doesn't have namespaces... at all. So none of that "using namespace ..." crap. Also, as a side note, C does not allow for function overloading, and pretty much every C compiler will not perform name mangling. Calling a C function from within C++ actually requires that the function be declared extern "C" in the C++ header file.

3. bool... is a data type only in C99 and C11... in a header called stdbool.h. It is a typedef for another C99/C11 type called _Bool. If you want to use the bool data type in C, it is required that you include this header. Otherwise, it is common for C programmers to use int for boolean values. 0 is false, 1 is true. Many C functions may return int to indicate failure. 0 is success, anything else is failure (and may indicate how it failed).

4. Should you ever find yourself writing C89 (also known as ANSI C), be aware that you can't declare variables inside for loops there. C99 and C11 are cool with the C++ way of doing things, however. This is one way in which C++ has influenced C.
>>
>>52664676
Thanks for re-hashing literally everything I said but just a little more specific
>>
>>52663559
Because competent programmers don't post their homework here.
The only time I post any of my work here is as a last resort for when nothing on Google is working.
The solution is more often than not derived from the debugger.
>>
>>52664649
http://blog.erratasec.com/2015/03/x86-is-high-level-language.html
>>
NEW THREAD

>>52664756
>>52664756
>>52664756
>>52664756
>>
>>52664766
faggot
>>
>>52659330
The mathematical definition is

|x| = sqrt(x2).

Would be then

abs :: Num a => a -> a
abs x = sqrt x^2
>>
>>52664566
>>52664405
Do not ever include print statements in a constructor though.
>>
>>52661553
I know several mathematicians who do it so inefficient. It's because in math you just define things without respect to the real world, it's even considered stupid to think about efficient implementation of something because that would be not elegant.
>>
>>52664829
Your haskell doesn't work, not even remotely.
>>
>>52665113
Well, it would work. Just the result wouldn't be exactly what is intended.
>>
Hey guys, I need help.
In Node, how do you store user inputs into a variable?
>>
>>52665142
No, you're right. It wouldn't work. :(
>>
>>52660305
I always go solo queue.
>>
Anyone have any idea why a program on someone elses machine would do math differently to mine?

The framework .NET 4.5.2.

I cannot for the life of me figure it out.
>>
>>52665326
what math?
>>
>>52665400
Floating point.

3.55*9.5*1.4=47.215

but the result the other machine is getting is 80.47
>>
>>52664838
literally why not
>>
>>52663556
Haskell
>>
>>52660439
No type in C is constant.
Every type's size is defined in terms of multiples of sizeof(char). It's hard coded that sizeof(char) always returns 1, but how big char actually is varies from platform to platform. A long time ago it was almost always 2 bytes, nowadays I think it's usually four or eight.
Thread posts: 333
Thread images: 33


[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.