[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: 316
Thread images: 36

File: 1485438720022.png (423KB, 720x720px) Image search: [Google]
1485438720022.png
423KB, 720x720px
Old thread: >>59131250

What are you working on, /g/?
>>
decompiling gentoo linux
>>
>>59136365
>an honest mistake
Let's wait for C defense force's official response

"LUL U MADE A MISTAKE U CAN'T EVEN HANDLE C XDXDXDDDD THOSE SECURITY BUGS ARE FROM PEOPLE JUST LIKE YOU :DDD"
>>
>>59136377
I asked in the last thread, I will ask here in the hopes that someone will answer. If someone could kindly tell me where I might find the netbeans for java in pdf form, I would greatly appreciate it.
>>
>>59136377
setting up visual studio to remotely connect to gdb in a VM.
still have no idea what i'm doing really.
>>
>>59136437
Textbook, I should say.
>>
>>59136415
>>59136454
>>
>>59136437
ask netbeans forums
>>
>>59136437
>tell me where I might find the netbeans for java in pdf form
>pedofile form
No thanks.
>>
>>59136472
>holding on to old and deprecated retro trash
'c' users, everyone

And no, C compilers don't check for many preventable errors
>>
>>59136530
There's a lot of errors that can't be detected easily, but undefined macros or identifiers are trivial to detect.
>>
>>59136530
Did a C programmer cuck you, or something?
Why are you so salty?
>>
>>59136559
C stands for cucks
>>
>>59136559
He's been samefagging for quite some time now. It's rather entertaining to be honest.
>>
File: 1456007784488.gif (18KB, 340x340px) Image search: [Google]
1456007784488.gif
18KB, 340x340px
>>59136567
So you were cucked by a C programmer, then?
C stands for Cuckolder, apparently.
>>
File: 1414446262996.png (109KB, 456x356px) Image search: [Google]
1414446262996.png
109KB, 456x356px
this is you

https://www.youtube.com/watch?v=hk9SYguokjE
>>
>>59136593
C also stands for communism, so it makes sense if C means Cucks
>>
>want to order pizza online
>can't go online without using an operating system written in C
>tfw the Cnet wants me to starve
>>
>>59136638
Whatever you say, you literal cuck.
>>
File: 16939404.jpg (51KB, 480x689px) Image search: [Google]
16939404.jpg
51KB, 480x689px
>>59136654
>c.uck
I'm not
>>
>>59136642
I browse /g/ with my Lisp Machine.
>>
>>59136642
Jokes on you I use Redox.
>>
Okay so can you anti-C shills explain why this isn't a good way to average two integers?

long double average(const signed long long a, const signed long long b)
{
register const auto long double c = a + b;
return c / 2.0;
}
>>
>>59136741
>const signed long long a, const signed long long b
God I hate C
>>
learning how to use PostGIS to make a routing network, and how to add new nodes to it and connect them as the user wishes. so far i can only make it work by recompiling the whole topology, but maybe that is necessary.

after that i need to write a python wrapper class for it so it can be automated for some guy's thesis
>>
>>59136758
>God I'm retarded
We knew ;)
>>
>>59136770
If I was retarded I'd still use C(ancer)
>>
>>59136741
it should return an integer you long double nigger
>>
>>59136741
>register
>auto
>Two storage class specifiers
That's not valid.
Also, a + b overflows on LLONG_MAX + 1.

Since you stupid faggots are STILL posting your dumb integer average meme, I'm going to post my solution yet again:
/**
* Averages an array of integers.
*
* Averages an array of integers, without overflow or conversion to a larger type.
* It is equivalent to the sum of the array, divided by the array's length (rounded towards zero).
*
* @param n Number of array elements. Must be greater than zero.
* @param arr A pointer to an array of n integers. Must be non-null.
* @return The mean of the array's elements.
*/
int iavg(int n, const int arr[static const n])
{
int avg = 0;

/* A buffer of values that are lost to integer truncation.
* It should always be in the closed interval (-n, n).
*/
int error = 0;

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int loss = arr[i] % n;

// error + loss >= n
if (error > 0 && loss > 0 && error >= n - loss) {
// error = (error + loss) - n
error -= n - loss;
++avg;

// error + loss <= -n
} else if (error < 0 && loss < 0 && error <= -n - loss) {
// error = (error + loss) + n
error += n + loss;
--avg;

} else {
error += loss;
}
}

// Fix some overcompensation for error

if (avg < 0 && error > 0)
++avg;
else if (avg > 0 && error < 0)
--avg;

return avg;
}
>>
File: 502-34.jpg (17KB, 480x360px) Image search: [Google]
502-34.jpg
17KB, 480x360px
>>59136804
>(((C))) productivity
>>
>>59136848
>Posters
You're even changing the way you write C to make it more obvious :^)
>>
>>59136848
It's an averaging function that works on an array of fixed-width integers, and only works within that domain.
There is nothing inherently "C" about it. This is close to the solution you would use in any imperative language, you stupid cuck.
>>
test


for(int i = 0; i < Vagina.Lengthl i++)
{
vagina[i]++;
m += 2*i;
}

Class Nigger{

public Nigger(int j)
{


}
}

