[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


Thread replies: 335
Thread images: 10

File: 161.jpg (42KB, 600x240px) Image search: [Google] [Yandex] [Bing]
161.jpg
42KB, 600x240px
old thread >>54292633

what are you working on /dpt/?
>>
stop making duplicate threads you dumb shit

real thread here
>>54297316
>>54297316
>>
What is the best way to read a string of text from a file in C? There's a shit load of options to do so
>>
thanks for the non-trap thread.
>>
>>54297404
any time friendo
>>
>>54297391
>C
>strings
yikes
>>
>>54297329
I need help doing Proper Case and PaTeRn CaSe on this array of characters. I figured out how to convert the string from uppercase to lower case and lowercase to uppercase, but I am not sure how to target individual elements of the array when the data type of the function is a character pointer.

#include <iostream>
#include <algorithm>
#include <array>
#include <iterator>
using namespace std;
int getLength(char *);
void toUpper(char *);
void toLower(char *);
void toProper(char *);
void toPattern(char *);

int main()
{
char name[80];

cout << "Enter a name :";
cin >> name;

int r= getLength(name);

cout << "The length of string is :" << r;
toUpper(name);
cout << "\nThe string in Capital Letters is: " << name;
// Arbitrary element processing on the container.
toLower(name);
cout << "\nThe string in Lower Case Letters is: " << name;
toProper(name);
cout << "\nThe string in Proper Case Letters is: " << name;
toPattern(name);
cout << "\nThe string in Pattern Case Letters is: " << name;
}

void toUpper(char *p)
{

while (*p)
{

*p = (*p>='a' && *p<='z') ? *p=*p-32 : *p;
p++;

}


}
int getLength(char *p)
{

int ctr=0;
while (*p)
{
//cout << *p << " " ;
ctr++;
p++;

}
return ctr;
}

void toLower(char *p)
{
// write code to convert to small cases

while (*p)
{

*p = (*p>='A' && *p<='Z') ? *p=*p+32 : *p;
p++;

}
}

void toProper(char *p)
{


}

void toPattern(char *p)
{

}
>>
File: programcross.png (1MB, 1702x2471px) Image search: [Google] [Yandex] [Bing]
programcross.png
1MB, 1702x2471px
>>
>>54297429
They refer to it as string in C.
>bullshit
look at printf conversion specifier %s
>>
>>54297443
Kill yourself faggot. Catch AIDS and die.
>>
>>54297429
People who don't know C really have no business forming opinions on a language they know nothing about.
I bet you also tell people on reddit that C is the "portable assembler", huh?
>>
>>54297484
here put on this dress it will help
>>
>>54297489
"C strings"
"Raw pointers"
It always gets me when they say stuff like that.
>>
sorry for the really dumb question.

On objects/classes, if you initialize an object in the main part of your program with say 2 variables but within the class of that object 2 other variables are created with the first 2, the object is actually pointing at all 4 variables right not just the first 2 you initialized with?

does this make sense?
>>
>>54297520
I hope you don't go around calling them char arrays
>>
>>54297534
they are char arrays tho anon same with int arrays
>>
File: AAAAAAAAAAAAAA.gif (337KB, 640x360px) Image search: [Google] [Yandex] [Bing]
AAAAAAAAAAAAAA.gif
337KB, 640x360px
>>54297520
>"unsafe pointers"
>"C has no automatic memory allocation"
>"Bounds checking is not possible in C"
>>
>>54297489
>I bet you also tell people on reddit that C is the "portable assembler", huh?

No, it's self-important C-fags who pretend it's assembler++.
>>
>>54297556
C is a portable assembler that is almost as good as Java's glorious JVM
>>
>>54297521
It just depends on what your constructor is initializing. If you leave it to the compiler it won't properly initialize them.
>>
>dat feel when pcis being messed up makes this feel like textboards again

It's good to be alive
>>
>>54297377
Kill yourself.
>>
>>54297648
>tfw you take off your trip to make a new thread and someone else makes one too and you're mad >:(
>>
What can I develop for Android with? I fucking hate Eclipse.
>>
Currently following a tutorial. Here's my implementation of a simple stack. It has push, pop, reset inputs and under/overflow indicator outputs. How could I improve its design?

FUNCTION_BLOCK STACK_INT

VAR_INPUT
PUSH: BOOL; (*Push into the stack*)
POP: BOOL; (*Pop from the stack*)
R1: BOOL; (*Overriding reset*)
IN_VAL: INT; (*Input value to push*)
N: INT; (*Max. stack depth after reset*)
END_VAR

VAR_OUTPUT
OUT: INT := 0; (*Top of stack data*)
OVERFLOW: BOOL := FALSE; (*Stack overflow*)
EMPTY: BOOL := TRUE; (*Stack empty*)
END_VAR

(*local vars*)
VAR
stack: ARRAY[0..128] OF INT; (*Internal stack*)
ni: INT := 128; (*Storage for N upon reset*)
stack_ptr: INT := -1; (*Stack pointer*)
pop_signal: BOOL;
push_signal: BOOL;
reset_signal: BOOL;
pop_rtrig: R_TRIG;
push_rtrig: R_TRIG;
reset_rtrig: R_TRIG;
END_VAR

(*---- Simple stack for integers ----*)

(*Trigger the rising edge of inputs*)
pop_rtrig(CLK := POP, Q => pop_signal);
push_rtrig(CLK := PUSH, Q => push_signal);
reset_rtrig(CLK := R1, Q => reset_signal);

(*Reset stack*)
IF (reset_signal = TRUE)
THEN
stack_ptr := -1;
OVERFLOW := FALSE;
EMPTY := TRUE;

(*limit max. stack depth*)
ni := LIMIT(1, N, 128);

OUT := 0;

(*Popping*)
ELSIF (pop_signal = TRUE) AND (EMPTY = FALSE)
THEN
OVERFLOW := FALSE;
stack_ptr := stack_ptr - 1;

EMPTY := (stack_ptr < 0);

(*end of stack*)
IF (EMPTY = TRUE)
THEN
OUT := 0;

ELSE
OUT := stack[stack_ptr];

END_IF;

(*Pushing*)
ELSIF (push_signal = TRUE) AND (OVERFLOW = FALSE)
THEN
EMPTY := FALSE;
stack_ptr := stack_ptr + 1;
OVERFLOW := (stack_ptr = ni);

IF (OVERFLOW = FALSE)
THEN
OUT := IN_VAL;
stack[stack_ptr] := IN_VAL;

(*end of stack*)
ELSE
OUT := 0;

END_IF;

END_IF;

END_FUNCTION_BLOCK
>>
>>54297709
Android Studio
>>
>>54297709
Android Studio Netbeans Eclipse Android Studio is best
>>
>>54297709
android stjewdio but it's not really better

you hate android, not eclipse
>>
>>54297555
Those are all true tho.
>>
>>54297730
No, I hate eclipse, it's slow as hell and really unnecessary. I'm just used to vim + gcc
>>
>>54297709
Visual studio
>>
Faggot, nigga
Nigga, nigga, nigga
Nigga, faggot nigga
Faggot, faggot, nigga
>>
>>54297828
lol ok loonix neckbeard, you're gonna hate other IDEs just as well then
>>
>>54297841
What? I said I'm used to vim + gcc. I didn't say I ever used it for Android.

>>54297849
>windows
>>
>>54297439
I made a post for you: >>54297761

Thinking about it, you could do something longwinded for toProper such as:

void toProper(char *p)
{
toLower(*p);

*p=*p-32;

while (*p)
{
if(*p == ' ')
{
p++;
*p=*p-32;
}

else
{
p++;
}
}

}
>>
>>54297855
Why do people like IDEs? The one thing I find good about them is that it will automatically write all of my imports for me, but everything else is extremely clunky and unnecessary
>>
>>54297584
so whatever variables the constructor assigns are the variables of that object?
>>
>>54297849
Android in VS?

would that be even slightly bearable?
>>
>>54297862
>allman
>>
>>54297877
you can do all kinds of things, more than i could list in a 4chan post
>>
>>54297891

is best
>>
>>54297897
I meant aside from things that I can't do in vim, gdb, etc.

In eclipse, if I want to make another class, I have to do new -> new java class, type in the class name etc into fields, then wait two minutes for it to generate another file with some words typed for me and for it to append it to the build command. It's ridiculous.
>>
>>54297919
lost all respect for you there
>>
>>54297927
Just filter all the /dpt/ tripfags, they're basically worthless.
>>
>>54297889
Better than anything else
>>
>>54297927

It really is the best brace style, though.
>>
>>54297862
It doesn't compile.
||=== Build: Debug in COMP 3141 Module 5 (compiler: GNU GCC Compiler) ===|
||In function 'void toUpper(char*)':|
|39|warning: operation on '* p' may be undefined [-Wsequence-point]|
||In function 'void toLower(char*)':|
|67|warning: operation on '* p' may be undefined [-Wsequence-point]|
||In function 'void toProper(char*)':|
|75|error: invalid conversion from 'char' to 'char*' [-fpermissive]|
|60|note: initializing argument 1 of 'void toLower(char*)'|
||In function 'void toPattern(char*)':|
|97|error: invalid conversion from 'char' to 'char*' [-fpermissive]|
|33|note: initializing argument 1 of 'void toUpper(char*)'|
|102|warning: operation on '* p' may be undefined [-Wsequence-point]|
||=== Build failed: 2 error(s), 3 warning(s) (0 minute(s), 1 second(s)) ===|

>>
>>54297946
see >>54297862
>>
>>54297957

Bad font.
>>
>>54297920
>wait two minutes
lmfao it's the year 2016 you should be able to run eclipse on a software development machine

and i bet you can do a decent amount of things in vim because it's borderline an IDE just that you call it a text editor

and like for android you have LogCat and many other tools specifically for android in the IDE
>>
>>54297965
You're joking, right?
>>
>>54297986

No. Whatever monospaced font you're using in your web browse makes it look bad. Allman braces are just fine in your editor with appropriate 9-point font.
>>
Any way to programatically overclock my hard drive?
>>
>>54297886
Well the variables of the object are whatever is declared in the object. Initialization is what the constructor handles when the object is created.
>>
>>54297996
it looks like shit regardless of the font
>>
>>54298026

Only K&R Ctards say that. Whitesmiths and GNU are the truly disgusting brace styles.
>>
>>54297996
My browser and editor use the same font. How could you assume it to be my font when I'm saying it looks bad? It literally is a complete waste of space. Christ. If you just said "It's good, I like it" I'd understand more than you're retarded "It's definitely your font"

filtered
>>
>>54298007
>overclock my hard drive
What meme is this?
>>
>>54297862
Okay, your code had the wrong date type in the toLower() and toUpper() functions. I changed it to just plain p and now it works. Thanks.
>>
>>54298040
1TBS master race
>>
>>54297948
>>54297948
It's because I left the * in the calls to toUpper and toLower.
Should be toUpper(p); rather than toUpper(*p);
Then it compiles but you need to use cin.ignore to get the full name (as well as some mistakes I did that you could correct yourself).

>>54297891
It's what I was taught when learning Java and it's how I've been doing things since.
>>
>>54297443
I'm actually really curious, did someone from /g/ makes this?
>>
>>54298077
Yeah I already changed that and it works fine.

Enter a name :Pajeet
The length of string is :6
The string in Capital Letters is: PAJEET
The string in Lower Case Letters is: pajeet
The string in Proper Case Letters is: Pajeet
The string in Pattern Case Letters is: pAjEeT
Process returned 0 (0x0) execution time : 9.703 s
Press any key to continue.
>>
>>54298120
But it doesn't work with a space.
I'm trying to change that using
cin >> name;
cin.ignore(256, '\n');
getline(cin, name);

but getline doesn't accept a character array.
You'll need to use an equivalent (which I'm too lazy to look up right now).
>>
Hi guys my friend Pajeet from class invited me over to his house where his family are all software developers and asked me if I would like to make mobile games with them and we are a team of 12 guys. How is this going to turn out? I finally got a team of guys and I will be the only white guy on the team
>>
>>54298077
Here:
void toProper(char *p) {
toLower(*p);

*p=*p-32;

while (*p) {
if(*p == ' ') {
p++;
*p=*p-32;
} else {
p++;
}
}
>>
>>54298184
They're gonna drop you from the group at some point and steal all your contributions.
>>
>>54298184
pajeets make the worst mobile games it's just quantity over quality shovel ware, they just do the bare minimum of what resembles a game
>>
>>54298184
Never work with pajeets
>>
>>54298199
he is a pretty good guy I doubt that will happen

>>54298204
>>54298222
I have a whole fucking programming team. I can not miss this opportunity. We just need good ideas now I am sure with the brain power of 12 grown men we can do this
>>
>>54298204
hi this is pajett i am make microtransactions for you sir
>>
>>54298240
6.5 grown men. Each pajeet is half a person when considering brain power
>>
>>54297709
>>54297720
>>54297722
>>54297730
>>54297849
It's ok guys I got Android Studio up and running seamlessly, and it looks great. (For some reason, the UI for Eclipse was fucked up and buggy)
>>
>>54298240
>he is a pretty good guy I doubt that will happen

Get everything in writing, EVERYTHING.
>>
In C, does anyone know how can i convert an octal number to int?

maybe sscanf?

example:
int array[012] // 012 is in octal which is 10 in base 2

// converted to int becomes
int array[10]
>>
>>54298274
even by your logic that is still a lot of programming power
>>
>>54298296
Your octal numbers are integer literals?
haha good luck m8
>>
>>54298294
this. in indian culture it's perfectly acceptable to be a lying, deceiving cunt
>>
>>54298296
That's literally how it works though?

https://ideone.com/UeDXfG
>>
>>54298319
Is this why all the old people computer scams are based in India?
>>
>>54298296
I don't understand your question.
Are you trying to convert a string which contains an octal number or something?
If you're talking about numbers in your source code, all of the integer literals are already ints regardless. You just chose to represent them differently.
>>
>>54298336
indians don't give a shit about anyone, and they most certainly don't give a shit about invading other countries and displacing their workers by working for literal scraps
>>
>>54298319
>>54298336
12 guys to program with my dream has finally come true
>>
>>54298331
this might work
>>54298343
basically i'm writing a mini compiler and when reading the file, the size of an array might be in octal, so i want to print the array size in int not octal
>>
>>54298296
If your octal numbers are represented as integer literals in your code, you need to convert them to a string and then convert the string representation of the octal number to an integer.
>>
>>54298376
yes! this is what i'm looking for!
how do i do it?
>>
>>54298365
lol they're gonna cut you off and take your name off the project the moment your app reaches $100 a day in revenue.
>>
>>54298371
>so i want to print the array size in int not octal
"print in int" doesn't mean anything. Do you mean print in decimal (base 10)?
>>
>>54298365
you could hire 100 indians and you wouldn't have to share profits with them
>>
>>54298398
yes i meant that
>>
>>54298397
>>54298400
That would cost too much I have it for free
>>
>>54298393
something like
char buff[20];
sprintf(buff, "%d", octal_value);
int val = convert_oct_to_int(buff);

as for convert_oct_to_int() you figure it out.
google can easily tell you how to convert a number from one base to another
>>
any intellectuals in here interested in game dev?
>>
>>54298545
I am post game
>>
Would you use a stochastic programming language that will follow your if statement only 90% of the time?
>>
File: 102866_300.jpg (41KB, 300x225px) Image search: [Google] [Yandex] [Bing]
102866_300.jpg
41KB, 300x225px
>>54298549
>>
>>54298584
Possibly
>>
>>54298584
What use would that be?
>>
>>54298584
A programming language based on emotion and not logic?
Sign me up!
>>
>tell me about yourself in 255 bytes or less.
>>
>>54298584
>>54298701
C+= is already a thing.
>>
So my Qt knowledge is kinda rusty, haven't used it for 3 years or so, are .ui files made with the designer program still a thing or do people just use QML nowadays? How's QML <=> C++ interaction?
>>
If you had an army of pajeets what would you do?
>>
>>54298778
>255 bytes
what
In what world would you ever use 255 bytes? I understand that what you're asking for is the equivalent of 255 characters, but wouldn't it make more sense to say 2^n bytes for some positive integer n? When I saw your post I was t
>>
>>54298870
grind the software world to a halt by having them produce mission-critical code for decades and decades
>>
>>54297329

anybody ever used phantomjs

I'm having fun

https://github.com/NateN1222/PhantomJS-test-project/commit/b5eb220dd04030249aa1f8668d9a04a97e16919a
>>
>>54298901
clearly, the index that holds the "about you" string is an unsigned char that only goes up to 255.
>>
>>54298870
divide them into teams of 5 and have them make one mobile game every two weeks, giving them enough time to really polish each game. 50 of the pajeets would be an idea committee, made up by 5 teams of 10 idea subcommittees, 10 more pajeets would be an approval committee for ideas, and there would be a design committee of 50 more pajeets. 1,000 pajeets would be for QA. The rest of the army would carry out the ideas.
>>
>>54298919
So you're looking for a number between 0 and 255.
>>
>>54298941
You just described Sun Systems
>>
>>54298941
>pajeets
>ideas
>>
>>54298901
We need the 256th byte for the null terminator.
>>
>>54298971
*oracle
>>
>>54298919
Retard, that's 256 indices.

>>54298901
Null terminator
>>
>>54298941
I like where this is going I only have a disposal of 12 pajeets on hand right now
>>
>>54298986
Yes?
That's still going up to 255 starting from 0.
>>
>>54299008
0 to 255 is 256 indices, giving room for 256 bytes you stupid fuck.
What you're saying in >>54298919 is technically correct however it's got absolutely nothing to do with why he said to do it in 255 bytes or less.
The reason is because of the null terminator, not the size of the index.
>>
main = putStrLn "Hello, /dpt/!"
>>
Hey guys,

I'm kind of interested in doing competitive programming, just for fun. There are a lot of websites that let you practice problems and participate in online competitions, but there are quite a lot of them out there.

>topcoder
>codeforces
>hackerrank
>many others

For you guys who participate in these competitions, what is your favorite website to use for competitions and practice?

I know that there are a lot of problem-only sites, like project euler and such, but I'm interested in something that allows me to do online competitions.
>>
Currently working on a C# project that buys something automatically without needing other userinformation than the input in the program itself.

So far I've been successfull in implementing selenium using chrome as the webdriver.

But I need it to check every 2 seconds if the html has been updated, can this be done with the HTML agility pack? Does anyone know?
>>
>>54299147
Since it's competition the most popular sites are going to be the best. Codeforces and topcoder are two of the most competitive.
>>
>>54298986
>>54298974
>tfw anons don't get your joke
:(
>>
>>54299147
Stop wasting your time on useless 'competitions' and make something useful, you dumb shit.
>>
>>54299194
I'll take a look at those first then, thanks

>>54299204
I do work on my own projects, but it sounds fun to do short, purely algorithmic puzzles in a competition from time to time.
>>
>>54299147
What's the point of a competition? Do you need to solve the problem before everyone else does? Does your program need to run faster than everyone else's? Are your submissions graded on some esoteric code style guidelines?
>>
newbie here, how do i get the first digit of an int in C

int test = 45651;

get_first_digit(test) // returns 4
>>
>>54299240
Generally, you have a set amount of time to solve a problem. Your "score" usually depends on how fast your solution runs and how many test cases it passes, and code style doesn't matter.
>>
>>54299255
You know what log() does, no? You can figure it out.
>>
Programming languages one can use out of the box on Windows machines without installing additional software:

Batch
Powershell
JavaScript
JScript.NET
C#
VB.NET
VBScript

Why don't they just ship the OS with a C or C++ compiler? Half of these languages are garbage!
>>
>>54299255
int num = 0;
while(test != 0)
{
num = test % 10;
test /= 10;
}

>>
>>54299255
int get_first_digit(int n)
{
n = abs(n);

while (n > 10)
n /= 10;

return n;
}
>>
>>54299197
What was the joke?
>>
>>54299318
>n > 10
Whoops, I mean
n >= 10
.
>>
>>54299280
because Microsoft didnt write C++ and doesnt make money off of it. They would get no advantage of shipping a competing language's compiler.

Now that you've realized the folly of proprietary software, I'm sure you'll switch over to an open source and free operating system.
>>
>>54299255
4 isn't the first digit of 45651.
1 is.
>>
>>54299341
Windows is superior to Linux
>>
>>54299327
He ended his post after 255 bytes. Would have been funnier if he posted gibberish for a while and then
>segmentation fault
>>
>>54299354
Go home Pajeet.
>>
>>54299280
99% of Windows users don't use C++ compilers, and if they shipped them with the OS they would just be out of date. Visual Studio has been the source of the OS's compilers since like the late 90s if I remember correctly.
>>
>>54299280
Doesn't C# require to download VS?
Does Windows ship with csc.exe?
>>
>>54299358
Windows is great it's easy to learn and more powerful than Linux. Linux just makes you feel special because not a lot of people use it it's okay special snowflake
>>
>>54299381
C# ship with cfr.exe plugin
>>
>>54299356
Oh, thought you were talking about >>54298778
Yes I saw that, well done.
>>
File: so_smug.jpg (27KB, 383x313px) Image search: [Google] [Yandex] [Bing]
so_smug.jpg
27KB, 383x313px
>get assigned month long final programming project
>everyone in the class is complaining it's too hard
>people saying it took them the whole month to finish
>on last day of project I decide to start it
>finish it a few hours before the deadline
>get a 90 because but only because I needed more comments
>mfw
>>
>>54299356
>>54299197
>C jokes
Bunch of fucking nerds.
>>
>>54299414
post project I feel like doing it
>>
>>54299401
>easy to learn
>more powerful
hmm
>>
>x = log(34) determines the number required to recreate that number in pow(10, x)

why am i just learning about this now?
>>
>>54299431
>just now learning what logarithms are
autism
>>
>>54299414
don't get so smug there, CS student
you still can't do real math or engineering
>>
>>54299431
That's fucking high-school maths, mate.
>>
>>54299429
All the best applications and best video games were all made in Windows deal with it noprogrammer
>>
>>54299447
t. neet
>>
>>54299414
what was the project about anon?
>>
>>54299453
i never took trig, calc, or advanced algebra tho
>>
>>54299455
>all the best applications and best video games
My I sure am kekking my balls off. Enjoy your Call of Dooty and Photoshop. What does the ISS run? What does the LHC run? What does your router run?
>>
>>54299453
plenty of adults who forgot about logs or never did them in math classes deal with it shitlord I identify as a polygon
>>
>>54299431
Note that's log base 10. Most languages have log() as base e. Another thing you probably never knew: log(x)/log(b) = log_b(x).
>>
>>54299455
4chan is the best application of all time. and it runs on linux. facebook runs on linux, too.
>>
>>54299447
Why are you in this thread? Fuck off back to sci you fucking cock sucking fucking faggot fuck.
>>
>>54299447
I'm a comp eng student anon
>>
>>54299471
Are you saying your last highschool math class was something like Geometry? You're fucked bro
>>
>>54299495
>>54299504

Windows. Cisco routers are shit anyways running on shitty Linux
>>
>>54297329
Is Java dead on the desktop? Minecraft was the last killer Java app to be released for desktops back in 2008. Everything these days seems to be written in C# or C++.

Why isn't Java more popular on Linux and OS X?
>>
>>54299516
what does algebra 1 count as?
>>
>>54298974
>>54298986
>Pascal strings
>null terminator
>>
>>54299533
Java apps are only run for Windows
>>
>>54299498
>That broken English
>That lack of capitalisation and punctuation
Go away, Pajeet.
>>
>>54299533
Applications in general are dead on the desktop. Everything new is web now.
>>
>>54299536
I took that in 7th grade
>>
>>54299549
all you need is maths for program I am white male just like you goy
>>
>>54299561
yeah well I didn't

do you know where I can catch up?
>>
>>54299536
They let you graduate with just algebra 1? Grab a text book. You need a good handle on algebra to be a good programmer. Don't listen to the memer who say you need more.
>>
>>54299447
>real math or engineering

Not him, but what does this mean?

Math for engineering fields is just calculus and some related diff. eq stuff. At the undergrad level, it's just rote memorization.

CS Math (aka discrete, combinatorics, graph theory, algorithms, etc) are actually fun, and give you cool new insights.

Your "real math" is pajeet-tier memorization nonsense that is only taught or studied for its practical applications. It has no inherent mathematical value. Any moron can memorize integration techniques and ordinary differential equation forms.
>>
>>54299541
Who the fuck mentioned Pascal besides you, faggot?
>>
>>54299455
>noprogrammer
>>>/v/
>>
>>54299545
What does this mean? Java apps can run anywhere.

>>54299550

Yeah, but of the remaining applications, why are so few written in Java?
>>
>>54299545
Are you retarded?

>>54299533
I occasionally run into applications that use Java, although it's rare and not very pleasing. I honestly think Java is only acceptable if you're trying to be portable to Android. If you're making a GUI application, use Qt or WinForms (I think? Not familiar with windows), if you're making a game, use C++, Java is too slow for modern games.

So yeah, Java is sort of dying for desktop applications. It's still used in a heck of a lot of places, probably things like servers and whatnot. I don't really know.
>>
>>54299585
>nodevs
>>
>>54299574
>>54299577
You don't need all those math skills all you need is basic math skills for programming like how to enter formulas in a program and calculate the time etc nothing too advanced
>>
>>54299522
>his router runs windows
>>
>>54299381

/Windows/Microsoft.NET/Framework64/v4.Blah/csc.exe
>>
>>54299574
What constitutes a good handle of algebra?
Point slope, graphing part and factorizations?
Because i've never used that stuff.
>>
>>54299595
Java is great for modern games plenty of successful games made with Libgdx.
>>
What is floor and ceiling used for?
>>
>>54299606
That's true, but there's no fun in that.

There is certainly value in being able to correctly implement database applications or CRUD android apps, but doing a lot of that will quickly burn you out and turn you off from programming.

Cool math is where it's at.
>>
>>54299642
building houses mostly
>>
>>54299642
One is to prevent you from falling into the earth, one is to prevent you from falling into the sky.
>>
what should I do to avoid the hammer while scraping?

Obvious things are changing headers and having a non-uniform delay
>>
>>54299649
Cool math is usually very difficult and requires extreme willpower and effort to understand which is not worth the time learning it. Instead if you want to program you are better off spending time becoming really good at logic and then starting making small projects which you learn the most from programming
>>
>>54299660
if there is no floor, then there is no earth, and therefore no gravity to pull you down
what is there to fall into?
>>
>>54299569
your university's CS program should be sufficient to help you catch up, unless the program is shit
>>
>>54299425
>>54299469
It was just a pajeet-tier software design project. Not interesting in the slightest.
>>
>>54299682
>all CS courses require calc as prereqs
that doesn't count
>>
>>54299673
>Cool math is usually very difficult and requires extreme willpower
not really. for example, most people know that the area of a triangle is 1/2 base * height. that's applied math. real math is figuring out why its 1/2 and not some other number, like 1/3. and no, you dont need integrals or anything complicated like that.
>>
>>54299683
what did you have to do
>>
>>54299627
I figured that it's only practical if you care about Android. I stand by that point, although I am a fan of libgdx
>>
>>54299676
My arms.
>>
>>54299708
mathematical proofs are not easy

fuck off
>>
>>54299654
middle kek

>>54299704
What? For me, only some CS courses require calc, but they all require discrete maths at least, some of the higher ones need linear algebra and whatnot. I'm thinking if he takes the classes that are prereqs for his CS classes, he will be fine.
>>
>>54299255
int get_first_digit(int input)
{
char *buffer = (char *) malloc(4096);
sprintf(&buffer, "%d", input);
return (int) buffer[0];
}
>>
>>54299577
I'm ECE. We had to take two years of CS math (discrete logic, combinatorics, graph theory, set theory, algorithmic analysis), Calc I, II, and III, LA, Stochatics, and DE. Plus we learned about Fourier and Laplace transforms in Signal Processing and AC Circuit analysis.

There is no way you aren't a second year, algorithmic analysis usually requires a lot of calculus and stats, neither which you mentioned.

>>54299621
Depends upon the problem. It's not that algebra itself is necessary, butyou need algebra to study the higher-level CS maths. Even if you don't "study" them you'll use them day-to-day as a programmer. If you don't have a grasp of algebra you won't know where to start when it comes to such problems. I guess my recommendation is to learn as you go. Just wikipedia or ask someone if you don't know something.
>>
>>54299708
when you're absolutely retarded but still want to talk about something
>>
>>54299737
>CS classes require calc IV
>calc requres calc III
>calc 3 requires calc 2 and college algebra
>college algebra requires calc 1 and 2 and algebra 2 (and one, or preferably both)

yeah fuck this shit
>>
>>54299708
what's the highest math you've taken? calculus 1?
math is very complex and filled with nuances and rules

it not only requires base hard knowledge but also logical understanding of how to fit functions together to effectively model whatever it is you're doing
>>
>>54299774
Is that for your CS program? Sounds good. I only have to take up to calc III and three other maths. I'm glad your university keeps retards from getting CS degrees.
>>
>>54299774
Depends on program for me I only had to take Discrete Math you will have to take some kind of applied computing math course. You can't avoid math for computer degrees
>>
>>54299777
>math is very complex and filled with nuances and rules

exactly, thank you based anon for saying what no one else seems to be able

there is ALWAYS more math, and it only gets more and more interesting as you go deeper
>>
>>54299732
they are pretty simple if you think about it creatively, just most people are conditioned to hate thinking about numbers by a terrible mathematics education system. for example i bet you gave the triangle problem no more than 5 seconds thought.
>>54299759
rude desu
>>
Quick pajeet (Java) question:

class MyClass {
int x = 10;
}

class MyClass {
int x;
public MyClass() {
x = 10;
}
}


What's the difference?
>>
>>54299814
They are not simple and known to be difficult to do
>>
>>54299777
i have a degree in math
>>54299829
nothing of note but you should decare your ints final anon
>>
>>54299789
>Only Calc III
What's that at your Uni? Vector and Multivariable Calc for me. Hell on Earth.
>>
Is there a crash course for linear algebra somewhere?
my opengl book assumes i know it already.
>>
>>54299811
>there is ALWAYS more math, and it only gets more and more interesting as you go deeper

Most math is of interest only to mathematicians. I'm not saying it's not cool, it's just not entirely relevant to everyone else.
>>
>>54299829
The constructor initializes x to 10 in the second MyClass but they are equal
>>
>>54299836
i gave you an example of a very simple one. like all things, some math questions are harder than others but many are very easy and have interesting solutions
>>
>>54299719
The documentation was like 30 pages but essentially it was a program that had to create and manage a database using c++ with specific functionality. The biggest emphasis was on style more than anything. Trust me anon, it's boring unless you want to practice your professionalism.
>>
>>54299814
I'm not trying to be condescending here, but I think that because you have yet to be exposed to difficult math, you don't understand how far the rabbit hole really goes. There are mathematical proofs you will have to do that are beyond your current imagination.

>>54299852
>>54299874
Alright, thanks.

>>54299853
The syllabus lists these topics: Vector functions, partial derivatives, multiple integrals, vector calculus
>>
>>54299869
true most things were discovered out of pure interest first and applications were only realized later when other folks drew parallels to real life. thats what the applied mathematicians are for and they are based people ill tell you that.
>>
imaginary numbers are a meme
>>
>>54299962
This.
I don't understand how a grown adult could look at his body of work, refuse to admit that it's all wrong and just duct taped some shit about "imaginary" numbers to save face.

I bet hawking radiation is the same deal.
>>
>>54299936
Yeah, the last bit is killer. Luckily the rest was easy. Did kind of struggle with the 3D shit at the beginning, hard to visualize. Power series in Calc II didn't bode well with me either. It would have been easier if they didn't try to stuff both of those things into the last two weeks of class.

>>54299962
lol ur dumb 4 reaLZ XD
>>
>>54299937

I guess. They do love their ivory tower, though. At the very least, unlike other ""research-only"" degrees, they're smart enough not to turn into commies.

That's a pretty common problem for people that spend too much time in academia.
>>
>>54299994
Completely agree about the series at the end of calc II. Everything else was fine but that. The first time I took it (in HS, I didn't fail and then retake lol) we did Taylor series first, but at uni we talked about it for half a class.
>>
>>54299750
Fourth year, I took finished all my calculus and stats a long time ago.

I wouldn't consider calculus to be CS math at all (even though it's required for the degree), because it's so far removed from the actual subject matter. You're right that it is is needed for ECE, but has no place in CS. Statistics are better than calculus IMO, but still fall outside the realm of what should be considered CS, unless you are interested in machine learning.

Only a few, extremely specific subfields of algorithm analysis require more calculus and stats that what should be common sense.
>>
>>54300006
There is literally nothing wrong with being a commie without them there would be no free software. Checkmate all of fucking /g/
>>
>>54299936
why do you think that anon? i love absurd mathematical solutions. especially those generated by a computer that no human could possibly decipher. i just think most people's possible love for mathematics was destroyed somewhere between memorizing multiplication tables and "solve for x," and "integrate by y". there's a whole world of math that most people are never exposed too.
>>
>>54300087
>There is literally nothing wrong with being a commie

Usually I don't have limits with regards to jokes, but this is something I think is sacred. Hundreds of millions of people have died directly as a result of communism and socialism. There is no other human creation near as deadly.
>>
>>54300100
Perhaps I quoted the wrong anon

>>54300122
Um... the holocaust?
>>
>>54300122
true communism hasn't been tried with full automation
>>
>>54300087
Your logic is about as sound as the flat earth society
>>
>>54300149
>the holocaust?

Yes, socialism (NSDAP), as I noted.
>>
>>54300122
yeah there is the worse one of all called Religion
>>
>>54300122
I still think religion has been responsible for many more, like many orders of magnitude more.

Also, I'm filtering you, because you're exceedingly stupid.
>>
>>54300122
you sound like a politician who rehearsed this line. there's no way you actually believe that jokes about communism of all things cross the line. jokes about tabs vs spaces, though? that's going too far.
>>
>>54300014
Seems like they should go back to the trivium model: year-long math and literature/philosophy courses every year that build upon where that particular class left off in the previous class. Obviously it would be split up by school: Engineering, Computer Science, Business, Art, etc. and would focus on skills in those areas.

>>54300076
We went through part of the TAOCP Vol. 1 for our Advanced Data and Algo class. The first real example in that book uses fucking series. There is no way you sincerely believe that.

>>54300149
Order of magnitude off.
>>54300087
Statist Leftism is the mother of all cancer. Syndicalism is better, that's what GNU is about; by workers for workers.
>>
>>54300164
The ideology didn't even work on life support (insert list of every failed communistical society). What makes you think it will work on it's own?
>>
im reading strings from a file and putting them in an array. how do I skip adding the string being read in if it already exists in my array? in C
>>
File: 1378754042364.jpg (305KB, 793x1400px) Image search: [Google] [Yandex] [Bing]
1378754042364.jpg
305KB, 793x1400px
>>54300164
>never been tried

yeah uh huh
>>
>>54300217
post the GPL one
>>
>>54300204
Search the array for the string? Obviously it will perform like shit, but that's what you get for using an list instead of a set.
>>
>>54300217
None of those have had full automation with robot workers so my argument still holds true. You cannot defeat my superior intelligence don't even try
>>
>>54300122
>On 4chan
>Thinks anything is sacred.
I feel like you might be at home somewhere where safe spaces are enforced.
>>
>>54300204
Run a search check before inserting in the areay
>>
>>54300179
>>54300181

I was thinking more recent events rather than of all time. Religious conquests during the early centuries of civilization were pretty bad, too.

>>54300183
>there's no way you actually believe that jokes about communism of all things cross the line.

Alright, you caught me, I put some acting into it. I still think it's incredibly destructive.
>>
>>54300204
implement a hashset in C or suffer O(n) insertion runtime
>mfw this would be trivial to implement in a modern language with a O(1) insertion speed
>>
>>54300252
I'm glad to hear you're not a complete pussy.
>>
>>54300236
even though you're just joking, even perfect communism is really miserable
imagine everyone having the same resources. Imagine trying to get more of those resources (like bread) and getting murdered by whatever government is enforcing the communism (which is necessary since people don't naturally share things selflessly)

all of those nice products you like to use like a good computer or peanut butter don't really exist in communist worlds
>>
what does it mean to put
class someClass
at the top of your head file?

e.g.

class classB;

class classA
{
public:
...
}
>>
>>54300265

Thanks. Nothing is truly sacred, except my negresses.
>>
>>54300217
"Functional programming has never been tried"
>>
>>54300270
desu in a perfect communist society i wouldnt work because why would I?
>>
File: GPL.png (53KB, 793x1972px) Image search: [Google] [Yandex] [Bing]
GPL.png
53KB, 793x1972px
>>54300228
>>54300217
>>
>>54300281
Oh shit it's OSGTP. Why no trip loser?
>>
>>54300279
it's an incomplete definition -- you can create classB's but not access anything in them (but you can use functions that are friends of them if you have access to those functions)

This is entirely a guess based on incomplete struct declarations in C
>>
>>54300298
kek
>>
>>54300270
Everyone gets to use a 2003 HP laptop. /v/ fags would stop screaming when that happens.
>>
>>54300291
I've tried it and its pretty based lad
>>
>>54300303

I think you have forced anonymous on, lad.
>>
>>54300303
He has a trip, your CSS is broken.
>>
>>54300306
ah so its use here is to allow for the virtual GetComposite function?
>>
>>54300311
You cannot be serious.

Why would computers be developed at all under a perfect communist system?
>>
>>54300270
they would exist when you have such a great abundance due to robot drones being the workers
>>
>>54300327
Looks like it, yeah.
>>
>>54300338
They were left over from a once capitalistic society
>>
>>54300344
stop living in this fantasy world like there are unlimited resources with unlimited labor and everybody can enjoy the same great products without working. We're talking about what would happen in real life. There aren't enough peanuts for everybody to have peanut butter
>>
>>54300322
Shiggity. Just reinstalled my OS, used an old conf.
>>
>>54300327
>>54300345
This is neat actually, they incompletely define it so that they can have the virtual function there, and then define it afterwards, inheriting from the class that has that virtual function. How neat, I wouldn't have thought of that. It's a way to get the child class from the base class, i.e. to get the square from a shape. How neat.
>>
>>54300372
Sure there are when we have to much resources here on Earth and the robots are doing everything it would work
>>
>>54300379
yeah i know man for the past 3 or so days ive been trying to find ways to overcome this and then i, for the first time in this course, open up the textbook and they in 1 line just do it
>>
>>54300387
OK, once the robots do everything we'll switch to communism.
>>
>>54300387
someone has to be skilled enough to design the robots, but can't be paid more. How are we going to motivate him to selflessly do this? Remember, we can't offer him any bonuses
>>
>>54300198
>We went through part of the TAOCP Vol. 1 for our Advanced Data and Algo class. The first real example in that book uses fucking series. There is no way you sincerely believe that.

The idea of a series when it comes to simplifying a recurrence or other structure isn't a calculus-specific concept. Even if you use equations typically taught in calculus courses to solve those series problems, you don't actually have to have grinded through a calculus course to understand how a series works, as they aren't inherently a part of calculus.

Besides, while using TAOCP at the undergraduate level is really cool, you have to understand that your class is not the norm. Most places will use select analysis chapters from CLRS for advanced algorithms classes, and you can easily work through the entire book without having ever taken a calculus course.

Yes, you can learn about algorithm analysis with a calculus approach, I'm just saying it's not required, and is tangential to actually learning about analysis.
>>
>>54300417
hobbyists?
>>
>>54300417
Robots will be able to design themselves and program themselves eventually so this will not be a problem you will see the power of full automation very shortly
>>
>>54300410
You mean we will switch to baby syndrome.

>>54300396
>I'll be right back, offing myself
>>
>>54300410
Who will fix the robots nonparadoxically? Will new ideas be a depleated resource?
>>
>>54300443
>hobbyists
Now that's some prime shitposting
>>
>>54300372
What will happen when more tasks have been automated by robots to the point where it's not feasible for the average joe to simply "get a job"? When automation reaches that point, he won't be out of a job because of laziness, but because there is actually no job for him to get.

There are three options a society can take in this case:
1) Do nothing, and make these jobless people resort to violent crime to make ends meet
2) Kill everyone who can't find employment
3) Give the jobless people some sort of handout to stay alive

