[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: 317
Thread images: 29

File: 1499833544385.jpg (171KB, 1142x885px) Image search: [Google]
1499833544385.jpg
171KB, 1142x885px
Old thread >>61330035

What are you working on, /g/?
>>
lisp
>>
>>61333611
(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))
>>
>>61333801
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))
>>
Taking OOP next semester, what should I expect?
>>
>>61333918
POO
>>
>>61333906
(define-values (add sub mul div) (values + - * /))
>>
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.
>>
Why is Rust not liked by the C++ developer community?
Why did they all gravitate to D instead? Was it just timing and politics?
>>
>>61334082
>Why did they all gravitate to D instead?
Get some perspective outside of /dpt/
>>
>>61334082
>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.
>>
>>61334096
>Literally nobody went over to D.
A core group of C++ uber nerds did. Andrei Alexandrescu, Meyers, etc.
>>
>>61334110
>Andrei Alexandrescu, Meyers
So the language designers are literally the only users?
I'm not suprised.
>>
>>61334115
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?
>>
>>61333611
A usefull program in python.. It's a address book which only works in CLI.
>>
File: pope3.png (463KB, 640x427px) Image search: [Google]
pope3.png
463KB, 640x427px
>>
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.
>>
>>61334252
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
>>
>>61334298
>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
>>
>>61334332
Not POSIX compliant -> NOT PORTABLE
>>
>>61333611
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 <= 0 then
return ""
elseif value == 1 then
return ("%d %s, "):format(value, unit)
else
return ("%d %ss, "):format(value, unit)
end
end

local S = s(days,"day")..s(hours,"hour")..s(min,"minute")..s(sec,"second")

return S:sub(0, S:len() - 2)..postfix
end

print(difftimeStr(os.difftime(DEADLINE, os.time())))
>>
>>61334584
Same thing in C
// Print how much ahead/ago the deadline is

#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

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 <= LONG_MIN) return EXIT_FAILURE;

long sec = diff;

const char *postfix;
if (sec > 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;
}
>>
>>61334082
>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?
>>
>>61334592
What is c++11, c++14 and c++17?
>>
>>61334298
how did you check POSIX compliant?
>>
>>61334612
By using only stuff in the POSIX standard
>>
>>61334590
>static int
What dose this mean as a return type?
>>
>>61334592
Not even C++fags think that.
>>
>>61334625
When talking about functions, static basically means the function is private to that file.
>>
>>61334611
What did he mean by this?
>>
>>61334267
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.
>>
>>61334637
Oh it's a linkage thing, thanks.

>>61334657
C++fags know their language isn't perfect and are constantly trying to improve it. C hasn't changed much since C99.
>>
>>61334665
There are very few new features added to the language itself. It's mostly additions to the standard library
>>
>>61334679
C++11 added tons of new syntax.
>>
>>61334688
That's 11 not 14 or 17 or 20
>>
>>61334705
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.
>>
>>61334726
>implying it was ever unattractive
>>
>>61334736
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.
>>
>>61333611
learning about machine learning and CNNs
if anon wanted to generate tits where would anon find consistent training data?
>>
>>61334781
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
>>
File: 1498108612020.webm (924KB, 600x336px) Image search: [Google]
1498108612020.webm
924KB, 600x336px
>>
would /dpt/ say "the process is in process" is correct english/jargon?
>>
>>61335043
In what context?
>>
>>61335043
It's correct, but kind of stupid. Things sound weird when you use the same word too many times.
>>
pdcurses or ncurses?
>>
>>61334829
What the hell is Govnocode?
>>
>>61335070
slang
>>
>>61335103
i think govno is like russian for shit?
>>
>>61335103
>>61334829
I don't really know why but for some reason that reminded me of zombo.com.
>>
>>61335121
So... if they would Call it "Govnokot" it would mean shit in russian at the beginning and shit in german at the end.
>>
>>61335045
i guess in the SICP sense of the process as a "program entity," or the common context of "parent and child process."
>>
>>61335121
No, pyccкиe is russian for shit
>>
File: IMG_0889.jpg (127KB, 749x1100px) Image search: [Google]
IMG_0889.jpg
127KB, 749x1100px
>>61333611
This uh... this isn't the right way to do an insertion sort, is it?
>>
>>61333918
Java as a case. Learn to conform yourself to the worldwide loo community.
>>
>>61335347
*use case

