/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: anime.png (1000x1300, 786K)

Other urls found in this thread:

kiwiirc.com/client/irc.rizon.net?channels=#Jow
learnyouahaskell.com/
amazon.co.jp/すごいHaskellたのしく学ぼう-Miran-Lipovača/dp/4274068854
onlywei.github.io/explain-git-with-d3/
gitlab.com/spacegeneral/moonrabbit-os
github.com/steveklabnik
github.com/ZigmundVonZaun/torrent-tracker-scraper
app.codility.com/programmers/lessons/1-iterations/binary_gap/
graphics.stanford.edu/~seander/bithacks.html.
twitter.com/NSFWRedditVideo

Thank you.

2nd for, where's the IRC shill?

kiwiirc.com/client/irc.rizon.net?channels=#Jow Forumsdpt

Thats better

>anime
good thread

if anything it should be freenode

I have five monitors since I used to stream back in 2012 and had access to cheap/free monitors. And I was too stupid or OBS was too glitchy to figure out how to capture specific windows so I just captured monitor regions. No issues with tiling there. Should I go through the yellow book before or after familiarizing myself with unity's API in VS?

>using shillnode instead of glorious rizon

Making a dynamic array of structs (or more generally with void pointers) is something everyone should be able to do.

>or more generally with void pointers
disgusting
struct dynarray
{
size_t size;
size_t cap;
alignas(alignof(max_align_t)) char data[];
};
Don't use indirection where you don't have to, or else you'll be slower than sepples.

Is there much point using UE4 if I wanna make a 2D platformer in C++?

Attached: 1524451153864.jpg (629x782, 81K)

>or else you'll be slower than sepples.
why is bad tho

>alignas
>alignof
>sizeof
>no sizeas
reeeee why is c so retarded

Attached: images (1).png (202x250, 8K)

Most ressources will do for your case.
You'll want to be able to understand basic programming so that you can learn from more than just youtube turorials for braindead pajeets. For that purpose any OO programming language will do.
It'd be better to go a little bit further and learn more about C# in depth (things considered intermediate or advanced features and/or unique of C#) and programming in general (make abstractions, making your programs composable, etc.). For those cases textbooks are the best. The Yellow book and C# in depth are the ones I see recommended most of the time. You could also skip the C# textbook and just learn the language from documentation and/or msdn guides online and read a more general purpose book on algorithms or programming as a whole.
If you really want to get serious about it, you'll need to understand how memory management works, and stuff like that. For that most resources will be in C or C++, so I guess it wouldn't hurt if you learn those too in your free time.

#define sizeas(n) (char[n])

wow so hard

Attached: c3CUo9o.jpg (600x600, 29K)

what would the semantics of sizeas be?

What is the name of that book?

Japanese version of learnyouahaskell.com/
specifically this one amazon.co.jp/すごいHaskellたのしく学ぼう-Miran-Lipovača/dp/4274068854

I know Racket, is there a reason I should use another lisp or am I good?

thanks dude

Fellow wizard, there's no reason for you to use any other PL. We're set for the rest of the century.

Good op

as an user learning programming, which would be git's and mercurial's essential/basics? I plan to read Pro Git book and Mercurial's Definitive Guide in a very near future

It's coming along pretty nicely, I've just completed the complimentary text editor.

Attached: screenshot.png (1024x768, 19K)

You should learn C. C is the perfectly balanced language, everything older isn't expressive enough to be practical and everything newer is too slow to be practical.

>read Pro Git book and Mercurial's Definitive Guide
Don't. The best way to learn Git and Mercurial is by practicing it. Look for a basic knowledge such as how both of them works online, and use it for your project, while search online for what to do when you encounter something.
Most of git's commands are well documented with git help. Diving thru git help will give you more information than any books

Learn you a Haskell or wikibook to pick up the language quickly?

...

LYAH is faster I think

For me, I like C for the simplicity. I don't do HPC, hell I don't do anything that stresses the performance of some interpreted language. But I still like C because I don't even regularly use all of the whopping 32 keywords. I'd say, it fits in the comfort between "too low level" and "too much cruft".

thanks

After you basically get the fundamentals of git, onlywei.github.io/explain-git-with-d3/ is an excellent visual/interactive sandbox thing with a bit of lessons.

Have this
ssize_t proc_read(struct file *file, char _user *usr_buf, size_t count, loff_t *pos)
{
...
}


Why does it point to *usr_buff and says "expected ; , or ) before * token?
I have compiled program with this exact same function and it didn't give me any errors. Must be something else in the program that is causing this?

Why is there _user there?

>char _user *usr_buf
Is that one parameter or two? Is it called _user or *usr_buf?

I have no idea. This function prints to terminal on call if appropriate module was created. First they used it in example source code and then gave me a project. Now I'm trying to use it and it's giving me that error. First I wrote it manually but after error I copy pasted to be sure but it still ended up with error.

On an social app

Probably not

Attached: notepad++.png (237x113, 2K)

have a github?

>dynamic arrays
>on mcus
whyyyyy

_user could be a macro for a type attribute, check in your working program what _user is

That looks like linux code, did you mean __user?

oops

__user is a an __attribute__, from my understanding it's only used by sparse which is like a linter for the linux kernel.

thanks, anons!

>Android doesn't have a standard, simple way to http POST upload files
>Volley, the official http request manager, has no formal reference documentation of its methods and classes
>when someone asks for documentation for something that isn't covered by the 1-page tutorials, people say "just read the source code bro"
>almost every open source app which handles image uploads implements their own complicated spaghettified implementation of file uploading
fuck me up daddy

Attached: oo77PfLUH1gAAAABJRU5ErkJggg==.png (225x224, 8K)