If a fully automated society were to exist, option 3 is probably the most reasonable.
>>
>>54300464
I'm a capitalist, but I do agree that once everything (and I mean everything, including repair and self improvement) is done by robots, we should just chill and do art and explore the galaxy a or whatever we want to do. In such a futuristic society, it would be rude not to feed your poor.
>>
>>54300494
that's not communism, that's like a weak socialism
>>
>>54300494
the only reasonable thing is 3 and discouraging new births because there really isn't much reason for humans to exist anymore
>>
what is the current flavor of the month language right now?
>>
>>54300512
robots will be able to repair and self improve shortly just you watch
>>
>>54300539
I know you're kidding this is why it's impossible to take communists seriously
>>
>>54300560
I am not joking robots will be able to program themselves, self repair, and improve it is the future
>>
>>54300539
when can they write websites im tired of doing that
>>
>>54300571
>>54299937
samefriend
>>
>>54300512
I kind of agree. It's still a theoretical ideology but I'd like to see a trial run on some shitty region once it's possible.
>>
>>54300571
being able to "improve" is only possible through AI, and AI doesn't exist. And probably will never exist.
>>
>>54300516
I don't care what it's called, it just seems to me that it will be the eventual result of technological progress.

>>54300523
>isn't much reason for humans to exist anymore
I don't buy that.