>>61335318
It's possible to do it in-place, by just swapping values.
>>
>>61335318
Probably wrong yes.
This is what you expect from sorting a sorted array with insertion sort.
>>
>>61335407
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.
>>
File: IMG_0890.jpg (46KB, 736x407px) Image search: [Google]
IMG_0890.jpg
46KB, 736x407px
>>61335464
>>61335407
Sorry forgot pic
>>
>>61335464
That's not insertion sort.
https://www.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 <stdio.h>
#include <complex.h>
#define dc double complex
dc
Y(dc
V,
dc B,dc c){
return
(cabs (V)<6)?(c?Y(V *V+
B,B,c-1):c):(2+c-4*cpow
(cabs(V),-0.4))/255;}int
main (){unsigned int w=1920, h=
1080, C= w*h,S =C*3+26,X,A,n=C>9?9:
C;FILE*f= fopen("M.bmp","wb");if(!f)
return 1;char buf[]={66,77,S&255,(S>>
8)&255,(S>>16)&255,S>>24,0,0,0,0,26,0,0
,0,12,0,0,0,w&255,w>>8,h&255,h>>8,1,0,24,0};fwrite(buf,
26,1,f);for(X=0;X<C;++X){dc T=0,t;for(A=0;
A<n;++A){t=Y(0,(A%3/3.+X%w+(X/w+A/3/3.-
h/2) /1*I)*2.5/h-2.7,255);T+=t*t;}T/=
9; buf [0]=T*80+cpow(T,9)*255-950*
cpow(T,99);buf[1]=T*70-880*
cpow(T,18)+701*cpow(T,9);
buf[2]=T*cpow(255,(1-cpow
(T, 45) *2));fwrite (buf
,3,1,f);}
fclose(f);
return
0 ;
}