>Android

Attached: gabu.jpg (800x450, 78K)

>either having a Windows """phone,"""" having an iShit, or not having a smartphone

Attached: throwpillow,small,750x1000-bg,f8f8f8.u6.jpg (750x1000, 133K)

why are you doing mobileshit at all?

A third Party app for a qt based poker app. Today I fixed a bug, that I had for years.

>>>>>>>>>>>>>>>>>>>>>>not having a smartphone

Attached: jfyETBg.jpg (1024x595, 69K)

it's my job senpai
the application would only work effectively on a mobile system, and I decided Android was a better platform to target

Retarded Wojakposter

Attached: 1506669552781.png (469x452, 277K)

>it's my job senpai
RIPIP

dumb frogposter

Attached: 1528838785777.png (620x581, 16K)

I'm trying to get a go script to run an iptables command but it keeps putting the fucking argument in [] brackets, it comes out as
iptables [-blah -blah -blah]

instead of
iptables -blah -blah -blah

I'm kinda noob at this, wut do?

stupid brainletposter

Attached: 1506104552620.jpg (1200x1200, 330K)

dumb animeposter
>inb4 "anime website"
dumb "anime website"poster

Attached: st,small,215x235-pad,210x230,f8f8f8.lite-1.jpg (210x230, 7K)

who are you quoting

dumb "whomst arst thoust quothingst" poster

Attached: tndy.jpg (711x508, 4K)

you tell us nigger

Here:
gitlab.com/spacegeneral/moonrabbit-os
keep in mind that I used it mostly to keep track of my progresses for my own use, the documentation is still not quite there yet (especially regarding build+run).

anime industry
anime field
anime science
anime hobby

Threadly reminder that programming is a subset of anime.

thanks lad, i just like reading source code of hobby OS's.

I have the choice to:
1. Make a big subroutine that takes a list reference and processes it
2. or make a smaller subroutine that takes a scalar to do the processing, and using a control structure outside of the subroutine to handle the list.

The language is Perl 5, but I figure its a more general question for which is preferable. I can't make out if one is actually more memory efficient. Is one of the two preferable for comprehension or anything?
It should be said that option 2 is shorter and less bulky in general.

freenode is for sjws

Thank you user!

Attached: ap2Y058_460s.jpg (460x457, 55K)

I'm more of a social justice rogue

Some easy Numerical Simulation work in python for my CFD class. I also have to do a matlab project for heat transfer next week... finite difference for temperature change mapping.... I hate matlab.

Attached: image.jpg (1092x1037, 310K)

Can anyone explain to me the difference between an SJW and an SSBBW? Because it seems to me there is none?

Posted this in some dead thread.

I did C like a year ago. Now we're doing OS programming and I forgot lots of small details about C language. Any advice, material on how to quickly pick it up again?

post the line in the script that generated this

Just use assembly

I roleplay as an employed haskell programmer when I fuck gf.

dumb frog poster

Who releplays your gf?

in c++ if I have a byte that I use for flags how do I check them efficiently?

use std::bitset
if you don't want to use std::bitset, use a bitfield struct
if you don't want to use a bitfield struct, use your bitwise operators.

make a medium subroutine taking the data and one or more callbacks.

byte & FLAG_XY_CONSTANT

That's how I'd do it, just define your flag constant as powers of two

Das me

Attached: image.jpg (750x743, 356K)

Mai waifu.

How hard is it to learn if I "know" C?

go play shenzhen IO, it's a really good intro to ASM, i think.

Its pretty awesome, have an (You)

It's a subcategory. A counter-example:
>github.com/steveklabnik

Im working on a public torrent tracker scraper. Its coming up bretty bretty good. Check it out guys
github.com/ZigmundVonZaun/torrent-tracker-scraper

Attached: 734.png (552x698, 273K)

>the most advanced program I've written is a 500 line program to help me with shitposting on Jow Forums
>can't use it for github/anything because I don't want to show my powerlevel

Attached: sad frog.png (421x407, 78K)

TIS-100 is better if you don't want to be insane because of the space limitation in schenzen IO

>500 line program to help me with shitposting on Jow Forums
Impressive

Better than me, at least sounds like you had fun.
I've written like 2k word program on shitty uni project.

I learned a lot of shit just by fumbling around, so I guess that was worth it.

The other thing that sucks is I can't post it even anonymously because it shares a lot of programming quirks in my public stuff.

Attached: file.png (979x512, 34K)

>monitor general for tripcode

Attached: dvq8uUH.jpg (906x813, 103K)

Can you use libcurl to asynchronously download large files?

Yes. You use the multi API to do asynchronous stuff.

Attached: 1t0amw.jpg (600x399, 58K)

In C is there a way to determine an array's size based on the binary value/size of a given number?
Example:
int solution(int N){
int arr[size of N] = {0};
// ...
}

int main(){
printf("%i", solution(any numer);
return 0;
}

If 17 is given, it's 10001. Only 5 digits.
Something like 89425 is 10101110101010001 is 17 digits.

This isn't a homework assignment, just a problem from codility.com about finding the greatest gap between two 1's for the given value N.
I succeeded, but didn't account for very large binary groups.
app.codility.com/programmers/lessons/1-iterations/binary_gap/

fllor(log2(n)) + 1

>fllor
floor*

hahahahaha how the fuck is web development real like nigga write html like just use a stylesheet lmao

this is /dpt/ not /wdg/

In gcc and clang:
(sizeof(N)*CHAR_BIT)-__builtin_clz(N)

For other compilers, see under "Finding integer log base 2 of an integer (aka the position of the highest bit set)" at graphics.stanford.edu/~seander/bithacks.html.