Even if everything in the world becomes automated, there is still all of space to spread through and catalog.

If anything, a fully automated society should push people to have MORE children, as full automation would solve almost all problems we have with food and water distribution today.

The fewer menial tasks must be done and the more children people have, the more people are available to send off into the depths of space for exploration.

Why worry about people dying in space when you have a thousand more lined up to take the spot?
>>
>>54300591
>AI doesn't exist
wikipedia/AI_effect
>>
>>54300596
>I don't care what it's called, it just seems to me that it will be the eventual result of technological progress.
>HIstorical materialism
Lol
>>
>>54300591
>what is evolutionary computation
>what are genetic algos
>what is machine learning
Programs have been improving themselves on their own for years.
>>
>>54300523
When we master space exploration and colonization it wont matter anymore.
>>
>>54300596
>there isn't much reason for humans to exist anymore
You should read that again and think about what that means.

>Why worry about people dying in space when you have a thousand more lined up to take the spot?
You yourself just admitted that human lives will be even more worthless than they have been at any point in human history.

Why would people keep churning out babies if this is their entire purpose in life?
>>
>>54300607
I'm not trying to imply it's a good or bad thing, but the fact of the matter is that things are headed in that direction, and it would be better to look ahead and prepare for the eventuality than to ignore it until later.