The resulting file is M.bmp after running.
I didn't make it, I just think it's really cool.
Also reposting because I didn't mean to reply.
>>
File: sock.png (17KB, 572x276px) Image search: [Google]
sock.png
17KB, 572x276px
What's the point of this sort of stuff in bsd/win sock? Why not a plain inlined func?
>>
File: fdclr.png (28KB, 571x557px) Image search: [Google]
fdclr.png
28KB, 571x557px
>>61335687
>>
I'm trying to write some ML code and would like to declare a type which is basically a list of (string * 't) couples. The problem I run into is that, when declaring it as
type 't env = (string * 't) list;;
I cannot then use this newly declared env type in another type declaration such as
type ntype = Ntype of env;;
, the interpreted keeps saying
Error: The type constructor env expects 1 argument(s),
but is here applied to 0 argument(s)
I know honestly incredibly little about ML, what's the correct way of declaring mutable type constructs?
>>
>>61335687
Less code duplication, I suppose?
>>
>>61333801
>>61333906
puts 2 + 5
puts 2*5
puts 2 - 5
puts 2/5
>>
>>61335906
type 't env
means that env takes a type parameter ('t)
so you need Ntype of 't env or Ntype of string env or something
if you know Java/C#/C++, 't env is like Env<T>
>>
>>61333980
I bought a python bootcamp like an hour ago. Ive got no exoerience in coding but a lot of free time after work. 25aud so we will see how it goes.
>>
>>61336047
>Bootcamp
I knew australians were dumb, but I didn't know they were this dumb.
>>
double mul_abs(double x) {
if (abs(x) >= 1) return x;
return 1/x;
}
>>
>>61336059
It was an impulse buy, there are like 130 "lectures" plus some other shit. Its $25, i dont really care. Also i am retarded.
>>
>>61336064
#define mul_abs(x) (abs(x) >= 1) ? x : 1/x;
>>
>>61336076
Just eat a Snickersâ„¢ bar, bro. You're not you when you're hungry.
>>
https://github.com/samshadwell/TrumpScript
>>
>>61336082
#define mul_abs(x) exp(abs(log(abs(x))))*x/abs(x)
>>
>>61336082
>;
you need go back
>>
>>61336128
back to your mom's pussy?
>>
>>61336128
fuck you brainlet
>>
>>61336137
>post C code when he can't even program in C
dumb shit poster.
>>
>>61336147
>when he can't even program in C
sure thing kid
>>
>>61336147
let brain = u
>>
>>61336158
Ending macro with ; is pretty good indication that he has no idea what he is doing. Dumb fuck.
>>
>>61336147
>>61336166

compiled with gcc, didn't throw any error

kill yourself
>>
>>61336098
le EPIC XDDD
>>
>>61336170
>it compiles so it can't be wrong
Is your name Lennart Poettering?
>>
>>61336158
Well you can't and it's apparent!
>>
>>61336187
yes why?
>>
>>61336189
>!

gb2 redd*t
>>
>>61336171
triggered?
>>
>>61336166
and not having its name in all caps
>>
(define (mul-abs)
(let ((You (lambda () "a shit")))


(You)


)
>>
>>61336218
praise kek haha
>>
File: flat,800x800,075,f.jpg (42KB, 800x682px) Image search: [Google]
flat,800x800,075,f.jpg
42KB, 800x682px
what are some cool ideas for some projects?

my manager said i need to bring ideas to table because as a idea guy, i earn more than the programmers in my team and i have to deliver.
>>
>>61336222
not him but ending macro names in all caps is bad because then it doesn't blend in well with non-macro code which would only be a good thing if you write unsafe macros like that guy so you want to make sure wherever you use them you know you're using them but otherwise it enhances readability to be able to think of macros as being like typeless inline functions and not have to be assaulted with the fact that they are macros wherever you use them
>>
>>61336283
:thinking:
MACROS_SHOULD_BE_IN_ALL_CAPS_LIKE_THIS just like I previously wrote
>>
>>61336300
no they should not.
>>
>>61336282
Think about what problems exist at your company.
Ponder how code could solve them.
Make sure what you come up with is realistic, unoffensive, timely, and affordable.
Coming up with ideas is hard when you do it right. They don't pay you for nothing.
You should also have a good understanding of programming, economics, and humanities -- the programming so you have some understanding of how your project might be implemented which can grant you insight as to whether or not it's plausible for the rest of your team to actually do, the economics to give you some insight into whether it's affordable, and the humanities to give you some insight into whether it's unoffensive and timely.
>>
>>61336323
you are objectively wrong and probably indian
>>
>>61336358
global constant should be all capital, function macros should be written like functions, dumb fuck.
>>
>>61336358
(You) are objectively wrong.
Macros should not be in all caps because having them in all caps is ugly.
>>
>>61336365
>>61336367
t. java professional solution developers in bangalore
>>
>>61336382
(You) are objectively wrong again.
Java doesn't have macros.
Probably because whoever invented it was as retarded as you and thought macros should be all caps, and decided that didn't fit with Java's aesthetic.
>>
>>61336398
that was a trick question since all pajeets take a basic c course before starting their java careers

kys retard
macros are always in all caps
>>
>>61336398
>and decided that didn't fit with Java's aesthetic.
>Java's aesthetic.
no it's not
>>
>>61336416
>macros are always in all caps
(You) are objectively wrong.
Macros should not be in all caps because having them in all caps is ugly.
>>
>>61336428

I'd hate to read any code written by you.
>>
>>61333611
>the pic
>the hood
no mudslimes allowed
>>
>>61336445
(You)r tastes are weird.
>>
>>61336082
mul_abs(x++)
>>
>>61336486
this is why a macro needs to look like a macro.
>>
Why is /dpt/ always so hostile?
>>
>>61336524
Nobody actually works on anything here.
>>
Would it be possible to port Linux to NES?
I know there's no MMU but could the kernel be modified not to make use of it
>>
>>61336514
(You) are objectively wrong.
The above is why you should only ever write safe macros.
And also why you shouldn't pass an expression whose value depends on evaluation order to a function that uses call-by-name semantics (which a macro basically is).
>>
>>61336575
>C macros
>safe
lmao
>>
>>61336540
Literally impossible. Putting aside all of the other various incompatibilities, NES systems don't have anywhere near enough memory for the Linux kernel so that renders it 100% impossible right off the bat.
>>
>>61336599
Yes. C macros can be safe and you should only ever write ones that are safe.
>>
>>61336540
Where the hell would you fit the Linux kernel? It's way too big.
>>
>>61336540
Port it to something with funky hardware.
Port it to a Saturn. Write Saturn homebrew, everyone needs more of that.
>>
File: nesclassicubuntu-1.jpg (155KB, 675x925px) Image search: [Google]
nesclassicubuntu-1.jpg
155KB, 675x925px
>>61336540
NES? No. NES Classic? Yes.
>>
>>61336082
>>61336486
>>61336514
>>61336575
>>61336599
>>61336618

>macros
>not inline procedures

you guys are fucking trashes at programming.
>>
>>61336662
This. So many fucking brainlets ITT.
>>
>>61336662
>inline procedures
Not portable

But I don't really care i just want to complain. Anyone who doesn't run their own preprocessor isn't a real programmer anyway.
>>
File: 1385136139955.png (19KB, 870x870px) Image search: [Google]
1385136139955.png
19KB, 870x870px
>>61336635
>port linux to saturn
>install virtualbox
>run windows
>install saturn emulator in windows because it's a windows-only emulator and you really want to play sanic on your linux system
>leave house
>come back
>still loading gam
>gotta go fast
>>
>>61336681
>Not portable
Good. Portability was a mistake.
>>
I wish I knew how IDA Pro and all that stuff worked so I could mod this game.
>>
>>61336654
the nes classic is more powerful than the 3ds.

>>61336681
>Not portable
what? inline is standard c since end of 1999/start of 2000
>>
>>61336681
who give a shit
>>
>>61336705
Ctards can't consider anything but C89 portable.
>>
>>61336662
>inline procedures
>not outline procedures
>yfw
>>
>>61336701
Fuck off you insolent retard. We're not going to help you.
>>
>>61336717
>C89
not portable
>>
>C
not portable
>>
>portable
not portable
>>
>>61336729
>he hasn't hacked at least once into Voyager 2
brainlets off my board
>>
>>61336746
>Voyager 2
not portable
>my board
not portable
>>
How do I contribute to a project /dpt/ ?

I look at the Github repo but it's fucking huge. I don't know how the thing works and I don't know where to start figuring it out. I want to change some specific things but I have no idea where they even are.
>>
>>61336767
>Github
not portable
>>
>>61336767
help me update https://github.com/freedom-brand-log/now
>>
>>61336720
Nowhere was I asking for any kind of help, I just wish I was a better programmer and actually do stuff I want to do.
>>
>>61336843
That's your own problem, maggot breath. Get lost.
>>
>>61336843
We don't care.
>>
>>61336843
piss off
>>
>>61336843
eat shit
>>
https://www.viva64.com/en/b/0130/
Makes me wonder, how did the game even work to begin with.
>>
>>61336843
I hope you get hemorrhoids.
>>
>>61336843
lick my balls
>>
>>61336843
light yourself on fire
>>
>>61336705
>inline
Doesn't force inline
You need to use compiler attributes for that usually.
>>
>>61336843
choke on milk
>>
>>61336921
__forceinline
>b-but muh portabiletey
>>
>>61336719
I would like to see what could be gained from outline hints. Probably not that much.
>>61336929
Yeah exactly. But I said it wasn't portable and anon here thought it was.
>>
>>61336910
>>61336903
>>61336900
>>61336880
>>61336874
>>61336865
>>61336847
Nice memery.
>>
>>61336944
all me btw
>>
>>61336921
>Doesn't force inline
still better than a macro.
>>
>>61337042
see >>61336929
you can force inline
>>
File: fossfeelsgood.png (6KB, 96x128px) Image search: [Google]
fossfeelsgood.png
6KB, 96x128px
>>61333611
Whoever made this meme of me using R is making me out to be a lot smarter than I really am. Common Lisp, Python on puters, C and forth on uC's. stopped doing C and asm for x86 back when dual core processors were bleeding edge :(
>>
>>61337042
>better than a macro
Not if you wanted to force inline.
Some compilers practically ignore it. As there's no requirements on the situations where they inline and they already aim to inline where it'd help (most of the time) it doesn't change much.
>>
>>61337239
fwiw i believe it's the redox os there not the r programming lang
>>
>>61337239
>R
it's Redox OS, an OS written in Rust
>>
How do I into Java Spring?
>>
Just started working on a game in unity although i have no previous java or c# experience. Its going well so far
>>
File: 1491491608393.gif (1MB, 200x200px) Image search: [Google]
1491491608393.gif
1MB, 200x200px
>>61337342
ah shows what I know. I've been on Arch for about a decade. Most of the stuff I do at work is either RHEL, Debian, occasionally Gentoo. Alpine for containers I guess. Haven't actually looked at other operating systems out there for a really long time I sorta lost that spark
>>
>>61337367
congratulations!
>>
>>61337367
eat my aids
>>
File: wap.png (10KB, 360x173px) Image search: [Google]
wap.png
10KB, 360x173px
>microsoft
>>
>>61337659
It would be great if they finally got rid of non-unicode mode and removed all the the retarded sometingW somethingA and TCHAR stuff.
>>
I can't believe I fell for the haskell meme.. this language is so dead...
>>
>>61337756
I fell for the lisp meme. How do you think I feel?
>>
>common lisp website hasn't been updated in 2 years
JUST
>>
>>61337694
>it'd be great if they [broke backwards compatibility]
People got very upset that their 16-bit applications wouldn't run on x64 versions of windows. If they break shit like this there'd be riots.
>>
>needs constant updates so they don't feel alone
Something wrong with these flavor of the month programmers.
>>
File: Clrs3.jpg (50KB, 420x475px) Image search: [Google]
Clrs3.jpg
50KB, 420x475px
Is this book a meme?
>>
>>61337826
>constant
We're talking about
>2
>fucking
>years
Get your head out of your ass.
>>
>>61337832
you dip
>>
>>61337845
c++ has been literally perfect for 200 years
fuck off
>>
>>61337845
>>61337826
>>61337784
Lisp has been around since 1958, Common Lisp since 81. Believe it or not most of the meaningful work on the language has been done. It's primary users early on were people trying to solve very interesting problems, and they drove the language to be able handle what they needed to do. 2 years is basically no time at all considering the language at this point is going on it's 2nd half of a century.
>>
File: dem_seal.jpg (77KB, 549x549px) Image search: [Google]
dem_seal.jpg
77KB, 549x549px
>>61333980

I took a golang course, that sucked there.
>>
>>61337832
It's a general purpose registere.
>>
>>61334154
Because the experience they gained when designing C++ would only be useful if someone wanted to design a bad language.

Thank god they moved to a D-ead language.
>>
>>61334622
I've met some of the people who authored the POSIX standard.

I guarantee even *they* couldn't write a useful program just using POSIX. POSIX was a failure, Anon. Just accept it.
>>
why can't i just dump the whole clang ast? why do i have to use the clang api to do the simplest possible thing you might want to do with clang as an external tool? i'm too dumb for this shit ;_;
>>
File: hhhhhgnnn.png (1KB, 144x24px) Image search: [Google]
hhhhhgnnn.png
1KB, 144x24px
>>61337694
it will never happen
>>
>>61337832
Yes it's a total meme skip it.
>>
File: fib.png (9KB, 674x248px) Image search: [Google]
fib.png
9KB, 674x248px
>>
>>61337832
nah
more like a reference manual
>>
>>61338118
I never thought about it, but I have no idea how right to left text works. I assume compiler/interpreter sees the program in the usual direction, ie the text's representation isn't reversed it's just displayed that way?
>>
>>61338034
>standard committee
>knowing how to program
They are not going to include standard for Graphic API there something like but it provides the general stuff like threads, directory handling and sockets.
>>
>>61333918
Java is the go-to language. Harder, but useful languages like C++, or easier scripting-focused languages like Python that have some OOP are usually not taught in these courses. Older OOP languages like Smalltalk are a laughing stock now.

>>61337832
It was my class textbook but I never used it. It's the general all-purpose book for the topic.
>>
File: 1487441596813.jpg (44KB, 640x539px) Image search: [Google]
1487441596813.jpg
44KB, 640x539px
>>61338118
>>
>>61338118
Is that rust?
>>
>>61338309
>useful languages like C++
>C++
>useful
lol
>>
>>61338012
>D-ead language.
D1 is dead, D2 is alive and well.
>>
>>61338118
No, you can't blow up the server with your program.
>>
>>61338362
What everyday software is written in D?
>>
>>61334807
funny, is there not a nation database for like breastcancer or something...
>>
anyone know how to change the perl6 rakudo repl prompt icon from '>' to something else?
>>
>>61338390
https://en.wikipedia.org/wiki/D_(programming_language)#Development_tools
>>
>>61338465
So nothing. Got it.
>>
>>61338448
no
>>
>>61338465
That's an answer to a different question.
>>
>>61338391
I'd assume it would be mostly cells and tissue and shit, not full on tits
>>
>>61338362
What's the difference?
>>
>>61338486
can you try to find out?
>>
>>61338118
honestly thats really pretty looking. thats pretty looking RTL lisp.
>>
>>61336889
>I've never worked on a real project before
>>
>>61338118
arabic confirmed for best language for programing
truly the language of the gods
>>
File: 1493037656275.png (93KB, 295x221px) Image search: [Google]
1493037656275.png
93KB, 295x221px
What's the cutest font for programming?
>>
>>61338828
impact
>>
>>61338828
comic sans
>>
>>61338828
That anime font.
>>
>>61338835
>>61338841
not cute
>>
>>61338625
Not that guy, but if you want sequence data, Genbank is your first stop.

https://www.ncbi.nlm.nih.gov/genbank/

There is no 'tit' tissue; breasts are composed of many different tissues, with tumours mostly occurring in milk ducts.

Cells lines are controversial, but still the best way to explore. I've used MCF7 for a little with good results.
>>
>>61338844
not monospace
>>
Newbie here. Is it cheating if I look at the C code of different algorithms(binary search, merge sort, insertion sort)? Or should I try to figure it out on my on. I have the basic idea of how it would look on code, but I still can't come up with the whole thing(especially merge sort).
>>
>>61338773
Arabic script is awful: terrible x-height, with many similar letters, differing only in diacritical dots, no true 'e' or 'o'. No capitals, no italics.

Bad.
>>
>>61338872
look at that code to learn from the best, then decide if you want to spend your time re-inventing a wheel that will never be as good as theirs, or if you want to take what they made and build on the backs of giants.
>>
>>61338872
Yes, it is cheating. You should implement it for yourself and then compare, otherwise it's not much of a learning experience.

>>61338880
>An abjad lacks vowels
stop the fucking presses
>>
>>61338872
There is no such thing as cheating in programming.
>>
>>61338864
So make it monospace.
>>
>>61338872
It's only cheating if you don't learn anything. And you're only cheating yourself.
>>
>>61338891
Arabic has written vowels, idiot.

Not true 'o' or 'e' though.
>>
How do you write good C++ code? C-like, OOP or some mix between them?
>>
>>61338953
C-like with RAII and a little bit of templates.
Avoid OOP.
>>
>>61338953
If you are writing your c++ c-like you are doing it horribly wrong. c++ is not c.
>>
>>61338953
>oop
Certainly no OOP.
>some mix
Doesn't exist. OOP is a programming paradigm, as the name would suggest.
>C-like
Yeah.
>>
>>61338883
>>61338894
>>61338912
>>61338891
I see. I will try to come up with the best I can. Then I will compare answers. Thanks for the answers guys.
>>
>>61338953
C-like, but with classes, except that the classes use operator overloads so that the code that uses them is still C-like
>>
>>61338953
there is no good c++ code
>>
>>61338971
>templates
>RAII
pls no

>>61338990
>C-like sepples
Just write fucking C dumb fuck.
>>
>>61338953
C style with containers and templates.
>>
>>61339014
>Just write fucking C dumb fuck.
C doesn't have classes or operator overloads
>>
>>61339014
RAII is an excellent pattern, I don't see what you have against it.
>>
>>61339037
>C doesn't have classes or operator overloads
GOOD
>>
>>61334665
>hasn't changed much
Not really. C11 added support for: complex numbers, static asserts, type-generic macros, threading, alignment, UTF8/16/32 support, bounds-checking, standard anonymous structs/unions (gnu99 had them), etc.
You can call these "nothing," but they do matter, if not all at the same time.
>>
>>61339087
No. Wrong. Bad.
>>
>>61339098
>C11 added support for: complex numbers
C99 had complex number support. Did they change it or something?
>>
>>61338828
Firacode
>>
Why is a char literal an int in C?
>>
>>61339118
It's now mandatory, it finally conforms to ISO 10967 and there's the CMPLX* macros for building a complex out of floats. In older implementations you had to use _Imaginary_I. I guess I should have said full support.
>>
>>61339186
Because byte is haram.
>>
>>61339186
Ints are more efficient than chars.
>>
>>61339186
Because B used to allow up to 4 characters inside a char constant, so that those 4*8=32 bits would fill the 36 bit word of the (IIRC) Honeywells of the time.
>>
File: 836090308543.jpg (80KB, 1024x576px) Image search: [Google]
836090308543.jpg
80KB, 1024x576px
lets say we have a C program myprog and this shell command
myprog < file.txt

is this file.txt opened by shell and then handle to it passed to myprog or myprog is ordered to open that file before main()? who has ownership of this file?
>>
>>61339325
the contents of file.txt are sent into stdin of myprog
>>
>>61339325
you would be piping input to the program. if you are opening the program with you would use argv and it would be
 myprog file.txt 
>>
How long does it take to become good?
Right now I can't do anything worthwhile by myself and feel like a brainlet when I have to look up solutions to basic programs
>>
>>61339339
>>61339353
This only applies on Linux. Shut up.
>>
>>61339339
>>61339353
yeah but who opens and reads that file? shell?
>>
>>61338851
holy fuck that's cool, thank you
>>
>>61339360
You will never stop being a brainlet.
>>
>>61339374
yes, the shell
>>61339368
what other operating systems are there?
>>
>>61339368
>>61339374
>>61339374
I guess that depends what you mean by read. the shell redirect is piping out the contents of the file but it's not putting that in some sort of buffer to be interpreted as a string or what have you. the myprog would 'read' whatever is piped into it if myprog has some read-type function.
>>
>>61339392
Seriously though
>>
>>61339415
>what other operating systems are there?
Ones that actually matter.
>>
>>61339360
How long have you been working on stuff?
>>61339368
I think they way Windows does it is that CSRSS allocates the handle on the system handle table.
>>
>>61339449
>How long have you been working on stuff?
For around three weeks/a month, I guess. I work about two hours per day.
>>
>>61339448
such as ... ?
>>
>>61339465
buddy lol give yourself some time. I've been working in software and embedded design for years and i still find problems i bang my head on the desk for. it's part of the struggle you'll get there give yourself a year at least man to go from competency to artistry
>>
File: harrypotter.png (328KB, 662x662px) Image search: [Google]
harrypotter.png
328KB, 662x662px
It obviously has room for improvement, but I wrote a little thing today to turn text into images. Here's the entire first Harry Potter book.

In the next update of it, I'm going to split the RGB values to represent characters, rather than having a whole hex number represent a single character. That'll reduce the filesize by a fair bit, and will still fit in with ASCII.
>>
>>61339594
neat. presumably you can decode the text from the image too?
>>
>>61339594
neat
if this is in a public repo can you post the link?
>>
>>61339594
you should see what sort of NLP you can do on it to have certain phrases or syntaxes take on hue values
>>
>>61339360
A few years norvig.com/21-days.html
>>
>>61339647
>>61339743
>>61339759
You must be new to programming (like, first month new) to actually be impressed by that. It's like 10 lines in Python. Fucking brainlets.
>>
>>61339799
what cool projects are you working on anon?
>>
>>61338851
>tfw to brainlet too understand anything there
>>
File: 2950940436441203.jpg (20KB, 337x342px) Image search: [Google]
2950940436441203.jpg
20KB, 337x342px
so lets say we have a grep
ls | grep

shell pipes ls's output to grep's input but how does grep know to read from stdin? invoking grep alone does not make it read from stdin, it displays help, is this also work of shell? closing stdin?
>>
>>61339855
grep doesnt read from stdin in this case
$ ls | grep
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]

also, go to the friendly linux thread
>>
>>61339855
>invoking grep alone does not make it read from stdin,
Try this though.
grep -Eo "z"

The grep command will then read from stdin.
Whereas if you did
ls | grep

without any options to grep, it would just display help in that case too.
So it's not the lack of a file parameter that makes it display help, it's the lack of a pattern parameter. It can deal with not having a file parameter, then it just uses stdin.
>>
>>61334590
Is this better?
#include <stdio.h>
#include <time.h>

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
};

