[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: 314
Thread images: 45

File: 1484953500372.jpg (110KB, 620x520px) Image search: [Google]
1484953500372.jpg
110KB, 620x520px
What are you working on, /g/?

Old thread: >>62477169
>>
Rust is a language with promise
>>
>>62482852
can't even initialize a struct on the heap without crossing your fingers and hoping the optimizer elides the copy
>>
I'm writing a switch function but when I the default case is used, it prints out the statement 3 times

int value(char romanChar) {
switch (romanChar)
{
case 'I':return 1;
case 'V':return 5;
case 'X':return 10;
case 'L':return 50;
case 'C':return 100;
case 'D':return 500;
case 'M':return 1000; //cout << "Sorry, '" << romanChar << "' is not a Roman numeral. Please enter a Roman numeral :";
default:
cout << ":)";
break;
}

}
So it prints out ":):):)"
>>
>>62482905
code tags
>>
Anons, I need help. I want to create a web page with a simple signup system.
I've already done a database and a C++ program to singup users.
I now want to do a web page but I have no idea how to connect the web page with the database
Pic related is the web page.
In other words, I just want the buttons to send the information and store it in the database, like the C++ program does

Also. How do I change the text in the buttons?
>>
>>62482905
Sepples was a fucking mistake.
>>
File: 1476664113323.jpg (48KB, 492x449px) Image search: [Google]
1476664113323.jpg
48KB, 492x449px
>>62482943
I know
>>
File: 1502078841465s.jpg (8KB, 244x206px) Image search: [Google]
1502078841465s.jpg
8KB, 244x206px
>>62482830
Im working on learning clisp

and Im about to hurl my thinkpad across the room. None of my shit is working when I try to compile it from notepad
>>
>>62482694
The code actually gets simpler.
Desc : Type -> Type
Desc a = a -> (b : Type ** Interpolator b)

entity : Desc a -> Type
entity d = (x : a) -> fst (d x)

interpolate : (d : Desc a) -> Interpolator (Entity d)
interpolate d t e e' x = (snd (d x)) t (e x) (e' x)


EntFields = X | Y

entDesc : Desc EntFields
entDesc X = (Float ** lerp)
entDesc Y = (Float ** lerp)

Ent : Type
Ent = entity entDesc

ent : Ent
ent X = 100
ent Y = 200
>>
>>62483000
notepad isn't great for programming
>>
>>62482914
int roman_to_int(string measure) {
int i, j;
int total = 0;
int max_value_so_far = 0;
j = measure.length() - 1;
for (int i = j; i >= 0; i--) {
if (value(measure[i]) >= max_value_so_far)
total = total + value(measure[i]);
else {
total = total - value(measure[i]);
}
max_value_so_far = value(measure[i]);
}
return total;
}
int main() {

string julius;
string brutus = "b";
int octavian;
cout << "Please enter a Roman numeral :";
cin >> julius;
while (julius != "b") {
// if (julius != ){
// cout << " Sorry, " << julius << " is not a Roman numeral. Please enter a Roman numeral :";
// cin >> julius;}
octavian = roman_to_int(julius);
cout <<"That has the value "<< octavian << ".\n";
cout << "Enter another numeral :";
cin >> julius;
}
cout << "Et tu Brute?\n";
keep_window_open();
return 0;

}
>>
>>62482830
Could someone find the bug in my code?
I'm trying to write a function in C that takes two strings s1 and s2, and removes any character in s1 that is also in s2. Here is what I have
https://hastebin.com/oxavasifay.cpp
The resulting string always contains a tail of the last character, whose length is the difference of the original string 1 and the edited string 1 (so it appears the function continues printing the last character until string length is reached).
>>
>>62483089
Also, I tried adding extra conditions to break out of the loop , but they never seemed to fix the problem
>>
Does anyone know of a good project management / scrum tool that is 1. free as in freedom and 2. offline with a local / easy to share database?
>>
>>62483078
CODE TAGS
>>
>>62483078
[ code ] without spaces [ / code ]
>>
>>62483034
So if you need a new field, you just add it to EntFields and entDesc and it doesn't break anything?
>>
>>62483169
You will also of course need to change the "constructors", but yes.
>>
>>62483194
>You will also of course need to change the "constructors", but yes.
"Constructors" being all the bits that go "ent Property = value"?
>>
>>62483148
host kanboard on your own computer with sqlite
>>
>>62483221
Yes. Idris doesn't have nice pattern matching lambdas but ideally you would be able to create objects anonymously more like this,
\{X => 100, Y => 200}

In Idris it would look like:
\x => case x of
X => 100
Y => 200

Agda has this feature.
>>
>>62483069
switched to notepad++

it was a fucking extra paran in one of my functions that I didn't completely delete last night. I can finally compile thank god
>>
File: 1484882114211.jpg (136KB, 644x632px) Image search: [Google]
1484882114211.jpg
136KB, 644x632px
>>62483166
>>62483151
>>62482914
Tried code tags. It didn't work. Probably using them wrong. Quick rundown on codetags?
>>
>>62483271
write the post >>62483166
without spaces in the brackets.
It is like html but with [ ] instead of < >
Is this your first week on the internet?
>>
>>62483271
that sort of question is probably better suited to >>>/g/wdg
>>
>>62483248
How do you get the value of a field? Is it just "ent X"?
>>
Please help me. I'm a moron using Haskell.

I'm trying to do a quick workaround to have C-style Char arithmetic ('C' - 'A' == 2) by doing an instance of the Num typeclass

I'm entering this in GHCi, but I'm getting a type error
Prelude Data.Char> instance Num Char where (-) a b = (ord a) - (ord b)
>>
>>62483302
Yep.
>>
File: 1502164397891.jpg (29KB, 342x358px) Image search: [Google]
1502164397891.jpg
29KB, 342x358px
>>62483293
No
It's my first week on /g/
>>
>>62483306
where's the code?
>>
File: flower thinks.png (418KB, 600x720px) Image search: [Google]
flower thinks.png
418KB, 600x720px
>>62483089
that logic seems a bit messed up, but, assuming that the length of s1 after squeeze should always be smaller (or at least different) than before it, it seems you need to mark the end of the string with '\0' at the last position + 1.
so i guess:
s1[k] = '\0';