>>
>>59136906
QUALITY SOFTWARE
>>
>>59136804
Fixed :^)
signed long long average(signed long long a, signed long long b) 
{
long double c;
if(a < (LLONG_MAX / 2) && b < (LLONG_MAX / 2) {
c = a + b;
c = c / 2;
if((c - (signed long long)c) >= 0.5) {
return((signed long long)(c + 1));
else return((signed long long)c);
} else fputs("kys", stderr);
return 0;
}
>>
>>59136906
THAT WAS GNU QUALITY!
>>
File: java paje.jpg (127KB, 600x894px) Image search: [Google]
java paje.jpg
127KB, 600x894px
java or c#
>>
>>59136969
java is more portable compared to c#.
Also fuck microsoft.
>>
>>59136991
Remember when Microsoft was good?
>>
>>59137001
When?
>>
File: 1485633675312.png (28KB, 470x241px) Image search: [Google]
1485633675312.png
28KB, 470x241px
>>59136969
>>
File: Bill_Gates_Letter_to_Hobbyists.jpg (339KB, 1024x1325px) Image search: [Google]
Bill_Gates_Letter_to_Hobbyists.jpg
339KB, 1024x1325px
>>59137009

Around this time
>>
>>59136804
I started C a week ago and I find this function pretty cool. thanks for sharing anon
>>
Wait, does QT's connect function require the Q_OBJECT macro to work? Is there any way to create a button with a callback in a local function scope?
>>
>>59137122
Because QT devs suck.
>>
was Bill Gates a good programmer?
>>
>>59137138
Forget Gates. Program in Lisp.
>>
>>59137138
No, he was a good business man
>>
How are you supposed to choose your own base and prime numbers for modulo operations for the Rabin Karp string matching algorithm? Should I use base 127 (because of ASCII, is this wrong?) and prime q:

PS MY ALGO ONLY WORKS WHEN I USE BASE = 26 (size of alphabet), PRIME = 17, AND when I shift the ascii char values with -96, so a = 1, b=2. c =3...z=26. I dont want this!

my algo:
 

//precompute hash of first window and pattern
for (int i = 0; i < patternWidth; i++)
{
uint windowChar= Text2[i] - 96; //note the shifting with -96. I dont want that
uint patternChar = pattern1[i] - 96;

//current window in text
textHash = (textHash * _base + windowChar) % prime;
patternHash = (_base * patternHash + patternChar ) % prime;
}

//do the rolling hashes with window sliding
for (int i = 1; i <= Text2.Length - patternWidth; i++)
{
uint nextChar = Text[i + patternWidth- 1]; //apend new char
uint oldChar = Text[i - 1]; //'throw' away this one
textHash = (textHash * _base + nextChar - oldChar * Math.Pow(26, patternWidth) % prime;

if (patternHash == textHash) //if hashes are equal, do a string comparison to be sure
{
if (CompareStrings(pattern1, Text2, i))
hits.Add(i);
}
}
>>
Daily Reminder

OOP is better than functional programming

Java is better than Lisp and Haskell
>>
>>59137222
You're funny.
>>
>>59137222
t. pajeet
>>
>>59136930
>>59136804
#include <iostream>
#include <algorithm>

template <typename T, std::size_t N>
constexpr std::size_t countof(const T(&)[N]) noexcept
{
return N;
}

template <class T>
std::size_t countof(const T& container)
{
return container.size();
}

template <class T, class Iterable>
T average(const Iterable& iterable)
{
return std::accumulate(
std::begin(iterable), std::end(iterable),T())/countof(iterable);
}

int main()
{
auto numbers = { 1, 2 };
std::cout << average<double>(numbers) << std::endl;
}
>>
>>59137222
>Haskell
>not the industry-proven OCaml
pleb
>>
>>59137246
"OOP".reverse()
>>
>>59137222
>>>/r/eddit
>>
>>59137249
>15 mins of building all this templated shit later
Also I'm still mad about how templates don't allow for any kind of auto-completion.
>>
>>59136969
literally java

C# is literally a cargo cult design where they've imitated java and altered it without understanding it. it's literally a pajeet'd java.
>>
>>59137267
Nothing Found
>>
>>59137274
is this real life?

people on /dpt/ actually defending java and thinking Java is better than a language?
>>
>>59137291
kys ms shill
>>
>>59137296
is shilling ms any worse than shilling orcl though?
>>
>>59137291
Only redditors would defend languages like C# and Java.
>>
averaging two ints in C is actually a good interview question

a smart person should be able to deduce the solution
>>
>>59137306
unemployment would skyrocket
>>
Lets Solve this once and for all

http://www.strawpoll.me/12426079
>>
>>59137013
this
>>
>>59137326
You forgot the 'neither' option.
>>
>>59137306
it's simply impossible
>>
>>59137326
>implying /g/s opinion is worth shit
>>
>>59137351
and the both
>>
>>59137326
>>59137357
samefag butthurt microcuck
>>
>>59137361
And the "don't know".
>>
>>59137365
And the "can you repeat the question"
>>
>>59137405
"I'd like to phone a friend"
>>
>>59137326
>>59137357
>>59137361
>>59137364
>>59137365
>>59137405
alright I tallied up the results

6 for Java
6 for C#

Confirmed /dpt/ cannot agree on anything and just shit on any language for no reason at all
>>
File: sheldonbubinga_zpse0057a96.jpg (48KB, 1024x610px) Image search: [Google]
sheldonbubinga_zpse0057a96.jpg
48KB, 1024x610px
>>59137405
>>
>>59137428
>alright I tallied up the results
lmao micros**t is getting desperate
>>
>>59137364
Wrong again, shit for brains.
>>
>>59137417
"I'd like to use 50/50, Chris"
>>
>>59137449
sure sure hahaha
>>
>>59137249
>average<double>
Nice try.
>>
>>59137446
There is literally nothing wrong with Microsoft
>>
>>59137428
>ask /b/ to vote java
>they all vote C#
>epin
>>
>tfw #c
the C people are extremely ill, they must have serious self esteem issues and suffer from anxiety for some reason.
>>
>>59136377
hey "elite" fizzbuzzers, how have you been?

I've got a question for you:
how do I learn to love programming?
>>
File: 1484699914718.jpg (993KB, 1182x1581px) Image search: [Google]
1484699914718.jpg
993KB, 1182x1581px
>>59137475
Sure thing goyim
>>
>>59137561
program in C#
>>
>>59137572
I fucking hate having to use an IDE (under Windows, no less) to have a good experience programming stuff. also, C# is OOP, and mostly for Windows. so, fuck it

I like Go, though, which reminds me...

>>59136377
Learn Go: https://tour.golang.org
>>
>>59137561
either you have it or you don't. you're born with autism.
>>
File: 1487638432167.png (347KB, 454x600px) Image search: [Google]
1487638432167.png
347KB, 454x600px
>>59137604
>Go
>>
>>59137604
IDES are the only way to properly program though nowadays you should try Windows
>>
>>59137607
>le nature argument
kys

actually, java (with its retarded error messages, and useless IDEs) made me hate programming a bit

>>59137561
is "The Practice of Programming" a good book?
>>
Go is nice
Rust is nicer
>>
>>59137662
C is the nicest
>>
>>59137658
Java has really well exception handling what are you talking about?

Netbeans and Eclipse are actually pretty good IDES
>>
>>59137626
I really, really, really like this image!
>>
>>59137684
>C
C stands for cancer and it needs to die
>>
>>59137690
>really well exception handling
Nice English, Pajeet.
Also
>Checked exceptions
>Good
>>
>>59137690
>really well exception handling
oh nvm, I see what's happening here
later pals
>>
>>59137684
C is inherently TRASH
>>
>>59137662
>let me talk about these two unrelated things because I'm a dumbass
>>
>>59137720
well, that's what happens when you don't collect your garbage
>>
>>59137690
this was with java 1.4, some 10+ years ago, when I was being taught programming for the 1st time. the errors messages seemde really cryptic and retarded, and the IDEs were shit because they used LOTS of resources (still do... we have better machines now, though)

>>59137728
he didn't say they were related, wtf are you talking about m8...

I actually want to learn Rust, but I still see it as a ever changing mess. is it?
>>
this thread is just garbage i'm literally closing this tab don't even bother with the (You)

and freaking watch this >>59136627 so you might learn how not to sperg out too much
>>
>>59137713
>>59137720
Calm down, cuckboy. I know you're upset about your "girlfriend" but you don't need to bring your bitterness here.
>>
>>59137750
Nice reddit formatting, faggot.
>>
>>59137746
He compared them by saying one is nicer than the other. Still fail to see how that implies a relation?
>>
>>59137757
The difference is, a C toddler remains kissless virgins
>>
>>59137768
>relation
in regards to what?
>>
>>59137767
not him, but is formatting for readability a reddit quality now?
i can't keep up anymore senpai, i'm too old and drunk
>>
>>59137772
>Fucks your girlfreind
>Is a kissless virgin
Whatever helps you sleep at night, buddy.
>>
>>59137757
C stands for cucks
>>
>>59137790
See >>59136593
>>
>>59137785
>Fucks your girlfreind
Your anime fantasy does not count
>>
>>59137798
see>>59136638
>>
>>59137784
It's just the same guy posting over and over again. For some reason, he's decided that double line spacing means you're from reddit.
>>
>>59137823
It's also the lack of capital letters, punctuation and overall structure.
They're fucking illiterate and are shitting the place up.
>>
>>59137844
woah watch out guys we got a grammar nazi here.

post your fizzbuzz in C89 as quickly as possible
>>
>>59136627
>>59137750
better watch this: https://www.youtube.com/watch?v=csyL9EC0S0c
>>
File: 1484944738532.jpg (35KB, 500x375px) Image search: [Google]
1484944738532.jpg
35KB, 500x375px
>>59137881
But is he a context-free grammar Nazi?
>>
>>59137653
>IDES are the only way to properly program though nowadays you should try Windows

tfw I talk to my old professor about how I hate in Java I have to write System.print.ln() where instead I could just write printf or cout.
tfw he says well eclipse will automatically fill that out for you anyways
mfw i created this problem myself because i use a text editor.
>>
>>59137844
You just started a sentence with a pronoun, you silly Nazi.
>>
>>59137907

public static void puts(Object args) {
System.out.println(args);
}


Anon..
>>
>>59137925
Oh shit so did you
wtf is going on in here
>>
>>59137925

You do know that's fine, right?
>>
File: 1483777020915.webm (687KB, 979x835px) Image search: [Google]
1483777020915.webm
687KB, 979x835px
>>59136377
Still this. Gotta add scrolling through quotelinks and nested quote expansion next and it will be more or less done I suppose.
>>
>>59137953
There has been an influx of retards today, with the 'C toddlers' guy leading the charge.
>>
>>59137907
are you serious? You are seriously complaining System.out.println();?

First of all that isn't even a big deal

Second you can use keyword shortcuts in both IDES

third of all you have the option to have IDES do it automatically for you
>>
>>59137974
Why wouldn't I call you a toddler if can't even write a proper and bug free hello world?
>>
>>59137989
you* can't
>>
>>59137941
welp
>>59137988
its a small complaint, I actually like Java. And you and I are making the same point.
>>
> Microsoft Research developing an AI to put coders out of a job

Driving a car by yourself and letting others drive your car for you are different things.
People that program for the money got BTFO while people that genuinely love programming are unaffected.
>>
ArrayList<Coordinate> ar = new ArrayList<>();
ar.add(new Coordinate(1,1));

ar.contains(new Coordinate(1,1)) //returns false

Why /g/? In C++ it would work.
>>
>>59137974
There are a few C tards I respect ITT though. Ruby and akariBBS anon are nice people
>>
>>59138097
Someone forgot to define an 'equals' method. Default equality is by reference ID, which is unique per 'new' call.
>>
>>59138085
It can only write 5-line programs. It writing anything non-trivial is not computationally feasible.
>>
>>59138085
>>59138085
Ever seen computer-generated code? It's unreadable, unmaintainable, and bug ridden.

I'm not worried about it for another 20-30 years.
>>
>>59138117
Equals method:
    public boolean equals(Coordinate e) {
return (x == e.x && y == e.y);
}


I think Java ArrayList only uses the .equals method from the Object class. Even typecasting to Coordinate didn't help.
>>
https://www.youtube.com/watch?v=EJWSRKyCGQA
>>
>>59138153
oh my god
>>
>>59138153
>C pajeets
>>
Hey, can any Javatards help me out with a basic Prime number script? I've got the algorithm for defining prime numbers correct but I can't get the output to say "The prime numbers are: x y z."

Here's the code:

import java.util.Scanner;

public class Prime {

public static void main (String[] args){
System.out.println("Enter a number greater than 2:");
Scanner userinput = new Scanner(System.in);
int prime = userinput.nextInt();

for(int i=2; i<=prime; i++){
boolean primenumber = true;

for(int n=2; n<i;n++){
if(i%n==0){
primenumber = false;
break;
}
}
if(primenumber)
System.out.println("The prime numbers from 2 to " + prime + " are " + i);
}



}

}

Output:

Enter a number greater than 2:
17
The prime numbers from 2 to 17 are 2
The prime numbers from 2 to 17 are 3
The prime numbers from 2 to 17 are 5
The prime numbers from 2 to 17 are 7
The prime numbers from 2 to 17 are 11
The prime numbers from 2 to 17 are 13
The prime numbers from 2 to 17 are 17

How do I get it to stop repeating itself like this?
>>
File: homu_posting_on_a.png (69KB, 386x398px) Image search: [Google]
homu_posting_on_a.png
69KB, 386x398px
>>59138085
>while people that genuinely love programming are unaffected.
>>
File: Volumetric shader balls.gif (4MB, 503x301px) Image search: [Google]
Volumetric shader balls.gif
4MB, 503x301px
So I'm working on precomputing a FBM noise table so a shader can look it up at a later date, and I have to ask; what would be my best bet for actually storing the data?
I'm using Unity, which uses HLSL / Cg. What would be my best bet for storing the data in a way that will take up as little space as possible, while mantaining compatability on less than state-of-the-art machines? I know that compute buffers are a thing but afaik they can't be used by hardware that's even remotely older. 3D textures are horribly laggy in general when it comes to tile sampling, and they can only have a depth of 512 which is sub-ideal.
>>
>>59138153
>>59138172
>>59138182
wtf I love C now
https://www.youtube.com/watch?v=__JKmT5EFb8
>>
Am I doing minesweep right?
void MineSweepState::play_at(int x, int y)
{
std::queue<std::pair<int,int>> playQueue;
auto queueInsert = [&playQueue,this](int i, int j) {
if (!revealedTile(i,j)) {
reveal(i,j);
playQueue.push(std::make_pair(i,j));
}
};
std::pair<int,int> currentpair;
queueInsert(x,y);
while (!playQueue.empty()) {
currentpair = playQueue.front();
playQueue.pop();
x = currentpair.first;
y = currentpair.second;
if (0 == danger_at(x,y)) {
queueInsert(x+1,y);
queueInsert(x-1,y);
queueInsert(x,y+1);
queueInsert(x,y-1);
}
}
}
>>
>>59138147
>Equals method
static public void main(String[] args){
Integer a, b;
b=5454;
a=5454;
System.out.println(a==b);
}
>>
What editor is he using?
https://www.youtube.com/watch?v=5UnPqRP236s
>>
>>59138153
I actually don't see anything wrong with that
Then again I also don't program in C
>>
Indians make the best Software Engineers they help wrote Linux distributions
>>
How do I make this more functional? less assignment operators? this is what happens when you read the first page of sicp and think your pro

string = "The quick brown fox jumps over the lazy dog"

def iterate_string_on_space(string):
return string.split()

def count_words(array):
wordcount = {}
for word in array:
wordcount[word.lower()] = wordcount.get(word,0) + 1
return wordcount

def count_length_of_words_that_arnt_the(array):
word_len_count = {}
for word in array:
if word.lower() != 'the':
word_len_count[word.lower()] = word_len_count.get(word,len(word))
return word_len_count


def main():
print("Word Count:",count_words(iterate_string_on_space(string)))
print()
print("Word Length Count:", count_length_of_words_that_arnt_the(iterate_string_on_space(string)))


if __name__ == '__main__':
main()
>>
>>59138264
Indians make the best C programmers
>>
>>59138244
Looks like the Borland Turbo C++ editor. Not sure why they use that in India, it's totally deprecated and non-conforming (note conio.h and void main()). I don't see why they don't just use GCC, it's free, runs on virtually anything post 1995, and conforms to all C standards, while Borland Turbo C++ doesn't even pretend to conform to any standard and is so outdated I'm pretty sure you need a DOS VM to run it in. Either that or ACTUAL DOS - and I find it hard to believe that running DOS to teach programming makes any kind of sense to anyone.
>>
>>59138196
>Hey, can any Javatards help me out with a basic Prime number script? I've got the algorithm for defining prime numbers correct but I can't get the output to say "The prime numbers are: x y z."
>Javatards
isn't that an insult? aren't you too much of a noob to start insulting people already?
>>
>>59138284
Use map and filter instead. Then try using a list comprehension.
>>
File: iverson_team.jpg (313KB, 951x509px) Image search: [Google]
iverson_team.jpg
313KB, 951x509px
>mfw I experinced the power of J right now
It's very underrated, to be honest.
>>
>>59138332
I was going to help him until he insulted me for using Java so I don't feel like helping him
>>
>>59138261
Main issue is that they use conio.h which is deprecated. It's still provided in MinGW, but was basically a DOS thing from the Borland days, and isn't generally available in Unix. And the fact that it took 9 minutes to explain such a simple thing.
>>
>>59138366
Well I mean it appears to be an intro to what chars are and how they are effectively integers. That's an intro to programming video, right?

I can fault pajeets for many things but for actually attempting to understand data types I cannot
>>
https://www.youtube.com/watch?v=RFR_eBXK3p0
Post programming music
>>
>>59138224
Just because you're writing C++ doesn't mean you're obliged to make it hard to look at
>>
Good /compsci/ books to read?
>>
File: test (2).png (716KB, 811x599px) Image search: [Google]
test (2).png
716KB, 811x599px
>>59138436
>>
>>59138244
Patrician

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main(void)
{
clrscr();
system("echo Hello world");
getch();
}
>>
>>59138147
>I think Java ArrayList only uses the .equals method from the Object class.
Wrong signature on that method; Java has method overloading by argument type. Needs an equals(Object) method (but that can typecheck and hand off to your equals(Coordinate) method; that'd be good practice).

Advice: make sure you add @Overrides to that method, since it'll tell the compiler to tell you when you fuck up this way.
>>
>>59138451
The first two headers are superflous.
>>
>>59138224
Make it insert diagonally adjacent points too. Otherwise it will miss a few cases.
>>
Which Standard ML implementation should I use?
>>
>>59138414
bakalava bls
>>
Find the transitive closure of

1 0 1
0 1 0
1 1 0
>>
>>59138436
Applied Cryptography 2e

Structure and Interpretation of Computer Programs

Read any textbook about discrete structures, like "Discrete Structures and their Applications" by Kenneth Rosen
>>
I routinely see people shit on C++ references, saying they were supposed to be non-nullable pointers, but somehow failed at that purpose.

Anyone care explaining more in depth what did they mean by that? What's wrong with references in C++?
>>
>>59138239
Try doing that with two objects
>>
>>59138718
>Find the transitive closure of a graph with no connections
no
>>
>>59138768
It's possible to return a reference to something that no longer exists in C++

int& dead_int() {
//variable will no longer exist after function returns
int x = 0;

return x;
}
>>
>>59138328
Many non-english speaking countries have poor cs programs because cs books are written in english first and take years to get translated into their native languages. My friend is Ukranian and says that the only languages they teach in his university (or have books for) are delphi and some russian banking software language, so he came to the USA to study
>>
>>59138747
I have a background from Electrical Engineering. I know jackshit about discrete maths. Can you recommend a good discrete math book to read before I get into these books or is jumping straight in fine?
>>
>>59138819
>HUR DUR I CAN DO STUPID FUCKING THINGS THEREFORE THE LANGUAGE IS SHIT.
Jesus christ, perhaps stop returning references to stack objects maybe?
>>
>>59138952
lmao, that anon was just giving the answer, he didn't say about sepples being shit.
Don't be autistic.
>>
>>59138933
Don't be a nigger and pick things about group theory and arithmetic (Jean Pierre Serre A course in arithmetic for example). You probably won't get anything at start and that's good, you can gradually go to a decent understanding of mathematics this way.
>>
OOP is a meme.
>>
>>59138952
I was just showing that it was possible to answer a question anon
>>
>>59138970
>>59138986
The "answer" is shit and doesn't answer literally anything.
>>
>>59138815
it's a binary matrix. The relation is:

{(1,1), (1,3), (2,2), (3,1), (3,2)}
>>
>>59138999

I answered the original anon's question, which was about null references. I didn't say anything about how good C++ is as a language. In-fact I actually love C++

Now stop being autistic and think about what you've done
>>
>>59138999
It answers the question that was asked. Q: "Why do C++ references fail the task of being non-nullable pointers?" A: "Because they are nullable; here is an example."

But please, keep being autistic. It makes me feel better about myself.
>>
>>59138819
Yeah and it's possible to point to areas of memory that basically never existed using linux system calls in any decent systems programming language using the brk and sbrk calls. Do you even know what the point of systems programming languages are?
>>
>>59138971
I know mathematics just fine. Everything up to triple differentiation and partial differentiation. I just don't know discrete maths which is an entirely different branch.
>>
>>59138768
I'd like references more if you could at least have them uninitialized in _init and only have to initialize them before any access at runtime. Right now you can't even create objects with references without having a billion of constructors overloaded for them.
>>
>>59139020
>I answered the original anon's question, which was about null references.
Nope, you didn't.
Do you think the underlying pointer is magically turned into a null when you returned that reference? no you fucking retard.
The reference is pointing to some arbitrary (invalid) location on the stack, it's not null. Therefore you didn't answer the question.

>>59139038
>here is an example
What example? if you're referring to >>59138819, he didn't null any reference. He just simply returned an invalid non-null reference.
>>
>>59138933
You can jump right into rosen.
>>
File: smug4.jpg (63KB, 447x400px) Image search: [Google]
smug4.jpg
63KB, 447x400px
>>59139042
>I know mathematics just fine
>I just don't know discrete maths
LMFOA YOU CAN'T MAKE THIS SHIT UP
>and they wonder why engineers are bullied and aren't taken seriously in any scientific context
Let me guess: you only know how to implement FFT and finite element method to solve separable linear PDFs but you have no idea how to prove theorems of existence and uniqueness, averages and min-max? What a fucking joke lmfao
>>
>>59139060
Ok fair point, it doesn't actually have to do with pointers set to null. I took nullable to mean "can point to undefined memory" which is technically incorrect, but what the original anon meant by his question.

The terminology is incorrect. Happy?
>>
>>59139080
I only know discrete math and I don't know calculus or other types of math this argument doesn't make any sense
>>
>>59139080
Did you miss the part where I said I was an electrical engineer? Lets pretend for a second you aren't a fucking moron. Do enlighten me what part of electrical engineering requires the use of discrete maths.
>>
>>59139093
>Happy?
I'm never happy.
>>
>>59138933
Those fields I mentioned ARE discrete math and having strong skills in them will make anything computing related trivial. If you are knowledgeable then you can pick any text and realize how much of a waste of time it is.
>>
>>59139115
So I can jump into those books right off?
Okay. Thanks for the recommendations familia
>>
Studying for discrete structures midterm. this class has only 2 grades: midterm and final. Worried about what may be on the test but I feel pretty confident about how much I've been studying, plus I'm allowed to print out as much as I want to use during the test, so I just printed half of the textbook
>>
File: solve (8).png (700KB, 1280x720px) Image search: [Google]
solve (8).png
700KB, 1280x720px
>>59139101
The argument is that his claim of "I know mathematics" is fucking bs when he doesn't even understand the mathematics required for his fucking job, let along discrete maths.
I'm surrounded by idiots. It's like my office hours last year all over again.
>>59139108
Reread the post dumbcunt lmao
>implying EE don't need to know a bit of control theory and logic gates
Confirmed dropout holy shit lmao this is pathetic
>>
Anyone mobile development in here?
Android?

Is it worth dedicating my time to
>>
>>59139140
You can still claim I know mathematics if you do not know one branch of mathematics. Your argument is invalid.
>>
>>59137222
>Java
Are you pretending to be retarded?
>>
>>59139148
There's plenty of work out there for mobile app developers
>>
>>59139158
The point is that he doesn't know any. Do you seriously not know how to read?
>The argument is that his claim of "I know mathematics" is fucking bs when he doesn't even understand the mathematics required for his fucking job, let along discrete maths.
>"I know mathematics" is fucking bs when he doesn't even understand the mathematics required for his fucking job
>>
>>59139148
Yes. Reminds me of Hacking Health camp last year, 3days hackathon and everyone wants to have very specific mobile apps for several platform instead of just one Web application that runs everywhere despite the short time. It's just the norm and it's probably not going away until you retire
>>
>>59139183
Now you are just being autistic and nitpicking.
I can only know linear algebra and say I know maths. Why do people like you exist?
>>
>>59139205
>gets called out and btfo for being unable to read
>"h-hurr yer autistic!!1!!"
Typical lmao
>>
>>59139219
>Lmao he doesn't know discrete maths
>He can't say he know maths unless he knows all forms of maths
Kill yourself retard. You have legit autism.
>>
>>59139223
>still can't read
Let me guess, homeschooled? LMAO
>>
>>59139183
I am sure if you study Electrical Engineering you need to know algebra which is one branch of mathematics and Discrete math is not needed for EE.Therefore, your argument is invalid.
>>
>>59139205
Um, no you can't. "Linear algebra" is a very wide subject that can go beyond Lie algebra and at this point you know much more than just "linear algebra". In math you can't really specialise hard until you reach close to the state of the art in your domain. I'm nnot trying to be elitist by pretending only research is real math, just mentioning progress needs to be homogeneous otherwise you're just messing around.
>>
>>59139235
So you don't know what math actually is.
>conflating symbol pushing and number crunching with math
>not a fucking idiot
>>
>>59139253
>So you don't know what math actually is.
Here we go
>>
>>59136377
Writing a twitch chat bot. Yeah, I know there are thousands already, but I couldn't think of anything else. Bettersuggestions are welcome.
>>
File: img_034.png (277KB, 416x406px) Image search: [Google]
img_034.png
277KB, 416x406px
>>59139267
>h-hurr n-no true scotsman1!!1
Am I wrong? Try reading Euclid's Element first, child.
>>
>>59139140
You must be fun to hang out with. Are you in academia because you lack the social skills for a real job?
>>
>>59139281
Lmao don't larp so hard literally no one does that
>>
>>59139253
The definition of mathematics

The study of numbers, equations, functions, and geometric shapes (see geometry) and their relationships. Some branches of mathematics are characterized by use of strict proofs based on axioms. Some of its major subdivisions are arithmetic, algebra, geometry, and calculus.

Your argument is still invalid btw
>>
File: solid_state_kyouju.jpg (116KB, 455x332px) Image search: [Google]
solid_state_kyouju.jpg
116KB, 455x332px
>>59139285
>projecting
It actually takes quite a bit of social flexibility to be in academia, since you need to go to all sorts of conferences and meetings and all.
Not that you'd know though.
>>
>>59136377
For one of my classes, I was instructed to write a program that used threads to perform matrix multiplication. That seemed too easy, so I tried to obfuscate it a bit. Pic related is the output.
from __future__ import print_function
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",{'end':''}
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(u'\u250F \u2513')
for i in c:
print(u'\u2503 ',**_)
for k in i:
print(str(k) + ",",**_)
print(u"\b \u2503")
print(u'\u2517 \u251B')
>>
>>59139281
Yup right on queue.
The next 100 post will be retards circlejerking over what maths really is. I remember we had this exact same shit when someone said programming wasn't maths about a week ago.
>>
>>59139295
I thought people who went into academia did so because they're narcissists and that way 30-100 people were forced to listen to them at a time. It's a great job if you've got delusions of grandeur

What do they say? Those who can't "do" teach?
>>
>>59139303
>programming not math
Well he wasn't wrong at least.
Even though I agree with the other guys regarding how far from mathematics math users are, he's displaying quite a great amount of sperging power
>>
File: 1487625602390.jpg (64KB, 780x780px) Image search: [Google]
1487625602390.jpg
64KB, 780x780px
>>59139297
>matrix operations in python
>>
>>59139297
Wtf this looks like shit. Not judging your code I don't do python but I more often heard it was supposed to look nice and elegant than... that
>>
File: tmp_752-1486942169611-793299164.jpg (193KB, 1300x1244px) Image search: [Google]
tmp_752-1486942169611-793299164.jpg
193KB, 1300x1244px
>they reinvent OOP in plain C when C++ exists
for purpose?
>>
>>59139329
You say that but a lot of scientific institutions use Python. I use Python for my work cause somehow despite Matrix operations being fucking retarded my field still uses Python as the de facto language of choice.
>>
>>59139341
cause the fucking retard isn't using tabs and indenting his code
>>
>>59139341
Nah, this is how all python code looks. In fact, this is some of the easier to understand python code.

>>59139329
I don't follow. I had to use threads, I didn't really feel like whipping out a lower level language for a simple programming assignment.
>>
>>59139313
Holy shit how clueless are you lmao? Poor little undergrad.
Also the "do" in that expression refers to research, not being a mindless codemonkey who doesn't even know basic discrete math.
>>
>>59139345
Yeah it's like your bringing the worst from Cpp. I'd love a C dialect with generics (but not the preprocessing insanity that templates behave like) and some function and operator overloading.
>>
>>59139368
>Nah, this is how all python code looks
>Using space over tabs
>Ever
>In any language
Fucking neck yourself and remove yourself from the pool before you teach anyone your retardation.
>>
>>59139383
I use spaces everywhere. Tabs are 4-width. I'm up for a fight.
>>
>>59139354
If you guys do a lot of matrix stuff, using C/C++, or even Java, would save you orders of magnitude of time.
>>
>>59139399
Fortran
>>
>>59139297
Use Terminix
>>
>>59139399
>not picking the superior FORTRAN2008
It's what it was designed for.
>>
File: ran_rape.png (156KB, 387x309px) Image search: [Google]
ran_rape.png
156KB, 387x309px
>>59139406
This. Fortran is fast af
>>
>>59139399
Yeah I want to too but ERIS and QGIS decided they want to use Python and guess which are the 2 best software to use in the market.
>>
>>59139370
>research
oh god you're one of those useless welfare monkey professors who has his TAs teach the course while he lives off of the government.

Get a job, dude.
>>
>>59139397
>I use spaces everywhere
There is no saving you heretic.
>>
>>59139383
I'm just jesting anon. I said in the original post I was trying to obfuscate it. Sorry you're butt-mad but next time read more carefully.
>>
>>59139297
Why make it unreadable when you could just hide the functionality under a big fat layer of pointless OOP, and everyone will pretend your solution is so elegant and shit?
>>
File: tips (2).png (49KB, 178x243px) Image search: [Google]
tips (2).png
49KB, 178x243px
>>59139431
>gets btfo and called out AGAIN for being an absolute mongrel
>projects almost immediately since he has no counterpoints
I'm gonna end this little spatfest in the next turn. Nothing personnel, kid.
>>
>>59139383
Always use spaces
If your editor can't convert tabs to spaces, then it's garbage
>>
>>59139472
>Using your editor as a crutch
>>
>>59139483
>wooooooooow he uses his editor to HELP him program?
>>
>>59139496
>Not programming on a piece of paper and then writing it on notepad and then compile it yourself
What are you? Some kind of scrub?
>>
>>59139496
Lmao ikr fucking madmen
>>
this probably doesn't belong here but maybe you guys can help

I'm trying to make a filter regex to filter out shitposting variations of Trump (drumpf, etc) without filtering the word Trump itself and without having to create seperate entries for every possible variation (there's a lot)

Here's what's in my filter:

/(t|d)rum(p|)(f|k|t)/i;stub:no;

But it seems to be blocking Trump as well

how fix?
>>
>>59139572
remove the t at the beginning?
>>
>>59139586
then it doesn't filter out "trumpkin" and variations

but it might be easier to just filter that seperately
>>
File: 1482317367521.png (2MB, 5000x5000px) Image search: [Google]
1482317367521.png
2MB, 5000x5000px
>>59139572
D R U M P F
R
U
M
P
F
>>
File: trump.png (1MB, 964x768px) Image search: [Google]
trump.png
1MB, 964x768px
>>59139586
>>59139572
>>59139606
>Drumpftard is too drumpftarded to write a proper regular expression
Why am I not surprised
>>
>>59136377
I did some HTML5 in college which didn't appeal to me in the slightest, but I want to do some programming as a hobby.
What's a good place to start learning, and what would be a good language?
Kinda wanna fuck around and make some utilities, or could even be more of a faggot and make game code desu
>>
>>59139631
>What's a good place to start learning, and what would be a good language?
Python. But that is my recommendation. You can learn C, C++, C# or even Java. I am sure people will recommend other shit but just pick any of the above languages. Do it for 2~3 hours for an entire week and then see if you want to continue doing programming.
>>
>>59139042
What about differential equations? Do you know anything about digital components?
>>
File: 1482202625842.jpg (60KB, 500x500px) Image search: [Google]
1482202625842.jpg
60KB, 500x500px
>>59139630
Republicans are not very bright people
>>
How long is your programming project /g/?
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 53 792 976 7263
C/C++ Header 51 329 651 1536
D 54 0 0 532
make 1 8 0 19
Bourne Shell 1 1 0 9
-------------------------------------------------------------------------------
SUM: 160 1130 1627 9359
-------------------------------------------------------------------------------

>>
>>59139297
>from __future__ import print_function

Just use Python 3 you filthy nigger
>>
File: 25.gif (2MB, 250x256px) Image search: [Google]
25.gif
2MB, 250x256px
Daily reminder why Rust will never be popular

> Rust is currently unable to call directly into a C++ library
>>
>>59139572
/(?!trump\b)rum(p|)(f|k|t)/
>>
>>59139681
Not even C++ itself is able to call directly into its library often times
>>
>>59139329
import numpy as np
>>
>>59139678
whatcha making
>>
the truest elite, that of /g/'s /dpt/, has spoken ITT

did someone tell you guys that you are the best amongst the best?
>>
>>59139850
decentralized internet tv system
github.com/Dako300/BasicTV
>>
File: languages3.png (17KB, 522x384px) Image search: [Google]
languages3.png
17KB, 522x384px
>>59139871
>>
>>59139631
I'm going to recommend you what I think is the most fun for beginners

Python. can start scripting and doing other cool stuff very early on, really easy syntax

C# in Visual Studio. the WPF app template is braindead easy to use and you can start making windows apps asap. Also have C++ to play with and learn real programming from

Java. if you want to use java
>>
>>59139901
exactly what I mean. you get my point.
truest elite of programming.
>>
File: dpt.png (742KB, 1920x1080px) Image search: [Google]
dpt.png
742KB, 1920x1080px
>>
it's library design decisions time!
should I put my initials in front of everything?

>kek::stuff::thing_class::function()
or just
>stuff::thing_class::function()
>>
>>59140066
Is anyone besides you going to use your library?
>>
>>59140066
what does this library do?
>>
Does anyone use Vim for D? I can't set up DCD, it's not working
>>
>>59140102
I do hope so.
no idea though

>>59140109
low-level hardware interfacing things on an obscure platform.
>>
>>59140145
vim only works with alive programming languages, sorry bro
>>
>>59140152
>low-level hardware interfacing things on an obscure platform.
could you be any more broad?
>>
>>59140152
>low-level hardware interfacing things on an obscure platform.

So C library interfacing with a outdated microprocessor? Yeah write your name all over it. Name it rude as well. The only chance of anyone using it is is in a university/college course.
>>
Guys im thinking of making a password manager thats portable and secure, but I don't really know where to go about looking for a modern secure encryption algorithm any ideas?

The goals is to make it light weight without the hassle of so many bullshit files included in certain repo's you see on git.

Just want one-two files. Sick of seeing shit on git which has like 20 files just for a fucking password manager
>>
>>59140154
Vim doesn't seem to work well with Java
>>
>>59140184
honestly that's the scope I'm aiming for.

>>59140197
I was hoping it would appeal mostly to hobbyists. also it's going to be c++14 without any external libs.
>>
>>59140227
>Hobbyists
>Obscure platform
?
>>
>>59140203
Don't. It is clear you don't have any idea how modern encryption works. All you are going to make is a password manager that is full of bugs that people are going to break within 10 minutes. Even better if it is portable.
>>
>>59140237
are you saying there are no hobbyists using obscure platforms?
>>
>>59140208
Java is undead
>>
File: 100 crack fist of chen.jpg (17KB, 325x221px) Image search: [Google]
100 crack fist of chen.jpg
17KB, 325x221px
>>59140257
>All you are going to make is a password manager that is full of bugs

How exactly can you spawn bugs from something which has very little logic? All you have to do is make one master password which acts as a key in some type of encryption algorithm to show your other plaintext passwords.

There is literally no bugs that can be spawned.

The only thing which is problematic is reverse engineering from a hex editor

>/g/ tells me to do something in my spare time so I wont become a worthless neet unemployed cuck

>decide to start something
>DONT DO IT
>>
>>59140237
that's some of the only people that ever do use obscure platforms
>>
>>59140339
Ignore the nayseighers do it anyways
>>
>>59140339
How is the plaintext passwords going to be stored and display? Have you thought of a way to dispose of it after viewing?
>>
>>59140456
I haven't even started but yes I've thought of that problem. Was just hoping someone would point me in the right direction for a good encryption algorithm and I can do things along the way.

AES looks like its safe apparently. Was just thinking of using RSA-2048 since its going to be a while before anyone claims the 200k USD prize.

Encryption strength isn't going to be that much of a problem anyway, like banks, I will put a timeout after 10 tries, makes it impossible to brute force.

The purpose of this isn't to SEKRITLY STORE LE PASSWERD in the most unbreakable haxor program. It's just a good alternative to using google chrome password manager which shows the plaintext of your password to anyone which has access to your computer (fucking ridiculous).

I will first implement it using a CLI thats very easy to use and no bullshit.
>>
>>59140512
>Inb4 google chrome
Im pretty sure its the same case with any web browser.

But yeah. Browser options -> Advanced -> Password manager -> Click show

Pretty ridiculous
>>
>>59140512
>>59140532
That is why you use professional password managers like lastpass. Or if you are afraid of (((them))) you store your password locally encrypted and decrpyt it if you need to.

>>59140512
SHA-256. That shit is secure as fuck.
>>
File: d-man.png (14KB, 160x301px) Image search: [Google]
d-man.png
14KB, 160x301px
>>59140154
Thank you for your inquiry. It looks like you might be slightly mistaken, as the community around D is bigger and more alive than it might seem to an outsider, and not only that--the language, the tools and libraries available for it are evolving, and the community is growing on a daily basis.
>>
>>59140586
Rustfag at heart but I like D as well. It's a shame that Deoplete-d is kinda broken. Or probably it's my neovim config.

I use Coedit if I have to work with D but working with vim is comfy
>>
>>59140586
Doubling a very small number results in a very small number
>>
File: image (1).png (78KB, 1168x722px) Image search: [Google]
image (1).png
78KB, 1168x722px
>>59140512
First off, you probably don't need asymmetric encryption if you don't plan on sharing the information with anybody.

IMHO, you would be best off with salsa20 symmetric encryption, since AES is slow in software with large chunks of data (on phone, desktops can probably use AES-NI).

I put AES-192 in a personal project (>>59139898) with OpenSSL wrappers, made a benchmark tool, and tested out different hardware so I can get some solid numbers on this. I had to do some other small stuff (RSA-4096 and SHA-256) which falls outside of what you are doing, but that doesn't add to the time too much. pic related
>>
>>59140613
>>59140586
>>59140154
I'd say in terms of likelihood to take off and make it big Crystal >= Rust > Nim >= D.
>>
>>59140658
oh, "laptop" here is a Core 2 Duo at 2.0 GHz
>>
>>59140672
>syntax similar to Ruby
WHY
>>
>>59140688
>>59140672
>>syntax similar to Ruby
Nice
>>
>>59140698
Ruby pls go
>>
>>59140715
sorry, I'm a rustfag
>>
>>59140688
I dunno, Rubyists really like their weird syntax. But at least it is not as crazy as Nim's where hello_world and helloWorld are the same identifier.

IMO Elixir did the right thing to take Ruby's syntax and make a new one that looks similar but is actually super consistent and homogeneous.
>>
>>59140764
I wish Ruby never became popular, it's such a shitlang
>>
>>59140813
#rekt
>>
File: 1379892882975.jpg (25KB, 376x366px) Image search: [Google]
1379892882975.jpg
25KB, 376x366px
>>59140813
haeving problem?
>>
>>59141100
man i wanna FUCK that boy
>>
310
>>
311
>>
312
what happened to the other thread?
>>
Reminder that bump limits are important, and it's good that they're being enforced.
Thank you, janitor.

New thread;
>>59141169
>>59141169
>>59141169
>>
>>59141179
>t. janitor
>>
>>59141178
A janitor/mod deleted it, because it was posted before the bump limit of this thread.
Thread posts: 316
Thread images: 36


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