/dpt/ - Daily Programming Thread

Old thread What are you working on, Sup Forums?

Other urls found in this thread:

toptal.com/developers/sorting-algorithms/insertion-sort
twitter.com/NSFWRedditGif

lisp

Why did you post this?
There is already a valid thread:

nobody is using that thread because that OP is fucking retarded

That thread was posted early. We don't reward early thread posters.

No it wasn't.

That OP is a thread splitter. Fuck him.

>2 Unique posters
That is just sad.

So is thread-splitting, which is what you did in response to the muslim thread.

Caring is even sadder.

So we're using this thread then?

guess so

>OP samefagged his way to victory
Stupid fucking janitors.

I should note, these are all OP:

Calm down, child. Who the fuck cares?

Are you seriously going to to fucking defend namefagging?
Also, the unique poster count did not go up.

(defun add (x y) (+ x y))
(defun mul (x y) (* x y))
(defun sub (x y) (- x y))
(defun div (x y) (/ x y))
(print (add 2 5))
(print (mul 2 5))
(print (sub 2 5))
(print (div 2 5))

*samefagging

>namefagging
Where?
And so what if he was samefagging? I couldn't care less. Why does it matter? We have our /dpt/ thread so seriously... calm down. Holy shit.

Are you fucking serious?
(Unique counter did not go up)

Again... I don't care, even if that's true.

someone didn't take their meds

Those are the literal tactics used by shills and viral marketers. It's fucking pathetic.
You should fuck off to reddit, where that sort of shit is tolerated, and the whole point of the site.

The unique poster count did not go up with this post.

This is you.

How do you care so much about it?
Is this thread your whole life?

meant for

>whine like a baby
>Someone whines about your whining
>"you're whining like a baby"

You're a bit special aren't you?

const add = (x, y) => x + y
const mul = (x, y) => x * y
const sub = (x, y) => x - y
const div = (x, y) => x / y

console.log(add(2, 5))
console.log(mul(2, 5))
console.log(sub(2, 5))
console.log(div(2, 5))

No it was meant for .

Taking OOP next semester, what should I expect?

POO

(define-values (add sub mul div) (values + - * /))

nice reddit le thinking face meme

Is udemy any good?
I've mostly used books before but maybe having the lectures and such could be useful.
Now that there's a sale it's cheaper than text books too.

The irony is that this OP is actually the "thread-splitter".

