[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 23
File: 1458424060664.png (7 KB, 525x137) Image search: [Google]
1458424060664.png
7 KB, 525x137
Previous thread: >>53582261

What are you working on, /g/?
>>
>>53589797
Addiction.
>>
File: confused.gif (1 MB, 380x285) Image search: [Google]
confused.gif
1 MB, 380x285
>>53589797
Learning C++
Idk why. I know a few languages but still don't know how to program. Anyone else know this feel?
>>
second for i love all of you
>>
>>53589836
god dammit man
>>
>>53589836
stick with C++ until you know how to program
>>
>note: containing loop
>for(unsigned int i = 0U; i != 5U; ++i) {
WHAT
>>
>>53589904
that's a big loop
>>
>>53589918
4U
>>
>>53589924
KEK
>>
>>53589904
who are you quoting?
>>
>>53589942
GCC

with the limited console output i get with my broken eclipse+ndk shit. i got the full compiler output for a while but not any more
>>
>>53589904
>>53589962
nvm i was going out of bounds on an array

"note: containing loop" is gcc's shitty way of warning about undefined behavior
>>
File: game eng.webm (3 MB, 1280x720) Image search: [Google]
game eng.webm
3 MB, 1280x720
pls rate my cross platform game engine written with C++ and OpenGL 3.3
>>
I'm in a beginner c++ course working on a basic rock, paper, scissors game using function. For whatever reason, I'm getting an error saying
 no matching function call to 'std::basic_string<char>::basic_string(int&, std::string&)' 
and I have no idea why.

Is it possible to pass strings like this through a function? Here's a pastebin for my code: http://pastebin.com/HmR2krRU
>>
>>53590091
looks cool but the frame rate better be 60+ when not recording
>>
>>53590149
debug mode (-O0) and screen capture, so yeah.
>>
>>53590091
>C++
>All these jewish non-free software
>>
File: tumblr_m68indH4Ml1qgha61o1_500.jpg (66 KB, 500x375) Image search: [Google]
tumblr_m68indH4Ml1qgha61o1_500.jpg
66 KB, 500x375
What do you usually drink while coding?
>>
>>53590225
arizona tea
>>
>>53590225
green tea
>>
>>53590248
I used to love it but then my stomach got fucked.
>>
>>53590271
what happened anon?
>>
>>53590221
enjoy writing over 100 lines of code with vim and emacs.
>>
>>53590279
Every time I drink or eat acid-ish stuff (any fruit for example) my stomach makes some weird white snot/slimy stuff that I throw up from my mouth and it feels really weird.
>>
>>53590311
Jokes on you, I use kate.
>>
>>53590225
Water. I probably drink a gallon of water a day.
>>
>>53590319
I think you acid reflux, buddy.
>>
>>53590319
gross
have you seen a doctor yet? i imagine you have but that doesn't sound very healthy
>>
>>53590376
>have you seen a doctor yet?
Yes, I got lansoprazole for a while and I am a bit better now but sometimes it still does it.
>>
File: 1457356334210.jpg (88 KB, 587x443) Image search: [Google]
1457356334210.jpg
88 KB, 587x443
What book under 500 pages could I read to become far better at computer science compared to most other computer scientists?
>>
File: _DSC1778.jpg (168 KB, 1000x667) Image search: [Google]
_DSC1778.jpg
168 KB, 1000x667
>>53590464
>>
>>53590311
$ find ./ -name "*.c" -o -name "*.cp" -o -name "*.hs" -o -name "*.java" -o -name "*.py" -o -name "*.js" | xargs cat | wc -l
48456

but anon I already have
>>
>no constexpr in C
i'm officially using "C++" again
>>
>>53590464
SICP
>>
>>53590559
>800 < 500
>>
>>53590571
then just do select chapters whose sum are less than 500 pages.
>>
>>53590541
>no designated initializers in C++
back to "C" again
>>
>>53590622
>no OO clusterfuck in C
back to """C++""" I guess
>>
>>53590622
nah i don't need those
>>
>>53590680
yeah, nobody needs C++
>>
>>53590149
give him a break, it's running on a mac so it's underclocked and thermal throttled to hell
>>
nested functions are neat if it's a function that will only be used in one other function

why won't they add it to C++
>>
How do I declare a 2D array of c_strings?
>>
>>53590764
like what, you can return a lambda from a function if that's what you mean
>>
>>53590779
char *array[2][2];

you're probably already fucking up if you need a 2 dimensional array though
>>
>>53590790
void someshit() {
float lerp(float a, float b, float x) {
>>
File: halppls.png (19 KB, 988x295) Image search: [Google]
halppls.png
19 KB, 988x295
Why is it when I compile a .h file into an executable, I get the following error, but when I compile it into an executable from .cpp, it works fine?

The code in question is
#include <windows.h>

using namespace std;

int main (int argc, char**argv) {
int input = MessageBox(0,
argc > 1 ? argv[1] : "",
argc > 2 ? argv[2] : "Question",
MB_YESNO + MB_ICONQUESTION);

input == IDYES ? MessageBox(0,"you said yes","Yes",0) : MessageBox(0,"you must have said no","No",0);
}
>>
>>53590814
And that defines lerp within someshit's scope? Then yeah you can do that:
void someshit()
{
auto lerp = [](float a, float b, float c) -> float {
return 0;
};

const float ret = lerp(1, 2, 3);
}
>>
>>53590819
.h is a header file. .c or .cpp is the implementation file.
>>
>>53589797
I wanna make a game with batch. Is this possible? I trying to make a rts game like
>>
>>53590805
I'm making Conway's Game Of Life, so I need a 2d array which will be the plate. If a cells gets close to the plates bounds I realloc to create the illusion of a infinite field. That why i need a 2d array of pointers.
>>
>>53590864
if you want graphics - no. if it's text based - yea why not, but i can't really see how you can make a text based rts
>>
File: nim-language.png (221 KB, 721x468) Image search: [Google]
nim-language.png
221 KB, 721x468
Has anyone used Nim language? It is a good language to learn?
>>
File: screenshot_00034720160320134202.png (758 KB, 1920x1080) Image search: [Google]
screenshot_00034720160320134202.png
758 KB, 1920x1080
Here's to learning another language.
>>
>>53590930
No
>>
>>53590878
yeah that sounds fine. just be careful if you're passing the array around to functions. multi-dimensional arrays don't work like you'd expect in C as function arguments.
>>
>>53590933
welcome to C
>>
>>53590933
Glad you picked my favorite :)
>>
>>53590559
Garbage
>>
>>53590819
The compiler does not link the object file into an executable by default when you compile a header.
>>
>>53590956
No for "not using the language" or no for "it is not a good language"?
>>
>>53590980
Not a good language.
>>
>>53590957
Yea but how do i declare that array?
>>
Be honest, programming is boring as shit.

Like a slave building a pyramid, the end result can be amazing but the process is fucking boring.
>>
>>53591031
nah man it's fun
>>
>>53591031
Agree with you, depending of what project you're working and how you're feeling about it, it can be fun
>>
I'm learning Java.
Why the FUCK do array sizes have to be declared up front?
Why are array sizes static?
>>
>>53591031
The problem solving part is fun.
>>
>>53591014
by explicitly passing the length of the dimensions.

function (char* array [SIZE][SIZE]) should work
>>
>>53591031
Not if you're doing interesting algorithmic work i.e. you took math seriously in college.
>>
>>53591081
Because arrays have a fixed size. Use an ArrayList if you want do grow/shrink functionality.
>>
>>53590845
cool
>>
>>53591123
>not if you're doing interesting work
>oh and by the way i find algorithmic work interesting
you know these should be separated, right? they're not inherently connected.
>>
>>53590334
Drinking too much water can be bad for you. You space it out evenly throughout the day right?
>>
>>53591159
it takes more than a gallon for water poisoning
>>
>>53591111
Doesn't that defeat the purpouse? I need to be able to change the size later
>>
>>53591183
that's why multidimensional arrays in C are bad and why I said you are fucking up

I suggest just an array of structs with the info you need
>>
>>53591198
>multidimensional arrays in C are bad
anon...
>>
Can someone [post the programming challenge pic?
>>
>>53591229
archives exist
>>
File: 1438960401975.png (302 KB, 1920x1080) Image search: [Google]
1438960401975.png
302 KB, 1920x1080
>>53591229
>>
>>53591227
bad for his purposes.
>>
>>53591198
I guess I'll try that. Sounds like spaghetti code doe
>>
>>53591274
holy...
>>
>>53591338
?
>>
>>53591258
I don't feel like going through random archives nor would I know what to search for.

>>53591274
Do you have the one that classifies each task by difficulty?
>>
>>53591349
>
great challanges
>>
>>53591274
why now people are gonna keep rolling for half the thread, should have just linked to the onlinbe roll
>>
>>53589836
>Spends all their time learning languages
>Wonder why they can't program.

Anon, you do know you're allowed to do more than just learn "hello world".
>>
SFML or SDL? Why?
>>
>>53591420
Sorry anon I don't...

>>53591423
I'm not sure If you are being sarcastic and implying that they are easy or you are being genuinely amazed
>>
I can't create an array that has 100 random numbers with an allowed value of 0-9, and then prints out in rows of 10 with the array sorted from smallest to largest in Java, I'm retarded and it's making me sad.
>>
>>53591472
SDL. Because /g/.
>>
>>53591430
Online roll?
>>
>>53590622
>mfw C++ isn't DESIGNATED enough
>>
>>53591493
https://better-dpt-roll.github.io/
>>
>>53591476
I don't know java but it shouldn't be too hard. If its 100 numbers just write a insert sort(google it).
The a for loop that counts to ten in a for loop that counts to 10 for printing. Feel free to post code if you have a problem
>>
>>53591485
sorry, but why "because /g/"?
>>
>>53591472
Both shit but go for SDL because C.
>>
>>53591559
there's a better option?
>>
>>53591580
No but that alone does not make either of these libs automatically good.
>>
This is valid C syntax:
int array[500];
int x = 200[array];
>>
>>53591666
what does the 2nd declaration even do
>>
>>53591502
how is it better it isn't even the same
>>
>>53591690
it's the same as array[200] so it assigns the value of 200th element to x
>>
>>53591666
Syntax only. Because it is undefined behavior.
>>
>>53591708
>200th
201th
>>
>>53591732
>201th
201st
>>
>>53591732
two hundred and oneth
>>
File: 1619754010.jpg (76 KB, 600x732) Image search: [Google]
1619754010.jpg
76 KB, 600x732
>>53590819
>MB_YESNO + MB_ICONQUESTION
>>
>>53590930
it's nice, but I feel like crystal will be better if/when it gets Windows support
>>
>>53591975

WinApi is goat.
>>
File: 1296883567435.jpg (541 KB, 864x576) Image search: [Google]
1296883567435.jpg
541 KB, 864x576
>>53592041
>MB_YESNO | MB_ICONQUESTION
>>
>>53592123

I can't be blamed for: 1. not reading, 2. user error.

Most people just insult WinApi, so I had to strike back immediately.
>>
im not really actively working on anything, but im enjoying learning about neural networks with python. calculus is a little confusing at times, but maybe im just using the wrong resources
>>
>>53590528
nice.

$ for i in c h cpp hpp java hs py; do echo -n "$i: "; find -name "*.$i" -type f -exec cat {} \; | wc -l; done | awk 'BEGIN {total=0} {total += $2; print $0} END { print "Total: " total}'
c: 1514745
h: 25990
cpp: 32592
hpp: 17792
java: 6606
hs: 512
py: 7083
Total: 1605320
>>
>>53589797
So I've installed debian and I'm learning to C using RItchie's and some other books + the interwebs. Why my code repeats itself without waiting for the 'y' input? And what you think of Nano? I'm finding linux and Nano very nice. (NEver used any of them, it's weird to go out of the "windows mindset")
#include <stdio.h>
int main()
{
int a, b , c;
char ch;
while (1){
printf ("Type 2 numbers \n");
scanf ("%d%d", &a, &b);
c = a + b;
printf ("Sum:%d \n", c);
printf ("Do you wish to repeat(y/n)?\n");
scanf ("%c", &ch);
if (ch = 'y')
continue;
else
break;

}
return 0;
}
>>
File: 1424571701728.jpg (19 KB, 500x500) Image search: [Google]
1424571701728.jpg
19 KB, 500x500
>trying to do some FFI with hsc2hs
>include library header
>doesn't define MinGW flags like __GNUC__ or _WIN32 so certain things break
>fix that by defining them myself beforehand (dunno if this will work indefinitely...)
>fails upon encountering a C99-style (//) comment
>>
>>53592298
>>doesn't define MinGW flags like __GNUC__ or _WIN32 so certain things break
What? The header? Why would they do it?
>>
>>53592333
No, I mean whatever preprocessor hsc2hs runs doesn't, even though it's trying to use the MinGW that is distributed with GHC.
>>
>>53592281
#include <stdio.h>
#include <string.h>

int main()
{
int a, b;
char ch[1];
while (1) {
printf ("Type 2 numbers \n");
scanf ("%d%d", &a, &b);
printf ("Sum:%d \n", a + b);
printf ("Do you wish to repeat(y/n)?\n");
scanf ("%s",ch);

if (strcmp(ch,"y") == 0)
continue;
else
break;
}
return 0;
}
>>
>>53592365
*MinGW headers
>>
>>53592365
Good, you should not rely on undefined behaviour like this.
>>
>>53592390
It's not undefined behaviour, it's implementation-defined. And that's how this implementation works.
>>
>>53592298
>had my file as .hs instead of .hsc
Well, that was dumb.
>>
>>53592411
Defining things that start with __ is UB. Thus it relies on a result of UB.
Any platform can define these, nobody is stopping them.
>>
>>53590225
Smurffi is better
>>
>>53590896
>>53590864
Can you not have opengl running in the background, and a translator that translates opengl images to ascii, and print the ascii to the terminal (preferrably with some sort of character replacement to speed things up) ?

Is there actually a problem with having bash make opengl calls?
>>
>>53592440
It's not up to me. Regardless, I fixed it.
>>
>>53590896
Bullshit
>>
>>53592388
Nice
>>
>>53590933
outdated as fuck
>>
So... an Anon in the last thread was asking about checking if "two non-transparent pixels from two picture boxes in VB.NET intersect". I don't know if he's still here, but the answer is a constant regardless of language used.

For any two rectangles s1, s2 with coordinates (x1, y1) and (x2, y2) referring to their upper left corners and respective widths and heights (w1, h1) and (w2, h2), they can be considered to collide if one of the following conditions apply:

1.) x1 <= x2 < (x1 + w1) AND y1 <= y2 < (y1 + h1)
OR
2.) x2 <= x1 < (x2 + w2) AND y2 <= y1 < (y2 + h2)

For a picture box, you likely want to just check collision between the two boxes. For a pixel... width and height are 1, so just check if the x and y coordinates are the same. If what you really wanted to ask was "if any of the pixels of two intersecting pictures boxes are non-transparent), find the cross section, and check if any pixels are non-transparent in both overlapping images at that cross-section

If you must consider moving picture boxes, look up 2d swept collision detection.
>>
>>53592596
How about polygons?
>>
>>53592388
>char ch[1]
>scanf ("%s",ch);
Input "yyyyyyyyyyyy". What will happen?
>>
Why are dates so fucking hard to manipulate on C++? God fucking damn it.
>>
>>53590091
Why OpenGL 3.3?
>>
Hey, /g/. I'm working on my CS homework with a buddy, and we just can't figure out what our professor is asking us to do. Here's the question:

Using the supplied code, you should be able to construct a function that given the orbital period of an object in Earth orbit, returns distance of that object from the Earth's center. Correct for the Earth's radius (approximated at ocean level), compute the altitude of such an object (distance above ocean level). Then, to estimate round-trip-time to communctate between two points on earth via such an object compute the time it takes light to travel 4 times the altiude. If required constants are not given, use the result given directly by Google for the values of such constants. Only a few significant digits are required. You should probably have some code that looks something like:

let geosyncR:float<m> = earthOrbitRadius(oneDay*secondsPerDay)
printfn "geosync(1<day>)= %E meters" (float(geosyncR))

Kepler's 3rd law of planetary motion: "The square of the orbital period of a planet is proportional to the cube of the radius" its orbit. Compute the ratio of the square and the cube of this data for the moon and use it in your earthOrbitRadius() function.
Attach your code to the next item and use the text entry box there to show the output of your program, the last line of which should give the at least the first few digits of the requested lower bound for the round trip time (approx 1/2 second).


What does he want us to code? We've read this over and over again and can't seem to figure it out. Thanks.
>>
>>53592417
https://www.youtube.com/watch?v=GwIsbnac5lE
>>
>>53592675

Tell him to fuck off because this isn't astronomy class.
>>
>>53592675
that looks cool anon, just google whatever words you don't know
>>
>>53592625

I believe the method used involves something called the "separating axis theorem" (basically, if you can draw a line between the two, they're not colliding), but I haven't done a lot of research into the subject. In general, however, it helps to avoid the problem of checking collisions for arbitrary n-gons all together if possible. If you are making a game, for example, you might want to consider if it is at all possible to do all of your collision detection with either circles or squares (or (hyper-)spheres, (hyper-)cubes if you are using 3 (or more) dimensions).
>>
>>53592705
Sounds comfy. Thanks.
>>
>>53592281
Put a space before %c in the second call of scanf to make it ignore white space (it actually reads the new line character left behind by the first call of scanf without it). Also "if (ch = 'y')" is equal to "if (1)" because you're assigning 'y' to ch instead of comparing the two.
>>
Are there any standalone c++ compilers for windows? I usually use my tiny netbook with debian and g++ to program and compile but I'm getting some bizarre as fuck numbers with this school assignment and need a second opinion.
>>
>>53590221
stfu

clion and Qt are literally the best IDEs out there
>>
>>53592726
Wish I could, the guy's an absolute fuckwit. Wants us to use F# for this assignment to "explore other languages" without teaching anything. He's the goddamn CS chairperson but can't teach an interesting class.

>>53592747
I just don't understand what he wants. Does he want an algorithm to find the orbital period of the moon? If it was more clear I'd just do it.
>>
how do I make and if else statement?
>>
File: mhm.png (9 KB, 359x273) Image search: [Google]
mhm.png
9 KB, 359x273
>implement sort and binary search in 68k asm for school
>fun for 15 minutes
>already finished
>back to being sad about no gf
Inner peace when?
>>
>>53592798
jesus christ anon that's high school intro level physics shit and the task is pretty clear
stop being a pussy and start reading up on shit you don't understand to catch up instead of throwing a shitfit as an excuse
>>
>>53592780
i had a lot of trouble with c and cmake using clion before when starting off, do you know if that got any better
>>
>>53592798
F# isn't hard to pick up though and exploring other languages is important

basically he wants to know how far from the surface of the earth an object is given how long it takes to go around it, and then estimate how long it would take for a message to do a round trip to it by seeing how long it takes light to travel 4x the altitude of that object
>>
In C++, when defining a variable's type by auto and initializing it per lambda return, should I use the JS-like syntax
auto x = ([]{
return 1+1;
})();

with parens around the lambda, or will it just confuse people?
>>
>>53592798
>im not retarded my professor who is the computer science chair is the moron!!
>>
File: 1378209376569.png (65 KB, 285x276) Image search: [Google]
1378209376569.png
65 KB, 285x276
>finish a project
>feel empty inside
>>
>>53592944
>finish comp sci degree
>feel empty inside
>>
>>53592931
Dude gets paid $130k, teaches one class, and has assigned three assignments so far. Hasn't graded a single one. Rambles for hours about his son's intelligence and other miscellaneous shit.
>>
>>53592970
sounds like hes doing fine
you however better step it up
>>
>>53592966
>classmates being jerks to me
>feel dead inside
>>
>>53592986
maybe you should have done something on the project instead of freeload off of them
>>
>>53592798
tard if you know any other language well you should be fine learning another one, especially if it's just basic shit.

Get it together anon

Anyways, does anyone know how math.h implements sqrt? I've made this one out of newton's method

int main(int argc, const char * argv[]) {
// NEWTON WAS A NECKBEARD
double approx = 200.; // Number to find square
double guess = 10.;


while(((guess*guess) < approx - .0001) || ((guess*guess) > approx + .0001))guess = newtonApprox(approx, guess);

cout << guess;
}

double newtonApprox (double approx, double guess) {
double func = (guess*guess)-approx;
double funcDeriv = 2*guess;
guess = guess - (func / funcDeriv);
return guess;
}
>>
>>53592970
What uni?

>Rambles for hours about his son's intelligence
I am interested.
>>
>>53592970
professors dont grade assignments TAs do lol

he sounds great compared to my databases teacher
>>
>>53592675

He wants you to write a function that takes as argument that orbital period of some object (that is, how long it takes to complete one orbit) traveling around the Earth, spit out a bunch of information, likely to stdout based on the example code.

That information should include:

1. Distance from Earth's center
2. Distance from Earth's surface (at ocean level)
3. Round trip time for communication between two points on Earth using such an object. Basically, if this is a satellite, how long is it going to take to communicate with it from two points on Earth. Your professor pretty much gives you the answer -- the time it takes for light to travel 4 times the altitude. Your professor wants you to google the constant, but to save you some time, the speed of light is 299,792,458 m/s.

>>53592773

Use MinGW when on Windows. Only acceptable C++ compiler for the platform.
>>
>>53592998
B-But I didn't.
>>
File: 1438781024656.jpg (68 KB, 640x585) Image search: [Google]
1438781024656.jpg
68 KB, 640x585
>>53592986
>>53592966
>>53592944
>>
Thoughts on the Eclipse IDE?

What should I be using on Linux?
>>
>>53593045
ya didn't do anything LMAO
>>
>>53593026
>databases teacher
?
>>
>>53593015
I've moved the while loop into the function lel
>>
>>53590992
Not him but why?
Personally I like it
>>
>>53593054
It wasn't about a project.
>>
>>53593064
old indian guy on tenure or something who just read his slides in the worst, most monotone broken english I've ever heard

halfway through the semester everyone stopped going to class

i showed up once and there was literally like 3 people there
>>
>>53593051
xterm.
>>
What IDE's do you use when writing programming in C++ on Linux?
>>
>>53592798

>He's the goddamn CS chairperson but can't teach an interesting class
Funny, the CS chair at my university is one of the most well-liked professors in the department. He only teaches the theory stuff though.

>Does he want an algorithm to find the orbital period of the moon?
No, he wants you to print out stats for an arbitrary satellite given its orbital period.

>>53592924

That looks retarded
auto f = []{
return 1+1;
};
auto x = f();
>>
>>53593028
Based namefag, thank you.
>>
>>53593115
codeblocks
netbeans
eclipse
pick your posion
>>
>>53593135
I'm installing eclipse right now. I'm guessing you use GCC to compile?
>>
>>53593149
yes
I also have no idea what i'm doing while I code small console application, so it really doesn't matter if I got hit by a bus tomorrow.
>>
>>53593115
>using an IDE for C/C++
>installing bloat

nigga you only need a text editor and a terminal
>>
>>53593195
D: help me f a m
>>
>>53593206
get vim
use g++ to compile

there's probably even an extension to let you compile straight from vim easily
>>
>>53593222
>there's probably even an extension to let you compile straight from vim easily
>what is :make
>>
>>53593206
i use:
- sublime text 3 for writting programs
- xterm for running the programms like:

gcc program.c && ./a.out 

or
g++ program.cpp && ./a.out
>>
2 questions for C/C++
1)What do I use to store a 12 digit number? It's for a bank account ID so I thought of using a string.
2)Was testing some sorting algorithms, but when using a big number of elements for my array the program would crash on run. How to fix this?
>>
>>53593236
idk i only use vim for web development
>>
>>53593244
wtf man do you never have programs with more than one source file? Have you gotten past the basics of hello world and onto more advanced programs?
>>
>>53593287

1) unsigned long long

2) probably the memory limit exceed. write better algorithms
>>
What is the linux alternative to Notepad++
>>
>>53593287
Show code.
>>
>>53593338
this please
>>
>>53593322
>wtf man do you never have programs with more than one source file?
yeah quite a lot. i use the terminal for everything.
$ g++ *.cpp *.hpp
$ gcc -pthread *.c
$ g++ $1 -lglut -lGL -lGLU -lm // open GL
>>
>>53592944
Start another one, anon!
>>
File: Untitled34.png (43 KB, 1920x994) Image search: [Google]
Untitled34.png
43 KB, 1920x994
Working on the LDAP admin panel again.
Made a lot of progress, and we're going into local production now.
There still has to be some polishing on error messages, but for the end user it works perfectly.
Certain parts are for admins only, so it is only accessible for members of the 'Administrators' group in LDAP.
Users can change their own passwords in the portal.
This directory is already running as the backend for WiFi using RADIUS on 3 sites, and we'll roll out some more very soon.

Next step is adding a RDBMS for password resets, tickets, status page and maintenance scheduling, etc.
>>
>>53593355
Gedit
>>
>>53593322
that's what makefiles are for. something simple like below will work for 90% of C you'll write
CC=gcc
CFLAGS=-g -Wall -Wextra -Wpedantic
DEPS=//deps here
OBJ=//object files to link here
EXECNAME=//name here

$(EXECNAME): $(OBJ)
$(CC) $(CFLAGS) -o $@ $^ -lm

.PHONY: clean

clean:
@- rm -fv *.o *~ *.swp $(EXECNAME)
>>
>>53593028
Oh shit thanks so much, I didn't want to use visual studio because it is shite.
>>
>>53591580
raw opengl

plain 2d is easy as fuck, you don't have to use those shitty libraries just because they're there
>>
File: this anime is aggressive.jpg (67 KB, 1280x720) Image search: [Google]
this anime is aggressive.jpg
67 KB, 1280x720
Does anyone ever make clean and recompile their project just to make their disk drive squeal for a few seconds?
>>
>>53593322
If you have a complex program, use build tool. You do understand that ide's are just wrappers to command line build tools, right? Do you understand the tools you use or are you a codemokney that pushes buttons in eclipse?
>>
Is there a better way to do this, im doing java and its code that checks if two is a multiple for one

public boolean method1(int one, int two){

if(two%one==0)
return true;
else
return false;
}

public boolean method1(int one, int two, int three, int four, int five){
if(two%one==0 && three%one==0 && four%one==0 && five%one==0)
return true;
else
return false;
}
>>
>>53593476
this is your average java programmer /dpt/
>>
>>53593535
hey fuck you this is what my teacher told me to do!
>>
>>53593341
>>53593334
1)what if it is not supported? wont a string do the job just fine?
2)just declared an int array of say 100k elements, runned a for loop to fill it with rand(), then called a typical merge sort on it.
>>
>>53593476
    public boolean method1(int one, int two) { 
return two % one == 0;
}