It is guaranteed to happen, regardless of whether people like it or not.
>>
>>54300613
these programs can only exhibit programmed behavior
in other words they can only do what they were designed to do
>>
>>54300587
put your trip on OSGTP. And no.
>>
>>54300637
see >>54299759
>>
>>54300536
>>
File: 1406757003100.jpg (28KB, 640x640px) Image search: [Google] [Yandex] [Bing]
1406757003100.jpg
28KB, 640x640px
In C++ how would I dynamically allocate memory for a pointer char array based on user input?

I already know how to count the input character by character and then initialize the array with the correct size, but how do I store the input before the allocation takes place? I don't want to have to ask the user to enter the same input twice.
>>
>>54300650
rude desu
>>
>>54300642
>implying I would post without my trip at any time.
>>
>>54300653
It is always Haskell, the most based language.
>>
>>54300618
>You should read that again and think about what that means.
I read it again, and I'm not sure what you are suggesting here.

>worthless than they have been at any point in human history
"Worth" is assigned to something by a society. Nothing has an inherent "worth", because "worth" comes from the value that other people assign it.

If such an automated society would exist in the future, I can guarantee you that the way a human life's "worth" is judged would change.

>Why would people keep churning out babies if this is their entire purpose in life?
Why wouldn't they? If people of the future decide it's their sole purpose, then why would they not?
>>
>AI woes
World population predicted to decrease after hitting 12 billion. Rate of population growth is decreasing. By the time automation becomes cheap and efficient enough to replace the jobs of most of humanity, we'll have a decreasing population.

