[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: 32
prev >>55554965
>>
>>55559257
First for Python + Django
>>
First for Go!
>>
File: thingken of cake.png (3 MB, 1229x1216) Image search: [Google]
thingken of cake.png
3 MB, 1229x1216
normtable = list(table)
print(table[80][3]) #debugging print
print(id(table)) #objects have different ids; not a pointer issue
print(id(normtable))

for i in range(len(normtable)):
normtable[i][3] -= normtable[i][8] * 10000
if normtable[i][3] > 100000:
normtable[i][3] = 100000
if normtable[i][3] < 20000: normtable[i][3] = 20000

print(table[80][3]) # prints different value; 'table' is manipulated


yet when i do this

normtable = list(table)

print(table[0]) #debugging print

del normtable[0]

print(table[0]) #prints same tuple; table is not manipulated



what am i missing?
>>
File: K&R c.png (1 MB, 1000x1400) Image search: [Google]
K&R c.png
1 MB, 1000x1400
You have been visited by the crossdressing C programmer of Shimoshina Academy!

Good performance, triple indirection, and tail call optimization will come to you, but only if you post "Keep overflowing the stack, Hime!" in this thread.
>>
>>55559348
>know she's meant to be Rose Quartz

I'm beginning to think I've made poor life choices.
>>
>>55559348
you didn't manipulate the table
>>
redpill me on SDL
>>
>>55559348
># prints different value; 'table' is manipulated
no, table[80][3] is manipulated
>#prints same tuple; table is not manipulated
of course not, just like in the first case
>>
>>55559505
Good luck. /dpt/ is the most blue pilled thread on /g/.
>>
>>55559505
it's ok
>>
>>55559505
It's better than SFML, even for C++. I don't even get why people think SFML is more suited just because it's made in C++
>>
>>55559505
Simple and works well.
Doesn't support special features like multiple mice.
>>
>>55559257
Why is there 3DPD dyke degeneracy on my /dpt/?
>>
>>55559360
keep overflowing the trap, mime!
>>
type * pointer


type* pointer


Or

type *pointer
>>
>>55559799
type *pointer
because that works in lists.
type *a, *b


However it is my opinion that C and C++ are braindead in that regard. The asterisk should be part of the type declaration:

type* a, b
>>
>>55559799
type* pointer
>>
>>55559799
type *name

or
type * name

Because
type* a, b

Will create a pointer a, and a value b.
Really though, staying consistent is the only thing that actually matters...
>>
>>55559257
oh shit do they have a video together?
>>
>>55559799
char *a, *b, *c;
is impossible with the with the first 2 you listed.
>>
>this much arguing on the most basic of tasks

This is why C is shit unless you're forced to use it.
>>
Can someone explain why they decided that OpenGL device coordinates would be in the range (-1.0, -1.0) to (1.0, 1.0), but OpenGL texture coordinates be in the range (0.0, 0.0) to (1.0, 1.0)?
>>
>>55559257
>posting women
Tech illiterate straightfags get off my fucking board, REEEEEEEEEEEEEEEEEEE.
>>
>>55559873
Because texture coordinates are UV coordinates and screen coordinates are not.
>>
>>55559896
You are aware we have a board for degenerates, right? It's called /lgbt/.
>>
>>55559899
But it doesn't make sense to make them inconsistent just because they are for different things.

Give me an actual real reason why.
>>
>>55559360
Keep overflowing the stack, Hime!
>>
>>55559861
>impossible
char* a, *b, *c;
char * a, *b, *c;

nothing is impossible
>>
>>55559934
that's so fucking inconsistent
why did you even reply?
>>
>>55559521
>>55559505
>bluepill
>redpill
Fuck off, /pol/. Get back to your containment board.
>>
>>55559949
We need the redpill more than ever because of OPs image.
>>
>>55559709
but that is less than 50 loc to write yourself, so why would you care?
>>
>>55559521

The illusion is that you have to choose one pill or the other.
>>
>>55559914
Get back to your containment board, /pol/. Computer science is about gay men's accomplishments.
>>
Is this a good resource to learn C?
>https://en.wikibooks.org/wiki/C_Programming
>>
>>55559960
what do you mean?
Because OP posted a picture of the tranny version of a missed high five?
>>
>>55559976
>muh /pol/ boogeyman
>>
>>55559960
I agree that OP's image is autism, but /pol/faggotry just creates more autism.
>>
quads get
>>
>>55559927
Anon. Screen coordinates are for rendering geometry and texture coordinates are for chopping shapes out of bitmaps and shit.

It would make no sense for them to be anything else. I just convert all my shit to pixels anyway by doing x=(2.0/width-1.0),y=(2.0/height+1.0) and texX=(1.0/width),texY=(1.0/height). I know it's bad practice but who gives a shit really.
>>
>>55559999
You son of a bitch.
>>
>>55559993
>uses /pol/ meme
>lol i'm not pole haha
You can call a /pol/fag anything and he won't care, but call him a /pol/fag and he'll be butthurt for years.
>>
>>55559999
>>55559999
>>55559999
>>55559999


>le maste hake
>>
File: sheeeeeeeeeeeeeeeeit.jpg (232 KB, 768x480) Image search: [Google]
sheeeeeeeeeeeeeeeeit.jpg
232 KB, 768x480
>>55559999
sheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeit
>>
>>55559999
gj getboi
>>
>>55559861
>>55559934
Why not
type* pointer[3]
?
>>
>>55559999
oh shit! are you a wizard???
>>
>>55560045
VLAs are forbidden in C89.
Why not
type *ptr = (type *) malloc(sizeof(type *) * 3);
>>
>>55560062
>casting from void * in C
>sizeof(type *) instead of sizeof *ptr
>>
>>55560062
Also, the thing he posted is not a VLA.
>>
>>55560002
I see literally no reason for screen coordinates to not be in the range (0.0, 0.0) to (1.0, 1.0).
It would be far more convenient that way.
There is literally no reason for it to be the way it is currently.
>>
>>55559257
What does this have to do with programming or 4chan?
>>
Anyone have the picture that has that bigass list of programming projects? I'm trying to figure out what to do next for my portfolio and I'm stumped.
>>
casting to/from void* is by far more common in C than in C++, anyone who isn't a fucking delusional retard knows this
>>
>>55560101
Do you just not understand the concept of an origin? It makes way more sense that the origin be in the centre of the screen for screen coordinates and it makes zero sense when assembling a texture map.
>>
>>55560046
yes

>>55560029
>>55560040
>>55560008

If anyone needs the quads get 4chan analizzard let me know.
>>
>>55560124
Wrong
>>
File: 1467840912792.gif (2 MB, 196x187) Image search: [Google]
1467840912792.gif
2 MB, 196x187
>>55559999
DOUBLE QUADS!
>>
File: Wizard.jpg (60 KB, 400x397) Image search: [Google]
Wizard.jpg
60 KB, 400x397
>Knowledge of C enables freedom.

why?
>>
>>55560138
KILL YOURSELF KILL YOURSELF KILL YOURSELF

WE ARE NOT TALKING ABOUT IMPLICIT CONVERSIONS FROM THE VOID POINTER RETURNED MALLOC (YOU DON'T EVEN NEED TO USE MALLOC IN C++, YOU HAVE NEW)

WE'RE TALKING ABOUT ACTIVELY CASTING TO/FROM VOID POINTERS THAT YOU PASS TO FUNCTIONS AND SUCH

FUCKING RETARD KILL YOURSELF PATHETIC SPERG
>>
>>55560168
>WE'RE TALKING ABOUT ACTIVELY CASTING TO/FROM VOID POINTERS THAT YOU PASS TO FUNCTIONS AND SUCH
yes... I know, you do not have to cast from/to void * in C
Is this so difficult to understand you foolish carposter?
>>
>>55560183
KILL YOURSELF PATHETIC CUNT YOU'RE FUCKING DELUSIONAL RETARD

KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF KILL YOURSELF
>>
is c++ really that scary

i know C (pointers)
i know java (OO concepts)

is it really that much more complex
>>
File: ghci.png (1 KB, 201x57) Image search: [Google]
ghci.png
1 KB, 201x57
who /haskell/ here
>>
>>55560191
yes (No)
>>
>>55560190
epic
>>
>>55560191
no and dont pay attention to anything /g/ has to say when it comes to discussing a langage
>>
>>55560168
>>55560190
The mad is real
>>
>>55560024
Lol rekt
>>
>>55559799
type */&var


and for functions returning pointers or references

type*/& foo
>>
>>55560218
enjoy your shitty pathetic life where you waste vast amounts of time willfully misunderstanding things in order to masturbate your delusional sperg brain
>>
>>55560239
He is like that in almost every thread. Makes me wonder if he is that upset irl or if he is just pretending.
>>
>>55560062
Jesus, C is so fucking horrifying.
>>
>>55560246
(Unlike you) I enjoy my life actually and don't get upset over everything for no reason. Moreover I explain clearly my problems instead of screaming "SPERG SPEEEEEEEEEERG!!"

>>55560277
This code uses bad practices.
type *ptr = malloc(sizeof *ptr * 3);
is the correct one.
>>
>>55560277
There's nothing wrong with it, anon.
>>
File: funposting certificate.png (67 KB, 750x250) Image search: [Google]
funposting certificate.png
67 KB, 750x250
>>55560259
i've been away for some time so you might be confusing me with others. i came back and saw people writing kys and things like that. i'm proud of some of you guys.
>>
>>55560191
C++ is shit, but it's shit because of the things it shares in common with C and Java. It isn't really harder than C, and every valid C program is a C++ program.
>>
>>55560293
mods = gods
>>
>>55559257

Because two women making out has anything to do with programming? Try posting the next edition with an image of two guys making out, and watch how quickly your thread gets nuked by the staff.
>>
>>55560320
Most straight guys are going to give lesbians a pass over gay guys because porn. You can thank the jews for being half done for accepting degeneracy.
>>
File: 1465210864373.gif (176 KB, 480x270) Image search: [Google]
1465210864373.gif
176 KB, 480x270
>>55560308
>every valid C program is a C++ program
>>
>>55560308
That's not true.
>>
>>55559505
not as well documented as SFML, and it needs extensions to be fully functional. Apart from that, it's great.
>>
>>55560289
>This code uses bad practices.
type *ptr = malloc(sizeof *ptr * 3);
is the correct one.
That's much better, but it's still horrifying. I'm sure the piss-poor variable naming contributes to it though.
When is an asterisk multiplication and when is it a dereferencing operator? That's so damn ambiguous.
>>
https://github.com/GNOME/gtk/search?utf8=%E2%9C%93&q=void

>http://man7.org/linux/man-pages/man3/pthread_create.3.html
>void *

https://www.khronos.org/registry/sles/specs/OpenSL_ES_Specification_1.0.1.pdf
>void*

>C

fucking kill yourselves retarded ass spergs, you can choose to understand what was meant
>>
>>55560355
>>55560365
I should have said "most" and not "every", sorry. C++ and C have differences in the way they handle type and the way they handle stupid shit like incriminating and decrementing, and sometimes scope, but you usually won't experience these differences very often in the real world.
>>
>>55560391
>When is an asterisk multiplication and when is it a dereferencing operator? That's so damn ambiguous.
This is pretty clear actually, what is not clear is when it is a definition of pointer to something and multiplication.
>>
>>55559679
And why do you think SDL is better?
>>
>>55560397
...
what?

>>55560435
In C++ you have to cast from/to void *, meaning that most C programs won't compile.
>>
>>55560449
>Most C programs use dereferencing
Citation very needed. Most C implementations of fizzbuzz and hello world (the two things C programs ever program) both work in C and C++.
>>
FUCKING RETARD you are talking about the trivial syntax requirement of having to explicitly cast to/from void*, i'm talking about ACTIVELY USING void* as a "design pattern" which is BY FAR more common in C than in C++
>>
>>55560477
>>Most C programs use dereferencing
I did not say that.
>>
>>55560489
in reply to >>55560449

>...
>what?
the fact that you can't even comprehend anything suggests that you're either a summerfag who's just starting to learn syntax, or a stupid sperg
>>
>>55560489
>i'm talking about ACTIVELY USING void*
And this is offtopic.

>FUCKING RETARD
Funny, considering that you were not able to understand what the topic was about even though I was clear from the start and it was explained multiple times. It's like someone says potato and you understand apples.
>>
repill me on Golang
>>
File: 235235.jpg (63 KB, 845x506) Image search: [Google]
235235.jpg
63 KB, 845x506
>>55560489
>design pattern
>>
>>55560502
>you're either a summerfag
We talked multiple times before summer, don't you remember me? ;_;

>the fact that you can't even comprehend anything
Because maybe it has nothing to do with the topic and you just linked some programs that use void *? Of course I would not understand what you are rambling about.
>>
>>55560496
So you meant that in C++ you have to cast from/to void multiplication-token? That makes even less sense.
>>
>>55560518
He likes Java and he is autistic about it even though it is one of the shittiest languages.
>>
>>55560517
Get back to your containment board, >>/pol/
>>
>>55560508
fuck off and die retard, the original post was just
>>casting from/to void is nice
in reply to
>C++ is nice, C is unpleasant.

the topic was not clear from the start, wecan't read your mind fucking retarded sperg
>>
>>55559799

The last one is correct because that it what Ritchie-san said was correct.
>>
>>55560544
Replied to you in the other thread.
>It's very clear. The term casting is very well defined both in general and in the standard.
Moreover I explained it multiple times in the other thread before you came.
>>
I think the world would be a better place if we all switched to Python.

C/C++ has no place in the post-modern world.
>>
>>55559799
#define pointer *

type pointer x;
>>
>>55560566
Python is a shitty language that ignores thousands of years of research.
>>
>>55560561
people were saying casts (conversions implied) to/from void* were more common in C than in C++ and you just said it was wrong with no explanation given, so fuck off retard

and yeah i don't give a shit about the prior context outside of the reply chain, i looked at several posts with the anime cosplay memes etc
>>
File: 1468168125283.jpg (5 KB, 200x200) Image search: [Google]
1468168125283.jpg
5 KB, 200x200
>>55560566
>postmodern
10/10
>>
implicit conversions to/from void* is fucking trivial, it's basically just syntax, how does that even matter for deciding if a language "is nice", and only C/python tier tards think implicit is better than explicit
>>
>>55560583
>prior context outside of the reply chain
It was in the reply tree.

>people were saying casts (conversions implied)
Well, casts can't never mean that. If they did not understand a well defined term like this, it's their problem.
Also, only a few dumbfucks (like you) were unable to understand.

>and you just said it was wrong with no explanation given
I gave explanation multiple times.
>>
File: (You).jpg (124 KB, 1280x720) Image search: [Google]
(You).jpg
124 KB, 1280x720
>>55560612
>putting C and Python users in the same category
>>
>>55560612
It automatically makes the language 10x times shittier.
>>
>>55560621
anons often shill for both C and python, which they think are good when used in conjunction, and both C and python are shit
>>
>>55560640
C is fine for it's job and age
Python is indeed shit
Same for C++, it's shit
>>
>>55560620
the mere fact that you think casting to/from void* matters shows that in C you use void* a lot more than in C++, in C++ you don't have to use them at all (you don't even have to use malloc) except when using C libraries/APIs, and this ties back to your original comment, just because you have to do an explicit cast instead of an implicit conversion the rare few times you use a void* doesn't (in itself, at least) disqualify C++ from being "nice"
>>
>>55560739
>doesn't (in itself, at least) disqualify C++ from being "nice"
It does because it is an unnecessary, stupid and annoying decision.
>>
>>55560757
ok champ
>>
>>55560195
λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ
>>
>>55560195
Scheme is just better
>>
>>55560800
In what world?
>>
>>55560582
>""""research""""
Do you think languages are just cooked up in a lab?
Do you think the quality of a language has some scientific measurement that lets you "research" a better language?

Real languages are produced in the field, for some particular need. Anything else is ivory tower mental masturbation.

inb4 I'm a brainlet, go kill yourselves cucks
>>
>>55560825
This post is just mental masturbation
>>
>>55560811
The land of lisp
>>
File: 2016-07-14_07-12-36.png (11 KB, 882x121) Image search: [Google]
2016-07-14_07-12-36.png
11 KB, 882x121
why can't things be simple like python?
>>
>>55560825
>Real languages are produced in the field, for some particular need
Python has no need however.

Enjoy your shitty stone-era languages.
>>
>>55560811
The real one.
>>
>>55560867
python has special needs
>>
File: memes.jpg (46 KB, 695x431) Image search: [Google]
memes.jpg
46 KB, 695x431
>>55560888
this 3bh
>>
>>55560811
The realm of Racket
>>
File: 1446701255143.png (120 KB, 1091x410) Image search: [Google]
1446701255143.png
120 KB, 1091x410
>>55560888
Can't disagree.
>>
>>55560920
>deprecated
It never had a use to begin with
>>
>>55560811
The sublease of scheme
>>
>>55560944
You can stop replying now
>>
>>55560956
The Conquest of Clojure
>>
>>55560929
python has done more for the world than C
>>
>>55561098
>python has done more harm for the world than C
ftfy
>>
>>55561169
this
>>
>>55561169
>>55561098 here, this is what I meant to write :3
>>
>>55561169
No. The world would literally be a safer place to live in if C didn't exist desu.

Python doesn't suffer from C's vulnerabilities.
>>
How do I pass a dictionary to a function in python?
I have a lot of dictionaries and I feel like it would be easier this way.
How do I fix this?
Button(root, text="black",fg= 'blue',  command= lambda: black(Entry.get(p_ent),black)).pack(fill=X)

TypeError: 'dict' object is not callable
>>
>>55561226
>Python doesn't suffer from C's vulnerabilities.
Like? Any safety problem in C exists in python, except that most of python's problems do not exist in C.
>>
>>55561257
>Any safety problem in C exists in python
You're a fucking retarded noob. Never talk about security again.
>>
Name a relevant implementation of Python that is not written in C.
>>
>>55561295
You don't know shit newfag.
>>
>>55561257
>Any safety problem in C exists in python, except that most of python's problems do not exist in C.
How can you be so deluded?
>>
File: sk14.jpg (57 KB, 568x310) Image search: [Google]
sk14.jpg
57 KB, 568x310
>>55559868
I hear Rust is getting popular. Pic related; Rust core team member.
>>
>>55561315
It's true though.
>>
>>55561318
Yeah, he's a weirdo, and the Rust community has some SJW elements to it, but it is a solid language.
>>
Anybody here know Prolog? I could surely use some help.
>>
>>55561375
>some
>>
>>55561389
My mother does.
>>
>>55561318

It's picking up. Still a very immature language.

I enjoy it. When the library support is up to snuff I'll probably fully transition to using it whenever possible.
>>
>>55561432
>I'll probably fully transition
don't do it bro it doesn't actually make you a better programmer
>>
>>55561257
>>55561304
You're too retarded for anyone to dispute your shut, but if you think you make a valid argument, go ahead.
>>
>>55561450
kek
>>
>>55561482
You are the one that started this bullshit, so the burden of proof is on you.
Moreover this talk has been here multiple times, however if you still want an explanation please make sure to ask.
>>
File: pnkharm.jpg (38 KB, 479x269) Image search: [Google]
pnkharm.jpg
38 KB, 479x269
>>55561375
>14 words is now sjw

pic related, another main member.

>>55561399
>only 1.4% of their users identify as trans
they clearly have a lot of work to do
>>
>>55561450

I never implied that it would.

It's just fulfilling the role I currently use c++ for with less bullshit and more bitching when I try to do something brain dead.
>>
Rust/Mozillafags are so depressing
>>
>>55561529
the meme
your head
>>
>>55559257
>File Deleted
Keep overflowing the stack, Hime
>>
File: rustcamp.jpg (93 KB, 960x540) Image search: [Google]
rustcamp.jpg
93 KB, 960x540
>>55561529
>>55561432
I know it's picking up. I'm getting nervous how alarmingly fast it is happening. How far are they going to take it? Is this just San Francisco politics?
>>
>>55561840
That image was painful to read.
>>
>>55560846
Well, you're building a Win32 application without an entry point that's required by a Win32 application so what did you expect?
>>
>>55561521
>>55561318
>>55561840
why do SJWs like rust? (LISP masterrace here)
>>
>>55561680

Statements without any reasoning backing them up are a sign of stubborn close mindedness.

>>55561714

Meh, I thought the same till I actually started using it.

When I started getting a bit comfortable with it I just started to notice that code was flowing more smoothly.

>>55561840

Hard to say.

Honestly, looking at the current world state I wouldn't be surprised if we had a economic crash / world war 3 before rust is mature andd in wide use.

>>55561946

<3 Lisp
>>
>>55561946
It's not that SJWs like Rust, it's that Mozilla likes SJWs and pays them to be attracted to Rust.
>>
File: 1358838189942.jpg (4 KB, 171x158) Image search: [Google]
1358838189942.jpg
4 KB, 171x158
>join hackerrank because I feel like I am shit at coding
>do some of the string functions
>one is to see if a string contains all the letters of the alphabet
>code a frequency table to do it in O(n) time
>check some other answers
>most are good
>find this:


public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
char[] a = "abcdefghijklmnopqrstuvwxyz".toCharArray();
char[] b = s.toLowerCase().toCharArray();
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<b.length; j++){
if(a[i]==b[j]){
count++;
break;
}
}
}