public boolean method1(int one, int two, int three, int four, int five) {
return two % one == 0 && three % one == 0 && four % one == 0 && five % one == 0;
}
>>
>>53593476
public boolean bait(int n, int m)
{
return two % one;
}
>>
>>53593535
This is your average unhelpful autist /dpt/, and no, you don't fit in.
>>
>>53592765
>>53592388
Thank you anons.
>>
>>53593589
>>53593601

so this would cost performance to run
>>
>>53593602
He is right, hang yourself.
>>
>>53593576

1) yes strings do the job just fine. if you know how to use them.
2) that doesn't seem to be a problem. unless you're doing too much recursion which may cause those erros
>>
>>53593535
it's a kid in school, retard
>>
>>53593601
java can't case int to booleans automatically I believe.
>>
>>53593625
Yes, he >>53593602 should hang himself.
>>
>>53593576
Stop using ancient language standards.
Stop declaring very large arrays on the stack.
>>
>>53593476
are you returning the remainder value, or just whether it's even divisible?
>>
>>53593589
public boolean method1(int one, int two) {
return !(two % one);
}

public boolean method1(int one, int two, int three,
int four, int five) {
return !(two % one) && !(three % one) &&
!(four % one) && !(five % one);
}
>>
>>53593699
>java
and your way is shit anyway, it's less readable and not more efficient
>>
>>53592944
>dad says i don't love myself
>feel dead inside
>>
>>53593699
>>53593589
public boolean method1(int one, List<Integer> ls) {
for (Integer i : ls) {
if (i % one != 0) return false;
}
return true;
}

