/dpt/ - Daily Programming Thread

What are you working on?
Previous:

Attached: 1472676648-7963a5927d16a13d3b9447c8316ca95f.png (500x281, 207K)

Other urls found in this thread:

haskell.org/
brokenthorn.com/Resources/OSDevIndex.html.
brokenthorn.com/Resources/OSDevIndex.htm
youtube.com/watch?v=IRsPheErBj8
en.m.wikipedia.org/wiki/Heaven's_Memo_Pad
myanimelist.net/anime/10568/Kamisama_no_Memochou
animenewsnetwork.com/encyclopedia/anime.php?id=12865
tvtropes.org/pmwiki/pmwiki.php/LightNovel/HeavensMemoPad
en.wikipedia.org/wiki/Spirited_Away
github.com/drathier/stack-overflow-import
github.com/Microsoft/vscode/issues/329
speakerdeck.com/freedomofkeima/deep-learning-in-python-image-recognition-for-anime-characters-with-transfer-learning
twitter.com/NSFWRedditImage

>What are you working on?
clojure for the brave and true

Why haven't you learned Haskell yet, Jow Forums?

Thank you for using an anime image.

Attached: karen haskell.png (1280x719, 818K)

Trying to learn the basics

How long did it take anyone else?

Basics like conditionals, loops, and functions?

It might take a while when you're just starting, but you only need to learn those concepts once. Then you can apply them easily to most other languages you learn.

Time. Any haskell quick tour or is that bad?