int main(){
time_t now = time(NULL);

int seconds = (int)mktime(&DEADLINE) - (int)now;

const char *postfix;
if (seconds > 0) {
postfix = " ahead.";
} else if (seconds == 0) {
postfix = " Now.";
} else {
postfix = " ago.";
seconds = -seconds;
}

printf("%d days, %d hours, %d minutes, %d seconds%s", seconds / 86400, (seconds %= 86400) / 3600, (seconds %= 3600) / 60, seconds % 60, postfix);
}
>>
File: 78566296655160.jpg (35KB, 247x248px) Image search: [Google]
78566296655160.jpg
35KB, 247x248px
>>61339884
this has nothing to do with linux, im trying to understand pipes in C and how does everything work about them

>>61339903
thx that actually makes sense that i could grasp
>>
>>61340050
Pipes are a Linux (or more generally Unix) thing.
>>
>>61340050
>im trying to understand pipes in C
Do you mean the bitwise operator "|"?
https://en.wikipedia.org/wiki/Bitwise_operations_in_C
>>
>>61333611
That's a real shitty shop. The screen is clearly concave, but the shopped image is flat. Nobody runs Redox.
>>
>>61340061
but stdout/stderr/stdin are pipes too and they are everywhere, even on windows

>>61340072
no, i was more interested if program in C has to detect if it was called with | or >, shell doesnt interest me at all
>>
>>61340050
This: >>61340072
Even though it's the same symbol, be careful not to confuse C's "pipes" (bitwise or) with the shell's pipes. Only the latter is a redirection operator. The prior is something completely different, it's just a bitwise logic operator and operates on numbers, not commands.
>>
>>61340120
>no, i was more interested if program in C has to detect if it was called with | or >
Look into the C function isatty, I think it will serve your purpose
>>
Is there a reason for a newfriend to use python < 3.x ?
>>
>>61340151
Library support.
If you're not using old libraries that only support Python 2, you're cool.
>>
>>61334590
And a bit more compact:
#include <stdio.h>
#include <time.h>

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
};