after the for loop would fix it?
>>
>>62483306
You have to convert back to a Char.
>>
>>62483306
the type of minus is `Num a => a -> a -> a`. So your implementation for `Num Char` becomes `(-) :: Char -> Char -> Char`. There is InstanceSigs extension which lets you write type signatures inside class instances. It's helpful to make sure you know what the expected type is and if you get it wrong, GHC will say the signature is wrong rather than your code.
>>
File: wtf2.png (110KB, 370x210px) Image search: [Google]
wtf2.png
110KB, 370x210px
>>62483311
>mfw you actually delivered
Fair enough. I stand corrected. I'll look into it and see what else you can do with it.
>>
>>62483356
> So your implementation for `Num Char` becomes `(-) :: Char -> Char -> Char`
So is there any way I can do the 'C' - 'A' == 2 thing besides doing the following?
subChars :: Char -> Char -> Int
subChars c1 c2 = (-) (ord c1) (ord c2)


>>62483342
Here's the code I have (wrote it in its own file instead of entering the statement in GHCi)
import Data.Char

instance Num Char where
(-) a b = (ord a) - (ord b)
(+) a b = (ord a) + (ord b)

main:: IO()
main = do
print $ (-) 'C' 'A'

>>
>>62483354
Never mind, I'm stupid.

>>62483428
No. Well, you could redefine the operators to be more flexible but you'd have to ensure that Num is never imported.
>>
>>62483399
Unlike you I never doubted her.
>>
>>62483428
Yes, you just wrote exactly how. Have a function to do it.(-) can only give you back the same type you feed it in the first place.

Also whatever you're doing, doing such arithmetic is almost always wrong but I'm assuming it's just for learning.
>>
>>62482940
>what is web service
>what is CGI
>>
Going into Database programming wondering what's more crucial to focus on, Oracle or SQL?
>>
>>62483312
Tags are like that everywhere.
The only /g/ specific part is it is called code.
Also, when you have a problem you want help with, boil it down to a minimal working example where you can reproduce the same error.
Imagine you have a giant project. You wouldn't be able to post it here and nobody wants to read through all your code that has nothing to do with the error in question.
If for nothing else, make it a goal to make a new project in 5 seconds.
You should be able to quickly test stuff or make it easy for people to help you.
Very often, it helps to make the small example, not being able to reproduce it and then read through the code to see what the error is.
If you don't have patience to do that, compile with -g, run the code through a debugger and step through the code to see what is happening.
>>
File: 1486596925978.jpg (47KB, 637x579px) Image search: [Google]
1486596925978.jpg
47KB, 637x579px
Have you been programming in the baka approved language, /dpt/?
>>
>>62483534
I'm forced to learn this for my degree (B.S. Informational Systems)

I want to die, there's so much shit.
>>
File: 1502557784285.jpg (7KB, 195x258px) Image search: [Google]
1502557784285.jpg
7KB, 195x258px
>>62483534
>c++ for idiots
>it's actually just c
would buy/10
>>
What would a /g/-approved programming language contain?
>>
>>62483575
Absolutely everything.
>>
>>62483575
goto
>>
>>62483575

Raw Pointers and Headers.
>>
>>62482830

JVM Languages or Javascript?
I'm wiling to learn something to get a job.
>>
File: 1492488946597.png (76KB, 982x1274px) Image search: [Google]
1492488946597.png
76KB, 982x1274px
>>62483293
Sorry I'm fucking retarded
test
>>
>>62482026
>Also, do you have some good style tips for writing readable C++?
use generic lambdas and lambda overload sets to drastically cut down on syntax while still retaining generic/templated functionality. make them constexpr values when they don't capture (i mean the lambda objects themselves - their operator()'s will automatically be constexpr-qualified (and thus also inline-qualified) if applicable. in practice, they often end up behaving like aggressively inlined constexpr functions, all while being concise and readable. and since they're objects, they can be easily passed as arguments to higher-order functions/lambdas/overload sets. as an example, here's a simple/concise implementation of left/right binary fold functions and variadic min/max:

template<typename... T>
struct overload_set : T... { using T::operator()...; };
template<typename... T> overload_set(T&&...) -> overload_set<T...>;

constexpr auto foldl = overload_set
{
[](auto f, auto x, auto y) { return f(x, y); },
[](auto f, auto x, auto y, auto... z) { return foldl(f, f(x, y), z...); }
};

constexpr auto foldr = overload_set
{
[](auto f, auto x, auto y) { return f(x, y); },
[](auto f, auto x, auto y, auto... z) { return f(x, foldr(f, y, z...)); }
};

constexpr auto min = overload_set
{
[](auto x) { return x; },
[](auto x, auto y) { return x < y ? x : y; },
[](auto x, auto y, auto... z) { return foldl(min, x, y, z...); }
};

constexpr auto max = overload_set
{
[](auto x) { return x; },
[](auto x, auto y) { return x > y ? x : y; },
[](auto x, auto y, auto... z) { return foldl(max, x, y, z...); }
};
>>
>>62483575
>>62483597
>goto
You mean COMEFROM.
https://en.wikipedia.org/wiki/COMEFROM
>>
>>62483653
>>62483293
 int value(char romanChar) {
switch (romanChar)
{
case 'I':return 1;
break;
case 'V':return 5;
break;
case 'X':return 10;
break;
case 'L':return 50;
break;
case 'C':return 100;
break;
case 'D':return 500;
break;
case 'M':return 1000; //cout << "Sorry, '" << romanChar << "' is not a Roman numeral. Please enter a Roman numeral :";
default:
cout << "test" << endl;
break;
}
}
int roman_to_int(string measure) {
int i, j;
int total = 0;
int max_value_so_far = 0;
j = measure.length() - 1;
for (int i = j; i >= 0; i--) {
if (value(measure[i]) >= max_value_so_far)
total = total + value(measure[i]);
else {
total = total - value(measure[i]);
}
max_value_so_far = value(measure[i]);
}
return total;
}
int main() {
string julius;
string brutus = "b";
int octavian;
cout << "Please enter a Roman numeral :";
cin >> julius;
while (julius != "b") {
// if (julius != ){
// cout << " Sorry, " << julius << " is not a Roman numeral. Please enter a Roman numeral :";
// cin >> julius;}
octavian = roman_to_int(julius);
cout <<"That has the value "<< octavian << ".\n";
cout << "Enter another numeral :";
cin >> julius;
}
cout << "Et tu Brute?\n";
keep_window_open();
return 0;
}
>>
>>62482940
The easiest way to connect the two is through a websocket.
I have used libwebsocket in the past, it is a C library but you can make it work.
On both ends, you define what to do when you receive a message.

Eg, here is my javascript for setting up the websocket:

