[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: 316
Thread images: 39

File: 1482583291457.png (323KB, 815x452px) Image search: [Google]
1482583291457.png
323KB, 815x452px
What are you working on, /g/?


Previous thread: >>58586140
>>
>>58590966
Fuck you for using an anime image.
>>
File: GGJ00-RoundLogo-900x900.png (203KB, 900x900px) Image search: [Google]
GGJ00-RoundLogo-900x900.png
203KB, 900x900px
Who Global Game Jam here?

http://globalgamejam.org/
https://www.twitch.tv/directory/game/Global%20Game%20Jam
>>
Fuck you for using an anime image.
>>
square brackets are one of the most aesthetically pleasing elements in code
>>
>>58590966
section .data

Msg: db "Thank you for using an anime image!",10
MsgLen: equ $-Msg

section .bss

section .text

global _start

_start:
mov eax, 4
mov ebx, 1
mov ecx, Msg
mov edx, MsgLen
int 80H

mov eax, 1
mov ebx, 0
int 80H
>>
File: Hare_Nochi_Munasawagi_2303.png (24KB, 504x380px) Image search: [Google]
Hare_Nochi_Munasawagi_2303.png
24KB, 504x380px
Thank you for using anime image!
It was the picture I wanted to use in the OP, but you made new thread earlier, so take this picture as a gift!
>>
File: a.png (46KB, 676x554px) Image search: [Google]
a.png
46KB, 676x554px
What am I in for?
>>
>>58590988
>>58591001
These posts are hate speech.
>>
>>58591034
thank you for using this anime image
>>
if it's not in c i'll take a pee on your "code"
>>
>>58590966
Fuck you for using yet another anime image

Go back to your /a/ containment board weaboo faggot
>>
File: 669.png (17KB, 480x280px) Image search: [Google]
669.png
17KB, 480x280px
>>58591050
Have one more
>>
>>58590999
What's the theme now? I want to waste some time.
>>
File: 1468483606994.jpg (87KB, 600x480px) Image search: [Google]
1468483606994.jpg
87KB, 600x480px
>>58590988
>>58591001
>>58591060
>>
>>58591060
This post is hate speech.
>>
>>58591079
>>58591083
Stay in /a/ or /jp/, leave quality boards free of your faggotry
>>
>>58591125
I hate anime but
>/g/ quality
>>
File: 1468015463584.png (402KB, 800x1400px) Image search: [Google]
1468015463584.png
402KB, 800x1400px
>>58591125
>/g/
>quality board
holy shit
>>
>>58591148
>>58591149
If you think it's bad why do you stay here? Leave and I guarantee no one will miss you
>>
File: 1484522561566.png (6KB, 369x369px) Image search: [Google]
1484522561566.png
6KB, 369x369px
>>58591148
>>58591149
>>
File: 1467398868589.jpg (475KB, 852x973px) Image search: [Google]
1467398868589.jpg
475KB, 852x973px
>>58591171
because it's the technology board of 4chan, the intersection of people who like anime and programming

why do you come here if you don't like anime?
>>
>>58591171
>Leave and I guarantee no one will miss you
Being this insecure
>>
File: anime_website.png (41KB, 467x235px) Image search: [Google]
anime_website.png
41KB, 467x235px
>>58591125
Anime website.
>>
>post anime pic
>people sperg out
>somehow the weebs are at fault
>>
>>58591197
10 out of 100 boards are about anime, you're free to stay on these

>>58591193
Nobody here likes anime because we're older than 12
>>
>>58591171
Anyways, it's not like you couldn't despise a board as a whole, but like a thread within it.
>>
File: 1484797935410.jpg (50KB, 640x480px) Image search: [Google]
1484797935410.jpg
50KB, 640x480px
>>58591225
>because we're older than 12
So, thirteen?
>>
File: cs-question.png (40KB, 735x366px) Image search: [Google]
cs-question.png
40KB, 735x366px
>>
File: anime website.png (580KB, 800x2810px) Image search: [Google]
anime website.png
580KB, 800x2810px
>>58591055
that was terrible
even worse than the "if its not rust you shouldnt trust it" one from the other day
>>
I'm working on BasicTV (decentralized internet TV). Currently converting some macros into user changeable settings, as well as just cleaning up the code and adding small features and changes that are too small to do on their own. I have an IRC channel dedicated to this project at #basictv on Freenode, but you can talk about whatever.

I'm also looking for ideas for what to put on the network. Anything text, video, or audio (or combinations) will work fine.
>>
>>58591306
>std::vector<std::pair<...
why not auto more?
>>
>>58591304
>4chan had a board about anime 15 years ago
>this somehow means the entire site is exclusively for people who like chinese cartoons for mentally retarded schoolchildren

ok
>>
>>58591337
>had a board
>being this new
>>
>>58591304
t. oop "programmer"
>>
File: anime web.png (10KB, 342x135px) Image search: [Google]
anime web.png
10KB, 342x135px
>>58591337
No, 4chan IS an imageboard for people who like anime.

Hence the name, 4chan, which is a pun on 2channel and -chan.

Why do you think we have this page?
http://www.4chan.org/japanese
>>
>>58591359
Face it weaboo faggot, most boards are not about your cartoons, most users here don't watch your cartoons, most people in the world think your cartoons are childish, and you would be ashamed to admit you watch them in public
>>
>>58591371
what does
>t.
mean
>>
File: 1484175671989.png (355KB, 555x770px) Image search: [Google]
1484175671989.png
355KB, 555x770px
>>58591337
>the entire site is exclusively for people who like chinese cartoons for mentally retarded schoolchildren
yes
>>
>>58590966
Playing with modifying, saving and loading a blocky gameworld in Rust following earlier success with OpenGL 3. Seems very robust if a bit verbose so far, at least I don't have to worry about accidentally streaming out ints when I intended to write u16 or something. Locally importing little trait extensions like custom data serialization methods for any io::Write is neat after over 9000 shitty Java and C++ libs for this.

And animu posts are far less cancerous than some of the retarded normie garbage on this board desu
>>
>>58591384
No, it's not. It's just a name, most people here don't even know it was modeled after some japanese website (as if that changes anything). Yeah sure 15 years ago it had a board about anime. So what? You're free to stay in that containment board though faggot
>>
>>58591388
>pic
Are there any papers on programs like that?
>>
File: Extra3.jpg (99KB, 773x893px) Image search: [Google]
Extra3.jpg
99KB, 773x893px
Anti-weebs get triggered at the dumbest things lol
Just imagine how much better this thread could have been if they weren't bitching over nothing
>>
>>58591388
>>58591400
Something tells me there's a touchscreen app out there that lets you molest the 2D grill.
>>
>>58591427
Go back to
>>>/a/
>>
>>58591427
>le xdd get triggered meme
2000 late called
>>
>>58591334
It helps me keep track of the work flow and fix errors since there is a concrete flow of the data written there.
>>
Can I make a program that refuses to run on Windows?
>>
File: wallhaven-343721.jpg (343KB, 1890x1541px) Image search: [Google]
wallhaven-343721.jpg
343KB, 1890x1541px
>>58591445
>>58591448
>neither deny it
Go to /anywherebuthere/ if you don't like it
>>
>>58591474
just don't compile for windows?
>>
>>58591386
That means you're a newfag
>>
OK, this might be a weird question

I learn c#, and i need to create objects in foreach loop

Since that is not possible, i have found workaround with dictionary, so i tried it somehow like this

Dictionary<int, User> dict = new Dictionary<int, User>();


and in my foreach loop i do something like this
                {
//do work
dict.Add(numerator, new User(car, price, link));
numerator++;
}


Problem starts in another Method, in which i have to look through items in ObservableCollection MyClients and, if any link from dictionary is different than any item in the ObsCollection i insert it into ObsCollection

if (!MyClients.Any(x => x.Link == **HOW TO ITERATE THROUGH EVERY VALUE _Link_ FROM DICTIONARY** )
{
//do stuff
}
>>
When using smart pointers in C++, I only need to supply a deleter when the object is not dynamically constructed using "new"? Is this correct?
>>
>>58591478
Nah bro, there is a containment zone where you can be rounded up with fellow chinese cartoon enthusiasts, but perhaps you're lost, this is a technology board.

So kindly get the fuck back to /a/
>>
>>58591485
I don't want other people to be able to compile and run it on Windows.
>>
>>58591474
#ifdef __linux
#error GIT GUD FAGET
#endif
>>
File: 1483551583853.jpg (55KB, 399x599px) Image search: [Google]
1483551583853.jpg
55KB, 399x599px
What's the difference between anti fascists and anti anime?

antifa get paid
antime do it for free
>>
>>58591494
It means I didn't browse this board for 2 years
>>
>>58591507
*ifndef
sorry about that
>>58591513
>implying I don't love hating weeaboos
>>
>>58591501
>>58591478
>>58591448
>>58591445
Could you chaps take this to a different thread?
>>
>>58591501
/a/ was never a containment board
Now get out, I'm afraid you'll shit up the next thread as well too
>>
>>58591505
if you give them the source code nothing stops them
>>
>>58591497
Fuck off, nigger this is a thread to bitch about anime and not programming.
>>
>>58591497
Just use a normal for loop.
>>
File: 1436435963605.png (59KB, 684x710px) Image search: [Google]
1436435963605.png
59KB, 684x710px
>tfw you're about to learn Haskell and Prolog at uni next week
>>
>>58591537
Haskell I wouldn't mind
Prolog on the other would probably not be fun
>>
>>58591537
https://en.wikibooks.org/wiki/Haskell
>>
>>58591517
Yeah, of course newfriend
>>
>>58591505
Abstract away as little as possible and have a heavy reliance on POSIX C
>this is assumings Macs are OK
>>
>>58591537
Embrace it anon. You'll probably never use Prolog at any other time in your life.
>>
>>58591526
It is now, now that most users don't give a shit about your childish cartoons
>>
>>58591565
Nope
>>
>>58591554
Can you just fucking tell me?
>>
>>58591574
>>>/a/
>>
>>58591536
Foreach (or for) isn't even the problem, i just need function to look through any value in dictionary, but that value is actually property of another class
>>
>>58591478
woa post more
>>
>>58591580
I don't have any anime or manga that I want to talk about right now though
>>
>>58591579
lurk
>>
>>58591561
Thanks.

Not letting Windows use it is higher priority than blocking Mac users because there's so many more of them. I'll look into blocking Mac users later if they become a problem.
>>
>>58591498
Doesn't the default deleter ("delete[]" if array, "delete" otherwise) pretty much handle this in most cases if your type can be destroyed cleanly by it?

I guess you might want something else if you're using your own allocator, pool mechanism or something, but it should destroy stuff created using "new" and then given to the smart pointer just fine.
>>
>>58591595
Quick question: why would you be doing this in the first place?
>>
>>58591592
I understand the contextual meaning you knob, what is the actual "t."
>>
>>58589719
In the end I do not know how to do this in a clean way, I'm already using more than one call to substr and I would gladly just use anything else at this point, but I'd have to rewrite the entire method

This is the easiest way I could think of without having to go for intermediate steps
sname*: (post) -> substr(post.file.name,_.match /\d{1,}(?=\,)/g or 0,_.match /\d{1,}(?=\])/g)

that is parameter when
parts[key] = parts[key].replace /%(T?URL|IMG|[sh]?MD5|board|name|%|semi|sname\[\d*(\,\d*)?\])/g, (_, parameter) ->
type = Sauce.formatters[parameter] post, ext

goes

I don't think sname* would work, I don't know if coffeescript or javascript even let me use wildcards at all, let alone for string contents. Hell, I don't even know if I can even reference the formatter that is passed in there at all
this is all overly complicated for no reason
>>
>>58591612
I want to discourage use of Windows.
>>
>>58591635
why?
>>
>>58591635
I guess a better question is what's the project? If this is a server software or something only you will use, go on ahead.
>>
>>58591613
more
>>
>>58590999
reporting in
>>
What's the best computer vision framework currently? Looking for something primarily C++ and open source.
>>
>>58591652
To get my parents to stop using it.

>>58591655
A game.
>>
>>58591615
and of course I would have to parse them to be integers, either with parseInt() or by using Number() or some other bullshit
>>
>>58591664
OpenCV is pretty popular
>>58591667
If you want this game to be popular at all, don't limit platforms intentionally.

Where is the source code?
>>
>>58591687
>Where is the source code?
On my computer. It's not ready for release yet.
>>
>>58591696
>not ready for release yet
Not ready like polishing up some graphics or not ready like haven't started yet? Can you post some screenshots?
>>
>>58591709
I've got as far as writing a main function and initializing SDL2.
>>
Want to learn some programming (I work in a science lab and I want to write some code to automate data analysis).
Matlab and python were recommended by coworkers. How do I start with matlab? A copy of mathworks?
>>
>>58591716
What type of game is this? I've made a 3D FPS sandbox game, but that never went anywhere and it was really badly made.
>>
>>58591729
I haven't really decided yet, I want to code the engine first before making any big decisions.
>>
Should I design and implement a simple human readable markup language for my UI lib?

XML doesn't have a good native interpreter (for portability), JSON looks ugly as hell and the implementation with regular Lua tables and files is quite unsightly
>>
>>58591742
Have you considered TOML?
>>
>>58591742
>human readable markup language

I meant human readable data serialization format or markup language
>>
>>58591736
>code the engine first before making any big decisions
Do you at least know if it will be in 2D or 3D?
>>
>>58591729
He'll never finish it kid.
>>
>>58591755
I'm probably gonna go 2.5D, have some bits be 2D but others 3D.
>>
>>58591764
>2.5D
I wouldn't bother with fancy graphics until you have the rest of it done. Will it be multiplayer?
>>
>>58591784
No, just singleplayer, videogames should be a solitary pursuit.
>>
what do I need to do to program a music player as fast and responsive as foobar?
am I overestimating the effort required to sort 4000+ songs seemingly instantly by their name/length/album etc.?
>>
What editor would you recommend to do C or C# programming in? And what is some of the main differences between C and C#? I am used to C++. Also is C or C# used more frequently for Embedded programming?
>>
>>58591794
>am I overestimating the effort required to sort 4000+ songs seemingly instantly by their name/length/album etc.?
Yes. It's a trivial task. You should notice slowness when sorting 1,000,000 songs.
>>
>>58591794
>>58591803

What the fuck? Worry about the fucking audio playback instead you fucktard

Fork and improve mpd instead
>>
>>58591800
I'd guess C# is almost never used for embedded programming.

Visual Studio is probably the best tool for writing C# in. For C I'd recommend vim or emacs if you're already familiar with either of them.
>>
>>58591792
>videogames should be a solitary pursuit
Not really. More players is more fun.
>>58591794
I would start with getting an environment set up with a ton of threads (one dedicated to audio, one for UI, etc). Just add a couple of locks together and you should be set.
>>58591800
Emacs
I've always known of C# to be a Windows programming language (although it has been ported over). I don't know of many prjects that actually use it.
C is the only language for embedded programming (except ASM). C#'s only embedded use case is WinCE, and that shouldn't count as embedded (64MB+ RAM)
>>
>>58591749
Hmm, how would

[paragraph]
text="Test paragraph 1"

[paragraph]
text="Test paragraph 2"

map to a table?

something like
{
{
type = 'paragraph',
text = 'Test paragraph 1'
},
{
type = 'paragraph',
text = 'Test paragraph 2'
}
}

right?

I might do it anyways, seems like a fairly trivial task to 'compile' it to a Lua table and then load that, but idk.
>>
>>58591814
What about quod libet?
>>
>>58591792
You're disgusting.
>>
>>58591800
If you're on Linux, definitely emacs or vim
C is definitely used more for embedded programming
>>
File: 1484943715765.gif (1MB, 1280x1024px) Image search: [Google]
1484943715765.gif
1MB, 1280x1024px
What languages I can use for ncurses?
As far as I know, you can use Perl, Python and C# aside of C(++).
Is there more?
>>
>>58591842
Do you prefer masturbating alone or with your buddies, anon?
>>
>>58591794
youre gonna wanna do some trial and error here. just build the naive case first (call sort function on click) and see if its fast with 4k+ songs... if not then theres a lot of things you can do to speed it up. just be creative

if you were asking what technology stack to use, then just do something that seems fun to work with. you wont run into performance bottlenecks due to language choice with this application
>>
>>58591840
Looks fine too. What about it?
>>
>>58591844
Rust
Haskell
>>
>>58591862
>Haskell
Are you serious
>>
>>58591868
https://hackage.haskell.org/package/ncurses
>>
>>58591794
>>58591803
Well, some Linux GUI media players do somehow slow down to a crawl or lock up when handling more than a few thousand files. But this probably has more to do with synchronous I/O and/or bad toolkit usage (I think one was creating a full layout of GTK+ widgets for every song available, whether it was visible or not).

Not sure how these turbosperg turds even end up in distro package repositories.
>>
>>58591792
You sound autistic desu
>>
>>58591800
>>58591827
If the full VS is feeling too slow, unstable or bloated, VS Code has pretty good code intel and other integration for C# these days.

Might also work on Linux if you stick to .NET Core, but last time I tried it its package installer was incompatible with my distro's libcrypto.so and couldn't run.
>>
>>58591814
What about audio playback?
My main concern here is to make it as lightweight as I can
>>
File: 1440865377371.jpg (1MB, 3072x2304px) Image search: [Google]
1440865377371.jpg
1MB, 3072x2304px
>>58591876
I fear to embrace the fact that there's no thing Haskell can't do.
>>
>>58591930
Try getting hired
>>
>>58591941
How do languages get hired?
>>
>>58591930
low level systems programming*

*unless you write a language inside of haskell, which is quite easy
>>
>>58591894
Thanks anon
>>
>>58591911
I don't really see normal audio formats presenting any issues for a lightweight audio player.

Just try to not integrate too many web browser stacks into the thing.
>>
>>58591911
By audio playback I mean don't screw it up.

Can't get lighter than music player daemon. Study that. Contribute code. It desperately needs better playlist management capabilities.
>>
How the fuck do i display multiple textures with opengl? I'm doing a completely 2D program so i dont' give a fuck about 3D. I'd use SDL but i'm drawing A LOT of lines (around 14k every frame) and so I needed to use VBOs to speed it up.

I've got that working and i've got ONE texture working but when i go to do the second texture (it's a GUI) it's just black. Do I need a second VAO? Do I need to generate another opengl program with a new shader? Right now i'm trying to reuse the texture shader (I have a separate shader for the lines) and reusing the VBO object, etc. I load the textures with SOIL and they seem to load find, it detects the dimensions, no errors. What sucks is none of the tutorials explain how to manage multiple VBOs/VAOs/Programs/Shaders, etc. They display one fucking texture and TUTORIAL OVER. God dammit it's driving me crazy. This is simple shit, JUST TEXTURES, nothing fancy.
>>
>>58592068
I could propose dropping OpenGL, since you don't need 3D.
>>
>>58592123
did you read the part about the lines? i need lots of those.

15k per frame is like 900k lines per second. SDL can't do that last time i tried. I was using RenderLine though, which is slow. I couldn't figure out any other way to do it as fast as opengl
>>
>>58592068
Just bind the second texture object before drawing?
Does it have mipmaps? If it does not, did you disable mipmapping for it? It's on by default.

Reusing and reconfiguring the VAO doesn't have much of a perf penalty unless you really need to micro-optimize drawing 10k+ objects --- it's just another case where they took some existing global state (the vertex attrib binds) and turned it into a switchable object. Probably less confusing to just use them like that because it's fucking hard to avoid bizarre side effects like accidentally changing a "static" VAO's element array buffer while loading stuff.
>>
>>58592170
Like i said i did BindTexture

It doesn't have mipmaps. It's a single layer PNG

I'm not reusing the VAO, I'm creating a second VAO, sorry if I misspoke. The rest of it i'm trying to reuse
>>
>>58592289
i even tried other PNG files in case the first is bad

the other texture i'm using is a PNG and it displays fine, i can't figure it out, I'M ABOUT TO HULK SMASH MY MONITOR
>>
>>58592289
If it's not broken mipmap configuration I can't really guess what might have gone wrong.

Run the program through apitrace to validate its GL usage?
>>
>>58592068
Use a program like CodeXL to make sure the picture is actually loaded into the texture

It should just be a matter of binding the second texture and running drawarrays/drawelements again with the same VBO, VAO, etc.
>>
>>58592389

yeah i'm using drawarrays

fuck! driving me crazy. ok i'll try codexl, i wasn't aware a program like that exists
>>
>>58592331
>>58592389
>>58592170


In my render loop i really should only have to bindtexture and draw right? everything else goes in initialization? what about if vertices are changing? I just have to bindbuffer to vbo and fill the buffer right? anything i'm forgetting? i need to select the right vao depending on what i'm doing? fuck it's so god damn complicated
>>
this is how I'm thinking doing that simple ui ml
[body
[text Lorem ipsum dolor sit amet]
[image{src='/file/image.png'}]
[table
[row
[text cell 1]
[text cell 2]
]
[row
[text row 2]
]
]
]

yay / nay?
>>
why does modulo of 2 input numbers (i.e 5 & 25) return the wrong number? like if i input 5 and 25, modulo returns 5. any of you encounter something like this?
>>
File: trumperwave.png (193KB, 1066x641px) Image search: [Google]
trumperwave.png
193KB, 1066x641px
I am approaching maximum vaporwave with this filter.
>>
>>58592522
Same, better file a bug report telling every language that they implemented modulus wrong
>>
>>58592522
you mean 5 divided by 25?
it's 0 and 5 is the remainder
>>
>>58592522
you have the operands backward you filthy kike
>>
>>58592544
its giving me 5 with all numbers i input, 2 & 20 included
>>
>>58592535
vaporwave can only be generated by humans
>>
>>58592572
Post the code
>>
>>58592568
i dont
>>
>>58592538
it's defined at the CPU level, you know
>>
>>58592522
> Why doesn't modulus do what I think it should
>>
>>58592586
r=input1%input2;
if(r==0){
cout <<r<<endl;
}

this is the code i have now so it prints it when its 0, but its never printing it. if i put the output out of the if, it returns 5
>>
File: the delegates donald.png (87KB, 1200x905px) Image search: [Google]
the delegates donald.png
87KB, 1200x905px
>>58592576

You would think so, but you'd be wrong. The A E S T H E T I C has been automated. The machines are becoming far too powerful.
>>
>>58592629
My eyes are literally bleeding from that
>>
>>58592614
its doing it with all numbers, thats the thing
>>
>>58592568
>>58592591
i did
sorry guys, thanks for bearing with me and my retardation
>>
i like my women how i like my guis

sleek, flat, and modern
>>
>>58592692
underage ?
>>
>>58592629
This is garbage though
>>
>>58592692
fuck off pedo
>>
>>58592714
>>58592734
༼﹏༽
>>
File: Wien_NHM_Venus_von_Willendorf.jpg (75KB, 461x682px) Image search: [Google]
Wien_NHM_Venus_von_Willendorf.jpg
75KB, 461x682px
>>58592692
fag
>>
>>58592743
nigger
>>
>>58592692
>i like my women how i like my guis
2d
>>
>>58591615
>>58591679
        parts[key] = parts[key].replace(/%(T?URL|IMG|[sh]?MD5|board|name|%|semi|sname\[\d*(\,\d*)?\])/g, function(_, parameter) {
var type;
if (parameter.substr(0,5) === 'sname') {
var n1 = parseInt(parameter.match(/\d{1,}(?=\,)/g));
var n2 = parseInt(parameter.match(/\d{1,}(?=\])/g));
parameter = parameter.substr(0,5);
}
type = Sauce.formatters[parameter](post, ext, n1, n2);

      sname: function(post,ext,a,b) {
if (!Number.isInteger(a)) a=0;
var result = post.file.name.match(/.+(?=\.\w)/g).toString().substr(a,b)+'.'+ext;
return result;
}
}

what a fucking shitshow
I'm glad I don't code
>>
>>58592489
If you're using multiple VAOs you should bind the VAO before drawing. Make sure whatever you do between drawing doesn't break its state. If you only have a single one just see that its attribs are bound to the right buffers and match your shader's vertex inputs.

Are you sure your code that tries to draw something using the second texture works properly? Just make the shader output bright red and if you don't see a bright red shape where the texture ought to be, your drawing setup is fucked.

If you _do_ get a bright red shape where the GUI should be, you're not setting up the texture properly.
>>
Is this allowed in C?
(
 float gal = scanf("%f", &gal); 
)?(what's the safer equivalent) : (why not?)
>>
>>58592639
>>58592720

Yeah well you're both stupid fags
>>
>>58592934
>why not?
Declarations first, code later.
>>
What's a good resource WITH EXERCISES to learn bash?
>>
>>58592934
scanf returns an int with the number of patterns it matched, so you're using it wrong.
>>
>>58592576
>humans
What are humans if not low functioning, inconsistent machines?
>>
>>58593011
float gal;
scanf("%f", &gal);


Looks so dumb, any neat way to assign a var?

>>58593031
>%f
https://beej.us/guide/bgc/output/html/multipage/scanf.html
>>
>>58593053
>https://beej.us/guide/bgc/output/html/multipage/scanf.html
>%f
Yes? You're telling it to pick up one float from the input and place it into "gal" but it still returns an int, which is the number of items successfully matched. Probably 1 or 0 in this case.
The guide you linked says the same thing.
>>
>>58591306
Now I'm polishing up and testing some encryption code. I have the encryption and decryption down pat, but I still need key generation.
>>
File: 1454507930343.png (160KB, 1920x1080px) Image search: [Google]
1454507930343.png
160KB, 1920x1080px
>>58593092
>>
>>58593132
>>58591306
I also got around to making a better demo for the webcam
https://dropfile.to/wU3R0C9

It freezes at the first frame because the timestamp for the bootstrap ID is in the future (shouldn't happen except for tests)

It is in black and white because I didn't bother with converting from Y'UV to RGB (it shouldn't be hard, but i'm not working on video for a while).

Frame rate being pulled from the camera doesn't match the actual frame rate of the footage. I manually inserted a good enough value for demonstration (10FPS)
>>
>>58593132
literally just use NaCl
>>
I recently started a new job and have to maintain a bunch of old software.

How do I fight the urge to just rewrite everything because whoever worked on it before just copy pasted stack overflow answers together without know what the code even did and now nothing works properly and I'm supposed to fix it all.

Protip: Don't get a job doing programming unless you work on your own projects.
>>
>>58592934

The scanf function returns an int, not a float. That int is the number of items successfully matched. If you want to scan a float with scanf, do it like this:

float gal;
scanf(%f", &gal);


With regards to safety in format string functions, just remember a few simple rules:

1. Never scanf with %s and no qualifiers for the length of the string.
2. Always use string literals with all format string functions. If you want to print a user-supplied string, use %s, or the puts/fputs functions. If you want to use a formatted input function with a user-supplied string... don't.
3. Don't use sprintf. Prefer snprintf.

In general, assume all user input strings can be malicious, and will try to overflow data, or read/write arbitrary data with %s or %n.
>>
>>58593175
The encryption is just OpenSSL and some custom data types for exporting and importing. I'm not stupid enough to hand-roll encryption
>>
>>58592866
I get a black square ( i can see it only because the first texture is displaying properly behind it)

something with the texture must be fucked. i tried a different texture though :(
>>
>>58593011

There's nothing wrong with mixing declarations and code (and if one uses C++, one SHOULD mix them regularly), but there is something wrong in that particular use case.
>>
>>58593204
Ruby Ruby Ruby Ruby
>>
File: ToTheFront.png (14KB, 640x480px) Image search: [Google]
ToTheFront.png
14KB, 640x480px
What do you think about my game?
>>
Would you recommend focusing on .NET and C# development right now?

I got a job with great opportunities to learn this stuff, but I have to really delve into it.
>>
>>58593195
Since you mentioned a separate VAO or buffer or something for the second draw, are the texture coordinates being passed properly? If the second texture contains black pixels, it could be just sampling that particular texel for every pixel because of bad texcoords.

If there is any doubt, make the shader improvise some kind of tex coords from view coords to see if any image data is coming through.

If you're not absolutely sure mipmapping is properly set up or disabled for that particular texture object (failure to do either will return black when sampling), try
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

to disable mipmap scaling for the bound texture. Just put the call right after you bind the texture for drawing for a quick test.
>>
>>58593310
>TempleOS
Aside memes, I'm happy
>>
>>58593310
It looks interesting but real fucking messy
>>
>>58593310
Is it about a racial holy war?
>>
>>58593320
thanks for the input but no, there aren't any black pixels and yeah the texcoords are the same as the first texture (-1,1,1,1,1,-1,-1,-1)
>>
>>58593342
HERD
>>
I want to get into programming to be able to contribute to the linux kernel in a few years, since I have nothing else to do with my life.

My plan is to learn bash, then C, work on some projects of my own for some time to get a strong grasp on them, then move on to resources like the dragon book, and "linux kernel development".

Is it the right path ? How do you think I should approach this quest ? How would you ?
>>
File: 120026-51.jpg (30KB, 350x361px) Image search: [Google]
120026-51.jpg
30KB, 350x361px
What's the workflow for embedded development?

Suppose I'm developing on my x86-64 machine for some ARM processor. The fact that my code compiles and runs on my dev machine does not imply that it will compile and run on the target device. Conversely, I might not be able to compile the code on my dev machine because it lacks e.g some specific hardware that the application is supposed to interact with. So how the hell do people do embedded development? Do they use virtual machines and emulators?
>>
>>58593250

Here you go, Anon
https://www.youtube.com/watch?v=qObzgUfCl28

>>58593311

Considering the sheer number of jobs that use it, I'd say go for it. Nearly every job I see these days wants one of the following:

Node.js experience
SQL experience
C# / ASP.NET experience
Java / J2EE experience
>>
>>58593366
>texcoords are same as the first texture
How are you passing these? Note that if you're using two VAOs, you need to call glVertexAttribPointer and glEnableVertexAttribArray(was that the name?) for both VAOs, for all attributes you want to pass,
>>
>>58593404
No Ruby. That's not how we do this. You're supposed to be confused, and then I post "doya doya doya doya".
>>
>>58593394
since the ARM ecosystem is so diverse (10 SoC's with same architecture have 10 different MMU and initialization code) yes, they use emulators modified to their purpose (for example qemu has a versatile board and virt board that have completely different peripherals and ways of accessing em). You could ask ruby senpai above more details
>>
File: Fridgebike.jpg (166KB, 1280x529px) Image search: [Google]
Fridgebike.jpg
166KB, 1280x529px
>>58593433

I figured you out, cunt.
>>
>>58593502

what is the anchor? windows?
>>
>>58593527
the anchor is OOP
>>
>>58593394
qemu?
>>58593389
before anything else, get better things to do with your life

If you know C enough, you don't "have" to keep working on personal work. The Eudyptula project (Project Euler for Linux kernel development) might be a better fit here. Make sure you also learn how to use mailing lists, Git, patch, and similar tools. I tried the Eudyptula project, but it kept rejecting my code for some reason, so be warned.

Unless you want to do small fixes everywhere and just work on the staging parts, you should get some intense knowledge in some basic protocols (PCIe, USB, I2C, infinitband, etc) for whatever you are doing to help develop.
>>
>>58593533
*tips*
>>
>>58593527

I believe it's supposed to be .NET or something. C# is not tied to Windows in the slightest.
>>
>>58593604
>C# is not tied to Windows in the slightest
Keep telling yourself that.
>>
>>58593527
>>58593533
If the anchor is OOP then C++ should also have it.
>>
>>58593564
class Tippable

>>58593621
Modern C++ only pretends to be OOP, it's basically just method call syntax
>>
>>58593621
>>58593604
Maybe it's garbage collection.
>>
>>58593635
But c++ also has class inheritance you fucking retard.
>>
>>58593379
OF
>>
>>58593527

the anchor is something java and c# have in common, c and c++ lack

could be the running environment?
>>
>>58593610

I've got 2 C# compilers on my system, and I'm running Linux.
>>
>>58593683
Sounds legit. C# and Java both run on virtual machines, aye? So then what is the fridge, libraries?
>>
>>58593502
>C# is like a really nice car that's tied to an enormous unwieldy anchor

Old comic
>>
Can you redpill me on go ?

Is it really as versatile, fast and powerful as C ? What do you think of it ?
>>
>>58593708
>So then what is the fridge
Unbelievable amounts of bloat.
>>
>>58593708

oop probaly
but then, c# should have it as well
>>
>>58593708
Containment for all the rotting legacy crap it couldn't quite throw away?
>>
>>58593673
Did you not read my post?
>>
I'm trying to compare the Etag of a file so that it would only download an update if the file did not have the same Etag. However when I send the request I'm getting not only the header but the full file as well.

Using curl also pulls not only the header but the rest of the file:

curl -i -H "If-None-Match: \"correct etag\"" https://s3.amazon.aws.com/file.extension

I just want the header only. What am I doing wrong?
>>
File: YEdZ1.png (96KB, 800x800px) Image search: [Google]
YEdZ1.png
96KB, 800x800px
Why are you using Rust, the most masculine language?
>>
>>58593865
Because I'm not a trap.
>>
How should I check to see if a string represents an integer?
>>
>>58593865

I don't really use Rust, but this just makes me want to use it more.
>>
>>58593865
this is why I avoid Ruby
it seems like a nice language with the best of Perl and Smalltalk features and a clean syntax but most of it's users are hipster web devs and it's the language of choice for women
>>
>>58593766
There's a special HTTP method for that which is HEAD. Use the --head or -I option.
>>
So, I'm a C/C++ and Perl/Python programmer for years now.


Regarding Go, Rust, etc, do you actually use any of the newer features in your code (i.e. something you wouldn't find in python or C++)? Can you provide some examples?

The problem isn't that I don't understand lambda funcs etc... the problem is I can't really think of how they would be _useful_ in programming.
>>
>>58593943
Step through each character of the string and see if it's 0-9:

for(int i = 0; i < length(str); i++) {
if(str[i] < '0' || str[i] > '9') return false; //is not a int
}

return true; //is an int
>>
>>58594031
go and rust do not provide anything new.
>>
>>58593865
>the stronger the type system the more dicks it has
>>
>>58593706
2? There's Mono and?
>>
>>58594031
Not having some of C++'s garbage is probably a feature by itself.
>>
>>58593943
If x = Val(x) Then x = number
>>
>>58593394
They program in Java. I am not even kidding.
>>
>>58594071

.NET Core.
>>
How do I even call a function
#include <stdio.h>
int main(void){
interest_rate_calculator(); //Warns about implicit func declaration
return 0;
}

int interest_rate_calculator(void){

puts("Performing interest_rate_calculator.");

puts("Enter loan: ");
double loan;
scanf("%lf", &loan);

puts("Enter rate: ");
double rate;
scanf("%lf", &rate);

puts("Enter days: ");
int days;
scanf("%d", &days);

int interest = (int)(loan*rate*days/365);

printf("%s%d\n", "Your interest is: ", interest);

return 0;
}


>>
>>58594006
The problem is I was using curl for a sanity check as my actual program requests it using HEAD and that's what's pulling the extra junk as well.

"HEAD /file.extension HTTP/1.1\r\nHost: s3.amazon.com\r\n If-None-Match: \"etag\"\r\n\r\n"
>>
>>58594102
The compiler reads the file in order, so it has no point of reference to interest_rate_calculator when it reaches main. You should either put the definition of interest_rate_calculator above it, or put a declartion before main (don't write the function here, just 'int interest_rate_calculator(void);')
>>
>>58594102
C is read from top to bottom.
When the compiler sees "interest_rate_calculator();", it hasn't seen that function yet, so it doesn't know about it yet.
You either need to prototype it, like
int interest_rate_calculator(void);

int main(void) {
// ...
}

int interest_rate_calculator(void) {
// ...
}

or re-order the functions
int interest_rate_calculator(void) {
// ...
}

int main(void) {
// ...
}

Most programs typically go with the reordering.
>>
>>58594102
Declare the function before main so the compiler knows how it's called. The actual implementation can be anywhere, even in a different source file you link in later. This is how libraries work.

Implicit function declarations are old crap from early C that didn't really check if you were calling the function properly.

int interest_rate_calculator(void);
>>
>>>58594129
>>58594132
>>58594135
Thanks
>>
>>58594031
don't you use anonymous subs for reduce or map?

stuff like
$sum = reduce { $a + $b } @array;

or
@squares = map { $_ * $_ } @some_numbers;


it's just more concise in some situations, nothing magical.
>>
>>58594064
>>58594073
>>58594031

Let me rephrase: the newer trends in programming are commonly implemented in C++11, 14, 17. Are they actually useful, and if so, can you provide an example in one of your applications?

Don't say x lang is shitty or x is good, provide examples.
>>
>>58594047
>negative integers
>>
>>58594196
>>58594047
>>58593943
Correction:
if(length(str) > 0) {
if( !(str[0] == '-' || (str[0] >= '0' && str[0] <= '9') ) ) return false; //
} else {
return false;
}
for(int i = 0; i < length(str); i++) {
if(str[i] < '0' || str[i] > '9') return false; //is not a int
}

return true;
>>
if doesnt have a .c extension stay away from me
>>
>>58593716
It's more like Java with less forced OOP.

If you want a hipster C/C++ try Rust.
>>
>>58590966
>>
I want to construct some good prpgramming language, what would be actually useful.
Any tips?
>>
>>58594282
>what would actually be useful
C++
>>
>>58594268
What language is this?
>>
>>58591029
jesus fuck you're bad
>>
>>58594311
actually usefull. You should just go Bjarne and stay go.
>>
>>58594327
>implying C++ isn't great
>falling for the bloat meme
>>
>>58594318
Vala
>>
>>58594235
Code tags
Have you heard of them
>>
>>58593550
>The Eudyptula project
Holy shit, that looks fun
>>
File: columbinee.jpg (164KB, 800x600px) Image search: [Google]
columbinee.jpg
164KB, 800x600px
I have a programming exam coming up that's written only. Who thinks up these things?
>>
>>58594404
Professors
>>
>>58594318
It looks like java except for the weird IO (stdout???) statements.
Yea seeing the "strings[] args" part that's definitely java.
>>
>>58594392
Apparently the "Eudyptula Project" and "Eudyptula Challenge" are two different things. I mean the Eudyptula Challenge.
>>
>>58591276
Part (a) is rather long to only be worth 4 marks. I wonder what answer they are expecting and what you are allowed to assume without proof.
>>
File: sparc64.png (94KB, 1280x1024px) Image search: [Google]
sparc64.png
94KB, 1280x1024px
So many threads.
>>
>>58594404
My second programming course, which was required, was taught by a professor who only did written tests, and asked us to do things like completely implement a linked list structure, write multi-file programs we did in labs from memory, etc. The average for that class was below a C, while the average for every other professor who taught the same course was a B-A
>>
>>58594404

That's how tests tend to go. If they were done via computer, it would be much easier for you to cheat by using a browser to search for solutions. They're not necessarily looking for perfect syntax, but it does have to solve the problem.
>>
>>58594502
Sounds like a pretty good class to me.
>>
How to check in C# if my list (that contains objects with 3 properties) has a property value that's equal to string i search for?
>>
>>58594514
My uni just has a special exam mode on all the PCs.
>>
>>58594498
>>
>>58591276

These are questions that I would have received in a couple of my math classes, and not in any of my CS classes.
>>
>>58594534
The debian port is miles better than it was a few months, ago with X actually running.
>>
>>58594554
Nice. I don't necessarily want a SPARC machine, I just want a computer with ore than 16 cores for BasicTV (compression and encryption eat computing power for breakfast)
>>
>>58594584
Yeah, I kind of accidentally lied on IRC, since it has 32(threads).
>>
>>58594616
Oh that's even better. I'm working on an insane stats collection and parsing system that can completely destroy all of the cores to save bandwidth

No threads shall go unpunished
>>
>>58591930
that package doesn't even compile
>>
>>58590966
I am trying to make a program which will read a textfile and will search through it for patterns. I'm kinda new to C. How do you get the program to read the input entered next to the terminal.
Pic related ,i've tried scanf and getline() but they both want the input to be typed after the executable file is called and will not read the text on the executable call.
Anyone know wat do?
>>
File: tumblr_nrav7uUXCW1s9amz4o4_1280.jpg (525KB, 1280x960px) Image search: [Google]
tumblr_nrav7uUXCW1s9amz4o4_1280.jpg
525KB, 1280x960px
H-hi
>>
>>58594679
argv[1] is the first parameter (argv[0] is the executable itself)
>>
>>58594282
common lisp
>>
File: 1478502112041.jpg (502KB, 1200x1912px) Image search: [Google]
1478502112041.jpg
502KB, 1200x1912px
>>58594700
Your a genius and im a retard! how in the FUCK did I not think of that.Thank you senpai.
>>
I'm working on multi threaded game of life in Java. It's a project for uni. I have implemented solving and generating maps, but I need a bit more. And ideas?
>>
>>58593865
>no Racket
>no CL
What a shit chart
>>
>>58594777
Rewrite it in terms of comonads
>>
What's a better language to learn after C++, Java or Python?
>>
>>58594796
Neither

Try Rust, or OCaml, or Haskell, or Idris
>>
>>58594514

The amazing thing about computers is you can use them without them having an internet connection
>>
can't program tomorrow because church and spending the rest of the day reading the bible
>>
>>58594853

You can, but it would be costly to have computers dedicated for test taking, kept off the network. Moreover, you don't really need computers to solve the problems you are typically given on these tests.
>>
>>58594853
Internet is fucking everywhere
>>
>>58594896
Remember to use TempleOS
>>
>>58594896
The Sabbath already finished, friend.
>>
>>58594949
Remember to HERD THE NIGGER CATTLE
>>
Please find at least one reason why Perl is needed and useful.
>>
>>58594961
But he isn't jew.
>>
>>58595061
>bible
>not jew
>>
>>58595081
It's not Tora.
>>
>>58595009
writing binpatches, for me, anyway.
>>
>>58594896
>bible
I hope you debug it first, or better yet, wait for a newer edition.
>>
>>58595096
Please tell more what you do
>>
>>58595111
automate things
>>
>>58595180
I mean, what's so special about binpatches so they are best patched in Perl?
>>
>>58594796
You must have no problems with both languages because they share the same paradigms.
Learn Haskell
>>
what's the highest art of programming?

writing undetectable malicious code?
>>
Why do machine learning """"specialists"""" have such a hard on for java?
>>
>>58595369
Writing readable and human-understandable programs is the lost art, anon
>>
>>58595327
Haskell is literally and actually u.s.e.l.e.s.s.

I have never seen it in any job ads and it has no important projects or programs or anything
>>
New thread:

>>58595406
>>58595406
>>58595406
>>
>>58595392
most are normies who just want to be cool and earn alot
>>
File: 3JPcvsx.png (406KB, 2000x1410px) Image search: [Google]
3JPcvsx.png
406KB, 2000x1410px
how many of you are completely dead on the inside
>>
>>58595431
waddup
>>
>>58593416
what if i'm reusing a single vao? still call glvertexattribarray again?
Thread posts: 316
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.