int main(){
int seconds = mktime(&DEADLINE) - time(NULL);

printf("%d days, %d hours, %d minutes, %d seconds%s", seconds / 86400, (seconds %= 86400) / 3600, (seconds %= 3600) / 60, seconds % 60, ((seconds > 0) ? " ahead." : ((seconds == 0) ? " Now." : " ago.")));
}

Hurry, Anon! Your deadline is less than ten minutes away!
>>
>>61340174
80 char line max
>>
>>61340120
Anon, |, >, < are all part of the shell. If you want to know how the thing works as far as how C sees it, it's implementation-defined. Windows (or rather, CMD) makes CSRSS juggle file objects around, which are then duplicated inside the process somewhere down the line, and then stored in the file descriptor table through MSVCRT, and then given a FILE*, which becomes stdin/out/err.
>>
>>61340120
>no, i was more interested if program in C has to detect if it was called with | or >
No, the file is opened and put in place of stdin/out/err. Look up freopen().
>>
>>61340184
#include <stdio.h>
#include <time.h>

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
};

int main(){
int seconds = mktime(&DEADLINE) - time(NULL);

printf("%d days, %d hours, %d minutes, %d seconds%s", seconds / 86400,
(seconds %= 86400) / 3600, (seconds %= 3600) / 60, seconds % 60,
((seconds > 0) ? " ahead." : ((seconds == 0) ? " Now." : " ago.")));
}
>>
File: foeof.png (5KB, 387x46px) Image search: [Google]
foeof.png
5KB, 387x46px
>>61339594
>>
>>61340351
Not impressive in the least.
>>
Are there any good programming books that deal with fractals?
>>
you're a programmer harry
>>
>>61340351
can you make it so capitals are encoded too?
>>
>>61340481
I'm not the OP, I just took his image and decoded it. But there's more than enough space for capitals
>>
File: mandelbrot_sequence.webm (3MB, 320x240px) Image search: [Google]
mandelbrot_sequence.webm
3MB, 320x240px
>>61340437
Are there any good books about fractals in general?
>>
>>61340600
no so learn it then write a book
>>
File: 1481434715174.jpg (4MB, 4511x3889px) Image search: [Google]
1481434715174.jpg
4MB, 4511x3889px
When people do make servers, are they replacing apache?
>>
>>61333611
Scheme is beautiful
(define (list-replace alist index value)
(append (take alist index) (cons value (drop alist (+ index 1)))))