//WebSocket connection
function connect(websocketServerLocation) {
if (typeof MozWebSocket != "undefined") {
websocket = new MozWebSocket(websocketServerLocation,"simple-protocol");
} else {
websocket = new WebSocket(websocketServerLocation,"simple-protocol");
}
websocket.onopen = function () {
not_connected = false;
};

websocket.onmessage = function (evt) {
received_msg = evt.data;
console.log("Message received = " + received_msg);
dispatcher();
};
websocket.onclose = function () {
not_connected = true;
//try to reconnect in 10 seconds
setTimeout(function(){
connect(websocketServerLocation)
}, 10000);
};
};
//and to send stuff
websocket.send("stuff");

In the HTML, the button will have an onclick function, you set that to the name of the javascript function, just remember everything is a string, so it is probably valid syntax whatever you do.

In C++, you basically follow their tutorial for a simple setup.
>>
>>62483588
so just like c++?
>>
>>62483672
in your function roman_to_int, you call the value function 3 times.
Store the value so you can reuse the result.
 int roman_to_int(string measure) {
int total = 0;
int max_value_so_far = 0;
int j = measure.length() - 1;
for (int i = j; i >= 0; i--) {
int result = value(measure[i]);
if (result >= max_value_so_far) {
total = total + result;
max_value_so_far = result;
} else {
total = total - result;
}
}
return total;
}
>>
>>62483759
Precisely.
>>
>>62483813
Thanks. The only thing I really need to do now is to to remove the random value that the non numerlas are assineged to
>>
>>62483353
I'm not sure why the logic i used was messed up, but you;re right I forgot to put the terminating '\0' at the end of string s1.
And it somehow works now...
I would not have guessed that this error in the code was causing this malfunction
https://hastebin.com/equfaviruh.cpp
>>
File: 1499369436553.png (889KB, 756x715px) Image search: [Google]
1499369436553.png
889KB, 756x715px
>>62483820
>>62483759
If C++ has everything why isn't it used for everything?
>>
>>62483575
Sane string support (so UTF-16).
>>
>>62483759
>>62483820
If C++ has everything, why does it take 10 times as many lines of code to get anything done in it as in any real programming language?
>>
>>62484016
UTF-8 and/or UTF-32 anon.
>>
>>62484016
Haskell text package uses UTF-16.
>>
>>62484029
UTF-32 is just as worthless as UTF-16.
>>
>>62484029
But UTF-8 and UTF-32 are useless on any operating systems that counts.
>>
>>62484018

Because it isn't hiding tons of abstractions for your shitty code.
>>
>>62483950
Because brainlets give up learning it and move to some piece of shit language like javascript
>>
>>62484054
t. struggles with any OS other than what his parents bought him
>>
Yak shaving

Had a bug in my game in which characters weren't loading properly. Figured it's most easily solved by migrating code from the client to the client/server shared library, which is a decent size refactoring job. As part of that, I had to ensure the client and server were producing the same random numbers given the same seed, which of course they weren't because fuck you Unity.

Spent my effort today making a copy of .net core's random class, ripping out unsafe code, adding my own functions, and then implementing that all over my project
>>
How does an Operating system bootstrap? I'm just wondering, where does the processor go to find its first instructions? I assume it loads data from disk into address 0x0, and that's the beginining/bootstrap of the OS, but how does it all work? Does anyone have a link I can read about how some specific like an x86 processor begins bootstrapping? Also, if I wanted to just write in x86 assembly WITHOUT an OS, like, write instructions directly to physical memory instead of virtualized memory, how would I go about doing that? Could I write programs to some 2ndary storage, like a CD, and then boot into it from bios?
>>
File: ignore_sepples.jpg (77KB, 677x463px) Image search: [Google]
ignore_sepples.jpg
77KB, 677x463px
>>62484061
x86 assembly has everything and it isn't hiding tons of abstractions for your shitty C++ code. Sepples monkeys BTFO.
>>
File: lime-text.png (31KB, 673x319px) Image search: [Google]
lime-text.png
31KB, 673x319px
>need to know Go to install text editor
Too hardcore for me.
>>
File: green-dragon.jpg (394KB, 1425x1034px) Image search: [Google]
green-dragon.jpg
394KB, 1425x1034px
>>
>>62484143
I used this guy's analysis to help me understand the boot process when I was writing my first OS, it may be useful to you too.
http://thestarman.pcministry.com/asm/mbr/STDMBR.htm
http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm

The osdev wiki has a few good pages too
>>
>>62484208
>pascal
>>
>>62484143
there's firmware that gets it started. not instructions that have to be loaded from memory, but ones that are etched into the chip or w/e
>>
>>62483813
It works.
Is there a way that when I print out a num roman statement that the main() won't run so that way no value is printed out?
>>
Are the exercises in pic related often pretty tricky or am I just brainlet?
>>
threadly reminder to study
- artificial intelligence (beyond tensorflow)
- quantum computing
- distributed computing
if you still want a job in 5 years
>>
>>62484584
i started skipping them after a few chapters. i have little time, can't spend it all doing exercises in the books i read. some are much harder than others, yes
>>
>>62484595
You can always be a webdev, bro
>>
>>62484584
he just skims and explains pointers in a dumb way, but good book nonetheless
>>
What jobs exist that aren't webdev anymore? Even if you're writing native code, it's meant to be the backend for some website/webapp. Nobody wants desktop applications anymore since they're difficult to maintain and support on various platforms. Nearly every job is webdev now.

What job do you do that isn't webdev?
>>
>>62484628
good luck competing with indians
>>
>>62484659
embedded software in c
>>
>>62483553
Good luck, anon. If you manage to keep your sanity at the end of semester, I'll buy you a drink.
>>
>>62484681
>work in web dev
>work for indians
>low expectations
>writing CRM-CTI integration software
>get 80k right out of college in low COL area
>5 weeks vacation
>parental leave (maternity and paternity)
>401k
>healthcare
>small company so I get to lead my own project

Do it. Work for Indians. It's awesome, it's the easiest job in the entire universe. I leave early every day and never work overtime.
>>
>>62484659
Are you serious? I'm still in CS but even I can tell that there is shit tin of jobs in maintaining, updating, patching adding features to existing software.
>>
>>62484659
consumer software? not much
video games

however, don't rule out software that's meant to run on a server for some website or app
there are tons of jobs that have you write that backend software while someone else does all of the web stuff
>>
>>62484744
So legacy work you mean. There's no work in writing new software that isn't web dev.