Actually the thread that was made before this one was made by a thread splitting. OP There was a muslim thread up as well but it was deleted (after the cry baby's one was made and subsequently deleted twice)

The stupid pope/rust one was posted at 309, so it was invalid and rightfully deleted.
The other one was made past 310, so it was valid. I fucked up the format a couple of times (making it not searchable), so I deleted the thread and immediately reposted it. It was still the "valid" thread.
This one was just OP being a samefagging crybaby who threw a tantrum until he got his way.

Someone needs Jesus.

kek

Why is Rust not liked by the C++ developer community?
Why did they all gravitate to D instead? Was it just timing and politics?

beautiful

>Why did they all gravitate to D instead?
Get some perspective outside of /dpt/

>Why is Rust not liked by the C++ developer community?
C++ programmers are shit-eaters and will continue to be shit-eaters.
>Why did they all gravitate to D instead?
Literally nobody went over to D.

>Literally nobody went over to D.
A core group of C++ uber nerds did. Andrei Alexandrescu, Meyers, etc.

>Andrei Alexandrescu, Meyers
So the language designers are literally the only users?
I'm not suprised.

...

Why didn't they become Rust designers?
Why is Rust being designed by lightweights?

Is SharpDX pretty much the best way to go about getting DirectX into a C# application?

A usefull program in python.. It's a address book which only works in CLI.

...

I enjoy programming a bit but don't know enough to be interested in anything specific.
Should I just pick the language with the highest probability for employment (assuming I continue to enjoy it and stick with it until I know a lot more).

I mostly know java now.

Java's a good choice as far as employability is concerned.

not $ elem False $ map C.isAscii "justGraduated:)"

>tfw when your program is POSIX compliant and Valgrind clean

>not using winapi functions even though there are portable functions that do the exact same thing just to make your code harder to port to other platforms

Not POSIX compliant -> NOT PORTABLE

Deadline program in Lua
#!/usr/bin/env lua5.3

-- Print how much ahead/ago the deadline is

local DEADLINE = os.time{year=2017, month=7, day=16, hour=23, min=59, sec=59}

-- Convert os.difftime output into a more human-friendly string representation
local function difftimeStr(sec)
assert(math.tointeger(sec) ~= nil, "arg for difftimeStr must be an int")

local postfix = ""
if sec < 0 then
postfix = " ago."
sec = -sec
elseif sec == 0 then
postfix = "Now."
else
postfix = " ahead."
end

local days = sec // 86400
sec = sec - days * 86400
local hours = sec // 3600
sec = sec - hours * 3600
local min = sec // 60
sec = sec - min * 60

local function s(value, unit)
if value

Same thing in C
// Print how much ahead/ago the deadline is

#include
#include
#include
#include
#include

struct tm DEADLINE = {
.tm_year = 2017 - 1900,
.tm_mon = 7 - 1,
.tm_mday = 16,
.tm_hour = 23,
.tm_min = 59,
.tm_sec = 59,
.tm_isdst = -1
};

static int makeUnitString(char *buffer, size_t bufferSize,
unsigned long unitCount, const char *unitName)
{
const char *formatString;
if (unitCount > 1) formatString = "%ld %ss, ";
else if (unitCount == 1) formatString = "%ld %s, ";
else formatString = "";
return snprintf(buffer, bufferSize, formatString, unitCount, unitName);
}

int main(void) {
time_t deadline = mktime(&DEADLINE);
if (deadline == (time_t)(-1)) return EXIT_FAILURE;

time_t now = time(NULL);
if (now == (time_t)(-1)) return EXIT_FAILURE;

double diff = difftime(deadline, now);
if (diff >= LONG_MAX || diff 0) {
postfix = " ahead.";
} else if (sec == 0) {
postfix = "Now.";
} else {
postfix = " ago.";
sec = -sec;
}

long days = sec / 86400;
sec %= 86400;
long hours = sec / 3600;
sec %= 3600;
long min = sec / 60;
sec %= 60;

char bigbuff[256] = {0}, smallbuff[32];
const long unitCounts[] = {days, hours, min, sec};
const char *unitNames[] = {"day", "hour", "minute", "second"};
for (int i = 0; i < 4; ++i) {
if (makeUnitString(smallbuff, sizeof(smallbuff),
unitCounts[i], unitNames[i]) < 0)
{
return EXIT_FAILURE;
}
strcat(bigbuff, smallbuff);
}

char *lastComma = strrchr(bigbuff, ',');
if (lastComma != NULL) *lastComma = '\0';

strcat(bigbuff, postfix);

if (puts(bigbuff) == EOF) return EXIT_FAILURE;

return EXIT_SUCCESS;
}

>Why is Rust not liked by the C++ developer community?
Because it's not C++. Why change if C++ is already perfect in every way shape or form?

What is c++11, c++14 and c++17?

how did you check POSIX compliant?

By using only stuff in the POSIX standard

>static int
What dose this mean as a return type?

Not even C++fags think that.

When talking about functions, static basically means the function is private to that file.

What did he mean by this?

Yeah I've seen it's very common among job ads.
I don't know what else to learn though. Just basics of this doesn't do much.
It seems I have to learn about other technologies or special parts of Java.
I want to make something real eventually (preferably contributions to open source or maybe some project of my own) but it still seems like I know pretty much nothing at all, for example when I look for anything to do on github.

Oh it's a linkage thing, thanks.

C++fags know their language isn't perfect and are constantly trying to improve it. C hasn't changed much since C99.

There are very few new features added to the language itself. It's mostly additions to the standard library

C++11 added tons of new syntax.

That's 11 not 14 or 17 or 20

14 and 17 were incremental changes in general, I think C++fags could live without them.
C++11 was the big shift that made C++ attractive again.

>implying it was ever unattractive

The only good thing about C++ before C++11 was templates, all it had to offer was OOP and that was pure shit.
OOP in C++ remains shit.

learning about machine learning and CNNs
if user wanted to generate tits where would user find consistent training data?

buy an 8TB external drive and make your own dataset
pay an ukrainian or for the same price a team of 20 poo in loos to fill it up

...

There was a Ruby meet up in my city today, but I was too scared to go. :(

would /dpt/ say "the process is in process" is correct english/jargon?

In what context?

It's correct, but kind of stupid. Things sound weird when you use the same word too many times.

pdcurses or ncurses?

What the hell is Govnocode?

slang

i think govno is like russian for shit?

I don't really know why but for some reason that reminded me of zombo.com.

So... if they would Call it "Govnokot" it would mean shit in russian at the beginning and shit in german at the end.

i guess in the SICP sense of the process as a "program entity," or the common context of "parent and child process."

No, pyccкиe is russian for shit

This uh... this isn't the right way to do an insertion sort, is it?

Java as a case. Learn to conform yourself to the worldwide loo community.

*use case

It's possible to do it in-place, by just swapping values.

Probably wrong yes.
This is what you expect from sorting a sorted array with insertion sort.

It wasn't already sorted, my solution was pretty poor though, I think I misunderstood what Insertion sort actually is. My steps:
>create new array the size of the one to be sorted
>take lowest value of the array and then place it at index 0 of the new array
>repeat until sorted

Obviously this shouldn't work for example because the lowest number remains the same, so after adding the lowest number to the sorted array, I'd change its value to the greatest value of the array+1.

Is this one right? It loops through the array swapping if Array[i]>Array[i+1] and stops whenever no swap occurred.

Sorry forgot pic

That's not insertion sort.
toptal.com/developers/sorting-algorithms/insertion-sort

Any decent books on Java? Have a class next year on pervasive network applications and a good chunk of it is taught in Java

#include
#include
#define dc double complex
dc
Y(dc
V,
dc B,dc c){
return
(cabs (V)9?9:
C;FILE*f= fopen("M.bmp","wb");if(!f)
return 1;char buf[]={66,77,S&255,(S>>
8)&255,(S)&255,S,0,0,0,0,26,0,0
,0,12,0,0,0,w&255,w,h&255,h,1,0,24,0};fwrite(buf,
26,1,f);for(X=0;X

What's the point of this sort of stuff in bsd/win sock? Why not a plain inlined func?