Assuming java is sane about boxing/unboxing primitives (or at least as sane as one can get dealing with this shit).
>>
>>53593734
>your way is shit anyway
no it isn't.
> it's less readable and not more efficient
no it isn't.
>>
>>53593794
are you sure it compiles?
>>
>>53593689
>stack
oh it's a stack problem then? i didnt know that.
thanks for your time man.
>>
>>53590930
It's pretty good actually, maybe not ready for large projects but quite a joy to program in.
Also, if you care, you can easily have an impact on the language developement, which is quite an impressive project but small enough to be open to every contribution (the BDFL is grumpy but definitely knows what he's about)
>>
File: 1456687774655.png (230 KB, 640x360) Image search: [Google]
1456687774655.png
230 KB, 640x360
>>53593028
Just finished my assignment thanks to you, Ruby. No thanks to the haters.
>>
>>53593809
it doesn't lel
fuckin lel
i thought java supported the unary operator '!'
>>
>>53593028
Not him but what about C for windows?
>>
>>53593859
it does, it does not cast integers to boolean though
>>
Rate mah code :D

#include <iostream>
using namespace std;

int main()
{
float hours, rate, pay;

cout << "How many hours did you work? ";
cin >> hours;

cout << "How much do you get paid per hours? ";
cin >> rate;

pay = hours * rate;

cout << "You have earned $" << pay << endl;
return 0;
}
>>
>>53593859
It does, but only for boolean values. The modulus returns an int, not a bool. In Java 0 != false.
>>
>>53593907
>C++
>I/O streams
0/10
>>
>>53593852
Ruby > GTP
>>
>>53593927
w-what. This is what I was told to do though.
>>
>>53593927
new but not him and i'd like to know why iostream is bad.
>>
>>53593936
#include <iostream>

int main()
{
float hours, rate, pay;

std::cout << "How many hours did you work? ";
std::cin >> hours;

std::cout << "How much do you get paid per hours? ";
std::cin >> rate;

pay = hours * rate;

std::cout << "You have earned $" << pay << std::endl;
return 0;
}
>>
>>53593932

Obviously.
>>
>>53593936
>>53593951
They are stupid as fuck.
They are ugly as fuck.
They are verbose as fuck.
They hard-code the order of arguments (makes internationalisation harder)
>>
>>53593978
Hey, my f a m . I'm just learning c++. Go easy, dick
>>
>>53593998
I don't care. It's a shitty language and you shouldn't be using it.
>f a m
Kill yourself
>>
>>53593978
so what should i use instead
i mean if i have to use c++
>>
>>53594014
no
>>
>>53594026
printf
>>
>>53594053
>mixing C with C++
pahjeet pls go
>>
>>53594091
Sir i am very many sorry sir. i will not do again sir.
>>
>>53594091
No, I would suggest you just write C in the first place.
>>
>>53594091
Isn't it cout for C++?
>>
>>53594134
kek
>>53594170
yes
>>
>>53593951
>>53593936
>the last time you ever used iostream in a real project
never

fstreams are OK. It's pretty cool to be able to dump an entire file into memory without a lot of effort. std::filesystem makes it simple.
>>
File: doge 5.jpg (169 KB, 960x955) Image search: [Google]
doge 5.jpg
169 KB, 960x955
After twenty minutes reading ritchie's and internets I made my 2nd program! Computers are fun, I'm eager to learn how2linux and how2code!
#include <stdio.h>
int n, mul, res, n3, add;
char q;
main()
{
printf("do you wish to add 3 to wich number?\n");
scanf("%d",&n);
add=3;
n3=n+add;
printf ("%d plus three is equal to %d\n", n, n3);
printf ("Do you wish to multiply that number?(y/n)\n");
getchar();
q=getchar();
if (q=='y'){
printf ("By what factor?\n");
scanf("%d", &mul);
res = mul * n3 ;
printf ("%d times %d equals to: %d\n", n3, mul, res);
}
else

printf ("Goodbye master!\n");

}


I still need to learn how to improve Nano with comfort things. But I find that using it instead of a IDE (like niggerblocks) and compiling in another shell thingie makes me work harder to spot my mistakes.
>>
>>53578603
>>53578672
>>53578820
Sorry for the vagueness
But let's say I have an array of 10 slots
and I input only 3 meaningful integers in the first 3 spots
When I set the rest of the slots to null I get a compilation error saying incompatible type
>>
>>53594194
yes it is. but the other faggot was saying to use printf in C++.
>>
>>53593589
>>53593699

(defn method1 [one & args]
(every? (fn [x] (zero? (mod x one))) args))


>>53593874

MinGW is especially recommended for C on Windows, because MSVC does not support C11.
>>
Is this who I am competing for a job against with my CompSci degree?

https://www.youtube.com/watch?v=mpg5CnagE9k
>>
>>53594243
meme
Thread replies: 255
Thread images: 23

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.