[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: 30

File: anonkun.jpg (65KB, 333x355px) Image search: [Google]
anonkun.jpg
65KB, 333x355px
Do you even program?
>>
>>57217788
i want to i think
>>
>>57217803
Then do it.
>>
>>57217803
dont know how to start though
>>
File: 1453204049048.gif (67KB, 600x400px) Image search: [Google]
1453204049048.gif
67KB, 600x400px
>>57217474
anyone??
>>
>>57217823
that's not how it works you dumb shit
you have to use LoadLibrary and GetProcAddress to get the implementation from an already compiled dynamic library
what you're doing right now is include the header from the dll project but not compile the implementation
RTFM and try again
>>
File: 1464890890037.jpg (276KB, 2067x1602px) Image search: [Google]
1464890890037.jpg
276KB, 2067x1602px
>>57217884
rude
>>
File: images (1).jpg (4KB, 300x168px) Image search: [Google]
images (1).jpg
4KB, 300x168px
>>57217823
Shit waifu
>>
>>57217897
as it was meant to be
>>
>>57217788
have you read your SICP today?
>>
>>57217823
Is it a DLL or a .LIB?

Your including the header if your using a .lib, but are you actually linking to the lib?

Right click properties of your project -> Linker -> Additional dependencies (add your .lib)

Otherwise if your it as a DLL, you need to LoadLibrary() it
>>
>>57218183
No, but reading The Rust Programming Language, it's the same right?
>>
>>57217788
if (op.image.isAnime() == true)
{
post("fuck you for watching anime\n>>>/a/")
}
>>
>>57218557
>== true
>no ;

reddit, everyone
>>
File: 1463286867111.png (120KB, 400x340px) Image search: [Google]
1463286867111.png
120KB, 400x340px
>>57218557
>
if (op.image.isAnime() == true)
>>
File: garmfeld.gif (393KB, 640x360px) Image search: [Google]
garmfeld.gif
393KB, 640x360px
>>57218557
>boolean value == true
>>
>>57218619
>== true
>implying compiler optimization doesn't take care of that

>no ;
I'll shove that ; right up your ass, buddy
>>
>>57218678
Whoops, you forgot
(b == true) == true
>>
>>57218678
>implying compiler optimization doesn't take care of that
that's not an excuse for writing shitty code
>>
>>57218557
Allow me tho correct your code
>
if (op.image.isAnime() == true)

You see, that's a redundancy, since
 a == true
is just like

 if (a == true) {
return true;
} else {
return false;
}


You could just return a.

Or in your case:
if(op.image.isAnime()


Second:
You seem to have made an understandable, yet inacceptable mistake by dedicating a whole line to just one char, again syntactically and aesthetically redundant since the "i" in "if" marks the start of the block anyways.

Next time, just put the first curly bracket in the same line as the condition!

if (op.image.isAnime()) {
post("fuck you for watching anime\n>>>/a/")
}
>>
>>57218557
struct Truthness
{
bool operator()(const bool &v)
{
if (v) {
return true;
} else if (!v) {
return false;
}
}
};

if (Truthness(op.image.isAnime()) == Truthness(true)) {
// ..
}
>>
How to toggle between 2 functions by pressing the same key?
>>
>>57218717
>first curly brace on the same line
W R O N G

no braces for one line statements
>>
>>57218685
kek
>>
What does everyone think of Fortran? That my main language outside the Java i'm required to take
>>
how do i improve this
if ((!b && true || false) == true)
{
; // todo : add three line comment
}
else
{
post("hello"); // todo - 5 line comment
}
>>
>>57218557
grad.png.jpg.tiff
>>
>>57218734
Also acceptable but bad for maintenance, kinda like not finishing statements with a semicolon.

>>57218747
neat language, even faster than C for mathematics.
It still has some uses
>>
>>57218767
>bad for maintenance
what did you just say to me
>>
>>57218767
>even faster than C for mathematics
What did he mean by this?
>>
>>57218728
bool flag = true;

void onKey()
{
flag ^= flag;
if (flag) {
f1();
} else {
f2();
}
}
>>
>>57218751
do some testing to make sure b == b

Something like
if ((b == true) && b)


Maybe add some unnecessary brackets
>>
>>57218782
this way flag will forever be false and thus only f2() will ever be executed.
>>
>>57218772
BAD FOR MAINTENANCE

>>57218776
EVEN FASTER THAN c FOR MATHEMATICS
>>
File: file.png (136KB, 624x432px) Image search: [Google]
file.png
136KB, 624x432px
>>57218734
>>
>>57218797
yeah meant to be flag = !flag;
>>
>>57218776
Fortran (FORmula TRANslation) was originally built for mathematical purposes. Currently thats what I'm using it for is math programming.
>Find Pythagorean triples and save into arrays
>Then find what pythagorean triples satisfy the following set of restrictions
c1<c2<c3
c1+c2>c3
a1+a3=a2
b1+b2=b3

doing this for a physics doctor at my university who worked at Argonne
>>
>>57218802
easy to see
>>
>>57218797
>>57218782

I'm fairly new to programming and this is a little over my head. Is there some way to do it like this?
if (key != prevKey){
counter++;
}

if (counter % 2){
foo1();
}
else if (counter){
foo2();
}
>>
>>57218802
>He uses shitty editors that do not indent your code
>He does not use a compiler that warns you about this
{} would not save you
>>
>>57218825
yeah so easy it never got deployed
>>
>>57218802
>if (...) goto fail
They should've used the Maybe monad
>>
I'm a CS bachelor's grad from a pretty tough school.
I've been looking for a job since May.
Finally, some local company needs a software engineer, but they don't want to hire me
on account of it not being very profitable for them to hire me and wait for me to catch up.
They wouldn't want me making any mistakes, and that's understandable.
They offered me a position as a technician, which isn't very related to software, but they hope that I'd be able to learn the ropes so to speak, and in two months, evaluate me and possibly make me junior engineer.

I've had little luck otherwise. Would this be a good move?
I don't think it'd be impossible for me to score a software position right off the bat, but
I've been having a lot of trouble with that.
>>
>>57218747
it's dated, but still useful. In academy and engineering there are still a lot of libraries that are still in use and being expanded.

But personally I would not start a new fortran project outside of learning the language.
>>
>>57217788
I just want sauce.
>>
>>57218801
thanks.
>>
>>57218869
yeah if there's no options id say just take it and eventually in two months either get the engineer position or find another job if the opportunity comes up
>>
>>57218888
Nice digits
>>
>>57218894
it's pretty low paying as well. 15$ an hour.
I'm still living with my folks who are pretty understanding, and would be happy to have me
if I leeched off them for another couple years.

Though the pay's not great, spending time at work rather than looking for a job and lazing around
the house is probably a good idea.
>>
>>57218871
have you used it? and what for?
>>
>>57218927
i take it you aren't willing to move?
>>
>>57218819
faggot.
use haskell or Matlab instead
>>
>>57219020
>recommending matlab
delete your ghc copy
>>
>>57218802
very nice bug

>>57218888
nice quads
>>
>>57219020
how about no. I like my OG math language
>>57219026
#roasted
>>
>>57218726
Let me correct your code for you.
struct Truthness
{
bool operator()(const bool &v)
{
if (v==true) {
return true;
} else if (v==false) {
return false;
}
}
};

if (Truthness(op.image.isAnime()) == Truthness(true)) {
// ..
}
>>
>anime website
>>
A virgin can buy a whore. A bitch can never buy her innocence and dignity back.
Next question.
>>
>>57218717
Putting the curly brace on the same line is unclear.
>>
>>57219042
t. blub programmer
>>
>>57219046
My bad! Thanks for correcting it.
>>
>>57219046
Whoops, you forgot your OOP

public: setBoolVariableValue(bool bBooleanInputValue);
bool getBoolVariableReturnsBool();
private: const bool& mp_boolVariableThatIsABoolAndIsPrivate;

Truthness test;
test.setBoolVariableValue(op.image.isAnime());

See how much more concise this following bit is?
Now it's just

if (test) {
}
>>
>>57219046
We can go deeper
struct Truthness
{
static bool isTrue(const bool &v)
{
bool Truth=true; //initialize
if (v==true) {
Truth=true;
}
if (v==false) {
Truth=false;
}
return Truth;
}
};

if (Truthness.isTrue(op.image.isAnime()) == Truthness.isTrue(true)) {
// ..
}
>>
>>57218557
if(op.image.isAnime()?post("fuck you for watching anime\n>>>/a/"):(void)0;
>>
how to do it in haskell
>>
>>57219203
when (isAnime $ image op)
post "Thank you for using an anime image!\n"
>>
>>57219183
now make a pointer inside it, so you can go as deep as you want.
>>
>>57219189
> he can't even do it properly
>>
>>57219189
You're missing a parenthesis.
Or you know, you could do
op.image.isAnime() ? post("fuck you for watching anime\n>>>/a/"): post("thank you for not posting anime");
>>
>>57219238
>>57219250
I r-rused you
>>
>>57219189
>(void) 0

How can you just cast something into the void like that?
Have you no heart?
>>
>>57219250
You really need to fucking end yourself, holy shit dude
post(op.image.isAnime() ? "fuck you for watching anime\n>>>/a/" : "thank you for not posting anime");
>>
>>57219267
It's ok anon
>>
Best resource for getting up to speed with Haskell, coming from a C++ background?
>>
>>57219287
post("fite me 1v1 i swr on me mum ill rekt u son")
>>
>>57219309
DMT
>>
What are some good projects where I can apply and exercise my (somewhat shallow) knowledge of data structures and algorithms?
>>
File: 1473240801317.png (12KB, 880x131px) Image search: [Google]
1473240801317.png
12KB, 880x131px
>>57219250
;)
>>
>>57218927
>Though the pay's not great, spending time at work rather than looking for a job and lazing around the house is probably a good idea.
It is, your parents will be happy to see you doing something instead of just shitposting
Also, work experience, even shitty one, can really help you to get a job
>>
>>57219183
struct Truthness
{
static bool isTrue(const bool &v)
{
static bool FalseValue = false;
static bool TrueValue = false;

bool truth = TrueValue;
if (v == TrueValue) {
truth = TrueValue;
} else if (v == FalseValue) {
truth = FalseValue;
}

return truth;
}
};

if (Truthness.isTrue(op.image.isAnime()) == Truthness.isTrue(true)) {
// ..
}
>>
>>57219321
write a double-linked list struct with all the useful functions (isnert, delete, append, merge, ..)
>>
>>57219329
who's that tripfag

literally no one

like seriously, wtf is that
>>
>>57219309
LYAH
http://learnyouahaskell.com/chapters

if you use windows, get haskell platform (download the installer)
>>
>>57219318
*grabs dick*
>>
File: Dimethyltryptamine_27feb.gif (277KB, 256x256px) Image search: [Google]
Dimethyltryptamine_27feb.gif
277KB, 256x256px
>>57219320
?
>>
>>57219373
Thanks.
>>
>>57219341
you blew it, works by luck though
>>
>>57218998
Well, for now, I'm hoping to get something local.
Getting a crash course in living on my own wouldn't be the worst thing, but
I also don't want to leave all my family and friends.

I could commute to new york city though. Haven't really gotten much of a response,
and I've spent so much time working with recruiters who annoy the hell out of me at this
point.
>>
how do i use this from the command line to accept something from standard input and then run on that?
(define (rh s i) 
(if (< i 10)
(begin
(display i "/n")
(rh s (+ i 1))
)
(#t)
)
)

(define (repeater s) (rh s 0))


>echo "hello world" | scheme -load repeater.scm
doesn't work, just says unbound variables hello and world
>>
How do I stop being a fucking faggot? All of my social interactions ever were extremely awkward due to my ego so high I see every subhumans as a piece of shit.
>>
>>57219542
>>>/fit/17018018

Why are you asking us?
>>
>>57219464
how long would the commute be?
you say you went to a good school. are you on speaking terms with any cs faculty? poke around for connections. even now that's the surest way to get somewhere. just some introductions
>>
>>57219397
if you have any questions just ask
>>
>>57219564
I'm underweight though.
>>
Why should I learn how to debug when I have printf ?
>>
>>57219588
That's literally a guide for underweight fucks
>>57219589
You can't printf everything
>>
>>57219542
The fact that you feel the need to ask random strangers on a Cambodian crab rearing forum for advice about this should be humbling enough.
>>
>>57219589
>>57219601
Why not just write a program that debugs everything for you? Checkmate.
>>
>>57219601
>fucks
How is this supposed to improve my social skills?

>>57219605
This is true I made lots of progress since I started browsing 4chan.
>>
>>57219589
traceprints are a powerful and basic debugging method
>>
File: 1476192694539.jpg (42KB, 380x400px) Image search: [Google]
1476192694539.jpg
42KB, 380x400px
Im self-taught java coder. while I excel on the things Im interested in and actually use for my stuff Im kinda lacking in formal shit (balancing a binary tree? well I would have to look that up...) and even more so in retarded bullshit like EE and working with the standard libraries and shit like awt/ swing gives me aids.
what should I know for getting a part-time low-level code-monkey job?
>>
>>57219619
>How is this supposed to improve my social skills?
Exercise helps a lot with anxiety and self-steem, anyways you should go to >>>/fit/ and >>>/adv/ instead of asking in /g/
>>
>>57219650
Yeah but everyone on /fit/ is a fatgot according to my social filter. I don't want to talk to them.

But I guess I'll.
>>
>>57219572
very short commute. Just two towns over.
I'm not particularly friendly with any of them.
I'd feel a little weird asking one particular professor who I know the most as to whether they could ghelp me get a job. She's always busy, and I don't think i'd be in the right.
>>
anyone has an invite for the secret dpt discord?
>>
>>57219765
No, the admin is a dark-skinned Java faggot.
Avoid this cancerous place.

Too bad it got popular.
>>
Whats a good book for starting Perl ?
>>
What's a good book on algorithms and data structures (preferably in C) for a beginner?
>>
>>57219660
Don't talk to them (I mean us). Lurk, read the sticky, and get a gym membership
Remember SS+gomad
>>
>>57219647
>>>/wdg/
>>
>>57219831
"Learning Perl"
>>
>>57219647
Oh boy
>self-taught java coder

I bet you've a mac
>>
>>57219864
nope
>>
>>57219841
Well, I'm sorry for you. I know it's hard when everyone on this society wants you to eat shit and get cancer.
>>
>>57219864
wrong, i have a chromebook. nice try
>>
>>57219913
>nice try
>Implying it's actually better
Terminate self.
>>
>>57219913
>chromebook

even worse
>>
double mycosx(double cosx, double threshold)
{
double cosFinal = 0.0;
int x=0;
while (true) {

double term = (pow(-1, myFact(x)) / (myFact(2*x)))*pow(cosx, myFact(2*x)); //cosx is the number that the user inputs
cosFinal += term;
if (term < threshold) { break; }
x++;
}
return cosFinal;
__int64 myFact(int x)
{
__int64 result = 1;
while (x > 1) {
result *= x--;
}

return result;
}


I'm using the taylor series expansion equation to try to find cosx, but I can't seem to get it. If the user enters .5 the answer for cos(.5) should equal .87758. However, I get -.5. What am I doing wrong?
>>
>>57217788
is programming apps for VR support harder than your normal everyday programming?or do you need to learn a new set of skills to program VR support?
https://www.youtube.com/watch?v=nrzmg5TeeA8
>>
C++ question.

struct A { /* members */ };
struct B { /* members */ };

struct C
{
A a{};
B b{};
};

C c = new C{};
// are c.a and c.b stack or heap allocated?
>>
>>57220237
Obviously it should have been C *c.
>>
>>57220237
c would (90% of the time) be on the heap

c concists of c.a and c.b
>>
any scheme peeps on? some guy said he uses scheme as a scripting language the other day. how do i run scheme programs from the terminal without going into the repl? i want to be able to invoke the scheme program without entering the repl myself
>>
Why doesn't my code run? I went through valgrind and there is an invalid read and an invalid write but I can't figure out why. Any help would be appreciated.
#include <stdio.h>
#include <stdlib.h>

struct stack_t{
long *data;
size_t size;
size_t i;
};

struct stack_t *init(size_t numberOfElements){
struct stack_t *s;
if(numberOfElements > 0){
s = malloc(sizeof(struct stack_t));
s->data = malloc(sizeof(long) * numberOfElements);
s->size = numberOfElements;
s->i = 0;
}else{
printf("Cannot initialize stack with size of 0 or less. NULL pointer returned!\n");
s = NULL;
}
return s;
}

void push(struct stack_t *s, long value){
if(s->i < s->size){
s->data[s->i] = value;
}else{
s->data = realloc(s->data, s->size + 16);
s->data[s->i] = value;
}
s->i++;
}

long pop(struct stack_t *s){
if(s->i > 1){
s->i--;
return s->data[s->i + 1];
}else{
printf("Cannot pop. Stack is empty. 0 returned!\n");
}
return 0;
}

void freeStack(struct stack_t *s){
free(s->data);
s->data = NULL;
free(s);
}

int main(){
struct stack_t *s;
s = init(5);
for(int i = 0; i < 5; i++)
push(s, i);
for(int i = 0; i < 5; i++)
printf("Popped: %ld!\n", pop(s));
freeStack(s);
return 0;
}
>>
>>57219945
wtf is this 2bh?
double term = (pow(-1, myFact(x)) / (myFact(2*x)))*pow(cosx, myFact(2*x));


Seriously. You're making it so much harder for yourself.

double cos(double rad, double threshold)
{
double ans=1; //This is the end product
short sign=-1; //To alternate signs
uint64_t x=2; //This is the iteration

while (true)
{
double term = std::pow(rad,x) / (double) fact(x); //Preforms simplified Taylor series iteration
ans += term * sign; //Adds/subtracts from running total
if (term < threshold) //pretty self explanatory
return ans; //No need to use "break"
x+=2; //Only even numbers are used in taylor series
sign *=-1; //Alternate signs
}
}
uint64_t fact(uint64_t x)
{
uint64_t ans=1;
for (uint64_t index=1;index<=x;index++)
ans *= index;
return ans;
}

All said and done you should use the cosine in the standard library.
>>
childhood is loving C. adulthood is realizing C++ makes more sense
>>
>>57220300
http://www.call-cc.org/

or

#! /usr/bin/env racket
>>
>>57220483
i type
#! /usr/bin/env racket hello-world.scm
in the terminal? is that what you mean?
>>
File: Untitled.png (2KB, 226x70px) Image search: [Google]
Untitled.png
2KB, 226x70px
>>57220434
I'm required to use the taylor expansion series equation for cos.
>>
>>57217788
I'm new to programming.
How do I start learning Assembly?
>>
File: 1470084118813.png (4KB, 265x259px) Image search: [Google]
1470084118813.png
4KB, 265x259px
>>57220621
And your idea is to basically copy the thing word for word?

This pic is a more understandable version of what a cosine taylor series looks like.

>>57220724
http://store.steampowered.com/app/370360/
>>
is zachtronics >our guy?
>>
>>57220757
Does anyone swear by this game?
>>
I'm alternating between floats and strings in the same variable because python allows that and it's hilarious
>>
>>57220520
You make a file, put that at the top, chmod +x the file, and execute it like ./hello-world.scm. Note that this is for linux.
>>
>>57220520
You're gonna want to slap that bitch on the first line of the file and then you can run it from the command line. ( ./hello-world.scm ) Assuming it's like Python that is
>>
>>57220858
Oh and you need to have racket installed. Looks like this is another alternative if that doesn't work. http://people.csail.mit.edu/jaffer/SCM
>>
>>57220800
It's not exactly assembly. But it's assembly like.

Also in real assembly, you're not limited to 10 lines and you have straightforward line from A to B.

This assembly is more like 9 different programs running at once, each program running side by side, with no random access memory, and a limited file size of 10 lines

All in all, it's a bretty good game.
>>
>>57220300
Here's what I use http://stackoverflow.com/questions/26008748/how-do-you-run-a-scheme-program-in-the-terminal-of-ubuntu
>>
What's the difference between non-blocking and asynchronous I/O?
>>
>>57220357
If it compiles fine then surely it runs up until some point and then stops right? In which case just run it through gdb and take a closer look at the line it stops at.
>>
>>57220800
Oh, I've seen that. It's not shit, and it will help.
>>
>>57220933
It sounds like you're talking about parallel vs interleaving, are you?
>>
>>57220933
https://en.wikipedia.org/wiki/Asynchronous_I/O#Forms

You're gonna have to be more specific.
>>
>>57220952
No, I mean I/O where you call a function and it doesn't block the current thread.
>>
>>57220964
I mean select/poll/epoll and completion queues. There's some wizardry going on with that stuff that I don't understand. Apparently I can only epoll on sockets, not files
>>
File: image.png (335KB, 1680x1050px) Image search: [Google]
image.png
335KB, 1680x1050px
>>57219321
A video game.

>>57217788
>Do you even program?
An Uu encoder for r/dailyprogrammer #279 easy.

>>57217788
Thank you for using an anime image.
>>
>>57220933
http://stackoverflow.com/a/10570261
>>
>reddit
>>
>>57219512
Seems like (in Guile at least) the relevant procedure you want is
(command-line)
.

https://www.gnu.org/software/guile/docs/docs-1.6/guile-ref/Command-Line-Args.html
>>
>>57219647
Pick up a book on algorithms.
>>
File: 1476425165265.jpg (69KB, 598x676px) Image search: [Google]
1476425165265.jpg
69KB, 598x676px
Anyone good at working with arrays in vb.net here?
>>
>>57221053
what is this amazing font
>>
>>57219834
the third edition of sedgewick's book has versions specifically for c, c++, and java
the organization might be bad for your purpose but check out an ebook copy and see. i can't think of another book that isn't heavy on pseudocode
>>
File: sicploli.png (631KB, 1111x1600px) Image search: [Google]
sicploli.png
631KB, 1111x1600px
>>57221182
One of the rare dpt approved fonts
https://github.com/belluzj/fantasque-sans
>>
>>57221066
I understand that. Node.js uses non-blocking I/O, not exactly asynchronous I/O.

What I don't see is why I can't epoll on regular files? They just return a ready event immediately because a local file is always available, while socket miggt not actually have data to read
>>
>1970+1477339625s
>he doesn't use material design exclusively.

What's your excuse?
>>
>>57221213
I use Noto Mono for dat Unicode support
>>
>>57221251
a local file is not always available though. sometimes there's lag.
>>
>>57219831
The Camel Book
>>
>>57221251
>They just return a ready event immediately because a local file is always available
what if a process want to read it while another is currently writing to it?
>>
>>57220858
tells me
me@me:~/misc$ ./hello-world.scm
default-load-handler: expected a `module' declaration
found: something else
in: #<path:/home/me/misc/hello-world.scm>
context...:
standard-module-name-resolver


this is the file
#! /usr/bin/env racket

(display "Hello World")
(newline)
>>
>>57221339
#! /usr/bin/env racket
#lang racket ; alternatively #lang r5rs

(display "Hello World")
(newline)
>>
>>57221323
You just read (potentially) mangled data.
>>
>>57221339
specifiy the language. eg
#! /usr/bin/env racket

#!racket

(display "Hello World")
(newline)


use #!r6rs for scheme or execute your file with plt-r6rs

>>57221392
depends, io operations are atomic on linux.
>>
>>57221379
nice! works. it's got a bit of a latency between the call and the output, but oh well
>>
File: 59535825_p0.jpg (729KB, 1000x1000px) Image search: [Google]
59535825_p0.jpg
729KB, 1000x1000px
k folks, this is the ranking of all tripfags in /g/:
http://pastebin.com/03CVZgy0
>>
>>57221472
they should all hang
i think that's the best solution for everyone
>>
>>57221472
>tripfags
Can we not? It just feeds them attention.
>>
>>57221472
I thought Gilded Anonymous was just a namefag
>>
>>57221486
>>57221501
Bad press is still press I guess. Most of them are under the average rating of all anonymous (0.91) though.
>>
>>57221508
>>57221472
not even a namefag

https://archive.rebeccablacktech.com/g/?task=search2&ghost=yes&search_text=&search_subject=&search_username=Gilded+Anonymous&search_tripcode=&search_email=&search_filename=&search_datefrom=&search_dateto=&search_media_hash=&search_op=all&search_del=dontcare&search_int=dontcare&search_ord=new&search_res=post
>>
>>57221501
Thing is that you're replying to one of them.
>>
>>57221551
that's dedication
>>
>>57221437
Well, under the hood
#lang racket
has a whole lot of baggage. If you're doing really simple stuff then you could get away with
#lang racket/base
which may increase the startup speeds for your scripts.
>>
I have a Python web server program that uses the web module to serve pages. It uses MySQL for the database.

I have no long running queries since the program gets results from the queries which always finish to display data to the user on the web interface.

Why am I getting "MySQL server has gone away" errors every 24 hours? The same code used to run for a month continuously.
>>
Anyone get easily bored of programming things as soon as you figure out the solution? Like any time I try to bring myself to completing a piece of software that's actually useful, I map out the challenges, prototype the hard stuff, verify it works, and then just kind of give up. I guess I program mostly to satisfy my intellectual curiosity. But unless you're doing cutting edge research, that rarely brings home any money. I'm scared that if I get a programming job I'll just hate it because I'll be forced to write javascript frontends or something.

tl;dr how do I fix my life?
>>
Hey /dpt/, as someone who has only really programmed in C++ and dabbled in Java, and wanting to branch out and learn other languages.

What would honestly be the best language for creating an application to run through a website?

I was wanting to try and create a chatterbot along the lines of cleverbot, just to fuck around and get some practice with some simple AI programming, while getting some web development experience as well.
>>
File: euphoric tip.jpg (42KB, 479x720px) Image search: [Google]
euphoric tip.jpg
42KB, 479x720px
>>57222043
>i program for the challenge
>>
>>57222043
>tl;dr how do I fix my life?

Get into Cyber Security.
>>
Makin an ordered list with a singly linked list and a dynamic array for class.
I'm an EE, fuck this OOP shit. I wish i was doing C
>>
>>57221472
timeframe? how come I haven't seen lots of those names/trips?
>>
>>57222043
No this is typical. You burn out basically and happens to anyone with anything. If the effort needed to do something is greater than the enjoyment garnered from the actual thing, its likely to happy. Because you either burnout and stop caring or you care more about doing it than the actual thing.
Take minecraft for instance. If I want to create a cool world for me and my friends to dick around in, it takes way too long to actually implement and its not worth the effort, But the challenge of doing it is enticing.
>>
Is there a c++gui thing as simple and androids gradle projects.
>>
>>57218717
Newfag here. How do you make those white boxes?
>>
Best functional language to learn? I mean, something that's actually useful in the real world?
>>
>>57222158
Haskell
>>
>>57222156
//Nesting code blocks isn't going to work, is it.
>>
>>57222174
But Haskell is useless.
>>
>>57222094
I've considered it, and it's something I'm interested in, but it seems like most of it is just banging your head against a wall with as many pre-made tools as you can until eventually there's a crack.

>>57222128
Minecraft is a funny example because a while ago I took on a really big minecraft project with a few friends and we only ever got about 10% through. Just enough to see that "oh, this is actually possible, it's just gonna take a really long time".

The question remains though, how do you overcome that kind of... laziness? If that's what it is. Does it take motivation, discipline, or something else entirely?
>>
>>57222191
???
>>
>>57222208
https://youtu.be/UMbc6iyH-xQ
>>
>>57222191
//What's the escape character?\[\/\c\o\d\e\]
>>
>>57222264
//meep\
>>
>>57222283
[ c o d e ]//remove the spaces[ / c o d e ]
>>
>>57222156

>>57222298
>>
>>57222222
sweet digits
>>
>>57220757
>And your idea is to basically copy the thing word for word?

That's what the professor said to do. We are not allowed any other way.
>>
>>57222336
the zed shaw school of programming
>>
>>57222339
You're welcome to school me, if you know better.
>>
>>57222251
>facebook
>>
File: 1470227952908-3.jpg (14KB, 234x255px) Image search: [Google]
1470227952908-3.jpg
14KB, 234x255px
>>57222298
arigatou gozaimas!
>>
>>57222158
Racket
>>
>>57222073
What are you doing on /g/?
>>
>>57222043
>>57222226
study artificial intelligence. i recommend this to very few people but for you i'm serious. most of the field is open research problems, the online self-education resources are excellent, and it's an incredible source of jobs right now

start with "data science" but don't get bogged down there and flee quickly into the pure realm of linear algebraic constructs like contemporary neural nets or whatever
>>
>>57222445
*What are you working on, /g/?
>>
>>57222408
Never heard of anything done in Racket.

Come to think of it, i've never heard of anything done in any functional language, besides facebook using Haskell. So i guess Haskell it'll be.
>>
>>57222376
i'm not coming after you. it just reminds me of his "______ the hard way" books. i don't know if it's a good idea or not
he is kinda funny to think about though
>>
>>57222408
Recommend me a good book about programming.

Please. I only have my old (2009 old) Programming in C book with mahmen Ritchie as co-author.
>>
>>57220237
new invokes the allocator, then invokes the constructor on that allocated space, and then returns a pointer to the allocated space. so it's on the heap (unless you have overrode the allocator is a truly satanic way)

so heap, and it should be C *c.
>>
>>57222483
Aww. I was actually hoping you WOULD drop some knowledge on me.
>>
>>57218776
>>57218819
Fortran is faster than C because Fortran has different aliasing rules for pointer arguments. in C, pointer arguments are assumed to alias unless stated otherwise ("restrict" keyword). in Fortran, pointer arguments are assumed to NOT alias. this ellides many checks and enables many optimizations, especially when iterating operators over large arrays of numbers

>>57219020
haskell's math performance is garbage
>>
>>57222639
That's why is restrict all of my high performance scientific computations.
>>
>>57222450
Yeah I've been meaning to take a look at some AI things but I've never gotten around to it beyond just reading up on the basic concepts. Closest thing I've done is NLP. Thanks for the suggestion anon!
>>
>>57222685
there is a stanford machine learning course on coursera that is a decent introduction. it is definitely an intro and you should try to move on from there, but depending on your background in linear algebra/statistics it could be a breeze or a decent challenge
>>
>>57222118
Lots of them are just op typing in the wrong input field.
The oldest thread is from 9 days ago.
>>
post programming themes

programming in java
https://www.youtube.com/watch?v=kJa2kwoZ2a4

vs programming in scheme
https://www.youtube.com/watch?v=_EbkSMPbj_I
>>
>>57217788
im writing my own cryptolocker variant. im not using public key encryption, im instead going the lazy route with AES256 (symmetrical block cipher).

The key is determined via the md5 hash of the 'VolumeSerialNumber' of the logical disk for the C drive. I then convert that hash value to sha256 for use with AES. There is no CNC to reach out to. It doesn't call home. All that is displayed is a buttcoin address. I'm almost done coding the thing.
>>
>>57222929
What did he mean by this?
>>
File: image.png (6KB, 357x188px) Image search: [Google]
image.png
6KB, 357x188px
Just beginning in Java and I'm trying to convert a string into an array.


E.G:
String p = "Hello";
String[] array = {"H","e","l","l","o"};

Image is what I've tried but it keeps crashing with 'Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0'
>>
>>57220357
When you've pushed 5 values s->i will be 5.
So what happens in pop()?
    if(s->i > 1){
s->i--;
return s->data[s->i + 1];

you decrement s->i to 4, but then you add 1 back again, meaning you're accessing s->data[5] which doesn't exist.
>>
any cl fags here?
just included a system with asdf, and I need to list the exported symbols of a package
(apropos "package" 'cl)
returns symbols with names that don't describe what I want

or is this done by looking at the packages.lisp

also, how do I into documentation
>>
>>57222993
String.split()

Also, don't do Java.
>>
>>57222993
there's probably an import that'll put a string into an array of characters for you
>>
>>57211680
>what are you trying to do?
I have made a classifier package, basically to refine my ML knowledge. If I can implement it, I understood it. I've looked into rapid miner and that's basically something I'd like to clone, although with less functionality.

>nice, which ones?
Found this one the last night to be the best: https://www.youtube.com/watch?v=eKD5gxPPeY0
>>
>>57223022
Thanks; part of my course.
>>57222929
https://www.youtube.com/watch?v=BhB6Lb7_kN8&list=RDpEJrT6TA8_Q&index=20
>>
>>57222499
In no particular order:
The Little Schemer
The Seasoned Schemer
The Scheme Programming Language by Kent Dybvig
SICP if you're feeling frisky

All of the above can be completed with Racket. There's even a sicp package you can install so you can place
#lang sicp
at the top of the program and it'll work just fine.
>>
>>57222469
yotsubAPI uses Racket
Ivy Image Viewer uses Racket
xmonad uses Haskell
A number banks use Clojure
Some train stations in Europe use Common Lisp

John Carmack is working to get Racket working on the Occulus Rift.
>>
>>57223043
Cheers found one.
System.out.print("p = ");
p = keyboard.nextLine();
char[] pArray = p.toCharArray();
>>
>>57222499
>>57223148
I said "in no particular order", but "The Seasoned Schemer" is actually a sequel to "The Little Schemer".

Oh! I forgot Realm of Racket as well, but if you've read the others then it's not as important. The Racket documentation itself is pretty amazing, so don't forget that.
>>
http://www.strawpoll.me/11499561
>>
>>57217788
>install clang
>does not come with its own linker
fucking dropped. win7 btw so gcc is kinda a pain in the butt.
>>
How did you guys learn how to program?
>>
LINQ is turning me into a god damned retard, I can no longer structure a program manipulating collections using anything but lists.
>>
>>57223293
introduction to algorithmic problem solving, the freshman programming class in java at my university
>>
>>57223293
I went to school for it.
>>
>>57223300
You're wrong. It's making you smarter.
>>
File: 1475148912454.gif (2MB, 500x375px) Image search: [Google]
1475148912454.gif
2MB, 500x375px
>>57223293
Visual Basic
[spoiler]I know i'm a pleb but I'm here now :^)[/spoiler]
>>
>>57223293
Got a book "Turbo Pascal 4.0" along with a compiler and another book with "advanced" code examples. Typing the examples from the book with the drive to manipulate and expand them was enough to stir my curiosity.
>>
>>57223293
I started with QBASIC.

The langugae of GOD
>>
>>57223325
Yeah, why would you ever want any collection other than a list?
>>
>>57223358
indeed.

LINQ turns everything into an IEnumerable btw though.
>>
>>57219647
>self-taught java coder
there's probably no helping you, you're already a lost cause. Java degenerates beginner brains. You might as well accept it and make money sucking dick.

If there is a way to fix you, it's porbably a strict diet of C, an algorhithm book and solving some algorithm problems.
>>
>>57223300
Don't forget HashMaps anon :^)
>>
>>57223390
Self taught might actually be a good thing. It's possible that, lacking an authority figure who forces OOP principles, the OOP damage hasn't struck too deep.
>>
>>57223375
Yeah, but lists are the goto typing whenever you need to actually save the data as it is the smoothest conversion to and from IEnumerables.
>>
>>57223426
tfw you realize oop'ers go for the order ending in SMT games
>>
>>57223478
I don't know what that is or means.
>>
I'm free! I finally uninstalled Java.

>inb4 tomorrow some project will come across my desk that will force me to reinstall it
>>
File: hask.png (32KB, 1000x1000px) Image search: [Google]
hask.png
32KB, 1000x1000px
>>57223642
Have you finally seen the glorious light of Functional Purity?
>>
>>57223642
The neverending story.
>>
>>57223293
Started writing little VBS scripts, then Java. Which messed me up pretty badly so I went over to C, which set me straight for learning anything else now. Functional is still hard for me though.
>>
>>57223657
Functional programmers are the hipsters of the programming world.

hurrr i can use tedious definitions of convoluted functions to represent data arent i cool
>>
File: 1450403019430.jpg (272KB, 1920x1080px) Image search: [Google]
1450403019430.jpg
272KB, 1920x1080px
>>57223293
I learned C in high school and went around all the algorithm programming competitions I could get to just so I could ditch school without getting in trouble. It was so much fun...I miss high school...brb going to watch keion again...
>>
What do you guys think of graphs? Do you like working with them?
>>
>>57223805
Most efficient data structure ever.
>>
>>57223844

Wrong

t. DJT
>>
>>57223876
Everything is a graph. Prove me wrong.

>You can't.
>>
>>57223844
>not linked lists
>>
>>57223939
>implying linked lists aren't a subset of graphs
>>
>>57223905

That's just categorically incorrect.
>>
>>57220237
The question is why you're exposing your new and using pointers.
>>
>>57223939
LinkedList is a subest of graph theory.

>>57223970
Not an argument.
>>
I've never used arrays higher dimension than 2. How high have you guys gotten?
>>
>>57220237
heap obviously.
>>
>>57224019
3
>>
File: yes.jpg (63KB, 625x564px) Image search: [Google]
yes.jpg
63KB, 625x564px
>>57224019
>How high have you guys gotten?
yes.

j/k. 6 was afair the highest. I tend to avoid this, though.
>>
need a crash course on data structures, anybody have any good ones? Particularly binary trees and ones to help with loading meshes in/out based on your position

>>57224019
3 as well, but at that point there are better options like xml nodes
>>
What is good music to listen to while programming?
>>
>>57224173
patrician level is none
>>
>>57224056
epic dude! DAE weed lmao? XD. /r/trees anyone?! lol!!
>>
>>57224173
https://www.youtube.com/watch?v=Fz2kTvbzXqo
>>
File: bong.jpg (406KB, 2048x1516px) Image search: [Google]
bong.jpg
406KB, 2048x1516px
>>57224173
autotuned kqts
>>
>>57224180
How can you concentrate with dead silence?
>>
>>57224173
I don't usually listen to music while programming, but while compiling large programs I listen to death metal.
>>
>>57224219
by being a normal human
>>
>>57224173
Boards of Canada
>>
>>57224173
rainymood
>>
>>57224219
by not having ADHD?

                                                                                                                       //i only have ADD
>>
>>57224173
I listen to the sound of my neurons firing when I program.
>>
>>57224274
This.
That's funny actually. I'm easily distracted, but when I got something like music to be distracted to, I can continue working.
>>
>>57224173
Personally I like listening to piano/classical music, sometimes electronic (like trance), depending on my mood.
>>
Tail call optimization

amidoinitrite?

quotient :: Nat -> Nat -> Nat
quotient x y = quotientAux x y O
where
quotientAux :: Nat -> Nat -> Nat -> Nat
quotientAux x y acc
| lt x y = acc
| otherwise = (quotientAux $! (minus x y)) y $! (S acc)
>>
lowerCamelCase or lowercase_separated_by_underscores for Function names?
>>
>>57224470
all uppercase with underscores and german.

Programming is not for the weak.
>>
>>57224470
lowerCamelCase and also call them methods
>>
File: 1450800412185.png (2MB, 1920x1080px) Image search: [Google]
1450800412185.png
2MB, 1920x1080px
>>57224173
Doesn't it depend on your mood? For me, I always feel like listening to something different so I make a new playlist like every week. But here are some of my favourites:

https://www.youtube.com/watch?v=CYNBOAoXReQ

https://www.youtube.com/watch?v=JQRsCXY5MGA

https://www.youtube.com/watch?v=JwhjqdSPw5g

https://www.youtube.com/watch?v=L1hMTa4REJs

https://www.youtube.com/watch?v=M2mZ-K7h0UM

https://www.youtube.com/watch?v=kk0WRHV_vt8
>>
>>57224470
neither
lower-case-separated-by-dashes
is better
lisp masterrace
eat shit, nigger
>>
>>57224173
https://www.youtube.com/watch?v=DfqlbHadp40

On repeat.
>>
>>57224513
this desu senpai
>>
>>57224498
Methods and functions are not the same. While all methods are functions, not all functions are methods. Methods are functions dependent on an object.
>>
File: 1477072789751.png (1MB, 1295x827px) Image search: [Google]
1477072789751.png
1MB, 1295x827px
>nearly done with the semester
>still the only github contributor for group project
>>
>>57224470
lowerCamelCase for variable
UpperCamelCase for functions
underscoreForAdditional_qualifier or when i just think it looks_nice
>>
>>57224549
Normalfags ruin everything and take everything ruined and make it even worse.
>>
>>57224545
then require every function to be dependent on an object
>>
>>57224560
disgusting
>>
>>57224173
A more interesting question would be: Is there any types of music that has a negative correlation with programmer types?
>>
>>57224470
snake_case for certain languages and also in non-member functions
>>
File: frog happy.png (32KB, 240x186px) Image search: [Google]
frog happy.png
32KB, 240x186px
>>57224549
That happened to me and a friend, anon.

>Working with two other guys on an entire semester CS project
>No commits from other schmucks
>End of term comes along
>Peer review
>Tell it like it is, tell the teacher we did everything and they did nothing and the commits prove it
>The other guys have to retake the class

Get your retribution.
>>
>>57224522
would be way better without the keyboard sounds.
>>
>>57224665
tfw getting a computer information system degree. tfw there's a project where it's peer reviewed. tfw retarded and probably won't contribute much. tfw group will probably hate me and talk bad about me. tfw will have to re-take the course and the same thing will happen. What can I do?
>>
>>57224470
I prefer just lowercasenounderscore, but can't say I really care that much, have used all kinds of styles.
>>
>>57224747
apply yourself
>>
>>57224747
Let me tell you the great secret of group projects, anon. If you don't want to work, lead. Take charge in your group. Act authoritative and schedule the meetings and set up a google drive folder for collaboration. Always attend the meetings. Give whatever input you can, it doesn't have to be much. I guarantee that people will think you did a lot of work even if you did almost none at all.
>>
>>57224747
In my experience with group projects, other group members are often forgiving of how much or little you contribute as long as you're being active and interested, and show that you're trying your very best.
>>
I'm trying to take my following C# code for a linked list class (using generics) and recreate in in C++ using templates. I

C# Class: http://pastebin.com/XgB6T527

Header: http://pastebin.com/bGHjssmN
CPP: http://pastebin.com/jtHL2wwj
Main: http://pastebin.com/CipnM042

Anyone have any ideas? I'm new to generic data structures and I've never done templates in C++, so this was my first attempt at utilizing them.
>>
>>57224816
Templates don't work like that in sepples.
You got to stick all your code in the .h file, or include the .cpp file in main.
I know, it's confusing.
>>
>>57224861
Fucking c++ this is why I prefer C so I don't have to use sepples shitty classes. Do all the methods need to be inline then? Most of the errors I get are weird symbol/linker related errors.
>>
Is there a list of programming challenges all in an image?
>>
>>57224917
No, there isn't. Fuck off.
>>
>>57224917
There is one floating around /g/, someone will probably post it but in the meantime you might do well to search "programming challenges" on RBT's /g/ archive.
>>
New thread:
>>57224975
>>57224975
>>57224975
>>
>>57224894
Only all the methods that depend on any template variable. I think.
C++ compiles different versions of templated instances depending on the template argument types, which means that you can't just compile and link the cpp file like you normally would. When compiling the cpp file the compiler sees that nothing is calling any templated functions in that translation unit, so goes "fuck it, i ain't compiling shit here"
>>
>>57224992
which is why you get the linker errors
>>
>>57224894
> Do all the methods need to be inline then?
In a template: yes. All methods are implicitly inline.

You can't compile a template. You can only compile a specific instantiation of a template. So each time you instantiate a template with specific parameters, the compiler has to compile that instantiation.

If you will only ever instantiate a template for a fixed set of parameters, you can put the method definitions in a .cpp file and explicitly instantiate the template in that file.
>>
>>57225227
By programming real applications, and butting heads with real world problems.
Thread posts: 316
Thread images: 30


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