if(count==26){
System.out.println("pangram");
}
else
System.out.println("not pangram");

}



someone explain this logic. that runtime looks fucking insane.
>>
>>55562002

Why design something when you can beat it with a hammer is the logic here!

*coughs loudly*
>>
>>55561957
>>55561450 is a reference to the recurring meme / spam that crossdressing makes you a better programmer.
>>
>>55562075

I completely ignore the cross dressing bs in dpt. It's completely unrelated to coding and honestly doesn't belong here.
>>
>>55561876
are you jewish?
>>
>>55559257
>>55555555
>>
how would I compare elements in 2 arrays in python?

I have a list of answers and a separate list of user input answers and I need to compare the answers and return the number of matches

COLS = 20

correct = ["b", "d", "a", "a", "c", "a", "b", "a", "c", "d", "b", "c", "d", "a", "d", "c", "c", "b", "d", "a"]
userAnswers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 0]

col = 0

while col < COLS:
userAnswers[col] = str(input('Enter an answer: '))
col = col + 1

input()

That's what I have so far and it does store the answers
>>
>>55562144
What >>55562157 said.

It reads like a group of "Don't mess with me, I have a hidden wolf inside that is raging, and if I snap I will end you!" people.
>>
>>55562175
any(map(lambda v: v in list2, list1))


https://docs.python.org/3/library/functions.html?highlight=any#any

https://docs.python.org/3/library/functions.html?highlight=map#map
>>
>>55562175
use the code tags bro
 
'code here'
>>
>>55562238
Oh, you can nest them!
>>
>>55562175
how do you want to compare them ?
Count the correct ones or, compare if they are the same
if the latter, then just do correct == userAnswers
if former, than do a loop and count correct answers - simplest, or use some functional tools maybe less simple if you are a beginner
>>
>>55562218
>>55562157

That's what I thought at first. But if you look up "we must secure a future for" it seems sort of anti-SJW quote

Personally I don't see how smart guys can be so SJW in honestly. maybe they are secretly not SJW and are just hinting so they can keep hitting bluehaird girls

I visited San Francisco one time and someone asked me why I was wearing this bracelet since I was white. a fucking indian friend gave it to me
>>
[i for i, j in zip(a, b) if i == j]
>>
>>55562175
code tags are ['code']code goes here['/code']
remove apostrophes though
>>
>>55562250
apparently
>>
>>55562273
I want to return both the number of "correct" answers and what ones don't match

Basically all in all it has to accept user answers, compare those with the answer list, tell the student if they passed of failed (15 or more matches), the total number of correct answers, the total number of incorrect answers, and a list of the incorrect answers
>>
hi DPT,

I have a little dilemma.

Fucking Noob here. I've been learning python to make little tools (simply equation solvers I can use at work)

None have a GUI yet or anything and all are run from the console.

I intend to make them into a single coherent application eventually.

The issue is that I figure the best way for me to have access to these applications is via a web interface of some sort. I have a wordpress site hosted on my own server currently up and running.

I can't for the life of me find a reasonable way of getting a webgui working with a python script without mixing two different languages and passing variables back and forth from the wordpress to a python script hosted on a server.

I'm wondering if I should jump ship to a more web-compatible language to make my life easier.
>>
Hello /g/uys! I need some help with randomness in C. I've got this code which is not random at all and I have no idea how to fix it... Any Idea?
Code:
int randBetween(int iMin, int iMax){
srand(time(NULL));
return rand() / (RAND_MAX + 1) * (iMax - iMin)+ iMin;
}

void randomizeUpdateData(){
TCHAR szPath[MAX_PATH];
strcpy(szPath, "C:\\Program Files\\GoogleUpdateService\\UpdateData");
int iLen = 42;
for(int i = 0; i < 5; i++){
Sleep(10);
szPath[++iLen] = (TCHAR) randBetween(48, 58);
}
for(int i = 0; i < 7; i++){
Sleep(10);
szPath[++iLen] = (TCHAR) randBetween(97, 123);
}
TCHAR buf[256];
for(int i = 0; i < 256; i++){
Sleep(10);
buf[i] = (TCHAR)randBetween(0, 255);
}
printf("%s\n%s\n", szPath, buf);
HANDLE file;
file = CreateFile(szPath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD numberOfWritten;
WriteFile(file, buf, 255, &numberOfWritten, NULL);
}


Output: Update00000aaaaaaa|(?$
>>
>>55562391
Django
>>
>>55562318
corrects = 0
for i in range(COLS):
if userAnswers[i] == correct[i]:
corrects += 1
else:
print 'Incorrect answer at question ', i, userAnswers[i]

if corrects > 15:
print 'Passed with ', corrects, 'correct answers'
else:
print 'Failed with ', corrects, 'incorrect answers'

try this
ues loops if beginner
>>
File: 1439109823574.jpg (25 KB, 256x261) Image search: [Google]
1439109823574.jpg
25 KB, 256x261
What's the best way to upload light source data to a GLSL shader?
I'm currently using uniform buffer objects, but there's a few problems I'm not comfortable with.
A. In GLSL, buffer backed interface blocks cannot have variable sized arrays, only static arrays, forcing me to specify a fixed upper bound on the maximum amount of lights possible.
B. The size taken up by the interface block is always the size you declared it, not the size of the buffer object that backs it, which magnifies the above problem.
C. UBO's have a small size limit (16K to 64K on most implementations).
On an implementation that only supports 16K UBO's (like intel, which I'm on), that means I can only upload about only 2000 lights at most (not enough for me).
D. Shader storage objects are only supported on GL 4.3, I'm on 3.3 hardware and even if I was on 4.3 hardware I'd still only target GL 3.3 core profile.
>>
>>55562437
>>55562318
ah, there's a bug in the last line, it should be correct instead of incorrect
>>
>>55562419
implement this https://software.intel.com/en-us/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor
>>
>>55562496
I'd prefer using srand as i need to have the smallest amount of code, possible. Apparently I'm not using the function right so I wanted to know how to fix it.
>>
>>55562175

Should be trivial to translate this to python. It's prob what your prof is expecting for the homework.

int main() 
{
int Count = 0;

std::vector <char> A = { 'b', 'd', 'a', 'a', 'c', 'a', 'b', 'a', 'c', 'd', 'b', 'c', 'd', 'a', 'd', 'c', 'c', 'b', 'd', 'a' };
std::vector <char> B = {};
std::vector <bool> Matches = {};
char temp;

for (size_t i = 0; i < A.size(); ++i) {
std::cout << "{" << i << "}" << "Enter answer: ";
std::cin >> temp;
B.push_back(temp);
}

for (size_t i = 0; i < A.size(); ++i) {
if (A[i] == B[i]) {
++Count;
Matches.push_back(true);
}
else {
Matches.push_back(false);
}
}

std::cout << "Count: " << Count << "\nMatches: ";
for (auto i : Matches) {
std::cout << (i ? 'T' : 'F') << ' ';
}
std::cout << std::endl;
return 0;
}
>>
Where can I find some decent QT codebases?
>>
>>55562555
you should run srand(time(NULL)) only once, because right now you reseed the random generator every single time
>>
>>55562583
I thought seeding it every time I need a random number will result in more randomness...
>>
>>55562431
I don't really understand all the Jargon.


Django is a 'framework' for python.

What does that mean and what does it allow me to do?

I know WP is based on php, so I wouldn't be able to work my current site setup with Django.

Can I install Django and a compatible CMS on the same server as my "Nginx,php,mysql,WP" site, then have wordpress embed that page?

Or am I missing the point here?
>>
>>55562575
No where.
>>
>>55562617
if you reseed it fast enough, you get the same seed
it's based on current time in seconds
>>
>>55562633
>Django is a 'framework' for python.
It's a web framework written in Python.
>What does that mean and what does it allow me to do?
When it comes to dynamic content for websites and using databases, a web framework helps for speeding things up, providing useful tools and security benefits.

WP and Django won't mix. If you've heard of things like Symfony and Laravel, Django is similar to those, it's not a CMS. The typical setup for Django is nginx, postgresql, uwsgi/gunicorn.
>>
>>55562676
I thought it was milliseconds. Thats why I have the Sleep calls...
>>
I know SQL database code is language agnostic, but what would the typical workflow look like for something simple like adding or deleting rows in an SQL table?
Do i seriously have to compose SQL commands in a buffer and send them to some SQL bindings for my language?
>>
spotsOpen = 9

board = [["#", "#", "#"],
["#", "#", "#"],
["#", "#", "#"]]

spotsUsed = 0

while spotsUsed < spotsOpen:
col = int(input("Enter your desired column number: "))
col = col - 1
row = int(input("Enter your desired row number: "))
row = row - 1
board[row][col] = "X"
print (board)
print ("Next player")
sportsUsed = spotsUsed +1
col = int(input("Enter your desired column number: "))
col = col - 1
row = int(input("Enter your desired row number: "))
row = row - 1
board[row][col] = "O"
print (board)
print ("Next player")
sportsUsed = spotsUsed +1

input()


how do I get this to print the "board" array in a 3x3 square?
>>
>>55563009
for line in board:
print("".join(line))
>>
>>55562175
sum(list(map(lambda x: int(x[0] == x[1]), zip(correct, [input('Enter an answer: ') for i in range(COLS)]))))
>>
>>55563058
word, thanks
>>
>>55562929
you can use an ORM library
>>
>>55563216
I'm asking what is typically done, not how to do it in python.
>>
>>55559257
>file deleted
Thank God stood weabshit got deleted
>>
>>55563383
It is typically done with an ORM library. It is not a Python-specific term.
>>
>>55563389
the picture was of 2 women smiling and tonguekissing in a disgusting way
>>
File: 1467398868589.jpg (475 KB, 852x973) Image search: [Google]
1467398868589.jpg
475 KB, 852x973
>>55563423
2 3d women
mods = gods
>>
>>55563423
>>55563451
mods CONFIRMED to detest 3dpd
>>
>>55560380
Whats missing from SDL?
>>
>tfw you put everything into programming at the expense of health/girlfriend but you're still mediocre
>>
>>55563598
>gf
idktf
>>
File: 1465334752453.jpg (62 KB, 428x410) Image search: [Google]
1465334752453.jpg
62 KB, 428x410
>>55563687
I don't either. I imagine it's like a fleshlight that you don't have to warm up to enjoy
>>
File: pypy.gif (443 KB, 400x480) Image search: [Google]
pypy.gif
443 KB, 400x480
>>55563745
>wanting a gf just for the sex
normies out
>>
>>55563763
>cout << normies << endl;

kwek
>>
>>55563771
normies > /dev/null
>>
What are best practices when using Python?
>>
>>55563957
>What are best practices when killing yourself?
>>
File: python.jpg (435 KB, 2000x1334) Image search: [Google]
python.jpg
435 KB, 2000x1334
>>55563957
>>55564026

it's simple
don't do it
>>
if (board[0][0] == board[1][1] == board[2][2]) or (board[0][2] == board[1][1] == board[2][0]): 
if board[1][1] == 'X':
print ("Game over - Player 1 wins")
reset()
elif board[1][1] == 'O':
print ("Game over - Player 2 wins")
reset()

def reset():
board = [["#", "#", "#"],
["#", "#", "#"],
["#", "#", "#"]]
main()



Why wont something like this reset the global variable "board" when the winner condition is met?

It just announces the winner and asks for the input again but the board is the old game board
>>
>>55564146
because scopes
>>
>>55564167
but board is a global variable, when reset() is called it should be able to redefine it again

This is only a portion of the program
>>
File: 1467947705812.jpg (71 KB, 1008x720) Image search: [Google]
1467947705812.jpg
71 KB, 1008x720
How do you fwrite an amount of zeros to initialize space in a file?
>>
>>55564185
Don't use global variables.
>>
>>55564223
well what's that code sharing website? The whole thing is too big for here
>>
>>55564235
See >>55564223
>>
>>55564241
well how am I supposed to amend the tic tac toe board when users give input?
>>
>>55564261
Make a Board class
>>
>>55564271
have to use an array
>>
How can I debug a C++/SDL2 program with GDB? When I run the program in GDB, it takes over my entire terminal, and none of the gdb commands do anything
>>
>>55564292
And? You can have a list inside the class.
>>
I'm trying to program a function that, given a vector with elements numbered 1-15, picks one at random and places it in a 2-D array.

The problem is, every time I run the code, I get the exact same numbers from the random number generator (see pic related. Left column is random number, right is contents of vector)

Here's my code:

int randNum = rand() % numberVector.size();

std::cout << randNum << " || \t"; // Prints index
printVec(numberVector); //Prints contents of the vector

playableSet[i][j] = numberVector.at(randNum);
numberVector.erase(numberVector.begin() + randNum);
>>
>>55564434
Seed the rand()-fnction with srand(time(NULL)). But not in every loop cycle, this would just recreate the underlying number-table of rand() for ever and ever (in this very second of your system-clock)
>>
I think there's something wrong with my surface normal.

So as far as I know, positive X direction goes out of the screen while the negative X direction goes into the screen, so I have setup my light source to hover above the 2D plane that fills the entire screen:
light lights[] =
{
{
.pos = {0.5, 0.7, 0.5},
.col = {1.0, 1.0, 1.0},
},
{
.pos = {0.0, 0.0, 0.5},
.col = {0.7, 0.3, 0.5},
},
{
.pos = {0.05, -0.55, 0.5},
.col = {0.3, 0.6, 0.2},
},
};

And I upload that to the GPU.

Now in my GLSL shader where I do a very simple light calculation (dot product of surface normal and normalized direction of light):
for (int j = 0; j < n_lights; j++)
{
Light light = lights[j];
vec3 pos = vec3(fs_pos, 0.0);
vec3 dir = normalize(pos - light.pos);

float i = clamp(dot(vec3(0.0, 0.0, -1.0), dir), 0.0, 1.0);
color_out += vec4(light.col * i, 1.0);
}

This works, however there is a slight problem with the normal, it's facing downwards, but it works. the fuck?
My light source is ABOVE the plain, and I'm pretty sure I'm calculating the direction correctly, and I'm pretty sure that the position Z direction goes UPWARDS (towards you), yet my fucking surface normal has to be facing DOWNWARDS (away from you) in order for my lights to light up the scene.
What the fuck am I doing wrong?
>>
Want to build an image viewer in linux since nothing is meeting my fapping needs. Haven't programmed gui since winforms, never in linux.

What is the g approved framework? I am trying to avoid relearning c/c++ so I can continue denying that I am able, but it might be time.
>>
>>55564694
>position Z direction
positive Z direction*
>>
File: randNums.png (105 KB, 700x500) Image search: [Google]
randNums.png
105 KB, 700x500
>>55564536
Thank you! Basically, I just put the
 srand(time(NULL)); 

at the beginning of my program right after the main() declaration...

So what does seeding the random function actually do?

Again, thank you, it's working perfectly now!
>>
>making android app
>rebuild project
>android studio now cant resolve any symbols relating to the facebook sdk
>tried everything and it wont work
ah yes, android studio very good gradle build VERY good yes
>>
Where can I get good exercises online where I can actually THINK of a solution, instead of the website spoon feeding it to me?I just want to practice my programming skills, but I feel like this is like math, looking at steps won't help unless you start practing.
>>
god damn it, i have a fetish of a sort.
i mostly get a stiff whenever i find an efficient way to to solve a problem.
and now i'm into programming, and working on an android app.
the app works by exchanging data with an api that returns it in the form of JSONobject.
the reason i can't rid my self from this fucking hardon is that the ways i found seem pretty shit from a performance stand point and pretty illogical.
Am i to use AsyncTask for every single little connection needed? The app is heavy on that side, so won't it flood the device with a multitude of threads when there isn't a decent connection on?
I figure i would use caching, and it would solve my problem a bit.
>>
>>55564706
GTK is easy to work with and it has bindings to shitloads of languages. Writing an imageviewer in C right now. I'd suggest taking a look at using glade, and also avoiding gtk3.
>>
how to I get a program to terminate in python? quit(), exit(), etc only seem to stop the module it's in or something. I want to kill the entire program when a condition is met
>>
>>55565003
system("pkill -9 your_program");
>>
>>55564930
The first few exercises might be a bit on the easy side, but it gets harder as you go on and it really helped me program better

http://codingbat.com/python
>>
>>55562419
I think you should only seed the random number generator once. So I usually put the srand line in the main part of my program. Beginner myself so take my advice with a grain of salt.
>>
>>55562002
that's O(n) too though, since it's just O(26*size of s) :)
>>
>>55565016
Thanks, m8. I will hop on it right now. I wish there was some for javascript/jquery. I believe I will forget these if I don't practice them lol.
>>
>>55564969
Use RxJava/RxAndroid for threading. Also if you're doing JSON deserialization, use Retrofit with GSON. If you get a stiffy from good programming then you'll go crazy over these libraries.
>>
what kind of array is this in PHP?

`array (
'test' => 'test',
);`
>>
What are some fun medium-large scope programming projects to do solo?
>>
>>55565171
Doujin translation request website
Thread replies: 255
Thread images: 32

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.