(define (list-replace-bulk alist . replacements)
(fold (lambda (pair alist) (list-replace alist (car pair) (cdr pair))) alist replacements))
>>
Bugger me. I can't figure out why >>61340209 writes days and minutes as 0 where as the following shows the correct time:

#include <stdio.h>
#include <time.h>

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
};

int main(){
int seconds = mktime(&DEADLINE) - time(NULL);

printf("%d\n", seconds);

int days = seconds / 86400, hours = (seconds %= 86400) / 3600,
minutes = (seconds %= 3600) / 60;

printf("%d days, %d hours, %d minutes, %d seconds%s",
days, hours, minutes, seconds % 60,
((seconds > 0) ? " ahead." : ((seconds == 0) ? " Now." : " ago.")));
}
>>
What are some simple projects to work on to put on a site/portfolio?
Stuff to just show that I know how to use the language. What kind of complexity would people be looking for from a college student's site and projects?
>>
>>61340975
If you can write code in a language that compiles, you'll be miles ahead of most CS grads.
>>
>>61340975
completeness / correctness is more important than complexity
the last 20% of a project honestly takes 80% of the work but its very important
>>
>>61340975
I think writing something that interacts with an API is a good idea. It's going to be easy for you to make, and it demonstrates to employers you're able to ingest and manipulate data from another source. They'd probably ask you to fizzbuzz on site so i wouldn't worry about writing anything like that.
>>
main class:


import javax.swing.JFrame;

public class Main{

private JFrame frame;
private static final int WIDTH = 640, HEIGHT = 480;
private Ball ball;

public Main() {
frame = new JFrame("Ball Test");
frame.setSize(WIDTH,HEIGHT);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
ball = new Ball();
frame.add(ball);

frame.setVisible(true);
}

public static void main(String[]Args) {
new Main();
}

}




import javax.swing.JPanel;

import java.awt.Color;
import java.awt.Graphics;

public class Ball extends JPanel{

public Ball() {
this.setBackground(Color.DARK_GRAY);
}

@Override
public void paintComponent(Graphics g) {
g.setColor(Color.WHITE);
g.drawRect(20, 20, 600, 440);
}

}



why does this.setBackground(Color.DARK_GRAY) doesn't do anything? Can anybody help me?
>>
>>61340975
A good program is a useful program.
>>
>>61340975
Small story: We once had a job applicant whose portfolio mainly consisted of press stories about him. The catch? He went to jail for filesharing and ran one of the biggest sites back in the day. Sadly they didn't invite him to an interview

Also this >>61341037
>>
>>61341087
anyway i get it. i need to call super.paintComponent(g); I really don't know what doest it used for but.
>>
>>61341037
How much is actually expected of CS grads?
I was talking to a 3rd year on my course and she was saying her dissertation was a mobile Java app that tells you your horoscope...
Is this what it's like with most students? It seems like something you could do in a day or so.
>>
>>61341165
Why the fuck wouldn't you hire him? Holy fuck.
>>
>>61340898
looks pretty much the same to me
>>
new thread
>>61341350
>>
>>61341289
Depends on the school. CS programs are a lot like the Bible, in that those who have a true yearning for learning and growth will find it, and those who lack a spirit of learning are wasting their time.
>>
>>61341289
>>61341037
>>61341358
>ever going in for CS
They're literal meme degrees now. Better off going CE
>>
File: 1483635660553.jpg (28KB, 500x500px) Image search: [Google]
1483635660553.jpg
28KB, 500x500px
whats the equivalent of msdn for linux? any tutorial for learning raw c functions in linux?
>>
>>61341419
man, or syscalls.kernelgrok.com
>>
>>61341419
>>61341484
By which I mean either the command man or man7.org/linux/man-pages/
>>
>>61341484
>>61341509
are those the lowest level on linux? i mean i dont want to learn any libraries nor C's standard library, i want pain linux api
Thread posts: 317
Thread images: 29


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