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

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

Thread replies: 255
Thread images: 27
File: build wall.jpg (89 KB, 728x1024) Image search: [Google]
build wall.jpg
89 KB, 728x1024
Previous thread: >>53840598

What are you working on, /g/?
>>
>>53847372
first for my wife's son java books
>>
Delete that slut and make a new thread with 2D immediately.
>>
File: annieclark.jpg (30 KB, 446x331) Image search: [Google]
annieclark.jpg
30 KB, 446x331
I have a quick C++ question. New to modern standard and confused, don't know how to google this properly.

I have an object of type A with 5 data members. Object B has a member of type A. I want a function to pass a new A to B to refresh that member in the most efficient manner possible. Here's what I have:

inline void B::refreshA(const A& _a) {
a = _a;
}


and wrote the copy assignment operator of A as:

inline A& A::operator=(const A& rhs) {
m1 = rhs.m1;
...
m5 = rhs.m5;

return *this;
}


I don't know:
1) If I should be returning an A in the operator= or A&.
2) If I should be using moves somehow, not copies.
3) If I should be doing copies if I even need to write this copy assignment operator as I'm pretty sure I just wrote the default generated one.
>>
Am I the only one who read <stdio.h> as studio and not standard input output for years?
>>
>>53847663
My cs taught it like:
It's an STD, c goes in c goes out.
>>
>>53847663
soutoudouayyyouuu
>>
>>53847663

I always say studio in my head.
>>
>>53847663
i did it too, before i started programming and didn't really know what it was, when i would see snippets of code in random places
>>
>>53847663
stud aye-o
>>
Holy shit, the Japanese culture around Ruby is so much better. People are not SJWs and are actually nice to each other.
>>
Im working on a asp 5 mvc 6 web app. Pretty dank, dont like some of the webscale bro changes with it

At any rate, do you have to wait 6 months to enable google ads? How fast can i monetize my site

Thinking of using azure for web app hosting too

(Im new to this shit)
>>
>>53848053
you're just saying that because you're an insufferable weaboo who is in love with Japan
>>
>>53848122
>insufferable weeaboo
>there are sufferable weeaboos
>>
>>53848135
I'll suffer you m8 I swear on me mum
>>
>>53848153
I swear on your mum that she'll finish first
>>
>>53848122
Nah. Matz and his brethren really are nice.
>>
>>53847663

No, but for the first year or so of knowing C++, I thought cout was pronounced "koot", and cin was pronounced "sin". Then I heard someone pronounce it "see-out" and everything made sense.
>>
>>53848367
oh yeah koot
>>
Babby-tier question, but is doing something like valid/good practice?

#define COLOR_CORNFLOWERBLUE 0x64, 0x95, 0xED, 0xFF
...
SDL_SetRenderDrawColor(myRenderer, COLOR_CORNFLOWERBLUE);
>>
>>53847642
a = _a;

Calls the assignment operator

m1 = rhs.m1;

Either calls assignment operators for m1 or deletes the old m1 and calls the copy constructor for the new one.
Typically if you wanted to move things you would write a move assignment constructor
A& A::operator= (A&& rhs) {

And you would call this with
void B::refreshA (A&& _a) {
a = std::move(_a);
}


which would take all the memory resources out of _a and move it into a.
You don't need to move things if the members are just primitives like int/bool. It's nice to move std::vector<>s or std::strings if you want to conserve memory but C++ is pretty fast so if the data structures are small then copying is fine.

Recently I've been writing my methods like
void foo (A a) { // fuck references
...
}

int main () {
A a1 = ...;
foo(std::move(a1));
// a1 no longer usable

A a2 = ...;
foo(a2); // implicit copy
// a2 still usable
}


This way the caller gets to decide if the memory is moved or copied. This gets annoying in some cases where it can't decide overloads, I can explain if you'd like.
>>
>>53848367
>koot
Are you fucking daft?
Cow-t
>>
>>53848571
Probably not. The "correct" way would be to have a helper method that you pass a single data type into.

static void setRenderDrawColor (void* r, uint32_t color, uint8_t alpha) {
SDL_SetRenderDrawColor(r,
color >> 16,
(color >> 8) & 0xff,
color & 0xff,
alpha);
}

setRenderDrawColor(myRenderer, 0x6495ed, 0xff);
>>
>>53848571
Seems limited. Might be better to wrap the functions in other ones so you can pass around 'Color' structs.
>>
>>53848684
>>53848704
Gotcha, thanks.
>>
>AMD dual graphics
>amdgpu doesn't support my GPU, so no vulkan support
>Ubuntu 16.04 has dropped fglrx support, so no modern OpenGL support
>radeon doesn;t use the dedicated graphics at all, so I can;t even watch youtube/twitch without 5fps slideshows
Year of the linux desktop. They just killed graphics support, the one thing that Windows shines on.
>>
>>53848746
What CPU do you have? You could set up a Windows VM with the video card passed-through.
>>
>>53848746
>lollinux
>lolamd
>>
>>53848746
>>Ubuntu 16.04 has dropped fglrx support
You don't need your distro to 'support' fglrx, you can download them, compile the kernel module and install them yourself.
>>
>>53848974
AMD have stopped supporting fglrx as well dude. It won't belong before a kernel update fucks it up permanently.
>>
>>53848336

Isn't that the whole MINASWAN dealio?
>>
File: pepe feels intensity.gif (1 MB, 720x720) Image search: [Google]
pepe feels intensity.gif
1 MB, 720x720
a girl from my operating systems class just convinced me to email her my entire program's source code. when she asked i said no because the professor gives you 0 if he finds you cheated, and that i would just send her the resources i used instead, but then she said she was just going to use it to see what we were supposed to do and how it worked. so i felt like an asshole. i feel so taken advantage of. i spent like 3 days working on that program.
>>
>>53849160
Yeah, but English-speaking rubyists often don't live up to that standard, especially Rails people.
>>
File: 1446962972638.gif (479 KB, 320x240) Image search: [Google]
1446962972638.gif
479 KB, 320x240
>>53849633
>didn't offer to come over and help her instead
Ya blew it
>>
>>53849633
It's all right. Everyone gets cheated a couple times until he gets wise. Save the logs/emails/screenshots. If she turns in your code and you are accused of cheating because of it, you can show the prof evidence it's her, not you.
>>
>>53849670
i'm fat and have acne, stereotypical nerd. whereas she's hot. i'm not under any delusions
>>
>>53849633
>haha chad stop it i need to get this stupid coding thing done
>chad let me just ask this nerd for the code
>haha he just sent me his entire program what a loser
>oh yes chad fuck me harder
>>
>>53849633
Don't feel bad... You've helped her and that's good! Maybe she is really just using it for reference... But no matter what, your help won't stay unnoticed and you should feel happy bout that.

Sauce: been on both sides of this story
>>
>>53849725
>>>/r9k/
>>
>>53849670
Don't do that. The girl will notice you expect sex and take you for a ride. You'll be coming over to help her time and time again and get nothing out of it.
>>
>>53849633
https://heartiste.wordpress.com/
>>
>>53849633
What program did you need for an OS class that only needed 3 days to write?
>>
File: CbYnz2pVIAEPKM_.jpg (22 KB, 400x388) Image search: [Google]
CbYnz2pVIAEPKM_.jpg
22 KB, 400x388
>>53847372
STOP ASKING THE SAME FUCKING QUESTION OVER AND OVER AGAIN YOU RETARD
>>
does anyone have a pdf of the c# yellow book?
torrents are dead and cant find one.
>>
>>53849800
>shitty heartiste
>not superior autiste
https://www.youtube.com/watch?v=z23Gzp0RTOg
>>
>>53849760
As opposed to just emailing her the code, where he gets all that money and reputation out of it.
>>
>>53849858
Obviously, you should do neither.
>>
>>53849633
Learn to say "no" or people will continue to take advantage of you. Be more selfish.
>>
>>53849821
producer/consumer in c. the class is called operating systems but its really more like just a c programming class
>>
>>53849874
Fucking morons ITT.
Write a shittier version and offer it for sex.
>>
>>53849877
If coders start standing up for themselves, pretty soon they'll want to unionize. We can't have that.
>>
>>53849906
>programming union
that'd be as cancerous as reddit and github combined
>>
>>53849894
Programming is no less than $20/hr. For 20 hours of programming, you can hire a high class prostitute who will give you better sex and more genuine affection than a college student.
>>
>>53849906
Unions hurt smart people and protect PoC legbutt slackers. If coders stood up for themselves they would expel the whole diversity crew, not unionize.
>>
>>53849941
>better sex than a college student

prostitutes are all middle aged uggoos
>>
>>53849841
You mean this?
http://static1.squarespace.com/static/5019271be4b0807297e8f404/t/55e8091ee4b0b7a615665de5/1441270046307/CSharp+Book+2015+Final.pdf
>>
File: csci.png (90 KB, 1425x796) Image search: [Google]
csci.png
90 KB, 1425x796
is this right?
>>
how to be pro:

 
char * ptr = 0;
while (true){
(ptr++) = *ptr - 1;
}


Preferably do this on a computer without an operating system.
>>
>>53850048
Yes
>>
>>53850048
no
you tell her "fuck off am i doing it for free"
>>
>>53850054

I might have fucked that up, I should check these things.
>>
>>53850048
post reply pls

>iphone
I think he would prefer himself being fucked.

Anyhow, if I was you I would say that I will be dressed like a girl.
>>
>>53850048
SEND IT
>>
>>53850088

Mention cucks.
>>
>>53847450

Go kill yourself and make /g/ great again, weeb faggot.
>>
>>53850032
thanks!
mind also telling me how did you find it?
if i'd like to find anything for myself in the future
>>
Thanks for the help yesterday on recursion

I have another question. How do you guys learn to read documentation of a programming language properly? Like I find myself not knowing exactly what I need to look for or search for when building a project. How do I figure this out?
>>
>>53850123
google?
>>
>>53850123
Keep fucking around with it until you do know what you need. That's really all there is to it.
>>
>>53850171
This has been my programming career so far but I still struggle with reading documentation and not knowing what to implement
>>
>I have another question. How do you guys learn to read documentation of a programming language properly? Like I find myself not knowing exactly what I need to look for or search for when building a project. How do I figure this out?

Ignore the crippling autism of the writer.

Get the important bits.

Ignore the safety/user warnings, eg, "malloc this first", "point this at memory", "error check this".

Nah, desu, if it's well written, I usually just use the language. Practice makes perfect. People follow standards, so a well followed standard makes it easy to understand.
>>
>>53850198
I am trying to read and understand Java documentation for projects
>>
>>53850115
Literally googled "c# yellow book," saw the author's name was Rob Miles and then found his site by googling "C# rob miles."

>If you want to print out copies for use in class teaching then that is fine by me, as long as:
>1. The printed copies are sold at cost price.
>2. They have a cover with something yellow on it.

Interesting second stipulation.
>>
>>53850241
that's probably how all these books get the bloody names

fucking colourblindophobic people
>>
>>53849633
>he fell for the open source meme
>>
>>53850055
nice double dubs
>>53850080
>>53850086
>>53850088
should i sent THAT or should i sent "now what do i get in return? ;-)" which r9k told me to send
>>
>>53850398
>now what do i get in return? ;-)
A normal person would think that you need monies.
>>
>>53848581
>This gets annoying in some cases where it can't decide overloads
I know what you're referring to, I need to review that but know where I can find the info.

here's my thing:
A has four floats and a scoped enum as members.

My old C style wants to just model it as a C array of size 5 and then I could just pass the pointer.
void B::refreshA (float* _a) {
a = _a;
}

Thats the kind of efficiency I'm looking for but then I'm modelling my enum as a float and its gonna get weird after that. If I use
void B::refreshA(A _a) {
a = _a;
}

int main() {
A a1 = ....;
b.refreshA(std::move(a1));
}

Is that the same thing behind the scenes or is it going to do member wise move for each member of a?

This code is being used in a critical part of a loop in some performance intensive code that I'm trying to refine.

Thanks for your post.
>>
>>53850190
Then you need to rethink how you go about fucking around.
>>
>>53850417
how about "now what do i get in return (something that's hot, wet, and hairy)? ;-)"
>>
>>53850398
>taking r9k advice
>taking advice this fucking autistic "now what do i get in return"

jesus fucking christ kill m e now
>>
>>53850458
Creepy and not funny.
>>
>>53850487
you obviously don't know anything about the game, kid
>>
>>53850523
*teleports behind your gf*
*unsheaths penis*
*cucks you*
Heh, nothing personal, kid.
>>
>>53850398
>"now what do i get in return? ;-)"
>>53850458
>"now what do i get in return (something that's hot, wet, and hairy)? ;-)"
please don't

>>53850048
this would actually be better
>>
>>53850584
how about just don't send anything and just help them for free rather than acting like an autistic beta faggot
>>
>>53850537
>nothing personal, kid
IT'S NOTHIN PERSONNEL KIDDO
GET YOU'RE MEMES RIGHT
REEEEEEEEEEEEE
>>
>>53850523
it's a complete meme

almost anyone can get girls if they try, you don't have to play stupid games

>>53850611
yeah
>>
>>53847372
Go and fuck your brother, you dumb bitch.
>>
>>53850619
I wish someone would vocaroo REEEEEEE I wonder how it is said
>>
File: trump deowitit.jpg (70 KB, 535x535) Image search: [Google]
trump deowitit.jpg
70 KB, 535x535
>>53850630
wdg = bernie
dpt = trump
>>
>>53850630
>she will never be your sister and do that
>>
>>53850635
https://www.youtube.com/watch?v=iU21_-g__yg
>>
>>53850635
https://www.youtube.com/watch?v=ctGJr85OpIs

there's hundreds of these videos
>>
File: TrumpScript.jpg (285 KB, 900x1200) Image search: [Google]
TrumpScript.jpg
285 KB, 900x1200
>>53850638
D - DONALD
P - "PROGRAMMING "
T - TRUMP
>>
>>53850665
based off of python unfortunately, but that's what happens when it doesn't come from the source
>>
File: 1449793672070.jpg (34 KB, 413x389) Image search: [Google]
1449793672070.jpg
34 KB, 413x389
>>53850643
>wanting to stick your dick in that
>>
>>53850649
What a dumbass
>>
>>53850665

ha ha ha what a funny internet joke
>>
>>53850699
kill yourself fag she's hot af
>>
>>53850699
look qute tho
>>
File: aryan trump qt.png (752 KB, 1080x725) Image search: [Google]
aryan trump qt.png
752 KB, 1080x725
>>53850699
>>
>>53850638
It's th opposit. /dpt/ = NEETs and college students = Bernie, /wdg/ = wage slaves and freelancers = Trump.
>>
>>53850706
thanks
>>
>>53850731
/dpt/ is cool = trump
/wdg/ is cuck = bernie
>>
>>53850731
I am both. I am a College student and a Neet
>>
>>53850757
>I'm in Education but I'm also Not in Education
>>
File: Leah Culver.jpg (42 KB, 512x512) Image search: [Google]
Leah Culver.jpg
42 KB, 512x512
>>53850707
>>53850708
Come on guys, we can do better than that
>>
>>53850750
/dpt/ has delusions of grandeur. /wdg/ is realistic and practical. Really, /dpt/ is Hilary.
>>
>>53850757
>>53850779

Majoring in quantum physics?
>>
>>53850790
how about dpt is trump because most people in dpt who actively support a candidate support trump, and wdg is bernie because most people in wdg support bernie
>>
>>53850584
she still hasn't responded what do i do?
>>
>>53850815
and because most of wdg does javascript html css or python, uses of which probably support bernie most, while /dpt/ uses non-faggot PROGRAMMING languages which trump supporters are more likely to be using
>>
>>53847372
Of course, only a women can be dumb enough to unironically support Trump.
>>
>>53850789
wud berry
>>
>>53850815
That is simply false.
>>
>>53850838
please dont tell me you actually asked for something
>>
>>53850789
>tfw no gf
>>
>>53850838
Send dick pics
>>
>>53850882
this. the only possible way to recover from this is if you have a nice cock
>>
>>53850882
>>53850900
send pics of someone else's dick
ideally a different race
>>
>>53850048

send
>>
Why is GLX (and by extension, X) such a fucking clusterfuck?
>>
>>53850081
++ptr would ensure it works
>>
>>53850863
http://strawpoll.me/7273172
>>
>>53847663
Lel holy shit, thought I was the only one.m
>>
>>53851055
>100% trump
>>
http://strawpoll.me/7273184/r
http://strawpoll.me/7273172/r
i rest my case
>>
>>53847450
jesus christ, do people like this actually exist?
>>
>>53849633
I had this problem with a chink in my class. He's like 30-40 and he smells like shit, some weird cologne he uses. He used to ask me all the time for help on our tasks and such and eventually I just stopped replying to his messages and he fucked off and found someone else to leech off. I probably should've just told him no but as you say I'd feel like an asshole.
>>
>2016
>Not programming in Java

what's your excuse
>>
>>53851619
I'm white
>>
File: You kids wanna try D.jpg (44 KB, 512x512) Image search: [Google]
You kids wanna try D.jpg
44 KB, 512x512
>>53851619
>>
>>53851637
That's not an excuse.
>>
best way to model dates in C++?

I need Year/Month/Day and time to the minute. Will just be doing basic subtraction and comparisons with them. Looks like my options are chrono and boost::gregorian or make my own. I haven't installed boost yet.
>>
>>53851619
Scala. Kotlin.
>>
Guys I have a problem all my websites have that 2000's old look to it. How do I style and build modern looking websites that look like recent ones?
>>
>>53851795
move to Japan and you'll be ahead of the game
>>
>>53847387
>my wife's son

Here we go again.
>>
>>53851795
>chop all current design content in half
>make all fonts 10pt arial
>drop down menus for everything even if the menu only contains two items
>all backgrounds to be white
>divide screen vertically into three sections, left section has navigator, right section has scrolling contact info, middle section has content
>middle section takes up two thirds of the screen, other two sections one sixth a piece
you are now a hip web designer
>>
>>53851891
>implying more information density always == better and easier to read
>>
>>53851891
Will I make more money as a web developer or a programmer or a system admin in linux
>>
>>53851954
I was trolling. I'm not a web designer. Install gentoo.
>>
>tfw using Ruby to procedurally generate C switch statements from an enum declaration in my editor

Macros ain't shit.
>>
>>53851988
>Tfw you will never eat out Ruby's booty while he programs
>>
File: hnnnng.jpg (104 KB, 1080x1080) Image search: [Google]
hnnnng.jpg
104 KB, 1080x1080
Anybody work with reading directly from URLs before? I was reading it up on Java Tutorials, but the example is confusing as hell.

I browsed the java.io API to see useful classes for reading HTML files to filter out strings that begin from one HTML tag and end at another.

For example, a text string beginning from: <div id="thread-53847372" class="thread"> and and ending at </div>.

pls halp
>>
>>53852025

Bruh, that's disgusting. I want no part in any sexual activity that involves shit, blood, or piss.
>>
>>53852032
Breh...
>>
>>53852057
Tell me how you like it bae
>>
>>53852076

Not in DPT. This is a sacred thread for the discussion of programming and programming accessories.
>>
>>53852097
i++ or ++i
>>
>>53850665

lame
>>
>>53852115

depends on if I want the previous value or the new value returned.
>>
>>53852032
>shove that pistol up her cunt all the way to the trigger
so you're trying to parse HTML? you're probably going to have to do that yourself but I haven't Java'd in years.
>>
>>53852115

For basic integers in for loops, whatever floats your boat.
For iterators, ++i every time.

Although this form should be preferred where applicable:

for (const auto &e : vec) { /* ... */ }
>>
>>53852149
Yeah. I think I can find the content between the tags by using a glob pattern, either with the dot (.) or (*) wildcards.

The example Oracle provides just doesn't make sense to me, though. They use this BufferedReader constructor to read the URL's contents after creating the URL object.

https://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html

BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));

String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
>>
>>53847450
your a homosexual
>>
>>53852239
Please don't tell me you want to parse HTML with regular expressions. Please.
>>
>>53852287
What's wrong with that? What's a better alternative?
>>
>>53852301
HTML is not a regular language. If you want to extract one very specific thing you can probably get by but don't parse full on HTML with regex, it's impossible.
Try a HTML parser library if you need that
>>
>>53852287
>Please don't tell me you want to parse HTML with regular expressions.

If it's a small bit of HTML that will likely remain the same, it's probably not a big deal.
>>
>>53852301

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML. HTML is not a regular language and hence cannot be parsed by regular expressions. Regex queries are not equipped to break down HTML into its meaningful parts. so many times but it is not getting to me. Even enhanced irregular regular expressions as used by Perl are not up to the task of parsing HTML. You will never make me crack. HTML is a language of sufficient complexity that it cannot be parsed by regular expressions. Even Jon Skeet cannot parse HTML using regular expressions. Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp. Parsing HTML with regex summons tainted souls into the realm of the living. HTML and regex go together like love, marriage, and ritual infanticide. The <center> cannot hold it is too late.

...
>>
>>53852196
>mind blown
does that work if you want a non-const iterator too?
>>
...

The force of regex and HTML together in the same conceptual space will destroy your mind like so much watery putty. If you parse HTML with regex you are giving in to Them and their blasphemous ways which doom us all to inhuman toil for the One whose Name cannot be expressed in the Basic Multilingual Plane, he comes. HTML-plus-regexp will liquify the nerves of the sentient whilst you observe, your psyche withering in the onslaught of horror. Rege̿̔̉x-based HTML parsers are the cancer that is killing StackOverflow it is too late it is too late we cannot be saved the trangession of a chi͡ld ensures regex will consume all living tissue (except for HTML which it cannot, as previously prophesied)

...
>>
>>53852336
PCRE's can parse more than regular languages anyway
>>
...

dear lord help us how can anyone survive this scourge using regex to parse HTML has doomed humanity to an eternity of dread torture and security holes using regex as a tool to process HTML establishes a breach between this world and the dread realm of c͒ͪo͛ͫrrupt entities (like SGML entities, but more corrupt) a mere glimpse of the world of regex parsers for HTML will instantly transport a programmer's consciousness into a world of ceaseless screaming, he comes, the pestilent slithy regex-infection will devour your HTML parser, application and existence for all time like Visual Basic only worse he comes he comes do not fight he com̡e̶s, ̕h̵is un̨ho͞ly radiańcé destro҉ying all enli̍̈́̂̈́ghtenment, HTML tags lea͠ki̧n͘g fr̶ǫm ̡yo͟ur eye͢s̸ ̛l̕ik͏e liquid pain, the song of re̸gular expression parsing will extinguish the voices of mortal man from the sphere I can see it can you see ̲͚̖͔̙î̩́t̲͎̩̱͔́̋̀ it is beautiful the final snuffing of the lies of Man ALL IS LOŚ͖̩͇̗̪̏̈́T ALL IS LOST the pon̷y he comes he c̶̮omes he comes the ichor permeates all MY FACE MY FACE ᵒh god no NO NOO̼OO NΘ stop the an*̶͑̾̾̅ͫ͏̙̤g͇̫͛͆̾ͫ̑͆l͖͉̗̩̳̟̍ͫͥͨe̠̅s ͎a̧͈͖r̽̾̈́͒͑e not rè̑ͧ̌aͨl̘̝̙̃ͤ͂̾̆ ZA̡͊͠͝LGΌ ISͮ̂҉̯͈͕̹̘̱ TO͇̹̺ͅƝ̴ȳ̳ TH̘Ë͖́̉ ͠P̯͍̭O̚N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ

>>53852371

Yes, absolutely. Also works without using references. And you can use it on static arrays if you know the length at compile time.
>>
>>53852388
>>53852360
>>
What kind of fag would use stack overflow copypasta on /dpt/?
>>
>>53852444

I wanted to use the /prog/ version, but I didn't have it saved, and /prog/ is kill.
>>
>>53852456
/dpt/ is /prog/ reborn
>>
>>53852481

Indeed, so we need to make a DPT edit.
>>
>>53852508
ok how about this

cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck cuck


i think this is a very modern style
>>
>>53852360
>>53852381
>>53852405

Good work.
>>
>>53852523
cuck is so 2015
>>
>>53852558
pretty sure it's 2016
>>
>>53852564
I know. That's the point.
>>
>Tfw I can't stop shit posting and can't stop reading all your comments instead of programming
>>
File: smug moss.jpg (3 KB, 125x122) Image search: [Google]
smug moss.jpg
3 KB, 125x122
when you're programming in D and realise half of stdlib can't be used at compile time
>>
>>53852685
Sounds like you just got D'd
>>
>>53852739
Can't even use fucking Algebraic because it uses memcpy
>>
>>53852751
You should use Ada instead. It's an even more obscure language that is even less suited to your application.
>>
File: 1435058567147.png (350 KB, 382x573) Image search: [Google]
1435058567147.png
350 KB, 382x573
>Taking a Java course, just a week in
>Group assignment
>One of the bunch of things we need to have the program do for said assignment is determine the lowest number out of all that the user enters
>Someone else proposes to do that part
>Yeah, whatever, it's easy so go ahead
>They send me code which uses a variable that was assigned the value of -999999... in order for their algorithm to work
At least if it were a value that was at the limit of the representation range for the variable type, but it's not even that. Jesus christ.
>>
>>53852778
This
>>
File: as.png (285 KB, 456x496) Image search: [Google]
as.png
285 KB, 456x496
hey /g/ i am coding this thing in c++ but unfortunately i forgot how to make an user input in for loop statement.
>>
>>53852778
Actually I think Nim might be what I want
>>
>>53852778

Ada is a truly hateful language.
>>
File: vulkan.jpg (208 KB, 1912x750) Image search: [Google]
vulkan.jpg
208 KB, 1912x750
>What are you working on, /g/?
Still fucking around with vulkan, now I have to figure out how to draw vulkan shit in a win32 window.
>>
So I took a class that taught all about the basics of OOP and used Java.

Where can I go from here?

I tried practicing some coding with C++ but apart from some basic syntax differences it feels almost the same. What's the big difference here?

What's the best option to take on from here?
Can I extend my knowledge of Java to using Android Studio and create Android apps now?

Or should I focus more on C++ and try web development through Visual Studio (and learn vb.net)?

What's the typical "next" step for someone learning to program who might hopefully use these skills in the workforce?

Any help would be appreciated.
>>
>>53852890
>C++
>Java
>feels the same
You make me want to kill myself.
>>
>>53847372
trap?
>>
is code academy any good for learning how to code before learning how to code?
>>
>>53852904
No my point was that I don't know how to use C++ yet beyond the very, very basics.

Please tell me more. What makes C++ so powerful and what should I pay attention to?
What should I try and do next?

I tried doing a bunch of the Project Euler problems as simple practice for math things.
What direction should I be moving here? I'm a beginner.
>>
>lists are a monad
> [1, 2] >> "foo"
"foofoo"


mind = blown
>>
>>53852941
templates, templates and more templates
>>
>>53852941
new


delete
>>
Any advice on how to read technical papers without feeling like a dumb shit? I get maybe 1/3 of the way into one then it goes into some intense theory that goes way over my head.

>How 2 git gud
>>
>>53853091
Replace every single-letter variable with a proper word
>>
>>53853091
I just don't do it. And I'm great. So yeah.
>>
>>53852890
Ok so I am a beginner.

What is the next step?
Anyone?
>>
>>53852914

no but jquery is
>>
>>53853091
What kind of technical papers? Some are pretty neat, others are borefests that would put anybody to sleep.
>>
>>53853138
>I'm great
please provide 3 references
>>
>>53852781

i would never have asked this before coming on /g/... but was it a girl?
>>
>>53853183
Nah, it wasn't, though I can see why you'd think it would be.
>>
>>53853183
>extremely convoluted way of working
Of course it's a guy, if it was a girl it wouldn't fucking work
>>
>>53853248

mfw this actually makes sense
>>
>>53853152
get a good C++ book and read it from cover to cover then read the C++11/14 docs to see what they added then get a good book explaining all the C++11/14 nuances, like Scott Meyers latest book.

You fucked up learning java first, all you really know is object oriented concepts and potentially basic OOP design.
>>
>>53853248
*tips fedora*
>>
File: 1434843893225.png (199 KB, 376x302) Image search: [Google]
1434843893225.png
199 KB, 376x302
>>53853248
This post made me laugh way harder than it should have.

Good job Anon. You made my night.
>>
>>53853175
I've been reading some computer vision papers that tend to devolve into intense math equations and weird terms that make little sense. Other data science papers have the same trend.

Example: http://refbase.cvc.uab.es/files/RKW2013a.pdf
>>
>>53853268
I mean, I just learned it that way because it was the way my university teaches it, and we've made a lot of interesting programs with Java.

So learn C++. What, then, should I do with it? Is web development the best option?

What about Android App development? Knowing Java should enable me to make the leap to Android App development, yes?
>>
>>53852941
C++ has things like template metaprogramming, RAII + smart pointers, move semantics, lambda expressions, etc., all of which give C++ a powerful suite of abstractions that don't significantly penalize performance.
>>
>>53853350
function calls destroy the notion of C++ free abstraction
>>
When will I get good at Unity? i've been doing the tutorials several times but it takes so long. I only grasp some of the basics. Are there better ways to learn Unity? Or am I being a weakling?
>>
>>53853378
>>>/vg/agdg
>>
>>53853364
My wording was careful. I said
>don't significantly penalize performance
Yes, there is often a small performance hit for these abstractions, but the gain in convenience is almost always worth it. Besides, you can spend the extra development time you save to micro-optimize and get faster code than had you used, say, C. qsort is an example of how these abstractions can result in faster code.
>>
Once I know C++ and Java, what should I do with it?

Is web development a good path to go down for C++ programming?

And for Java, I can move on to Android App development, yes?
>>
>>53853319
>what do I do with it
whatever you want.

The big thing about C/C++ is the memory management is up to you. That is you have to control when physical memory (RAM) is taken and freed by your program. Recent to not so recent standardized features in the language can make this a lot easier but it's one of those things where if you don't start from square one getting to square n will be a lot harder and confusing.

If you're a student its good to use this time to learn a variety of languages and try doing different shit with them. Don't expect every project you make to make you the next Zuckerberg, focus on learning and do what you want to do.

Android App dev is done in Java, yes.
>>
>>53853378
You need to actually build on the tutorials yourself and play around with the documentation to figure out stuff
>>
>>53853400
Come up with some projects and make them.
What else would you do?
>>
>>53853400
web dev and C++?

boy
>>
>>53853399
C++ doesn't just need a guaranteed inline specifier for functions, it needs one for structs and classes too - and it should be available at the call site AND the callee.
>>
>>53853400
App development is one path. C++ is increasingly being used for mobile apps because both iOS and Android have an C++ SDK, meaning that you can write the core of your app in C++ and it'll be portable between the two OSs, and leave the GUI stuff to Swift and Java respectively. If your app is performance critical (like a graphically intensive game) you'll also want to use C++.

Web development is another possible route. C++ is used in high performant servers (Google for example makes extensive use of C++).

Both are very versatile languages that won't limit your career path.
>>
>>53853445
by inlining a struct/class I mean this:

template <typename T>
inline struct pair {
T first, second;
pair(T a, T b) : first(a), second(b) {}
}


pair<float> x (3, 4);
->
float x_first (3.f), x_second (4.f);
(some mangling for . / _)
>>
>>53853445
>it needs one for structs and classes too - and it should be available at the call site AND the callee.

I don't understand. If you inline your constructor, doesn't that accomplish the same thing?
>>
>>53853470
not necessarily & inline in C++ is just a hint

I mean inline the whole thing
>>
C++ really just needs a proper macro system with strong CTFE
>>
>>53852913
no fucking shit. 0% she's female
>>
>>53853257
Not really. Assuming there is a minimum IQ to programming irrespective of gender, there are less men capable of learning it.
>>
How do I get started in AI? It's what I've wanted to do for a while.

I know C, Python ish, C++ ish, whatever. Where do I begin from scratch in AI? Norvig?
>>
>>53853488
are you actually looking at what your compiler generated to support your "its just a hint" meme?

I've never had issues with reasonable functions not being inlined and using modern g++ you can see functions that weren't explicitly inlined actually get optimized to be inlined.
>>
>>53853539
game AI appears to be hot today, why not start there?

>tic tac toe
>nash
>checkers
>stratego
>chess
>go
>>
>>53853554
I use VC++ and write a lot of functional code
>>
>>53853578
I'll look into it, thanks!
>>
>>53853595
well inlining is necessarily implementation dependent so you have to trust your compiler. you're bitching about something thats not really an issue.
>>
>>53851673
> best way to model dates in C++?
> Will just be doing basic subtraction and comparisons with them.
In which case, you want to store linear time (i.e. a number representing the amount of time elapsed since some epoch) and convert to/from calendar time (year, month, day, hour, minute, second) as needed.

For linear time, you can use <ctime>, <chrono> or boost.date_time. For calendar time, <ctime> or boost::date_time.

The conversion between linear time and calendar time is complicated by time zones, leap seconds, and synchronisation ("system" time may be slightly faster or slower than real time in order to synchronise with an external time reference, which is why <chrono> has system_clock and steady_clock).
>>
>>53853673
>complain that inability to portably force inlining is an issue
>your post
>>
>>53853488
> I mean inline the whole thing
You mean make every member function automatically inline?

It's not like you can "inline" data.
>>
>>53853728
I mean act as if there were never any struct in the first place
>>
>>53853728
>>53853741

Like, put declarations directly into the scope with a mangled name like
x_m1 (for x with member m1)
the syntax would be the same, x.m1

all calls to functions would be replaced with the inlined body referring explicitly to in scope variables
>>
>>53853755
There's no difference. x.m1 does not involve any indirection, so it is the same as reading the value of a variable.
>>
>>53853800
inlining the struct would make all the member functions forcibly inline
>>
File: mitre.gif (47 KB, 197x297) Image search: [Google]
mitre.gif
47 KB, 197x297
>>53853686
>started writing my own basic calendar time wrapper to support my basic functions after my post.
>realize all this would be 1000% easier if we didn't have months and added leap years to the beginning of the year or the end of the year
Working with dates is way too complicated for how simple they are. Why the fuck do we use a 2000 year old system that has only been modified once by a dude who unironically wears pic related.
>>
>>53853806
You don't necessarily want that. Your compiler knows better than you whether a function should be inlined.
>>
>>53853838
Not always, and it'd be nice if we could make the compiler put the functions together first and then decide how to split them up, especially with function composition
>>
>>53852032
Just do it in python with beautifulsoup or c++ with rapidxml
>>
>>53853832
or have 5 months of 73 days

>from the big bang theory:
73 is the 21st prime number
37 is the 12th prime number
7*3 = 21

73 in binary is 1001001, a palindrome

>too spoopy for me
>>
File: 1360453091472.jpg (154 KB, 2000x720) Image search: [Google]
1360453091472.jpg
154 KB, 2000x720
>>53853937
>>
>>53853937
do you mean that shit show
cool observation thow
>>
>>53853947
yeah I truthfully hate it but that is the second result of 73 on google. i didn't know if it was prime.
>>
Mainly working on a Python IRC client and ignoring my Java schoolwork.
>>
File: jsf.png (14 KB, 210x98) Image search: [Google]
jsf.png
14 KB, 210x98
I have to use JSF for a project at work. I swear that JSF is the dumbest framework I've ever used. It's "component based" rather than using request-response. The idea is to try to make it easier to manage state over a session. The problem is that JSF's lifecycle model is so fucking complex with so many little intricacies that it actually ends up being harder to understand and use. I think the only person in the world who truly understands it is BalusC (every JSF programmer will recognize that name). The second problem is that you have no idea what kind of HTML will actually get generated. Want to create a simple hyperlink? Here's some Javascript to go along with that. Want to output a message? Guess what, it's getting wrapped in a table tag even though you never specified that. Oh, I see you put "myelement" for an id. Let me just change that to "j_124" so that your CSS and Javascript break.

Everything in JSF feels like an ugly hack. Want to validate user input for a form field? No problem. Want to do validation that requires examining two fields (example: checking if the confirmed password field matches the password field). Sorry, JSF can't do that without resorting to ugly, convoluted hacks to work around it. The way JSF works reminds me of Maven in that the base cases work okay, but if you want to do anything slightly outside its domain of acceptable functionality (even things that are considered quite common), then you have a fucking mess on your hands trying to get it to work.

Don't even get me started on the verbosity of JSF. Look, I'm a Java programmer. I'm used to verbosity. But JSF makes other Java code look downright fucking concise. Whenever you see a call to "FacesContext", you know that you'll be reading a short novel's worth of method chaining just to access something trivial. OmniFaces can make it a little more tolerable, but not by much.
>>
>>53853979

For all x less than 100, if x mod 10 is 3, and x mod 3 is not 0, x is prime.
>>
>>53854083
-67?
be a little more specific with your premises roobs
>>
>>53854083
3
>>
>>53854119
he didnt say it was true for all primes
he said for numbers that fit that, they are prime
loser
Thread replies: 255
Thread images: 27

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.