haskell.org/
(it's not a real REPL and is very limited)

Trying to find something fun to do with it. I was thinking of fucking around with servant to throw together a simple dnd game manager.

Any link for good haskell tutorial / guide for someone that have C experience?

C experience is completely irrelevant for Haskell.

what i some good project i could work on? I almost finished a stacker terminal game written in c but got frustrated at the very end. I know a bit of C, C++, Python, java (and matlab)

I'm trying to get better but i don't know what to do

LYAH/wikibook/haskellbook

How to get consistent device names (e.g. cameras)?
/dev/video0 used to be my laptop camera and /dev/video1 the USB camera. Now /dev/video0 is the USB, video2 is the integrated and video1 and video3 exist but don't display anything.

Looks nice so far. Thanks

Making a graph editor with opengl.

I'm having trouble learning strings

What about strings is giving you a hard time? Could you post some example code that you don't understand?

you don't you shouldn't rely on that, enumerate the devices instead

A string is just a piece of rope my guy

Newfag here, what is the criterion for choosing a programming language?
I tried to go towards computer networks, but I noticed that it was much harder to find a job in this direction.
I've tried few languages in school like c++, javascript or PHP but i feel no difference.

I posted my penis in a thread on /v/ with a timestamp to win an argument.

Am i fucked? Can they find my identity?

just pick something and learn it thoroughly, then picking up new languages will be easier. python and java both are used heavily in industry and have a lot of tutorials available for beginners.

yes they can but fuck off this isn't the right thread

only if you're circumcised

c and assembly is for men
java and c++ is for learning in college
javascript and php is for internet stuff

cobol is for maintaining social security systems

this is just general stuff

Learning a bit of Go, it's supposed to be good for hobby projects. Any ideas for hobby projects?

only if looks like the cover of no love deep web by death grips

a toy irc server

Working on a framework right now lads, how about y'all

Good idea desu

A string is just an array of characters.

Learn arrays and 95% of all programming will make more sense.

Programming a bootloader is hell.

How much time a day should I spend learning? How much time a day did you spend? (Noncollegefags of course)

I wouldn't call it painful, just different. You're setting up an execution environment for a kernel using the barebones tools at your disposal when the machine first boots up. And yeah, x86 is particularly weird in how it works at boot up, but there's plenty of documentation about its weirdness.

Diving slowly into Rust. I kinda like its ownership/borrowing system. What do Jow Forums think about it?

I use it full time at work. After a couple of months fighting with the compiler it feels pretty awesome to work with (but those first few months are not fun). That ownership/borrowing system imparts lessons on you that you carry over into other languages as well.

Life sucks until you understand lifetimes and quit fighting the compiler. Then it's wonderful to work with and you write better code in other languages because you avoid common bugs that Rust doesn't let you make.

It isn't a magic bullet and you'll still write buggy programs - especially if you do anything non-trivial (eg: require unsafe code)

I'm trying to learn OSdev and currently I'm reading this brokenthorn.com/Resources/OSDevIndex.html. Maybe I should just use GRUB.

>heaven's memo pad
Did not expect to see this after it aired

>heaven's
What bootleg ass motherfucking subs did you watch?

神様 means "god" not "heaven". Heaven would be 天国

>brokenthorn.com/Resources/OSDevIndex.htm
bootloading is the worst, just skip it

youtube.com/watch?v=IRsPheErBj8

en.m.wikipedia.org/wiki/Heaven's_Memo_Pad
myanimelist.net/anime/10568/Kamisama_no_Memochou
animenewsnetwork.com/encyclopedia/anime.php?id=12865
tvtropes.org/pmwiki/pmwiki.php/LightNovel/HeavensMemoPad
Fuck off retard.

Attached: bluray.jpg (1280x915, 260K)

enum {
flag0,
flag1
};

typedef struct {
int flags;
} thing;

or
typedef struct {
union {
int flags;
struct {
int flag0:1;
int flag1:1;
};
};
} thing;

LMAOOOOOOOOOO

Attached: koth laughing.jpg (680x962, 184K)

Bitfield layout isn't portable, so maybe you don't wanna do that.

I don't see why you don't simply use a bitfield struct though.

Attached: dijk.jpg (480x362, 34K)

Google Translate is better than the translation team.

>神様のメモ帳

It's a pretty nice anime actually

"Official English Titles" are often shitty translations of the source material. One of the most famous Studio Ghibli films is incorrectly titled for the English release.

Just because it's marked as "official" doesn't mean it isn't a shitty translation.

>千と千尋の神隠し
Actual translation: Sen and Chihiro's Spiriting Away
Translation for American brainlets: Spirited Away
en.wikipedia.org/wiki/Spirited_Away

Attached: kill the anime fags.jpg (1370x1116, 710K)

>wikibook
since when are those any good?

get back to

what is the colon and the number after it means in
struct {
int flag0:1;
int flag1:1;
};

even trough I use C a lot, I've never seen that thing, is that a bit level hacking stuff?

That's called a bitfield struct. It's basically automated bit shifts to pack n-bit flags into a single integer type so you don't have to do them yourself.

bitfield. The number is how many bits the number should ocupy

fucked that up a bit, it should be
enum {
flag0 = 1,
flag1 = 2,
};

This is a problem just waiting to happen, user. If your flags are enum and your first flag is 1 just name your flag0 flag1. I don't know your use case but you'll avoid many off-by-one errors in the future. Name things in a way that doesn't force you to go read the code.

enum {
flag1 = 1,
flag2 = 2,
};

How do I take return a user to ask for the prompt again in Java? I'm making a program where people can get info on some Guitar Companies, super simple, but I'm not sure how to redirect a user back to a scanner prompt after printing out what I have.
import java.util.Arrays;
import java.util.Scanner;

public class guitar {
public static void main(String[] args) {
Scanner basic = new Scanner(System.in);
String[] companies = {"Gibson", "Fender", "Breedlove", "Epiphone", "Ibanez", "Yamaha" };
String[] colors = {"blue", "red", "orange", "white", "cream", "yellow", "black"};

System.out.println("Hello there! Today, we are going to find out what guitar you should look at.");
System.out.println("The most common guitar colors are: " + (Arrays.toString(colors)));
System.out.println("Some of, but not all, guitar companies are listed here. " + (Arrays.toString(companies)));
System.out.println("What company or color would you like to know more of?");

String choice = basic.nextLine();
if (choice.equals("Gibson")) {
System.out.println("Gibson is known for it's Les Paul model, which often comes in a bright red model.");
}

}
}

Also, would there be an easier way to ask for the information rather than making an if/else loop for every company and color, or is that something to do manually?

You can put the prompt in a loop.

you dumb fucking roody-poo

Do you guys read books? were having an argument on agdg

Attached: 1519773120605.png (1063x550, 60K)

>take return a user to ask
tf am i reading

Attached: backprop.jpg (1334x868, 59K)

take it one step further
github.com/drathier/stack-overflow-import

>pajeets thinks its better to copy and paste from stack overflow than to actually understand how things work
colo me surprised

So a while loop for example? I can see how I can utilize that if the answer for input isn't something listed in the arrays (maybe (while(!choice.equals(""))) or something, still a brainlet), I'm not sure what loop I would be using to continuously prompt.

Sorry, just meant how do I return a user to prompt an answer again after I received their input then printed out either the information. In this case, the information for the color, the company, or printing out an error message if neither were input.

This combined with the fact that half the people dont seem to fully understand English im starting to think it is just for pajeets.

As an example:
set a boolean like prompt = true.
iterate over it. if user sends "exit" change prompt to false, loop will exit.

Have you seen the bug tracker for any large Microsoft project?

It's someone explaining the issue and how to reproduce it and the expected results perfectly in English while a bunch of pajeets have no clue what the person is talking about, offering solutions to things that aren't the actual problem, and after it's been explained to them what the problem is several different times just lock the thread saying they don't understand the problem.

They don't even understand what "portable installation" means: github.com/Microsoft/vscode/issues/329

it's not if you want to implement efficient algorithms

while(basic.hasNext()){
choice = basic.nextLine();
if(choice.equals("exit") break;
//do something
}

Does anyone have experience with convolutional neural networks/tensorflow? I have a ton of data that I want to train something on, but I want to know what is likely hood of getting good results?

Attached: screenshot.22.png (1070x572, 452K)

Ive used it a bit.

Makes sense to me.
flag0 --> 2^0 = 1
flag1 --> 2^1 = 2
flag2 --> 2^2 = 4

I have experience with all of these things. What kinda data you dealing with?

Well, did you manage to get out of it what you wanted?

>What kinda data you dealing with?
Images, 2D art. I want to build something that auto-tags images of a particular type. I have around 4million images of that type to work with.

I can program, but I've never touched NN stuff before, so it's completely out of my field.

You'll most likely need a large catalogue of manually labelled cartoon porn to be able to classify your collection.

How to learn all of java in under 1 hour for an exam?

Thanks for reminding me of this. I remember reading the whitepaper for something similar (may have been this exact project) but couldn't find the code.

Oh, all images are already tagged thanks to e621/gelbooru/etc. However this should be useful in tagging future images added, or atleast as a 'suggestion' feature.

speakerdeck.com/freedomofkeima/deep-learning-in-python-image-recognition-for-anime-characters-with-transfer-learning
Sadly the one I found doesn't really go into depth, just surface level explanations and images of how it works.

Okay, image recognition is the kind of thing that convolutional neural networks are basically designed for. Important questions though:

1. Are all of your images in a standardized format. That is, same dimensions and same color palette? If not, can you transform them all into a standardized dataset? The reason I say this is because you're going to want to map the images onto a fixed set of "features" that will be the same for each image.

2. Are you looking for a single label for each image (e.g. this is a horse, this is a cat, this is a mountain), or multiple labels (e.g. this image contains a horse, grass, and a mountain, this image contains a cat and a desk and a couch)? In the case of the latter, you may be dealing with a structured prediction problem, in which case, I would recommend PyStruct (which right now is basically the only decent structured prediction library out there for pretty much any platform).

have a look at the tensorflow tutorials
tensorflow is a tool to build networks, it is not a network architecture. the success of your network is dependent on the architecture, which is up to your design (read: a publication of your choice's design).

I've learned all the basics of C++ till classes, but how do I continue now? When I look at other people's code, they are using a lot of other things which I don't know yet. So, where do I learn those things?

Google the concept and read the documentation on it.

>That is, same dimensions and same color palette?
No they're going to vary wildly. The color pallete should mostly be the same, but considering it's 2D art, and every artist has a different style, I'm not so sure.

> If not, can you transform them all into a standardized dataset
I guess I'd have to figure out a way of doing that. My best guess is separating each artist and then turning those into a standardized set, meaning it'd be able to recognize images from a particular artist, but not the image as a whole, which is fine for now.

> Are you looking for a single label for each image
Single label, I only care about the character in the image being defined.

Thanks for the advice, I have some ideas.

>the success of your network is dependent on the architecture, which is up to your design (read: a publication of your choice's design).
Curious, why is everyone building these frameworks off python? Wouldn't C++ or even C# make more sense for something doing this much processing?

Attached: screenshot.23.png (1133x656, 228K)

>Curious, why is everyone building these frameworks off python? Wouldn't C++ or even C# make more sense for something doing this much processing?
the backends are written in languages like C++ (usually C++ as far as I know).
python is fast to write in, C++ etc is fast to run. thus, frontend python, backend C++.

>No replies

Attached: maxresdefault_2.jpg (1280x720, 56K)

Some days not at all, other days I stay up all night learning and trying stuff out. I'm sure it's something that some people (like me) pick up really quickly while others struggle for months working their butt off but making barely any progress.

When I say dimensions I am not talking about artistic differences. What I mean is like... would you have an image that is 800 pixels x 800 pixels in the same dataset as one that is 1920 pixels by 1080 pixels? If you do, and you want to base your features on the pixels in the image, that is going to be a problem.

To use this data with a machine learning algorithm of any sort, you are going to need to map the datapoints onto a fixed-width vector of "features". So imagine some array of numbers that can represent the image you are trying to classify. You are going to want to make it so that any image you are trying to deal with, you can map it onto an array of numbers of the same length, every time. For image classification, it might be common for those numbers to represent the color values of each of the pixels, or an average of the colors in some fixed size block. The thing is, if the dimensions of the image are all different, you will need to find a way to transform that image onto something standardized. For instance, pick a maximum width and height, scale the image down so that both dimensions are less than that, and put a solid black border around it so that everything has the exact same dimensions.

>Curious, why is everyone building these frameworks off python?
People who are very good at machine learning are often not very good at engineering. Regardless, Tensorflow has its backend in C++.

Yea, the one I read was an actual whitepaper released to publication - not this slide. I'll see if I can find it again.

What is it with anime and those diamond-truss shelf constructions?

>Oh, all images are already tagged thanks to e621/gelbooru/etc
how?
hydrus network?

>Single label, I only care about the character in the image being defined.
An image may contain multiple characters that can be detected, so the output of your network still needs to be multivalued. The sort of problem you're describing is well studied. Take a look at (C)NN architectures like R-CNN and its many, many variants. These are available in "library: form for most ML frameworks out there. I would also suggest to start with PyTorch instead of Tensorflow, as it is much more coherent design/API wise and far, far easier to tweak a published / established architecture to your own liking.

Also, make sure you follow Ruby's advise above and pre-process all your images to some sort of standardized format, otherwise you're gonna have a bad time. Also, from your description, you're using Gwern's Danbooru dump?

Many thanks for using an image originating from a Japanese animated series.

Attached: 1487681636678.jpg (1280x720, 98K)

Why unsigned overflow is well defined in C, but signed overflow is UB?

>PyTorch
Haven't heard of/used this, but would like to throw a recommendation into the ring, and that is Keras. It's sort of a wrapper around Tensorflow, and it makes convolutional neural networks easy as fuck.