[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: 39
File: timetocode.webm (2 MB, 1152x648) Image search: [Google]
timetocode.webm
2 MB, 1152x648
This is /dpt/, the best subreddit of /g/

Umaru-chan edition, the best of all editions.

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

code of conduct:
no racism
no insult
no sexual harassment
no gender discrimination

wat r u working on, anon-chan ?
>>
FIRST FOR TRAPS!
>>
>>53537618
Kill yourself.
>>
>>53537637
>I'm not a programmer
m8...
>>
File: 1437789415181.png (17 KB, 2414x648) Image search: [Google]
1437789415181.png
17 KB, 2414x648
Is there a quicker way to find the second occurance of a character in a string without compromising readability? This seems slow.

string numberString = NameAddressComboBox.SelectedItem.ToString(); /* can't just get text when we add dynamically, it gets previously selected item */

int dashcounter = 0;
for (int i = 0; i < numberString.Length; i++)
{
if (numberString[i] == '-') /* remove from the beginning of the string, to the second dash, to get the number on it's own */
{
if (++dashcounter == 2)
{
numberString = numberString.Substring(i+1, numberString.Length-(i+1)).Trim();
break;
}
}
}

Basically I have a string which is
string - string - number

and I want to get rid of the
string - string - 
so I can get the number on it's own and parse it
>>
>>53537658
>obvious bait
>>
File: 1452954169210.jpg (150 KB, 500x815) Image search: [Google]
1452954169210.jpg
150 KB, 500x815
>>53537673
it's not bait senpai, pls no bully. also this is slightly better but I don't like the substring bit
int dashcounter = 0;
for (int i = 0; i < numberString.Length; i++)
{
if (numberString[i] == '-' && ++dashcounter == 2) /
{
numberString = numberString.Substring(i + 1, numberString.Length - (i + 1)).Trim();
break;
}
}


I wish 4chan would stop fucking up my formatting and making me fix it manually
>>
Let a0, a1, a2, ... be an integer sequence defined by:

a0 = 1;
for n ≥ 1, an is the sum of the digits of all preceding terms.

The sequence starts with 1, 1, 2, 4, 8, 16, 23, 28, 38, 49, ...
You are given a106 = 31054319.

Find a1015.
>>
>>53537646
>Still hasn't offed his useless existence
anon...
>>
>>53537756
>2016
>still can't into coding
lad...
>>
>>53537823
>coding
sport...
>>
>>53537847
/* kernel/traps.c */
void do_trap(struct pt_regs *, int fault_num, unsigned long reason);

weeb...
>>
>>53537867
I don't watch anime and I'm not a sexually confused faggot. The funny thing is, all you do is shitpost. But when I do it, I actually get paid while doing it.

Enjoy being a faggot all your life.
>>
>>53537910
Who's paying you. Get a brother in
>>
>>53537726
>a106 = 31054319
Typo?

Anyways a1015 is 16921.
>>
I currently have a PostgreSQL function that returns data of a user with the specified ID.

Non-admin users should be able to view only their own data.

How do I implement this with PostgreSQL 9.0? I read that row-level security is only available in 9.5, but the database will run on an old piece of shit uni server with no chance of upgrades.
>>
I'm still amazed how Mozilla managed to make a language uglier than both C++ and Haskell combined.

>pub fn new<Window>(window: Option<Rc<Window>>) -> Browser
> where Window: WindowMethods + 'static
>>
File: K&R watashi kininarimasu.jpg (475 KB, 852x973) Image search: [Google]
K&R watashi kininarimasu.jpg
475 KB, 852x973
IT'S HAPPENING

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2021.htm
GET HYPE!
>>
>>53538102
Java is the worse language and cannot be beat t b h It's even worse than PHP
>>
>>53538117
No, If the standard needs revision it's already over.
>>
Anyone have any C tips?
>>
>>53538067
SELECT data FROM users WHERE username='user_name';?
>>
>>53538102
Rust is sexy and you should feel bad for thinking otherwise.
>>
File: download_20160315_183134.gif (947 KB, 500x500) Image search: [Google]
download_20160315_183134.gif
947 KB, 500x500
>>53537602
Hell yeah Umaru edition
>>
>>53538149

I already have that. It stores the logged in user's and runs queries based on that ID. I was just wondering if that was enough security.

Do you think a function that takes an ID and returs a table row of data corresponding to that ID is overdoing it? Would a view query with "WHERE id=specified_id" be sufficient without any security compromises?
>>
Visual C++ 32-bit and 64-bit compilers recognize the types in the table later in this article.

unsigned __int64
8
unsigned long long
0 to 18,446,744,073,709,551,615

What did they mean by "unsigned" ?

What is this unsigned and signed?
>>
>>53538117
>"YES! Small incremental changes in a dying language are so exciting!!! XD"
>>
>>53538180
>>>/a/
>>
>>53538235
Unsigned - can only be positive, uses all bits in the memory to represent the value.
Signed - can be either positive or negative, uses the last bit to represent whehter it's negative or positive and the rest for the value.
>>
>>53538235
unsigned means the number can't be negative.

1110 = 14 if unsigned
1110 = -2 if signed
>>
>>53537910
>don't watch anime
you don't belong here
>>
>>53538316
Post code or fuck off.
>>
>>53538180

http://www.4chan.org/rules#global
>3. You will not post any of the following outside of /b/: Trolls, flames, racism, off-topic replies, uncalled for catchphrases, macro image replies...

>6. The quality of posts is extremely important to this community. Contributors are encouraged to provide high-quality images and informative comments.
>>
>>53538332
you don't seem to be able to understand code >>53537867
is that because you're not actually a real programmer?
>>
>>53538345
>2. You will immediately cease and not continue to access the site if you are under the age of 18.
kid...
>>
>>53538219
If you've 100% verified that they're correctly logged in before, then I see no reason why you'd need more security. I'm not sure what language you're using to communicate with the DB, but in PHP you could create a session variable for the user's username (on login) or something and use that in queries.
>>
>>53538380
Do you even have any idea what you're talking about?
>>
>>53538352
You posted a prototype you didn't even write. Good job, buddy! Back to your pizza delivery job you go.
>>
>>53537975
How? It's way too small considering this thing increases forever and a106 is already bigger than your numberdick...
>>
>>53538408
What would be wrong with it?
>>
>>53538372
It's good that you admit that son, but I am still disappoint.
>>
>>53538410
>you didn't even write
>backpedaling
>>
>>53538456
As I thought.
Into the trash you go.
>>
>>53538420
Looking at the problem again I now realize that he meant to write a_10^6, not a_106.
>>
>>53538279
>>53538267
thanks
>>
>>53538469
>gets told
>maximum damage control
>>
>>53538279
>1110 = -2 if signed
false, it's still 14 if signed
>>
>>53538628
No.
>>
>>53538641
please educate yourself
>>
>>53538651
>I'm going to assume the type size is bigger that the number of bits given even though there is no sane reason to do so

It could be signed or unsigned, however the fact you said it couldn't be -2 makes you incorrect.
>>
>>53538749
>going to assume the type size is bigger that the number of bits given
no assumption, I know for a fact
>you said it couldn't be -2
it can't; please don't be this ignorant
>>
>>53538796
So you're going to tell us the exact type-size of the thing in anons head he used to explain the difference?

I didn't know PSYOPS were still going.
>>
>>53538641 (You)
>please educate yourself

Go eat a dick fag.
https://ideone.com/AOYMiA
>>
>>53538834
>in anons head
we just established anon is a mentally ill moron; I don't care what he's imagining, we're talking facts
>>
>>53538874
Also what the fuck 4chan I quoted >>53538651 not myself.
>>
>>53538542
I see. I still haven't gotten to start solving it tho.
>>
>>53538900
>not myself
your idiocy knows no bounds apparently
>>
File: autism.gif (698 KB, 200x113) Image search: [Google]
autism.gif
698 KB, 200x113
>>53538891
>"Every given bit representation is out of as many bits as I say it is, with no reference point, just because"
>Calls other people mentally ill
>>
>>53538944
>as many bits as I say it is
no, it's as many bits as the standard says
>no reference point
please leave if you're not a programmer
>>
>>53538874
>just wrote some unrelated crap to print what I want
it's easier to just puts("-2");
>>
>>53538982
How's that unrelated crap? It proves that 1110 can be inded -2 when the size is 4 bits.
>>
>>53538962
What standard, anon? Please tell me.
>>
>>53538991
>using non-standard binary constants
why are you so shit
>>
God I hate nigger so much.
>>
>>53539057
https://en.wikipedia.org/wiki/4-bit#List_of_4-bit_processors
>>
>>53538991
>when the size is 4 bits
__int64 and long long are never 4 bits
>>53539033
C++, can't you follow a conversation?
>>
>>53539081
What are you implying?
>>
>>53539057
The language and whether it's complying with its standard is irrelevant here, it was merely used to represent that when an integer is 4 bits wide, 1110 will represent -2.
>>
>>53539057
you don't know C++, binary literals are standard
>>
I wrote my first terrain LOD system today.

It's ugly as fuck, creates horrible cracks everywhere.

But hot damn it is fast. At least when compared to rendering the whole terrain at maximum detail level. And it looks really neat in wireframe.

I guess I need to figure out some proper continuous LOD system now. I can't leave those cracks there.
>>
>>53539106
>4 bits wide, 1110 will represent -2.
that depends on binary representation of numbers. C does not enforce such a thing.
>>
>>53539091
And my pencil isn't even binary!

What the fuck are you posting? int64 and long long aren't the only two things on the planet.
>>
>>53539106
>when an integer is 4 bits wide
not possible, CHAR_BIT is at least 8
>>
>>53539135
Your point being?
>>
>>53539135
Who said we were talking about C? You can represent binary numbers without C you Mongol.
>>
>>53539127
>What the fuck are you posting
you must be very new if you can't follow a conversation on this board
>int64
you can't read either, it's __int64
>>
File: browser.png (47 KB, 250x250) Image search: [Google]
browser.png
47 KB, 250x250
browser #112
>>
>>53539150
>who said
the anon that started the discussion
>we were talking about C
get it right, we're talking about C++
>You can represent binary numbers without C
obviously, but that irrelevant
>>
>>53539159
>"Someone's calling me out on making irrelevant appeals. Better accuse them of illiteracy and being unable to follow conversations XD"
>>
>>53539174
>the anon that started the discussion
Wrong.

>get it right, we're talking about C++
We're not talking about languages, we're talking about binary numbers, C++ was merely used to prove a point.

>obviously, but that irrelevant
It's the most relevant thing because that's what the discussion is about.
>>
>>53539174
Except he as about signed versus unsigned integers, which are not restricted to C++. Binary representation of signed integers is a mathematical topic that is not restricted to the scope of programming languages.
>>
>>53539148
you're shitposting
>>
>>53538749
>>53538279
8 bits minimum in C/C++ tards
>>
>>53539190
>Wrong.
read again, he asks specifically about visual c++; I don't care if you give a correct answer about oranges when asked about apples
>We're not talking about languages
of course you're not, you're too stupid to know what the fuck you're talking about; the question was specific though
>most relevant thing because that's what the discussion is about
reading comprehension
>>
>>53539091
If you think people should be providing 64-bit literals just to explain the difference between signed and unsigned datatypes, you need to up your medication.

>Guise, 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 signed is different to
> 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 unsigned, how could you not know this!! xD
>>
>>53539204
>>53539190
>WHAT IS CONTEXT
FUCKING SPERGS

>>53538235
>>
>>53539204
>Except he as about signed versus unsigned integers
in Visual C++
>which are not restricted to C++
he doesn't care about that
>is a mathematical topic
irrelevant
>>
>>53539243
>What is this unsigned and signed?
Exactly.
>>
>>53539262
>[in visual C++]
>>
>>53539236
>He needs a programming language to explain basic mathematical concepts
>>
>>53539262
>What is this unsigned and signed
>well, you see, when you use cryptography to prove a document has not been tamped with, it's said to be a "signed" document
>what? you didn't ask about C++ in the exact same line, did you?
>>
>>53539287
you were implicitly assuming 2's complement anyway fucking retard
>>
>>53539247
I think people that don't know what they're talking about should stop being "helpful"
>>
>people trying to use both the standard and VC++ in their argument

what a clown fiesta itc
>>
just set windows calc to programmer mode and dick around with it if you can't figure this basic shit out
>>
>>53539331
>where's the animu, guise?
>>
>>53539295
You actually have autism.

I'm not saying that as a joke or to be mean. I implore you, for your own safety and the safety of others, to seek immediate medical treatment.
>>
>>53539333
>windows calc
>programmer mode
ask me how I know you haven't "upgraded" to windows 10
>>
>>53539343
Anime website.
>>
>>53539359
no i haven't because i'm not retarded
>>
>>53539349
you just don't belong here, mate
>>
>>53539279
That's, weird I can't find the phrase "in visual C++".

Do you think there's a problem with Chrome's web rendering? Maybe I should switch to Firefox.
>>
>>53539372
just ask already
>>
>>53539372
>uses windows
>claims to be not retarded
uhhhh
>>
>>53539396
you never answer and it's supposed to be a rhetorical question anyway

how do you know?

>>53539397
>uses linux
kek

nothing wrong with windows 7
>>
Does anyone here know the knapsack problem?

i'm a having a little trouble coming up with a solution for a new constraint.
>>
>>53539423
P != NP
>>
>>53539423
If you're the same guy as last time, you never actually cleared up what constraints you were using in the first place.
There are at least 3 common variants, but the general problem is open to them all being set to pretty much anything.
>>
>>53539433

well i think it is NP-Complete but i'm not sure.

anyway my question is:
- you have the items and their values and weight. (that's the classic problem).
what if i have the same item but with different weight and value to choose from ?
for example:

- item 1 has cost 2 and weight 2
- item 1 has cost 3 and weight 5
- item 1 has cost 6 and weight 7
- item 2 has cost 1 and weight 1

question: how do i choose the *best* item for each product?
>>53539483
yes its me sorry for interrupt :\
>>
>>53539258
>>53539262
>>53539279
>>53539287
wew lad i asked 2 hours ago and still arguing?
pretty good
>>
>>53539569
>>53539258
>>53539262
>>53539279
>>53539287
btw thanks because i really didn't know the difference or what it meant
>>
>>53539569
Well, you can clear it up once and for all. When you asked about signed versus unsigned, were asking in general or were you focusing exclusively on Visual C++?
>>
>>53539569
Still arguing because some retard objected that under no circumstances 1110 could be -2.
>>
>>53539421
>how do you know?
windows 10 replaced calc with a shitty metro "calculator app"
>>
File: fract.jpg (54 KB, 520x523) Image search: [Google]
fract.jpg
54 KB, 520x523
OK, I'm generating fractals in Java using N-Raphson and I receive this image for z^3 - 1. My worry is that it doesn't look at all correct near the origin. Will this be because the image is representing a square of width 2 with only 400 x 400 pixels, or should I be looking at my code for errors?
>>
File: ebinm8.gif (546 KB, 255x255) Image search: [Google]
ebinm8.gif
546 KB, 255x255
>>53539583
>>53539589
Visual C++
Got it from here

https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx
>>
>>53539589
with __int64 or long long? that's true
>>
>>53539613
Well, I shouldn't have used the word origin since it could very well not be
>>
>>53538149
Holy shit, PLEASE do not do this.
>>
>>53539635
WHY not?
its simple and efective.
>>
>>53539612
cucked hard lmfao
>>
Btw. guys this >>53538874, is in fact standard.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3690.pdf
Page 222.
>>
File: 20150716112228609.png (82 KB, 1207x372) Image search: [Google]
20150716112228609.png
82 KB, 1207x372
>>53539663
I've explained this before in /dpt/.

Look up SQL injections.

Even if the service account used for the query is read-only, there are other considerations such as someone being able to retrieve data from your database, or fetch information on other users.
>>
>>53538874
implementation-defined
>>
Rate my string to float converter. No I'm not going to use stof.

float StF(std::string vString)
{
float value=0, decimalOffset=1;
bool decimal=0;
const int multiplier=10;

for(int n=0; n<vString.size(); n++)
{
if(vString[n]=='-'){n+=1;};
if(vString[n]=='.'){n+=1;decimal=1;};
if(decimal==1){decimalOffset*=10;};
value+=vString[n]-(int)'0';
value*=multiplier;
}
value/=10;value=value/decimalOffset;
if(vString[0]=='-'){value-=value*2;};
return value;
}
>>
>>53539730
It was merely an example, no one in their mind will do that without sanitization/query preparation.
>>
>>53539681
Whoops it's 237.
>>
I want to pick up cosing, any websites with coding problems and the sort?
>>
>>53539749
bool deciman=0;

OK, kid.
>>
Can someone please explain where I've messed up here? No matter what I type number I type in, it always skips the if and else if and outputs 'sign' as 0.

#include <stdio.h>

int main(){

int number = 0, sign=0;

printf("Enter number");
scanf("%", &number);

if(number<0){
sign= -1;
printf("%i\n", -1);}

else if(number>0){
sign=1;
printf("%i\n", 1);}

else{
sign=0;
printf("%i\n", 0);}

printf("Sign = %i", sign);

return 0;
}
>>
File: 1431386073438.png (265 KB, 767x650) Image search: [Google]
1431386073438.png
265 KB, 767x650
Look at here lads, a new C standard.
https://www.reddit.com/r/C_Programming/comments/4at4km/the_iso_c_wg_has_started_working_on_a_new/
>>
>>53539823
>scanf("%", &number);
>>
>>53539818
I-I don't understand. I-It's a flag.
>>
>>53539823
>scanf("%", &number);
>>
>>53539841
Man I'm fucking retarded. Thanks anon
>>
>>53539842
C++ has 'true/false'. Use them. You're not hackering in C.
>>
>>53539853
Tip: -Wall defends you from this
>>
File: 14070193233064.png (99 KB, 234x231) Image search: [Google]
14070193233064.png
99 KB, 234x231
>>53539856
Why? 1/0 is vastly superior to true/false.
>>
>>53539859
>-Wall
I'm new to programming and don't know what this is. I'll do my best to understand if you explain it to me.
>>
>>53539823
>
scanf("%", &n);

>"%"
That's not a valid format specifier. Debugging type: try printfing number right after scanf and see that it's still zero before you come here to whine. Also add a check for the return value of scanf (yes, you couldn't have known).
>>
File: how_about_no.jpg (78 KB, 457x386) Image search: [Google]
how_about_no.jpg
78 KB, 457x386
>>53539866
>>
>>53539868
A flag you pass to gcc.
>>
>>53539889
Justify your stance.
>>
>>53539749
std::cout << StF("-..|..-.fag-..|..-");
>>
File: 4.jpg (17 KB, 300x169) Image search: [Google]
4.jpg
17 KB, 300x169
>>53537658
>>
>>53539866
No it's not. Use numbers for calculations or bit masks. Use true/false for flags.
>>
>>53539901
see >>53539912
>>
http://strawpoll.me/7107377 what do you call yourself?
>>
>>53539924
>Use
>no justification given
>>
>>53539866
Why? Code is much more readable if you use true and false.
>>
>>53539912
Why though? This is completely arbitrary. It is never better to not use 1/0 if you can beyond readability and 1/0 are just as readable as true/false.

>>53539924
That's a demand not a justification.
>>
>>53539937
>all these gurlcoders
disgustedconstanza.jpg.exe
>>
File: 20160317_193145.jpg (412 KB, 600x747) Image search: [Google]
20160317_193145.jpg
412 KB, 600x747
>>53539749
Pretty awful in form and content. Maybe I'm late to the party on this one, but isn't sscanf hella comfy for string parsing? It takes as many output parameters as you want, and it even returns exactly what you need to chain it. Also it basically implements a parser EDSL. I read somewhere that EDSLs are the future of computing, so it must be true.
>>
>>53539749
why do you hate spaces anon
>>
>>53539937
A computer scientist, an alchemist, a spirit conjurer.
Bad poll
>>
>>53539924
>>53539912
>>53539976
>>53539985
Thanks /dpt/, this is much more readable. Don't know what I'd do without you guys.
enum flags{thisvalueisfalsenottrue,thisvalueistruenotfalse};


float StF(std::string vString)


{
float value=0, decimalOffset=1;


bool decimal=thisvalueisfalsenottrue;


const int multiplier=10;


for(int n=0; n<vString.size(); n++)
{


if(vString[n]=='-'){n+=1;};


if(vString[n]=='.'){n+=1;decimal=thisvalueistruenotfalse;};


if(decimal==1){decimalOffset*=10;};


value+=vString[n]-(int)'0';


value*=multiplier;
}


value/=10; value=value/decimalOffset;


if(vString[0]=='-'){value-=value*2;};


return value;
}
>>
>>53539749
>if(vString[n]=='-'){n+=1;};
rofl
>>
>>53540038
>>
>>53540046
See now that is a legitimate point. I actually forgot to use n++.
>>
>>53540069
3 problems with it
1: n++
2: {} for one thing
3: no new line
4: ; at the end of the if? wot
>>
>>53540038
crippling autismo
>>
>>53540038
What exactly were you expecting when you posted your code originally?
>>
>>53540083
The rest of those points are autism.
>>
>>53539749
Here's better, faggot:
float StF(const std::string &vString)
{
float f;
std::istringstream(vString) >> f;
return f;
}
>>
>>53540117
try to do it in 1 line
>>
>>53539942
>Why though? This is completely arbitrary. It is never better to not use 1/0 if you can beyond readability and 1/0 are just as readable as true/false.
The compiler should never allow numeric values to be used as a boolean. Fuck C for introducing that cancer. Consider the following:
while (PI);

How could that be considered valid?
>>
>n++
>not ++n for increased performance
>>
>>53540138
static const float StF(const std::string &vString)
{
return std::stof(vString);
}
>>
>>53540138
float StF(const std::string &vString){float f;std::istringstream(vString)>>f;return f;}

success!
>>
>>53540143
>How could that be considered valid
simple: you learn the language
>>
>>53540117
When will one of you faggots signal errors in a nonambiguous way? Spoiler: never, you're way too dumb.

float StoF(std::string str) {
float res;
if(str.size() == 0 || sscanf(str.c_str(), "%f", &res) != str.size()) std::terminate("NaN in Stof");
return res;
}

Now bow down to me.
>>
>>53540192
thats some manly programming right there
>>
File: 130563817943.jpg (122 KB, 650x433) Image search: [Google]
130563817943.jpg
122 KB, 650x433
>>53540150
>>
>>53540215
>C++11
>>
>>53540214
>sscanf(str.c_str(), "%f", &res) != str.size()
>I don't know how to use sscanf
you don't belong here, webshit
>>
>>53540150
It would only increase performance if he was dealing with STL iterators, but he's clearly not.
>>
>>53540230
The default standard in GCC and Clang.
>>
>>53539749
>No I'm not going to use stof.
>>53540192
>std::stof(vString);
anon...
>>
>>53540150
>100 instructions that take 30 circles each and refresh the cache are faster that one instruction that takes two circles.
>>
>>53540271
>muh circles
>>
>>53540207
Poor design decisions should be avoided. The C++ language is a good example of a poor design decision.
>>
>>53540296

Poor design decisions: {list of languages I dislike}

Proper, well reasoned, design choices: {list of languages I like}
>>
If I have a function which does not return any values, do I still need to use return()?

def print_all(items):
count = 0
for item in items:
count += 1
print("Item {}: {}".format(count,item))

return()
>>
What IDE should I use? Need to learn Python as fast as humanly possible but don't want to pick any random IDE and miss out on the best.
>>
>>53540316
Yes. It doesn't compile without return.
>>
>>53540315
>defending C++
I'm sorry your mother dropped you on the floor after you were born (could also explain why you're a tripfag).
>>
>>53540334
Emacs.
>>
>>53540316
No. Besides doesn't your function currently return an empty list rather than "nothing".
>>
>>53540296
C++ is literally the best high-performance language
>>
>>53540354
>>defending C++

You don't know how to read.
>>
>>53540354
What the fuck are you quoting, you tumblr shit?
>>
>>53540367
>No
Wrong! Return is required.
>>
>>53540334
Pycharm, maybe the educational edition
(I don't use it, but I love IntelliJ for Java)
>>
>>53540379
So? The language i still poorly designed.
>>53540383
You're a burger.
>>53540390
Dunno. Maybe the person I replied to?
>>
>>53540379
>literally
I'm afraid you're mentally ill.
>>
>>53540408
>I love IntelliJ for Java

Same. Unlike Egglips, IntelliJ just works.
>>
>>53540402
https://ideone.com/CfSU28
>>
>>53540359
Seconding that. Why learn one """IDE""" per lang? One editor to rule them all. Plus an """IDE""" is basically a walled garden : you don't want to live without freedom, do you?
>>
>>53540417
>literally the best
>poorly designed
>>
File: 1445388886131.jpg (55 KB, 697x960) Image search: [Google]
1445388886131.jpg
55 KB, 697x960
>>53540417
>You're a burger.

Assburger, Ameriburger, or both?
>>
>>53540417
>Maybe the person
WHAT, NOT WHO, YOU FUCKING WORTHLESS SHIT STAIN!
>>
>>53540441
What you working on now chap? anything new to not-lisp?
>>
>>53540434
JavaScript is blazing fast. That doesn't mean it's properly designed.
>>53540441
*burger
>>53540451
Sorry, I no understand. I am Albanian viris.
>>
>>53540429
>>53540429
I'm not talking about python, autismo, I'm talking about the general concept of returning from functions and how it's mandatory in some languages!
>>
>>53540473
>JavaScript
>blazing fast
bwahahahahahahaha
>>
>>53540481
Not him. In other languages, functions have to return a value that fits its signature's return value. Python method's start with def, no return type in the signature, so whatever you return is up to you
>>
>>53540461
>What you working on now chap?

Project for the FAA.

>anything new to not-lisp?

Not lately, no. I think I'm gonna go back in and work on my other meme language, SP4.
>>
>>53540316
Look at the syntax. How else does the compiler/interpreter know your function has ended?
You could say "Well it'll just look for next function" but then how does it tell between a nested function (if even allowed) and a new function, after implicitly closing the current one?
>>
>>53540506
The V8 engine makes it really fast. It's fast enough for programs cucked by IO.
>>
When are Java apologists going to let go?
>>
>>53540604
pajeets have a tenacity for holding onto shit
>>
>>53540359
>>53540408
>>53540431
Thanks for the input, I think I'll go for emacs.
>>
File: pfft.gif (1 MB, 400x225) Image search: [Google]
pfft.gif
1 MB, 400x225
>>53540611
>>
>>53540627
>he fell for the meme
>>
What is a good way to store a board like this and score it? Squares are easy, but odd hexagon shapes are hard, and it's only further complicated by the fact that people can play on both the triangle and line shaped spots.
>>
File: sponza_test.png (652 KB, 797x511) Image search: [Google]
sponza_test.png
652 KB, 797x511
>>53537602
Cleaning up my raytracer code a bit today.
>>
>>53540725

ffuck ur blimp pong not a ray tracer fuk u fuk u fuk u!
>>
File: raytrace.jpg (77 KB, 443x591) Image search: [Google]
raytrace.jpg
77 KB, 443x591
>>53540725
>But that's not a raytrace!
>>
>>53540345
>>53540367
>>53540567
Thanks Anons, I added the return()'s. Seems to work. Here's my code so far. I don't understand much about programming but yet it's fun to play with Python.

http://pastebin.com/aesVXPXa
>>
Noob programmer here just starting and i have a problem with this:

#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
int main()
{
int i,j=0,k=0,str_1=0,str_2=0,str_3=0,space=0;
char sta[40];
char stb[40];
char stc[100]={ };
cout<<"Enter sentence: "<<endl<<endl;
cin.getline(sta,39);
cout<<"Enter Second Sentence: "<<endl<<endl;
cin.getline(stb,39);
for(i=0;i<40;i++)
{
if(sta[i]=='\0')
{
break;
}
else
{
str_1++;
}
}
cout<<"The first sentence has: "<<str_1<<" characters"<<endl<<endl;
for(i=0;i<40;i++)
{
if(stb[i]=='\0')
{
break;
}
else
{
str_2++;
}
}
cout<<"The second sentence has: "<<str_2<<" characters"<<endl<<endl;
space=str_1+str_2;
for(i=0;sta[i]!='\0';i++)
{
stc[space]=sta[i];
space++;
str_3++;
}
for(j=0;stb[j]!='\0';j++)
{
stc[space]=stb[j];
space++;
str_3++;
}
stc[space]='\0';
cout<<"The third sentence is: "<<stc<<endl<<endl;
cout<<"And has "<<str_3<<" characters "<<endl;
return 0;
}

why it won't print the stc string?
thanks in advance, again i am a noob.
>>
>>53540725
looks sexy m8
>>
File: 9.gif (19 KB, 1000x800) Image search: [Google]
9.gif
19 KB, 1000x800
is this is the right place to ask about dev flow?
>>
File: 256.jpg (29 KB, 367x451) Image search: [Google]
256.jpg
29 KB, 367x451
>>53540578
fast by webshit standards maybe
>>
>>53540692
arrays and pointers
>>
>>53540879
no we are neckbeard neets and basic codemonkeys
>>
>>53540958
and kids
>>
>>53540958
and trump voters
>>
Which one of you sick hipster fucks still uses RSS?
>>
>>53540788
jesus fuck m8 use std::string for that shit
>>
Trying to implement a Plan9 like system throughout my house, got a media center hooked to my flat screen. A HTTP + file server (for holding all my backups and for sandboxing my web development) and now a media server (I can stream netflix better than the last 3 blue ray players I bought) and I'm about to add another media streaming PC in my room (using plan9 userland with arch and sshfs to mount all of the /home/ directories under one master /home/ on the HTTP server.

tis noice friendos.
>>
File: leftists.png (651 KB, 642x816) Image search: [Google]
leftists.png
651 KB, 642x816
>>53540983
/dpt/ has a disproportionate amount of leftist trap fags
>>
>>53539840

You know, Anon, you could have linked to the proposed standard instead of the comments section of Reddit.

Also, that faggot talking about "named loops"... we have that in C. It's called labels and gotos.

For everyone else:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1990.htm
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2016.pdf
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1989.htm

>>53539749

Use a const reference instead of copying the string by value. Doing it the way you're doing right now invokes the copy constructor.
>>
Working through an RxJava problem with an update to Mimi. This is the first time I've had any significant problems with Rx but holy fuck it's annoying.
>>
File: glenda_space_medium.jpg (13 KB, 239x276) Image search: [Google]
glenda_space_medium.jpg
13 KB, 239x276
>>53541012
Good job!
Here's your Glenda.
>inb4 yes Glenda is a cute trap
>>
Just wrote what will be the fastest sorting algorithm in history
>>
>tfw sexist fucked-in-the-head liberals will vote for fucking hillary clinton just because she's female
>>
>>53537602
Fuck off weeb
>>
>>53541041

I can't wait until they add templates to C. :)
>>
>>53537722
Google C# String.Split
>>
>>53541105
>inb4 O(n^2)
>>
>>53541105
It better be a mutation of BOGO sort that utilizes quantum space to only exist in the universe where the collection is already sorted.
>>
>>53540725
>0.169 fps
>tfw we won't have real-time proper ray tracing in our lifetimes
>>
>>53541164
O((n^2) / 2)
>>
>>53541004
can you help me a bit more? thanks.
>>
>>53541176
or maybe with quantum computing somehow?!
>>
>>53541041
>You know, Anon, you could have linked to the proposed standard instead of the comments section of Reddit.
I would have to click every single link.
Anyhow, named loops are shit, one of the documents is a report and the half-float thing is useless. However, I see no indication that they have a higher possibility of getting into the standard than this for example: http://www.open-std.org/jtc1/sc22/wg14/www/docs/historic/n424.txt
>>
>>53541176
Yes we will. We're pretty close even. My implementation is just unoptimized shit.
Well, technically ray tracing won't be real time anytime soon, but path tracing (which is better) will.
My program is a whitted-style ray tracer so reflective materials keep bouncing lightrays off and refractive materials spawn 2 new rays each time they're hit.
With path tracing you employ stochastic techniques and only trace 1 path per ray (simulating a photon, sort of). Then you increase the number of samples per pixel to get a less noisy image. If you accumulate that, eventually it will converge to a photorealistic image.
>>
>>53541231
still O(n^2)
>>
>>53537658
>>53537722
Bruh.

string s = "ayy-lmao-nerd"; //second hyphen is at index 8
int nthOccurance = 2;
char c = '-';

int index = s.TakeWhile(x => (nthOccurance -= (x == c ? 1 : 0)) > 0).Count(); //index ends up as 8
>>
>>53541108
>tfw rednecks will vote for trump because he's that guy from the show on tv

Every candidate has a following of retards, that doesn't really mean the candidate is bad, just america in general.
>>
>>53541231
"fastest"

Do you have it published yet, m8?
>>
>>53541298
>>tfw rednecks will vote for trump because he's that guy from the show on tv

That's not why they're voting for him.
>>
>>53541300
No, but who should I contact about it?
>>
>>53541254
They're all shit. Meanwhile statement expressions and typeof are ignored.
>>
>>53541324
it's because he's """"""""racist"""""""" (ooh scary word) and literally hitler (which would actually be a good thing imo)
>>
>>53541298
arXiv if you think it's that good.
Thread replies: 255
Thread images: 39

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.