All consumer and enterprise computing is over the internet now. Embrace the cloud. Nobody buys native software anymore.
>>
>>62484759
Right that's what I'm talking about. When I say web dev, I include backend software. I'm saying all software dev now involves the web in some way, nobody writes standalone desktop apps anymore and makes money off of it
>>
>>62484769
>Embrace the botnet
ftfy
>>
Why the fuck do I have to learn compiler design for my degree. Who the fuck is writing compilers anymore, LLVM and GCC family run everything now, and if someone really does want to write a compiler they're gonna learn it themselves, not learn it in college.
>>
>>62484805
> GCC family run everything now
Is that Linuxean mafia?
>>
>>62484805
So you can have deeper understanding of tools you're using?

You remind me of all the chads and stacies in high school who keept asking "why do we need to know this" on math lessons
>>
>>62484848
Alright when have you ever had to use calculus? When has anyone that doesn't do scientific/research work had to use calculus?

>never

Admit it: the Chads and Stacies have a better grasp on what ought to be a priority than you do. Chads and Stacies are way better adjusted for life than you
>>
>>62484872
I use calculus every day just by knowing it. With your kind of thinking humanity would still be living in caves
>>
Can I learn programming?
I'm the bad kind of autistic and can't really get my head around how code logic works
>>
>>62484902
>use it just by knowing it

Does not computer

>with your kind of thinking humanity would still be living in caves

Bullshit. the vast majority of humans get along knowing what they need to know. It's only like 0.1% of humans that will actually change the world by knowing this shit. Let the nerds learn the smart shit, and leave me for the middle class cushy web dev job
>>
>>62484976
You are right. But society actively, or even desperately, searches for that 0.1% and if you never try yourself at something how do you know that you're good at it?
>>
File: 20170917175520.png (28KB, 1280x800px) Image search: [Google]
20170917175520.png
28KB, 1280x800px
Simple multiplication marathon game so my son can learn his multiplication tables better.
>>
>>62484954
Yes, you can. There is no "bad kind of autistic".

If you want to learn to program, you have to figure out "why". it doesn't have to be an abstract reason: if you own a computer and you wish that it could do something that nobody else has made software for yet, you should learn to program so you can make it do that thing. What do you want to make? A website? A videogame? Making some software that lets you record your desktop (that's what I first wanted to do). Maybe you just want to write whatever code will get you paid, and you'll figure out what you like along the way. That's fine too.

Figure out WHAT you want to do, then figure out HOW to do it. Then come back here when you've get specific questions on how to write code
>>
File: wat.jpg (47KB, 640x454px) Image search: [Google]
wat.jpg
47KB, 640x454px
>>62485012
T...that sure looks engaging for a kid, anon. Keep it up. Your son is gonna grow up with a love for math.
>>
>>62485012
You're a good mom/dad. Maybe teach him to program when he's old enough as well
>>
>>62485019
I want to learn so I have another skill
I also need a certain program for managing my files and I haven't found something that will do what I want to do
>>
File: 17882.jpg (40KB, 480x298px) Image search: [Google]
17882.jpg
40KB, 480x298px
Kind of random, but I'm sure someone here knows. I downloaded this off a github zip, it's an app for a pebble smartwatch, however it says I have to compile it so it gives me a .pbw file (basically the setup file for an app for the watch) how the fuck do I compile this exactly? I have 0 knowledge of how this works but I assume it's a quick process
>>
>>62485012
cute
>>
>>62484740
i like how you tried to subtly pretend he said "work for" instead of "compete with"
>>
>>62485053
You can absolutely learn to program. There's no doubt in my mind.

Do you think you learn better from reading books, watching other people do something, or maybe watching youtube videos? In person instruction (like in a classroom)?
>>
How do you call one cpp.file in another.
>>
>>62485139
you fucking don't
>>
File: 1503237831496.jpg (138KB, 1356x1017px) Image search: [Google]
1503237831496.jpg
138KB, 1356x1017px
>>62485139
You mean user defined headers?
>>
I have never seen an intelligent argument for null terminated strings besides "saving memory on 50 year old computers".
>>
>>62485139
What do you mean "call" a cpp file?

The process for compiling multi-file programs in C or C++ is to compile the files into .o (object) files first, then the final step of compilation is to compile an executable using all the intermediary object files. You have to use .h/.hpp (header files) in order to reference classes, objects, functions, etc. from one .cpp file in another
>>
>>62485176
I'm trying to call a function forma another cpp.file
>>
>>62485165
How would you terminate a string in Assembly
>>
>>62485165
if I'm reading or modifying the string in memory I don't need to constantly keep track of my position compared to some length value
instead, simply, if I hit '\0', that's the end
>>
>>62485165
one of the many things that make C the fastest & most efficient language
>>
File: 20170917180724.png (27KB, 1280x800px) Image search: [Google]
20170917180724.png
27KB, 1280x800px
>>62485030
I bait him by promising him a dollar for every right answer. It gets funny when he has a groove going on and messes up because he quickly puts down a number.
>>62485044
I'm probably going to teach him Ada when he gets older. Idiot-proof, simpler than C, and relatively powerful.
>>
>>62485165
you don't have to pass the strlen as a register to puts()
>>
>>62484805
Because you're doing computer science, the academic study of computation. There's still a ton of research work going on by the guys who work on LLVM and GCC. If you want to be a code monkey who has to compete with pajeet you should have done a software engineering degree. Too many people thing that computer science = programming.
>>
isn't this
for page in json_resp:
for thread in page["threads"]:
thread_ids.append(thread['no'])


the same as this

thread_ids = [thread['no'] for thread in page["threads"] for page in json_resp]

?

it gives
NameError: name 'page' is not defined
>>
File: Screenshot_20170918_001310.png (31KB, 369x466px) Image search: [Google]
Screenshot_20170918_001310.png
31KB, 369x466px
Maybe some of you remember me from days ago, I was the QT Stock Ticker guy

Well I finally got it to refresh stock quotes while the program is running and I also got some gosh dang UI work done

Feel hapi
>>
>>62483950
Because if I can code something 10x faster in python then it doesn't matter if it takes 10 times longer to execute on the microsecond scale
>>
>>62484681
kek are indians supposed to be good at web developement?
>>
>>62485187
imagine you've got one file, main.cpp which has your main method:

#include "someFunction.hpp"

int main(void){
someFunction();
}



and another file, someFunction.cpp, which has the definition for someFunction():

#include "someFunction.hpp"

void someFunction(){
printf("Hello world");
}



You need a 3rd file, the header, which contains the declaration of the function, called someFunction.hpp:


#ifndef __SOMEFUNCTION_HPP
#define __SOMEFUNCTION_HPP

int someFunction.hpp();

#endif


Those #ifndef and #define lines are there to make sure you don't accidentally call the same code twice.

So then, to compile the code, you have to do it in parts. First, compile the someFunction.cpp:

g++ -c someFunction.cpp -I.


that line -I. is where your header file (someFunction.hpp) is. If it's in the same folder as your .cpp files, then you just do -I. which means "look right here for it". It's a good idea to keep your headers in a different folder just for organization sake.

Next, compile the main.cpp

g++ -c main.cpp -I.


the -c option tells it to make an intermediary object file

then, to put them both together, you can do:

g++ -o program main.o someFunction.o


and there will be a program called "program"
>>
>>62485202
Keep track of the end pointer, then, and simply compare to that.

>>62485204
>often have to calculate length in O(n) for memory allocation purposes
>can't handle in place substrings

>>62485229
>micro optimizing passing parameters to a slow I/O function
Funny stuff.
>>
>programming language designed for productive parallel computing on large-scale systems
Can such language be used for general purpose software?
>>
>>62485246
>software engineering degree

when will this meme die. To be a code monkey, you need a CS degree. Nobody will hire you without one. Anything less and you look like a retard
>>
>>62485327
maybe in Amexico, not Europe
>>
>>62485327
What does one do with a math degree?
>>
>>62485304
typo on the header file. It should just say:

#ifndef __SOMEFUNCTION_HPP
#define __SOMEFUNCTION_HPP

int someFunction();

#endif
>>
>>62485327
So what is software engineering degree for?
>>
I want to write a bot that will trade cryptocurrencies for me. What do I need to know to get started?
>>
>>62485327
That's because software engineering is less valuable. Anyone can be a code monkey, people want computer scientists because they have a deeper understanding of what's going on. Removing theory from computer science just degrades it into a software engineering degree, which already exists and is shit.
>>
>>62485332
Who the fuck wants to work in Europe, especially in CS? you'll get paid half of what an American software developer will, and you have to live in Europe as well
>>
Are people who work in the Mozilla foundation literally idiots?
case $i in

(0) set -- ;;

(1) set -- "$args0" ;;

(2) set -- "$args0" "$args1" ;;

(3) set -- "$args0" "$args1" "$args2" ;;

(4) set -- "$args0" "$args1" "$args2" "$args3" ;;

(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;

(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;

(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;

(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;

(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;

esac
>>
>>62485372
>have to live in Europe

You're right. It's so unbearable living in countries with highest standards of living in the world
>>
>>62485333
Die homeless? Teach precalculus at community college?

>>62485340
Wiping your ass

>>62485359
That's simply not true. They simply have jammed anyone who works into the software development field into a single pipeline, the CS track. few people in CS degrees actually give a shit about theory or aspire to be computer scientists; they all want to be software developers. CS has already been degraded into a software engineering degree. What they should just do is create a new degree for theory shit and call it informatics if you don't give a shit about getting a job
>>
I'm doing my fourth year of computer science in a Russell Group uni and I'm on track for a first. Should I move to a different country when I graduate? Looking at the available jobs in the UK they all seem pretty unexceptional in terms of pay compared to other professions. Also, what skills should I pick up in a year for a better chance at succeeding in interviews?
>>
>>62485401
what is this from?
>>
>>62485426
https://github.com/mozilla-mobile/focus-android/blob/master/gradlew
>>
>>62485402
>highest standard of living

Everyone is white, smells funny, the Asian food sucks, the white people food sucks depending on the country (England), and you make significantly less money than if you live in the USA.

In the USA, a software development job will give you healthcare, AND you get to keep 85% of your paycheck instead of giving it to the government.

Plus, I don't have to live with a bunch of fucking frogs. Euros and their culture are annoying as shit
>>
>>62485419
You can earn a decent salary as a programmer in London.
>>
>>62485419
Move to America. The food is better and we've got more freedom

>what skills should I pick up
Social skills
>>
>>62485436
>white people food sucks depending on the country (England),
fuck off
>>
>>62485401
>>62485432

cute
>>
>>62485437
But in real terms I'd probably be earning less because of the cost of living there. Also, I hate London
>>
Can't say. My work contract doesn't allow me to speak about the project I'm in.
>>
>>62485401
>>62485432
that script can take at most 9 arguments.

so the switch case list them all

it's like a hashtable or loop unrolling and it's faster
>>
>>62485436
>In the USA, a software development job will give you healthcare, AND you get to keep 85% of your paycheck instead of giving it to the government.
But when pajeet takes my job I no longer have healthcare. Also, we'd have to actually start taking your ridiculous politics seriously, which sounds terrifying.
>>
>>62485450
>the food is better
Are you retarded?
We live in globalized world now. You can have exact same food in any corner of the world as long as you're not in some shitty 3rd world country, like US for example.
>>
>>62485459
A good strategy is to live as cheaply as possible while you're there, and save up to buy a comfy place somewhere outside the south east.
>>
>>62485436
>85% of your paycheck instead of giving it to the government.
HAHAHAHHAHAHAHA
>>
>>62485484
I sincerely doubt your government heavily subsidizes corn and gasoline like ours does.
>>
>>62485459
>tfw I almost got an internship with the civil service in London but dropped it because of how much I hate it

I got to the final round of interviews and I still didn't know what my actual job was.
>>
Is it hard to write a simple web server in C?
>>
>>62485513
fast cgi
>>
>>62485513
No.

I built one for a project in my IT engineer course in college.
>>
anyone here familiar with MiniIDE?
>>
>>62485480
>being concerned about speed in the few milliseconds of the build automation system
Confirmed for never being employed
>>
>>62485521
>>62485569
Thanks anons
>>
>>62485579
That's why i don't program but employ programmers.

Get fucked.
>>
>>62485307
>Keep track of the end pointer, then, and simply compare to that.
that's just as complicated
if you're modifying the string, the end pointer might change
and it's still a lot less efficient
>>
How do I in to AI?
>>
>>62485679
>if you're modifying the string, the end pointer might change
The null terminator would change as well. I don't see your point.

>a lot less efficient
End pointer: comparison
Null terminator: memory read, comparison
>>
>>62485692
read artificial intelligence: a modern approach
>>
>>62485746

boring! i just want to make games like crysis and black ops and put that in my game
>>
>>62485165
Pascal strings are superior
>>
>>62485789
the absolute state of would-be programmers today
>>
>>62485275
Swap the for statements
>>
Should I read SICP before going into AI programming?
>>
>>62485789
you're looking for aggydaggy on /vg/
>>
>>62486170
but muh games tho
>>
>>62486196
they will help you with your games..
>>
>>62486069
There's a lot of history with AI using LISP but that's not a reason to read SICP
>>
>>
>>62486334
Not that guy
What skills/knowledge does SICP provides?
>>
>>62486417
I gave up like 30 pages in
>>
File: ben-bernanke-1-sized.jpg (21KB, 217x287px) Image search: [Google]
ben-bernanke-1-sized.jpg
21KB, 217x287px
Why is programming C so comfy?
>>
>>62486523
Because C stands for comfy
>>
File: 1490336659494.png (537KB, 732x743px) Image search: [Google]
1490336659494.png
537KB, 732x743px
>developing program with curses GUI
>"can you add a GUI, please"
>>
>>62486523
Because you feel like you're talking directly to your computer
>>
>>62486593
>curses
>gui
i bet you're one of those kids who uses hacker typer while sitting at the front of a lecture hall
>>
Can anyone explain why my asm code keeps giving an error when I try to link it? The code is
.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO,dwExitCode:DWORD

.code
main PROC
mov eax,5
add eax,6

INVOKE ExitProcess,0
main ENDP
END main

I keep getting an LNK2019: unresolved external symbol error on the ExitProcess line. I am using ml.exe to assembler and link.exe to link the .obj file
>>
File: 1421165201452.jpg (82KB, 740x720px) Image search: [Google]
1421165201452.jpg
82KB, 740x720px
Employed Haskell programmer here
>>
>>62482830
idiot here, I forgot everything.
Can someone tell my why this isnt working please
char array1[5]
char array2[5]

array2[i] = array1[i];


Im trying to do a for loop in C/C++ where it copies a certain character from an array and assigns it to a certain position of another array.
This matchs exactly what I did in another program I made years ago on windows, which still compiles and works as intended, but on linux it spits out garbage when I do printf with %c, %s, or with cout
>>
>>62486718
Is that it or did you initialize the array in your actual code?
>>
>>62486610
I don't follow.
>>
So let me get this straight.
Machine language is 0s and 1s
Next tier is assembly, which is still very cryptic, and anything written in asembly is translated to 0 and 1.
Then high level languages like C and C++ are translated to assembly and then 0 and 1?

Why are all our computers use binary symbols to operateas? Surely there has to be a more effective way.

Imagine alien planet which also has some sort of computers. Do you think they operate on binary symbols? I doubt it. They questions is are the alien computer faster than ours? Maybe, maybe not. But one thing for sure. There is an alien computer, somewhere, that is faster than ours and it's not binary.
>>
File: smug homer.jpg (149KB, 530x600px) Image search: [Google]
smug homer.jpg
149KB, 530x600px
>>62486716
I'm an employed OCaml programmer, so take that
>>
>>62486716
Impossible. It is so low on the TIOBE that its in the unranked 50-100 list. ffs, its below Visual Basic
>>
>>62486800
so this is the "logic" young programmers use these days
>>
>>62486755

Don't do drugs.
>>
>>62486738
Thats the jest of it. Its two char arrays.
I just opened notepad and started dicking around trying to relearn everything I forgot, the "original" was no better than this. I deleted everything when my ex started a bunch of shit gave me a headache and pissed me off.


#include <iostream>
using namespace std;


int main(){
//char asdf[5] = "asdf";
char asdf[5] = {'a','s','d','f'};
char fdsa[5];
for(int i=0;i<5;i++){
asdf[i] = fdsa[i];
}


// for(int i=0; i<5; i++){
printf("%s",asdf);
// }

return 9;
}
>>
>>62486814
>go to Indeed
>Type "Java"
>15,200 jobs
>Type "Haskell"
>79 results
Enjoy being an """""""empolyed""""""" Hasklel dev
>>
>>62486833
>>62486738
ok, in this code I have the asdf = fdsa switched around. Ive corrected this in the new code file.
This seems to compile and run correctly.
So if I try to do "char asdf[5] = "asdf";", is that wrong? it doesnt work?
>>
>>62482830
Making lots of progress on my crying

Not making any progress on my neural network
>>
How the fuck do you get better at programming?

How do you progress from "I kind of know how to theoretically do a few things but I can't organize my code well enough and/or lack the knowledge to finish any real projects" to "Here are my personal projects, give me a fucking job"

I go through bouts of learning to program and I always wind up getting overwhelmed and worrying how long it'll take me before I'm proficient at anything and how poor the resources I'm learning from must be.
>>
>>62486833
Try
char asdf[] = "asdf";
>>
>>62486867
char asdf[5] = "asdf";
is legal and should work afaik
>>
>>62486833
Also is that supposed to be C or C++ code? Remove the "using namespace std"
>>
>>62486856
>it is apparently impossible to be an employed haskell programmer because there are more than zero jobs for it
Yeah, I'm gonna stop worrying about being replaced by someone younger than me.
>>
Can anyone help me with the >>62486708? its x86 asm
>>
>>62486952
I refer you to >>62486856
Here is a shortened version of your BTFOing
>go to Indeed
>Type "Java"
>15,200 jobs
>Type "Haskell"
>79 results
>>
>>62486984
79 > 0
>>
>>62486966
Sorry I only know ARM asm but I've had stupid errors due to incorrect spacing and commas and periods and shit in the wrong place. Refer to an example and make sure your syntax is correct
>>
>>62486755
We use binary because our transistors have two states
>>
so will a cs degree get me a jorb or am i like 10 years late for cs
>>
File: 1502820322331.png (6KB, 321x321px) Image search: [Google]
1502820322331.png
6KB, 321x321px
>2017
>implementing a linked list
>>
>>62487072
15 years too late kid. The social sciences are flooded with jobs though.
>>
>>62487072
If you're not a virgin then it's too late.
>>
>>62487072
it will probably get you a job, but you'll be paid like crap. Unless your in one of the major tech hubs, youll only be earning like 35 starting out
>>
>>62486935
It was C but I got pissed off with typing printf and fucking with the variable types over and over and switched to C++ because cout seems to deal with all types the same. I know its not proper, I know Im a pos for doing it.

>>62486925
>>62486913
All This is what Im trying todo
#include <iostream>
#include <string.h>
using namespace std;


int main(){
char asdf[] = "asdf";
char fdsa[4];
int a = 4;

for(int i=0; i<4; i++){
fdsa[i] = asdf[a];
a--;
}


cout << asdf << endl;
cout << fdsa << endl;
return 9;
}
>>
>>62487114
Take a break anon and come back later. You're making stupid array out of bound mistakes
>>
>>62487108
35k? no fucking way
>>
File: 1463606423970.gif (152KB, 400x267px) Image search: [Google]
1463606423970.gif
152KB, 400x267px
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-s096-introduction-to-c-and-c-january-iap-2013/

worth the time?
>>
>>62486905
build something

are you learning C? make a web server.

are you learning JavaScript? make a tetris clone
>>
File: 1479691517348.jpg (26KB, 504x480px) Image search: [Google]
1479691517348.jpg
26KB, 504x480px
I need to learn C# Good and fast.
Where?
All of the textbooks i have come upon are complete dogshit
>>
>>62487150
this is my break. Im not a programmer any more. I havnt coded anything in years. I just need to see this work and thats all for tonight.
good advice though.
>>
>>62487189
Are you already proficient in another language? Make a small project and google syntax as you progress.
>>
>>62487158
Too high or too low? I've seen anywhere from 35-45k entry level. Not very high by any means
>>
>>62487220
are you in wyoming or shit?
>>
>>62487213
int a = 3;
and
return 0;
>>
File: 6446.png (100KB, 320x148px) Image search: [Google]
6446.png
100KB, 320x148px
>>62487165
>>
>>62487243
What rates are you seeing?
>>
>>62487285
70k entry for maryland as a software engineer
>>
>>62482830
I'm a programming newfag, so teaching myself HTML.
>>
File: 6-s096iap14.jpg (116KB, 320x240px) Image search: [Google]
6-s096iap14.jpg
116KB, 320x240px
>>62487279
>>
>>62487299
>HTML
>programming
>>
File: 1466535523441.jpg (177KB, 590x443px) Image search: [Google]
1466535523441.jpg
177KB, 590x443px
>>62487218
No, Complete Newfag
I want to stop being a codelet
>>
>>62487299
Have fun making flowerpots
>>
>>62487313
Wtf do you want from me?
>>
>>62487319
>Good
>Fast
choose one

You need to take your time. Calm your ADHD and just work through a textbook

>>62487326
https://automatetheboringstuff.com/
>>
>>62487295
>70k entry level
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
>>
File: mfw it is tumbling down.png (153KB, 500x281px) Image search: [Google]
mfw it is tumbling down.png
153KB, 500x281px
>>62487346
Ok i will calm myself.
Where the fuck do i start
>>
>>62487362
I've no idea for C# sorry
>>
>>62487353
>The average salary for a Entry Level Software Engineer is $78,185 in Baltimore, MD. Salaries estimates based on 2,304 salaries
>>
>>62487277
>int a = 3;
That was it. I also added a null character to stop it from printing fdsaasdf from an overflow or some shit.
Either way it does what I want it to and now I can rest. Thanks.
int main(){
char asdf[] = "asdf";
char fdsa[4];
int a = 3;

for(int i=0; i<4; i++){
fdsa[i] = asdf[a];
a--;
}
fdsa[4]='\0';
printf("%s", fdsa);
return 9;
}

ps the return of 9 was my f you to gcc for not letting me declare main as void. once again, not proper but I didn't feel like typing "return" because I wanted this quick and dirty, and the environment I learned to code main was actually void (nonstandard). When it said "main has to return an int" I went for 0 but stopped and was like no fuck you to gcc.

Thanks for pointing the issue out for me.
>>
File: 3ac.jpg (38KB, 853x480px) Image search: [Google]
3ac.jpg
38KB, 853x480px
>>62487379
Well shit.

Anyone here with some c# background that can give tips to a begginer?
>>
>>62487311
https://ocw.mit.edu/courses/find-by-topic/#cat=engineering&subcat=computerscience&spec=programminglanguages
>>
>>62487427
I can tell you C# is a stupid language to start with unless you're learning it for gaymes
>>
>>62487362
learn java then move to C#
>>
File: 1457296252956.jpg (21KB, 479x282px) Image search: [Google]
1457296252956.jpg
21KB, 479x282px
>>62487441
>>62487485

It is forced at my college.
I have literally no fucking option.

And Java has caused me physical pain before
>>
>>62487514
Then read the textbook for your class you dumb nigger
>>
>>62487423
why not just fdsa[i] = asdf[3-i] ?
>>
>>62487514
If your used to the pain of java C# should be fine,it's like they pull the stick of of someone ass for C#.
>>
>>62487514
Shut the fuck up and stop moaning you weak faggot.
>>
>>62487423

And this ends today's episode of 'c strings are stupid'
>>
>>62487568
C doesn't have strings
>>
>>62487535
P-pls no bully

>>62487521
>Then read the textbook for your class you dumb nigger

[spoiler]The textbook is some kindergarten shit written by some spic that barely explains concepts like datatypes or concurrency and is packed to the fucking ass with subjective garbage[/spoiler]
>>
File: ed.jpg (11KB, 287x217px) Image search: [Google]
ed.jpg
11KB, 287x217px
>>62487514
http://www.tutorialspoint.com/csharp/
>>
>>62487524
as oppose to what? Are you saying to eliminate the a variable?
idk honestly my mind is really clouded right now and I visualize what I wrote as two scroll wheels moving like v ^ and the numbers match up with their opposites to flip the string.
>>
Anyone with x86 asm skills can write me a basic program? I wrote a program, and assembled with ml.exe, but the I keep getting an error when linking
>>
>>62487580

if that's true why does a google image search for c string give me so many useful results?
>>
>>62487636
Because google doesn't want to make you cry
>>
>>62487636
https://www.google.com/search?source=hp&q=does+C+support+strings&oq=does+C+support+strings&gs_l=psy-ab.3..0.183.6050.0.6221.22.21.0.0.0.0.199.1680.10j5.15.0....0...1.1.64.psy-ab..7.15.1671...0i131k1j0i22i30k1.0.TdHMjzTvmyM
>>
Wishing there was a daily for language theory discussion and other discussion of computer science concepts, and then a separate daily for software projects, development, etc...
>>
>>62487681
This.
One for applied CS and the other being PLT
>>
>>62487681
Let's talk about CS theory anon
>>
>>62487681
>>62487725
There are two kind of people:
1. Who get shit done actually
2. Masturbate to type theories
>>
I love bitflags but they make my brain go ouchie.
Can anyone explain me how they are best used?
>>
>>62487580
Then what does the "printf("%s"" do?
>>
>>62483553
Management information systems major here as well. Haven't done a single thing with C++, all java baby.

Thank god.
>>
>>62487681
Take your high-falootin science talk to >>>/sci/
>>
>>62487766
It makes the program fail to compile
>>
>>62487822
it doesnt though. gcc doesnt complain at all.
%s is a valid thing in C, and it stands for string.
>>
File: 20170917214256.png (29KB, 1280x800px) Image search: [Google]
20170917214256.png
29KB, 1280x800px
I dolled it up, nice enough for crystal to have a color library for terminals. I'll see how he likes it tomorrow.
>>
>>62485333
If you're young and a genius get a masters and learn computer science to become a quantitative analyst. Otherwise learn webdev and work for maybe 30k a year.
>>
File: sphero-robotic-ball-4.jpg (90KB, 1200x1200px) Image search: [Google]
sphero-robotic-ball-4.jpg
90KB, 1200x1200px
Using the sphero app to program a sphero robot in javascript. I type it on my android emulator and i use the app when i wanna test my code because no bluetooth
>>
>>62483089
>https://hastebin.com/oxavasifay.cpp
void removeMatches(char *s1, char *s2)
{
unsigned char map[255] = { 0 };
int i = 0;
int j = 0;

while (s2[i])
{
if (!map[(unsigned char)s2[i]])
map[(unsigned char)s2[i]] = 1;
++i;
}

i = 0;
while (s1[i])
{
if (!map[(unsigned char)s1[i]])
s1[j++] = s1[i];
++i;
}
s1[j] = 0;
}

int main()
{
char *s1 = strdup("abcdefghijklmnopqrstuvwxyz");
char *s2 = "abcdefghklmp";
removeMatches(s1, s2);
return 0;
}
>>
How much do you guys make, how long have you been working, and what do you do?
>>
What's your favorite language to quickly knock out a program in?
>>
>>62488279
Ruby
>>
>>62488279
python
>>
>>62483089
just add
    s1[k] = 0;
at the end problem solved
>>
>>62488279
Coq
>>
>>62488184
>and what do you do?
We don't forgive
We don't forget
We have over 9000 penises and all raping children
>>
>>62488042
let us know how it goes!
>>
>>62488291
Might try to learn Ruby then. Getting tired of Python atm.
>>
>>62488544
If you learn python you can learn to make metasploit modules
>>
>>62488553
Ruby*
>>
>>62488553
Doubt my nerves could handle it. I'm already at the point where I grab a handful of magnets and my katana every time I hear a dog bark.
>>
>>62488751
lol
>>
Awhile back somebody was asking for resources regarding game hacking and somebody provided links to two really helpful sources. One of them was a Carnegie Mellon assembly course and the other was a plain text website about assembly, if I remember right.

It seems I've lost the links, but if anyone remembers could you post them?
>>
>>62489094
>the other was a plain text website about assembly
that was probably the art of assembly language
http://www.plantation-productions.com/Webster/www.artofasm.com/Windows/HTML/AoATOC.html
>>
File: 15822597.jpg (5KB, 370x334px) Image search: [Google]
15822597.jpg
5KB, 370x334px
What's the most hack-y stuff you found out about C++? For me it's brace intialization and std::initializer_list ambiguity
#include <initializer_list>
#include <iostream>
class Container {
public:
int data[3];

Container(int a, int b, int c) {
data[0] = a;
data[1] = b;
data[2] = c;
std::cout << "Brace initialization invoked.\n";
}

Container(const std::initializer_list<int> list) {
size_t i{0};
for (int item : list) {
data[i] = item;
++i;
}
std::cout << "std::initializer_list invoked.\n";
}
};

int main() {
Container fromValues = Container{5, 23, 11};

// HACK! HACK! HACK! DON'T USE BRACE INITIALIZATION
Container fromLists = Container(33, -54, 8);
}
>>
 function fags(){
}
>>
>>62485436
>everyone is white
And that's a bad thing? Go back to whatever shithole you or your mud family crawled out of.
>>
>>62485436
Go back home to pakistan Achmed
>>
>>62489351
>? Go back to whatever shithole you or your mud family crawled out of.
Havnt you heard, anon? Jews are "white" now just like the Italians.
>>
>>62483000
>>62483268

nigga that is the worst way to write lisp.

Get Emacs + SLIME and SBCL.
>>
Hi guys, if I have a grid represented as a 2d array.


array = [[0, 1, 0],
[0, 1, 0],
[0, 1, 0]];



and I need to write a functino to rotate these values clockwise. Will something like

for every value
array[row][col] = array[col][row];


work?
>>
>>62489833
that transposes, it doesn't rotate

look up rotation matrix, apply it to the coordinates (col, row) and get back (new col, new row)
>>
>>62489854
Thanks, I'll do some reading.
>>
>>62489833
>>62489854
e.g.

|cos a|-sin a| |c|
|sin a| cos a| |r|


where a = the anti-clockwise angle (so for 90 degrees clockwise, a = -90)

substituting a for -90

| 0|1| |c|
|-1|0| |r|


| r|
|-c|



So (col, row) goes to (row, -col)
In other words you could do

newArray[row][colMax-col] := array[col][row]
>>
>>62485436
>the white people food sucks
This is true. White people have the worst food
>>
>>62489896
Thanks, I was just reading about rotation matrixes now. This makes sense. I appreciate it guys.
>>
>>62489896
what does colMax refer to? The number of columns?
>>
>>62489987
Yes, because with the rotation matrix you'd go negative basically, so instead you say

1 = the second element
0 = the first element

-1 = the last element
-2 = the one-before-last element
>>
>>62485436
>white people smell funny
I've seen this meme so many times, but I still don't understand it
what does a white person smell like?
>>
>>62490135
old spice and sauve shampoo
>>
File: 1488476303875.jpg (62KB, 235x266px) Image search: [Google]
1488476303875.jpg
62KB, 235x266px
>>62487716
>cs theory means plt
>>
File: tumblr_njhhrhhxxv1tm91fmo1_1280.jpg (60KB, 738x405px) Image search: [Google]
tumblr_njhhrhhxxv1tm91fmo1_1280.jpg
60KB, 738x405px
What do you do when you aren't in the mood to program but want to do something related and productive? Learn something new?
>>
>>62490356
Exercise. Healthy body keeps a healthy mind
:)
>>
>>62490386
I actually have been doing that! Working on the couch to 5k for about 6 weeks now.
>>
why the fuck would anyone ever use asp.net?

is it literally only for microsoft cucks?
>>
>>62490471
yeah basically, the whole MS stack is built around vendor lock-in
>>
NEW THREAD!!

>>62490496
>>62490496
>>
>>62490509
>creating the new thread before bumplimit
idiot
>>
>>62490523
>bumplimit
myth
>>
Is 27" @ 1440p the way to go for a portrait-orientated coding monitor?
Thread posts: 314
Thread images: 45


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