Well, at the very least, the West will have a decreasing population. The rest of the world may have a more stable population, albeit with higher crime if we suddenly decided we no longer need their business, and don't want to feed them.
>>
>>54300636
That's the thing, the idea that society is headed in a certain direction politically is something everyone revers as a bad joke.
>>
new thread >>54300685
>>
I don't see any programming.
>>
New thread >>54300703
>>
>>54300681
>decreasing
nah its steady state
>>
>>54300693
I'm saying that the political aspect is a side effect of technological growth.

Do you have any other ideas about this?

Is there any way for a primarily capitalist economy to coexist with full automation?
>>
>>54300753
it is conceivable that no matter the levels of automation, human effort will always be worth something therefore it will always be worth rewarding human effort that helps you thus capitalism will always exist
>>
hello Fa/g/s
>>
>>54300808
I agree, but if the vast majority of people can't be employed, they would have to be put on the dole, which would give way to a far more socialist society than we have right now.

Sure, apple, samsung, etc may still manufacture and sell devices, but the revenue they make will come from the people who live on the dole, who get their money from the government's collected taxes on running machines. That's far different from what we have now where people make money, and buy stuff with some of it and give some other bit for taxes.
>>
>>54300753
It's not a side effect. It allows for it, but doesn't guarantee it. Hitler lived just 70 years ago. Very non-liberal, very technologically advanced. The two might be correlated, but there is no direct causation. More technology makes more resources available, liberalism is a fight for the people to own those resources. They don't always have to win.
>>
>>54300539
Even after robots become self repairing and able to program themselves, They're still not going to be cost/resource effective.
>>
>>54300836
i wouldnt think about it that way. if we still used human telephone operators, the whole US's population would be employed by the telecomunications company to route its telephone calls. Automation frees up people's time, lets them do things they couldnt before.
>>
>>54300637
Humans through natural selection were designed to survive and reproduce.
Genetic algorithms go through a very similar process.
>>
>>54300656
He's right.
>>
>>54301017
No he's not. Humans act due to biological imperatives. We are programmed. There is no will without programming.
>>
>>54301064
You're an idiot.
Actually read the chain of posts your replying to.
>>
>>54301083
I did.
>Genetic algos are super cool!!
>Intelligence is all that's necessary for conscious life
Genetic algorithms is still programming my dude. Programming something to improve itself isn't the thing wanting to improve itself. Humans are going nowhere soon. That's my point, therefor:
>these programs can only exhibit programmed behavior
is correct and ur dumb 4 realz.
>>
>>54301148
I agree.
Humans are also programmed through natural selection.
My point is that programs can also be intelligent.
Intelligence is not exclusive to biological creatures.

On an unrelated note, emotions are probably exclusive to biological creatures since emotions are just the effect of chemicals on the brain. although I'm not a biologist so what I just said there is could be completely retarded, sorry if it is.
I guess you could emulate emotions in an intelligent program.
>>
>>54301196
Certainly intelligence isn't limited to biological creatures. But intelligence isn't everything. I think it will be hard trying to design a system that is intelligent and has motives similar enough to our own to help us, without exposing us to the same negative side effects of our condition.
>>
>>54301252
I have to agree, intelligence isn't everything, but it's certainly something not to be ignored.
I think motives is just a matter of having multiple layers of intelligence and tuning them to maximize it's "score".
>>
>doing kalman filtering
>matlab doesn't stop you from adding a scalar to a matrix
>it adds the scalar element by element
Fucking why?
>>
>>54301354
Fucking because.
>>
What happened?

NEW THREAD
>>54301567
>>54301567
>>
Janitor deleted both threads for some reason.

New thread:
>>54301571
>>54301571
>>54301571
>>
>>54301578
I hope you realize this was all your fault.
No duplicate threads, you autist.
>>
>>54301578
Delete your thread. >>54301573 is first and is the official thread.
>>
>>54301578
delete your thread
Thread replies: 335
Thread images: 10
[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.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK