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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 331
Thread images: 39

What are you working on, /g/?

Old thread: >>60334610
>>
File: 1452138437848.png (597KB, 1280x720px) Image search: [Google]
1452138437848.png
597KB, 1280x720px
>>60341904
First for
>Please use Rust
>>
That picture makes no sense.
>sepples shitter giving SICP to somebody
>>
File: 1460207177541.png (368KB, 636x694px) Image search: [Google]
1460207177541.png
368KB, 636x694px
Is anime a construction?
>>
File: 1481681028621.png (228KB, 367x600px) Image search: [Google]
1481681028621.png
228KB, 367x600px
Listening to Walter Bright. I wish this man was my professor

https://youtu.be/iDFhvCkCLb4?t=2m30s
>>
Nth for use dynamic for your ints.
>>
File: shot0033.jpg (310KB, 1920x1080px) Image search: [Google]
shot0033.jpg
310KB, 1920x1080px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>60341904
Thank you for using an anime image.
>>
>>60341919
It's funny that nobody actually programs in rust.
There are just "rust programmers" who tell others to rewrite all their shit in rust.
>>
>>60341939
>shot0033.
>33
You are an impostor
>>
>>60341942
Nobody ITT does any programming, and that includes you
>>
how do i become a hacker srs question
>>
>>60341942
https://servo.org/
https://github.com/uutils/coreutils
http://www.piston.rs/
https://www.redox-os.org/
>>
>>60341955
Most people in this ITT thread do programming, and that includes you.
>>
>>60341970
If you need to ask you will never become hacker
>>
>>60341928
> Memory Safety and D
> Let's add poor man's borrow checker to a language with GC and Null
Wew, they're desperate to stay relevant.
>>60341942
I actually program in Rust occasionally.
>>
All programmers visit /dpt/
>>
>>60341981
meme answer
>>
>>60341983
You didn't even finish the whole video, is it the lack of attention span?
>>
>>60341990
>meme
>>>/v/
>>
File: ref.png (19KB, 826x407px) Image search: [Google]
ref.png
19KB, 826x407px
>>60341993
I skimmed other the slides, and I've been aware of the development for some time.
>>
File: 1477912256761.jpg (57KB, 1024x569px) Image search: [Google]
1477912256761.jpg
57KB, 1024x569px
>>60341978
T-thanks anon.
>>
>>60341990

No he is actually right.

If you can't type "essentail skills for hacking" in a search engine, you are way too stupid to begin hacking.

BTW it takes years of dedication. You don't have this dedication, so just stop it.
>>
>>60341979
>1. Game "programming" (as you put it) is one of the most difficult fields in programming with applications of things like higher math and artificial interlligence.
Fucking this. Regular programming is a stroll in the park for me, ezpz. The only hard part is going through the slog of error handling boilerplate.
But game programming man. You need to do so many awkward things. Just starting with basic shit like having to find arbitrary other objects requiring ridiculous setups to be performant with any number of objects in the game. Figuring out how often to run logic because if you do it too often it slows the game down but too rarely and the game experience is diminished. Goddamn.
>>
>>60342023
>>>/vg/agdg/
Learn your place in the world you overgrown toddler.
>>
>>60342016
ill hack ur mom first when i learn
>>
@60342023
>Fucking this.
>ezpz
>>>/v/
>>
So, what is the equivalent of "The C Programming Language" for Python?
>>
File: 1490796673751.jpg (54KB, 500x500px) Image search: [Google]
1490796673751.jpg
54KB, 500x500px
>>60342023
>Figuring out how often to run logic because if you do it too often it slows the game down but too rarely and the game experience is diminished. Goddamn.
Is this really what /v/edditors consider "difficult"?
>>
>>60342023
i just want to make video games to play
i went to computer science because i wanted to program video games like crysis and blackops
>>
>>60342070
> Just starting with basic shit
No?
>>
>>60342068
"The Python Programming Language"
>>
>programming language lines dont end with ;
into the trash it goes
>>
>>60342077
There is no book on Amazon with this name.

Pls no bully I really want a good book
>>
>>60342088
Fuck ;
Why the fuck would you need that shit
>>
>>60342073
You could look into engines like torque3d or qfusion.
They pretty much implement fps shooter which can mod on.
>>
>>60342102
;
>>
>>60342098
https://www.amazon.com/Beginning-Python-Professional-Experts-Professionals/dp/1590599829
>>
>>60342088
Source? I want to read the full story.
>>
>>60342116
my ass
>>
>>60342073

Hahaha.
No.

Maybe there are some japanese kids with a lot of spare time and passion out there that can do an amusing little game with mediocre graphics in one year.

Doesn't mean you can do this.
>>
>>60342111
can I program something quickly without knowing the scary math? i just want to make some games for myself and my friends and maybe then make a bigger game (something like call of duty)
>>
>>60342098
Read this instead.
https://stallman.org/amazon.html
>>
>>60342122
Why the hell do you space your posts like that, redditor?
>>
File: 12713949.jpg (28KB, 456x620px) Image search: [Google]
12713949.jpg
28KB, 456x620px
>>60342073
> i wanted to program video games like crysis and blackops

LOL

In anyways start learning C++
>>
>>60342143
>reddit spacing xd
Shut the fuck up.
>>
>>60342129
>stallman
Why would I be reading anything he has to say?
>>
>>60342143
People have been spacing their posts like that since creation of 4chan.
>>
File: rms.jpg (258KB, 800x1200px) Image search: [Google]
rms.jpg
258KB, 800x1200px
>>60342154
Because he's right.
>>
>>60342144
>meme
>LOL
Please refrain from posting here.
>>>/v

>>60342153
>xd
>>>/v/
>>
>>60342143

To annoy underage newfags without any programming experience like you.

btw


lurk
more.
>>
>>60342166
Do you think anyone actually cares that you get an autistic meltdown at others' posts?
>>
>>60342166
>>>/reddit/
meme reply btw
>>
>>60342161
Someone with his political opinions can't be right unless he is quoting someone less retarded. I will consider reading that page if it doesn't contain a single word originally written by him.
>>
>>60342161
Stallman was right again
>>
@60342168
>btw
I didn't even bother reading the rest of your post.

>>60342176
>meme
see >>60342166
>>
60342198
no you this time memer
>>
>>60341904
can i use artificial intelligence and deep / machine learning to make games?
i just want to make games to play. like call of duty.
>>
>>60342206
No.
>>
>>60342204
hey. do you know if i can make games using machine learning?
>>60342213
why?
>>
>>60342198

that's what i call quality trolling

is the /b/ elite raiding /g/..?
>>
actually i've written 7 games (on my 8th), am a contributing dev to an open source game project
>>
>>60342218
yes dude u can did call of duty in 1 day myself
>>
>>60342218
In its current state, deep learning allows you to create a thing that takes a bunch of numbers and outputs another bunch of numbers. Naturally that can't be used to create a videogame, you'd have to write additional code, and that additional code would be enough to make a videogame even without deep learning.
>>
File: 12506712512.jpg (41KB, 960x960px) Image search: [Google]
12506712512.jpg
41KB, 960x960px
> Machine learning

> meme

> xD


> Classes and Objects. OOP

> Game dev

> Test driven development

> Web scale

> Employability
>>
>>60342235
did you use machine learning and deep learning? how can i make a game using those?
>>60342243
but why not? isn't machine learning like artificial intelligence
>>
I'm studying java and developing a calculator with swing. Still solving what I will gonna do for base conversions.
>>
>>60342258
who asked u
>>
>>60341904
learning machine learning at the moment to try and make a triple A game for me and friends.
>>
>>60342249
I outlined the "why not" in my post. Please read it.
>>
Is python okay for learning neural network and deep learning AI?
>>
>>60342270
but can't machine learning be used to make the amount of codes lesser? i just want to make a game.
>>60342278
yes. i'm learning it to make a call of duty style game in the future.
>>
using assembly mips to use AI and machine learning to make call of duty 10 in 2 days tops
tips?
>>
>>60342261
The main thread...
>>
>>60342261
op
>>
Is there a lisp that doesn't have a garbage collector and allocates memory on the stack instead?
>>
>>60342278
Yes. Your other option is Lua with its Torch. Python's Theano and Tensorflow are just as good, though.

>>60342285
>but can't machine learning be used to make the amount of codes lesser
For some very specific tasks in your game, maybe. But most certainly not the thing you'd work on first.
>>
>>60342291
>>60342292
why are u answering a faggot
>>
>>60341896
>that collar

Who is this sex slave?
>>
>>60342307
>Tensorflow
yes! i've heard of this. didn't they make an AI with it?
>But most certainly not the thing you'd work on first.
why not? can i just make an AI which will help me write code for my game?
>>
>>60342258
What's difficult about base conversions?
>>
>>60342321
They didn't make an AI with tensorflow.

>can i just make an AI which will help me write code for my game?
Definitely not.

https://www.tensorflow.org/get_started/
>>
>>60342348

>can i just make an AI which will help me write code for my game?
>Definitely not.


Well, why not?

But it would be about 100 times harder than just writing the game yourself..


I think about a GUI with sprites. Every state in the game gets represented by a matrix. First line is your personal life points, x-value, y- value and some kind of weapon. Next line is the same for the first enemy and so on.

Say your input are four buttons for "move up/down/left/right". The result is another state, represented as matrix, but visible for you as sprites.

Now you need to generate input data. For every button press, you give the desired result. For example I press the up button and expect my sprite to move upwards and the enemies to move closer towards me.


Something like that would be pretty difficult, but doable (for smaller games).
>>
>>60342497
Like I said, you'd write more code to support the NN than you'd need to write the same game without NN.
>>
>>60342245
kek
>>
>>60342497
>>60342321
jesus christ the AI meme is fucking cancerous
>>
>>60342321
AI is a tool people you use when you know what the result of something should be but you don't know how to get there.
For example, making an AI for your game so people can play against it makes a lot of sense because you want the computer to make decisions based on a given state of the game, but you don't want to program what it should do for all given states of the game.

Think of it as a calculator that never is able to learn math.
You show it a ton of calculations and what the result should be and at some point the calculator will be able to calculate the problem.
But often you need to implement the rules the AI should follow anyway so it can make the best decisions.
>>
>>60342348
>Definitely not.
but why not?
>>60342563
but what if i implement some rules which will help it invent new rules? then i will have a game writing AI which i can use to help me write my game. can i do this with machine learning and tensorflow?
>>
https://github.com/espruino/Espruino/tree/master/src

Look at this clusterfuck
>>
>>60342594
>but what if i implement some rules which will help it invent new rules?
why dont you just program an AI that does every task in the world so we don't need programmers anymore?
>>
>>60342563
I wonder if it's possible to make a completely fair AI for a game like Street Fighter. Input is every pixel on the screen and output are controller input for the game. Just like an actual player.
>>
>>60342594
>but why not?
No one was able to do that yet including leading researchers.
>>
>>60342609
idk. i just want to write and make some games.
>>60342615
i don't care about "street fighter". i want to make something like call of duty.
>>60342620
are you sure? i mean it sounds possible if you use machine learning.
>>
>>60342601
Looks neat
>>
>>60342615
it is and it's already been done
>>
>>60342615
Definitely yes. This has been done for Doom, and the AI that only sees the pixels ended up playing better than custom bots.

>>60342628
I am sure.
>>
>>60342601
>JS interpreter written in C
It's like the two worst things in the industry blended together.
>>
>>60342628
you mean you want the computer to make some games?
>>
where can i learn about machine learning if i want to make triple A games in the future?
>>
>>60342639
Really? Got a source? I'd love to read about it.
>>
>>60342638
>>60342647
The C code has two-space indents and C89-style for-loops.

It also doesn't have working serial communication.
>>
>>60342650
I was thinking of the Doom thing that this guy mentioned
>>60342644
can't remember where I saw it
>>
>>60342658
Oh I'm sorry the code style tickled your autism anon. Brb while I call the autist police and jail the developer.
>>
whats the best way to develop mobile games for android ans ios? is there a good framework so i can program it once, and deploy it to both platforms? or is it better to just program each one in different frameworks? i just want a small 2d type game
>>
>>60342650
Here. Found it for you.

https://www.youtube.com/watch?v=oo0TraGu6QY
https://arxiv.org/abs/1609.05521
>>
>>60342649
>>60342675
>>60342678
>games
>>>/v/
>>
>>60342675
Cool I'm gonna look into it.
>>
>>60342688
me too! damn. wanna discuss this on /v/ later? I'll make a thread.
>>
>>60342685
>implying video games are any more pathetic than consumer electronic enthusiasts that make up 90% of /g/
>>
>>60342707
Sure.
>>
>>60342708
/g/ is a subreddit just like /v/. /dpt/ isn't /g/.
You and your gamer kind can fuck off to either:
>>>/v/
>>>/g/
>>
>>60342719
programming video games belongs on the /dpt/ subreddit
>>
>>60342677
t. koder who uses inconsistent, 1000 column wide code to implement his solved problems
>>
>>60342731
Video games, mobile "apps" and web "development" belong mainly on these two boards:
>>>/v/
>>>/b/
>>
File: 1458383683649.png (450KB, 812x720px) Image search: [Google]
1458383683649.png
450KB, 812x720px
>>60342737
>solved problems
I don't usually touch uninteresting stuff.
>>
>>60342737
Deal with it nerd.
>>
>>60342098
That book is online free tho 2nd edition literally just search the books name. tinyurl for lazy
tiny
/lvspyxl
>>
>>60342628
Why don't you do it then?
Either you know more than every other programmer or you have no fucking clue about what machine learning is.
Prove me wrong.
>>
>>60342912
>Either you know more than every other programmer or you have no fucking clue about what machine learning is.
Is this decidable?
>Prove me wrong.
Is this your idea of how logic works?
>>
>>60342406
Thanks pham.
>>
File: 1477876987894.jpg (117KB, 392x469px) Image search: [Google]
1477876987894.jpg
117KB, 392x469px
So *nix shells are feeding my arguments as actual file paths instead of just strings. My option is to
1. Either actually take the files as arguments
2. Find a way to take the arguments as strings

//basename
//Takes file names as arguments
//Prints NAME with any leading directory components removed.
//TO-DO If specified, also remove a trailing SUFFIX.
//TO-DO Mandatory arguments to long options are mandatory for short options too.

import std.stdio;

void main(string[] args)
{
foreach (arg; args[1 .. $])
{
auto last_backslash_index = ulong.max;
foreach (index, character; arg)
{
if (character == '\\')
{
last_backslash_index = index;
}
}
if (last_backslash_index != ulong.max)
{
arg[last_backslash_index .. $].writeln();
}
else
{
arg.writeln();
}
}
}
>>
File: 1489239786672.jpg (106KB, 392x495px) Image search: [Google]
1489239786672.jpg
106KB, 392x495px
>>60343078
>are feeding my arguments
Keep arguments fit, don't let shells overfeed your args.

>Either actually take the files as arguments
Why you can't do that?
>>
File: 1478114711981.jpg (272KB, 462x832px) Image search: [Google]
1478114711981.jpg
272KB, 462x832px
>>60343126
>Why you can't do that?
How can I do that?

For example, if I call
$basename ~/devel/test.d

It has to reach the file and get the file path. I just wanted to take the args as a string[] instead, makes life easier
>>
>>60343192
>>>/global/rules/6
>>
File: 1454533643706.png (34KB, 744x247px) Image search: [Google]
1454533643706.png
34KB, 744x247px
>>60343192
>IMG_3675
>>
>>60343078
Doesn't D(ead) have functions to operate on file paths in any of its 5 standard libraries?
>>
>>60343196
D wikibook has args type as char[][] though.

How are file paths not strings or chars?
>>
>>60343207
>>60343230
>(1.) Images depicting the technology of past, present, and future are all welcome here.
You violated the rules first, now fuck off.
>>
>>60343281
>Images depicting the technology of past, present, and future are all welcome here.
Did I claim otherwise?
>>
Can someone explain what DevOps people ACTUALLY do? So far i understand they are a bridge between devs and IT guys, but if IT guys set up servers correctly and devs starts programming, what the fuck do devops people even do?

Also, can someone describe how CI/CD looks in practice
>>
>>60343280
>args type as char[][] though.
I thought it was string[]
Anyway string[] is the same as (char)[][]
>>
is there any /dpt/ project where to give my precious expertise?
>>
>>60342719
>dpt isnt g
w-wew
>>
Will programming turn me into an autist?
>>
>>60343378
no its a prerequisite
>>
>>60343378
It's the other way around.
>>
File: 1481681028611.png (431KB, 913x557px) Image search: [Google]
1481681028611.png
431KB, 913x557px
>>60343378
Yes
https://www.youtube.com/watch?v=crHnumzsLUs
>>
File: normiesunwanted.jpg (464KB, 1131x1600px) Image search: [Google]
normiesunwanted.jpg
464KB, 1131x1600px
Where were you when the great functional programming revolution happened?
>>
>>60343300
pls explain, there's got to be someone here who's corporate slave
>>
File: 1490845728308.jpg (147KB, 750x720px) Image search: [Google]
1490845728308.jpg
147KB, 750x720px
>>60343192
>/po/
>>
>>60343443
It's a strange kind of revolution, if no one heard of it.
>>
>>60343443
Getting paychecks
>>
>>60343500
Just like the industrial or agricultural revolutions, it takes time to realize it happened.
>>
Why would you make your program 64-bit as opposed to 32-bit?
>>
>>60343752
Why the fuck wouldn't you?
>>
>>60343759
string sizes are ulong in 64-bit :^(
>>
>>60343752
I don't think it's even possible to produce 32-bit binaries nowadays without setting up a cross-compilation environment. You don't need it anyways.
>>
>>60343770
your CPU converts everything to int why do you care
>>
>>60343752
speed
>>
Preface: I have no idea what I'm doing
Trying to customise this lua script for mpv

https://github.com/occivink/mpv-scripts#encodelua

https://raw.githubusercontent.com/occivink/mpv-scripts/master/encode.lua

to work with my own webm making script

I've already gotten it to work with files but I'm trying to get it to work with streams

I tried using
mp.get_property("stream-path")


but it's not working, and even the mpv docs say it should be useless.

This is what I'm working with right now.

https://pastebin.com/PG6a48Si

The case I need to fix is the one at line 84.

It gives me errors about table expected, got nil
Not really sure what the table was for in the first place, but I've left it there just in case.
All I really care is that line 54 is run and that it gets path, from, to + filename in that order

What I'm really looking to figure out is how I can get mpv to return the http url it's working with. I can try figuring it out from there.
>>
>>60343443
>communist garbage
>>>/r/abbit
>>
>>60343752
If you have to "make" your program a certain bitness, it probably sucks. Write portable code.

If you must do something that isn't portable like assembly optimisations, x86_64 asm is faster and easier than x86, so the choice is obvious.
>>
File: 313123123wsx.png (14KB, 1005x348px) Image search: [Google]
313123123wsx.png
14KB, 1005x348px
why is Java this color on git hub?
>>
>>60342321
You need to learn statistics and probability first to get into AI
>>
>>60344024
curry poo :DD
>>
>>60343897
stream-path isn't what you think it is. It's not a path specific to streams, it's the path used by the stream layer of mpv, which is an internal thing you probably don't need to worry about. Like the docs say, it's only different from 'path' in certain special cases.

If you're dealing with web streams, you can still use 'path'. If you're streaming, 'path' will be a URL.
>>
Programming Languages Red Flags

I'll start:
>it isn't a Lisp
>>
>>60344153
>Red Flags
see >>60343987
>>
>>60342678
bump
>>
>>60344161
I'm treating red flags as something bad
=> I'm not a commie
>>
>>60344161
>red flags are exclusive to communists
>>
>>60344180
>I'm treating red flags as something bad
Are you now? Can you prove that you aren't one of them?
>=> I'm not a commie
This statement contradicts "I'm treating red flags as something bad". Unless you meant to write "=> I'm a commie"
>>
I need to parse a huge file using python. Because the file is so big, I want to do it by chunks. How can I extract paragraphs from the file? if possible from the end to the start?

I am not experienced with python, I tried a for loop: for line in reversed(list(file)) and looking for line = "\n"

But not exactly working for me, because I also need to search for the last paragraph starting with a string. Looking in reversed lines the first paragraph starting with that string.

Any sugestion?
>>
>>60343300
>Can someone explain what DevOps people ACTUALLY do?

No, because there's no standards and every company that does it does it in a completely different way (and most of them miss the point). In some companies DevOps is just a meme name that the combined dev and ops org calls itself without any change in behavior. In some companies they hire for 'DevOps' roles that just include programming, deploying, and operating services; this is most common in companies running purely on public clouds.

>Also, can someone describe how CI/CD looks in practice

You check in some code, tests run, and if the tests pass, the code is deployed to prod automatically.
>>
>>60344228
>Any sugestion?
Yes. Stop spacing your posts in such a retarded manner.
>>
>>60344107
how can I get the script to display properties or other things, either on screen or in the terminal? for debugging purposes/understanding how the script works and what it's trying to do
>>
>>60344220
Do you even know what commies are?
>>
tfw pretty decent programmer but too much of a sperg to get a job
>>
>>60344252
You can log stuff with
mp.msg.info("hello world")
>>
>>60344153
>has call/cc
>has GC
>has Type : Type
>>
>>60344228
change the way you space your posts
>>
>>60344273
I don't see your feel.
>>
>>60344270
Why are you trying to evade such a simple question?
>>
>>60344153
has pointers
>>
File: stoned-guy.jpg (24KB, 555x555px) Image search: [Google]
stoned-guy.jpg
24KB, 555x555px
>>60341978
>in this ITT thread
>>
>>60344448
ITT means "in this trash" now.
>>
>>60344284
>>has Type : Type
couldnt this just be considered analogous to c++ template typenames.
>>
>>60341970
It's never impossible, but with the state of modern security, it's something you can't do by learning. You have to be born an autistic savant who can enumerate large primes in linear time complexity. I WOULD say that if you don't know what linear time complexity is, you shouldn't even bother, except that frankly most people who DO know what it is shouldn't even bother anyway, because you really do have to just be brilliant beyond brilliant to be a hacker, and even knowing everything you could possibly know about how to program is NOT enough.

Can you count in nothing but prime numbers, as quickly as you can count normally, without memorizing them or doing any mental math, and in such a way as to manage to count past 2^74,207,281 − 1? If not, you'll never be a hacker--and I say "never" because that's a skill you have to be born with, not one you can learn.
>>
File: 1488976252141.gif (1MB, 268x375px) Image search: [Google]
1488976252141.gif
1MB, 268x375px
>>60344500
checked
>>
>>60344229
>You check in some code, tests run, and if the tests pass, the code is deployed to prod automatically.

Ok, i understand this, but can you give some practical example like, Pajeet codes in Visual studio, sends X to Y, Y does some tests and snds Y to Z that uses ZDeploy to make .exe file
>>
File: 1492794120819.jpg (72KB, 640x765px) Image search: [Google]
1492794120819.jpg
72KB, 640x765px
>>60344699
your logic is undeniable
>>
>>60344699
>>60344841
that's how you do it
>>
File: 1479592760342.gif (550KB, 728x720px) Image search: [Google]
1479592760342.gif
550KB, 728x720px
>>60344539
I'm not familiar with C++.
>>
>>60344153
>doesn't have classes
>doesn't have inheritance
>doesn't have mixins
>doesn't have interfaces
>doesn't have generics
>doesn't have namespaces and/or packages
>doesn't support singletons
>has first class functions
>uses recursion
>is declarative
>has contracts instead of real type checking
>has prototypes instead of real polymorphism
>doesn't have prototypes but also doesn't have real polymorphism (even worse)
>uses the word "duck" anywhere in its wikipedia article
>almost as much parentheses as there is real code in them
>assigns meaning to whitespace
>is slower than C by a function of problem size that's not in O(log n) (by the way, in case anyone is confused, O is an upper-bound descriptor, so even asymptotically smaller functions than n are still in O(n) for example, log(n) for example is in O(n), it's just also in O(log n))
>it's a client side web language
>it only exists to be used with a specific development framework
>you can't develop anything you want in it and do anything you want with what you've developed without paying someone royalties
>>
>>60344921
>>>/r/india
>>
>>60344921
>is slower than C
what does this even mean?
>>
@60344921
>generics
What is a """Generic"""?
>>
>>60344953
why do you want me to ask strangers for indian porn

by the way your meme logic is off if you're saying i'm from india. the typical meme is that all the indians work for microsoft, but actually i use elementary os and very nearly specifically decried c sharp for being made by microsoft
>>
>>60345008
>meme
>>>/v/
>>
>>60344967
given any design problem, the optimal known solution in so and so language takes longer to run than the optimal known solution in C, discounting development time
>>
>>60345031
Fuck you, video games are an art form and will change the world. (Not the ones about shooting people, though. Those are just media bullshit.)
>>
>>60345056
you sound gay even for /v/
>>
>>60345038
so every language other than C and Assembly variants?
>>
>>60345056
Where does my post mention video games?
>>
>>60345038
but c is a language, not an implementation.
>>
>>60345002
in a good language, a generic is a type whose public interface is informed by another type

in a shit language, a generic is a user-defined macro, sometimes with syntactic sugar, that takes a type and spits out a type
>>
File: fasfasfa.png (40KB, 736x583px) Image search: [Google]
fasfasfa.png
40KB, 736x583px
Sorry for posting here, but there is no /webdev/ or /sqt/ now and this is solely coding related

So I have to wring the shortest code possible and I'm 1(one) character too long now
I have no further ideas

stickOrChopsticks=(t,n)=>t[5]?n*2:n%2?-1:n/2
>>
>>60345075
that's because i'm a developer, not a gamer
>>60345081
no, because i said "by a function of problem size that's not in O(log n)"
>>60345088
yeah but let's be realistic here, the popular implementations are all mostly asymptotically equivalent and comprise an overall ideal efficiency for the language specifications, otherwise they wouldn't be popular
>>60345082
where you say >>>/v/
>>
File: IMG_0263.jpg (51KB, 722x400px) Image search: [Google]
IMG_0263.jpg
51KB, 722x400px
>>60341904
Any clue on why this isn't working? Not the actual layout, but the %x formatter didn't print i in hexadecimal like I expected. I can't tell if I did something incorrectly or if it's the fact that I'm using a phone.

#include <stdio.h>

int main(){
int i;
for(i=0;i<10;i++)
printf("Decimal:\t%d\nHex:\t%x",i,i);

return 0;
}
>>
>>60345161
Here's an idea, change stickOrChopsticks to SoS if you have to have readable name, call it test
>>
>>60345208
nice bait, almost made me answer
>>
>>60345179
>no, because i said "by a function of problem size that's not in O(log n)"
but that's just straight up dumb. You can pretty much implement the same solution in different languages and the complexity will not change.
>>
>>60345225
It's not bait man, I'm a complete noob, what's the joke?
>>
>>60345224
ah forgot to mention, the function name must be this name, otherwise it won't pass, it's a codewars excercise

of course that would be the first thing to change come on I'm not retarded
>>
>>60345225
Oh wait lol. Disregard this I suck cocks. 1-9 in hexadecimal is still 1-9. Kek. Good thing I'm anonymous, this is embarrassing.
>>
File: 1491413390140.gif (2MB, 480x270px) Image search: [Google]
1491413390140.gif
2MB, 480x270px
@60345121
>in a good language
>public interface
>>
>>60345253
If you're only counting from 0 to 9, you're bound to see the same results, because the numbers from 0 to 9 are represented the same in decimal and hexadecimal. It's only immediately after that that they start looking different.
>>
>>60345283
>his "good languages" don't even separate interface from implementation
>>
File: 1494285455156.gif (124KB, 590x333px) Image search: [Google]
1494285455156.gif
124KB, 590x333px
>>60345779
>good languages
>interface
>>
>>60345779
Are you talking about C++?
>>
File: 1457838416578.jpg (171KB, 1280x1024px) Image search: [Google]
1457838416578.jpg
171KB, 1280x1024px
Is Haskell the fastest language?
>>
>>60346415

no it's C++
>>
>>60345161
Not sure what language that is but is:
stickOrChopsticks=(t,n)=>t[5]?n*2:-n%2?:n/2

A valid syntax?
>>
>>60346474
C# maybe
>>
>>60346474
that's js
and sorry, this doesn't work, not valid
>>
>column major
>>
>>60346455
But Haskell is faster than C++.
>>
>>60346628
>He can't choose which he wants
>>
>>60346532
Sadly it didn't work but:
stickOrChopsticks=(t,n)=>t[5]?n*2:-n%2||n/2

should work.
>>
>>60346776
thank you
>>
Is there a list of programming exercises that range from beginner to advanced? The ones that I find online are pretty bad. I want to git gud on programming/algorithms, in other words, being able to visualize algorithms. I am having trouble converting my thoughts into code. My language of choice is C. Yes, I am still a beginner. Thanks in advance.
>>
>>60346810

C is shit for practicing algorithms, use Python or some other little script
>>
>>60346810
Have you read a book on algorithms yet?
>>
>>60346810
http://rgho.st/6YyWw5XCG
>>
>>60346842
>use Python
>>>/v/
>>
whats the best layout in Java? I'm dead serious.
>>
File: 1491619022917.jpg (44KB, 282x341px) Image search: [Google]
1491619022917.jpg
44KB, 282x341px
>>60346842
>The language that gives you the most control over everything in an algorithm is bad, use this one that obscures everything away from you
>>
trying to use a stack for inorder tree printing, right now my pseudocode puts both nodes and keys into the stack, and tests if the thing x it popped was a key, if x is a key it prints it. otherwise it sets current = x for the while loop. how do i do this without it being able to store both keys and nodes in the stack?
>>
>>60346971
>[C] gives you the most control
Hmmmmm
>>
>>60346869
I am currently reading "Algorithm's Unlocked" by one of the authors of CLRS. I wanted to get my feet wet with algorithms before I get into CLRS, and probably improve my math too.
>>
>>60346971
c doesn't give you the most control over everything, assembly does. use assembly op, don't be a pleb
>>
>>60346881
Thanks a lot anon, gonna start practicing now!
>>
File: lolipunchtsulu.webm (143KB, 1067x600px) Image search: [Google]
lolipunchtsulu.webm
143KB, 1067x600px
>>60346415
yes

Haskell GHC:                    0.454930841 seconds time elapsed
C clang: 9.971914301 seconds time elapsed
C++ clang++: 5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed
>>
>>60347125
How dare you?
>>
>>60347125
I've never seen an /a/ poster make a good post
>>
>>60346971
>no, I prefer the term "professional algorithm developer" over "codemonkey"
>my favourite part of algorithm development?
>why, it's memory managment of course!
>>
File: 1457671617658.gif (218KB, 584x720px) Image search: [Google]
1457671617658.gif
218KB, 584x720px
What's the best language for writing a kernel using only the type system?
>>
>>60347179
ATS?
>>
>>60347028
this is the current pseudocode
Inorder-Tree-Walk(T)
stack.push(T.root)
while stack.size > 0
c = stack.pop
if c is a key: print c
else:
stack.push c.right
stack.push c.key
stack.push c.left


assuming the stack doesn't allow null to be pushed. trying to do this without the magic if c is a key, thanks for any help
>>
>>60347179
coq, but you'll have to write your own exporter.
>>
https://esolangs.org/wiki/Libra
>Libra is a language that provides no real features, so the programmer must rely entirely upon libraries to do anything. These standard libraries use extremely esoteric techniques to provide basic functionality.

>Implementations: C
LOL
>>
>>60347176
>why, it's memory managment of course!
like it's that hard to manage memory you pleb
>>
>>60347278
Usually the tree nodes contain keys. What kind of tree is it supposed to be / what is it supposed to do?
>>
>>60347208
What's the best learning resource?
>>
>>60342329
I'm trying to move between OCT and DEC, making the correct operations.
>>
>>60347456
Books.
>>
>>60347456
Official docs.
http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/book1.html
>>
>>60347429
a binary search tree, printed in order
>>
>>60347125
Believe it or not, but Java is faster. Proof:
Java:                          -1.219031652 seconds time elapsed
>>
>>60347531
AbstractBeanTimeMachineFactoryBeanAbstractFactory
>>
>>60347531
Back to the future!
>>
>>60347514
Inorder-Tree-Walk(T)
stack.push(T.root)
while stack.size > 0
c = stack.pop
print(c.key)
else:
stack.push c.right
stack.push c.left


Don't push your keys onto the stack
>>
>>60347653
>>60347514
Ignore the "else"
>>
>>60347278
>>60347028
nvm, just going to use a tuple with a string and the object

>>> stk = stack.Stack(100)
>>> stk.push(('a', "char"))
>>> stk.push((1, "int"))
>>> (xv, type) = stk.pop()
>>> xv
1
>>> type
'int'
>>>


didn't realize that'd work

>>60347653
that doesn't work
>>
>>60341904
What does this unix command do:

ln -s
>>
>>60347685
>that doesn't work
Why?
>>
>>60347718

Symbolic link.
Any time you try to open the link, it'll silently redirect you to the file at the path in the link.
>>
>>60347685
>storing your types as strings
what the fuck are you doing?
>>
>>60347754
Ah thanks anon, studying for a final and I couldn't find the ln command with the -s option.
>>
>>60347718
>>60347754
>>60347780
Not programming.
>>
>>60347780
$ man ln
>>
>>60347722
it prints it out of order
>>
>>60347860
Try this
Inorder-Tree-Walk(T)
Inorder-Tree-Walk(T.left)
print(T.key)
Inorder-Tree-Walk(T.right)
>>
>>60347774
trying to use type() gives me
>>> x
<__main__.Node object at 0x7fbaef693a90>
>>> type(x) is Node
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object is not callable
>>
>>60347961
you obviously don't know how to use a stack for inorder tree printing which is what i'm asking about
>>
>>60347969
isinstance(x, Node)
>>
>>60347969
hmm exited and restarted the repl and it works now so nevermind me
>>
I just posted this in /sqt/, but I suppose here would be better help

I'm creating a winform app with c# in visual studio with buttons that lead to separate forms, but the issue with this is that opening and closing forms has a visible effect and processing time. What I want is to have a button press pretty much update the form instead of open a new form and close the current, but I can't figure out how to simply do this. Any google or youtube guide I watch for a gui keeps all the components in a single form, so there's no help there. Here's the code I'm working with:

private void pageTwoButton_Click(object sender, EventArgs e)
{
menuP2_Form menuPage2 = new menuP2_Form();
menuPage2.Show();
this.Hide();
}
>>
>>60347969
earlier in the command line you did
type = 'str' 

so now type is a string, and therefore not callable
>>
>>60348053
keen catch
>>
>>60347994
Yeah, because it seems stupid to use a stack when you don't need a collection in the first place.

If you absolutely need a stack then you can do this:

Inorder-Tree-Walk(T)
traverse(T)
while stack.size > 0
print(stack.pop)

traverse(T)
traverse(T.left)
stack.push(T.key)
traverse(T.right)
>>
>>60348111
you DEFINITELY know how to use a stack to traverse a tree inorder, but the question's just stupid so you won't deign to solve it, seems legit
>>
>>60348148
This >>60348111 is traversing inorder. The stack is reversed though (because it's not a list).

If you want the stack to have the inorder-keys, you can either reverse the tree traversal (by swapping "left" and "right", or just reverse the stack before printing it
>>
File: 1492970427374.gif (926KB, 500x281px) Image search: [Google]
1492970427374.gif
926KB, 500x281px
>>60339820
Please respond.
>>
>>60347794
Thanks judge.
>>
>>60344024
Underrated post
>>
>>60348305
Sounds like you're multiplying the wrong object with this matrix

Are you applying it to the whole scene graph?
>>
>>60344153
>requires you to compile before you can run
>>
I want to contribute to something open source but I am shy and scared
>>
>>60348553

I want to gain enough experience to do this first
>>
>>60348553
>I am shy
Why? Do you have your real name on github or something?
>>
>>60344921
>>assigns meaning to whitespace
intx=0;
>>
what do I need to do so that when I change pl[0] it also changes p?
class P:

def __init__(self, name):
self.name = name


p = P("name")
p2 = P("name2")
pl = [p, p2]
pl[0] = None
>>
Is it a dumb idea to write imageboard in Java (Spring framework)? It should be faster than php
>>
>>60348796
You cannot, the p1 list contains a copy of p1 and p2, not a reference.
>>
>>60348796

you don't.
>>
>>60348848
how do I make them references?
>>
is there a way to store a pointer to a constructor in cpp, somehow like this:
KeyObj x = some_map[key](arg1, arg2);
>>
>>60348841
>is it dumb
only in the sense that it probably already exists
>>
>>60348916
Probably not, all the mature imageboards are in php and the rest is in Python
>>
>>60348860

you don't
>>
Making an FTP client in C# but it's like it's already been written for me lmao
>>
>>60348969
>all the mature imageboards are in php
>what is wakaba
>>
>>60348969
do you have the source code for such imageboards?
>>
>>60349038
>C#
>lmao
>>>/v/
>>
>>60347794
not programming
>>
>>60349304
>>60349319

not programming
>>
scraping yahoo so i can understand my chinese cartoons
>>
>>60341904
I'm working on my personal "library" tool thingie that i have been working on for about 3 years now

i have started writing in c# but after about 23 restarts i have started to write it in c++

this may not be directly in topic but
how do i stop restarting my projects

it's always things like
>the ui looks not ideal
>i do need that other feature too but now i have to rewrite this part but i can just go and rewrite everything to fit this
and other really autistic thoughts ranging from
>uh i don't like how my code looks
to
>i want to use a different language

[spoiler]
also as a sidenote could someone please post that one image of madoka lying in bed while holding sicp and saying something like "it's too hard"[/spoiler]
>>
>>60349426
>the ui looks not ideal
>i do need that other feature too but now i have to rewrite this part but i can just go and rewrite everything to fit this
>uh i don't like how my code looks
>i want to use a different language
Source? I want to read the full story.
>>
>>60349400
Elaborate?
sounds interesting
>>
>>60349449
sadly i can't provide you with a link into my head
but i'd gladly elaborate if you have questions
>>
>>60349400
Pretty good idea anon-kun
>>
>>60349498
>sadly i can't provide you with a link into my head
But how did you quote something nobody said?
>but i'd gladly elaborate if you have questions
Why do you space your posts in that retarded way?
>>
>>60349576
>But how did you quote something nobody said?
because i at some point actually said those things
i just never published them online

>Why do you space your posts in that retarded way?
i space it as i think it if this makes sense?
>>
>>60349452
Most japanese learners use this application: https://apps.ankiweb.net/

I have a "deck" of japanese to english definitions. I'm now converting them to japanese to japanese, by first exporting my "deck", then iterating over my words and scraping the definitions off dic.yahoo.co.jp . When I have scraped my whole deck, I will import it again into anki.

My next little script will import to anki automatically the list of words I have looked up on my kindle since last time I plugged it in, as soon as I connect it via USB, again scraping yahoo.

>>60349507
thanks senpai
>>
>>60349342
So, is shell script programming?
>>
File: 1488055942092.png (675KB, 1280x720px) Image search: [Google]
1488055942092.png
675KB, 1280x720px
>>60349619
>because i at some point actually said those things
Do you have a recording of it?
>>
>>60349720
Yes
>>
>>60349783
So "ln -s" is programming indeed!
>>
>>60341925
it's even worse because in the show she's a C programmer
>>
>>60349678
Ooh that's pretty neat and useful.
>>
>>60349778
i fear i do not have a recording, i tend to dislike recording myself for several reasons one of which is a general dislike of my voice

I am very much thankful for the image.
>>
New thread:

>>60349876
>>60349876
>>60349876
>>
>>60349810
What show?

I don't watch chinese cartoons, but I might start if it has cute C programmers in it
>>
>>60349993
>I don't watch chinese cartoons
>>>/v/
>>
>>60350058
/v/ is as much about anime as /g/ is and they're part of the same weeaboo website. I'd rather discuss programming than video games.
It would make more sense if you redirected me to Reddit surely
>>
>>60350226
>they're part of the same weeaboo website
Their kind doesn't really acknowledge it though.
>It would make more sense if you redirected me to Reddit surely
I did. /v/ is a "subreddit" of the site "Reddit".
>>
>>60350367
Alright, hope you feel better now that you did. Do you happen to know what that anime is though?
>>
>>60350424
it's written ON THE PICTURE

stella no mahou
>>
>>60350424
The anime is right on the image
>>
>>60349576
>>60349778
so this is how turbo autism looks like?
>>
>>60350736
how is your first week here going?
>>
>>60350748
the "who are you quoting" meme was always shit
>>
>>60350555
>>60350542
Thanks, long day, too tired to have realized.
Girls are cute, but I couldn't go through with the first episode.
Sorry >>60350058
I still don't like anime. I get the appeal of cute anime girls, but surely that's not enough to make a show interesting
>>
>>60350824
That's not what you said.

>>60350970
>I still don't like anime.
You have watched one shitty show. Of course you wouldn't like it.
I find it hard to believe there is something inherent in anime that you don't like, someone like that wouldn't post there. Or at least I hope so.
>I get the appeal of cute anime girls, but surely that's not enough to make a show interesting
I wouldn't say the girls in that show are "cute".
>>
>>60350970
it can certainly make a show interesting
after all it's more or less the ultimate form of catvideos
ie cute girls doing cute things in cute ways
>>
File: 175.jpg (42KB, 311x311px) Image search: [Google]
175.jpg
42KB, 311x311px
>>60341904
I tried learning how to program. My only desire in life is to make a video game, but i failed, the three times i tried.
Then i considered taking programming classes, but turns out i need to graduate from gymnasium to do so.

What do i do? I can't even manage to learn a simple language like C# on my own /with help from a friend.
>>
>>60347531
kek
>>
>>60351565
you are clearly lazy
and or unmotivated

back when i took programming classes
about 60% of our class were people who wanted to make video games
they all failed
because you don't just make video games

i guess what i want to tell you is, get yourself a proper motivation that is not only video games
like useful tools etc
and once you got the basics down you can slowly start to consider thinking about starting to learn writing code that could possibly resemble a video game
>>
Newbie C programmer here. Why are linked list so frowned upon? Still learning their properties, and how to useit, but so far, they seem pretty damn useful.
>>
>>60352223
Use dynamic array. Do you want one stupid implementation?
Thread posts: 331
Thread images: 39


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.