/dpt/ - Daily Programming thread

Previous: →

What are you trying hard to be working on, Sup Forums?

Other urls found in this thread:

docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
v8project.blogspot.com/2016/10/webassembly-browser-preview.html
en.wikipedia.org/wiki/Bin_packing_problem
myanimelist.net/modules.php?go=api
xmlsoft.org/
learnxinyminutes.com/docs/csharp/
strawpoll.me/11545470
twitter.com/SFWRedditGifs

1st for F#

To get my motivation back.

can anyone explain the filesystem/ filehandling in java to me?

I'm trying hard to be working on learning how to write an mp3 decoder.

German, by any chance?

Refactoring an erlang project.

if (op.image.isAnime() == true)
reply("Fuck you for using anime weeaboo scum\n");

I love how this samefag is triggered each and every time.

>== true

Nope.

if you're lonely just say so

Doesn't MISRA require that?

/dpt/ can't make a JS script that sorts comments by the number of replies they have.

oh, that would be interesting to look at

getting a gf

YOU HAVE 10 SECONDS TO WRITE A FUNCTION THAT TAKES IN A FOUR DIGIT NUMBER AND RETURNS THE HIGHEST DIGIT

no u

max(raw_input())

('div' 1000)

I don't wanna......

Haha.
Well, but we can program one, dont we?

I always wanted that feature. I'll look into it

Oh wait did you not mean the first one?

maximum . map read . show

hopefully intro to AI that I'm taking this semester will teach me that

No.

Yeah I worded it poorly, sorry

post results

oh sorry, I thought program not function

lambda x: max(str(x))

I'll share my gf on Sup Forums if I ever write one

thanks famalam
I await eagerly

do so, please
its my only chance

Whoops

maximum . map (read @ Integer) . pure . show

The slut.

So far we are teaching a machine on paper how to recognize if papaya is good or not, that's pretty close right? ...right?

Made a shitty script that does that a while back.

var replies = document.querySelectorAll('.replyContainer');
var replyCount, n = 0;
var chanX = document.querySelector("[title='Sup Forums X Settings']") !== null;

function getReplyLength(node) {
if(chanX) {
return node.querySelectorAll('.desktop .container a').length;
}
return node.querySelectorAll('.desktop .backlink > span').length;
}

for(var i = 0; i < replies.length; i++) {
replyCount = getReplyLength(replies[i]);

if(replyCount > n) {
n = replyCount;
}
}

while(n !== -1) {
for(var i = 0; i < replies.length; i++) {
replyCount = getReplyLength(replies[i]);

if(replyCount === n) {
document.querySelector('.thread').appendChild(replies[i]);
}
}

n--;
}


Could be cleaner and looking at it now, I don't really know what's going on, but meh, it works.

>open source GNU/Girlfriend

you have to have a lot of data
how will... how will we get data

>tfw you write a girlfriend and she rejects you

>tfw you write a girlfriend and she deletes herself rather than sleeping with you

Fuck off, nip moot, you just destroyed my userstyle.

>YOU HAVE 10 SECONDS
Nah, I took my time.

#include

int main(){
int num;
int dig = 0;
std::cin >> num;

for(int oom=1; oomdig) dig=(num/oom)%10;
}
std::cout

with proper training set she won't know what rejection is

but how are we going to get said training set...

...

>with proper training set she won't know what rejection is
l-lewd

>ftw fucking your AI girlfriend until her stack overflows

Works fine with OneeChan

what purpose does the java.util.Scanner serve?

What font is that?

Doing everything with objects is obviously always better, duh

Roboto

docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
>A simple text scanner which can parse primitive types and strings using regular expressions.

fugg

what is the best language to write your girlfriend in?

i guess java, since i can run easily port her to my smartphone then.

arexx

They taught us Prolog and Python to start Intro to AI so I would say these, we are using them in that course

okay.
if i make my girlfriend too smart, she might come to the conclusion she can date someone else (as every other woman I knew did), so i have to be careful.

Box packing algorithm. My workplace has put me on a long term project to develop ways to make our warehouse packing more efficient. I've currently got a stack and slice method going, but I'm considering a 2D pack and slice method instead.

That or, considering we have hundreds of thousands of records of how items ought to be packed, finally taking the plunge and learning muh mashin lurnin

sounds interesting.

Could you give a rundown of the algorithm?

Sounds coolio.

What shape are the boxes?

Fucking square you retard

I mean the things you're packing them inside. If they're all square boxes, than the algorithm can be made in less than a few lines.

v8project.blogspot.com/2016/10/webassembly-browser-preview.html

what's going to happen when you give web devs c/c++?

Is there anywhere I could find a condensed English or pseudo code outline of the typical structure of video games?

I was just mucking around :)

Sort items by largest side area. Reduce problem space by checking bounds of the containing boxes and a rudimentary stack of items, considering the majority of our items are stackable tile shapes.

Grab largest item, fit in smallest necessary box for all potential items, run reducer each time you fit an item, opening and closing boxes as needed until the smallest item is fit. It runs in shitty n^3 time because it's dependent on the number of possible containers.

Boxes are all six sided, quadrilaterals of unknown dimensions for sides.

I originally went with a method that takes the space above and space beside the box because I thought splitting into three spaces might negatively impact performance but it seems that the system I'm running on and the overall size of the packs can handle it.

I don't know machine learning. But I know how to learn it.

>make_share

Look up the doom source code on github if you're feeling real daring

trying to figure out how to send a keystroke over a network in java. The key values I know are an integer, but how will the server handle it to control the program its running

>It runs in shitty n^3 time because it's dependent on the number of possible containers
I mean, if you're only going to be running it every so often, that's okay.
I just looked up the problem. Apparently it's NP complete
en.wikipedia.org/wiki/Bin_packing_problem

Thinking about writing a program that can give me a random anime from my plan to watch list on MAL in C. You think that would be a doable project for someone who have pretty much started out with C?

I guess I would first read the source code from the plan to watch list, then extract the ID of each anime into an array. After that randomize an array position for one of the anime IDs, and open that one in a web browser.

How would be a good way to sort out every thing other than the IDs from the source code and get them into separate positions in the array? That feels like it would be the hardest part. Can you open stuff into a browser from C?

I wrote a script so you can SELECT YOUR SPOOKY SKELETON
var s = document.getElementById("skellington");
window.change = function(n){window.skeleton+=n;if(window.skeleton < 1){window.skeleton = 23;}if(window.skeleton > 23){window.skeleton = 1}document.getElementById("skellington").src = "//s.4cdn.org/image/skeletons/"+window.skeleton+".gif";};
var a = document.createElement("a");
a.innerText = "next";
a.style.position = "fixed";
a.style.right = "150px";
a.style.bottom = "0px";
a.style.cursor = "pointer";
var b = document.createElement("a");
b.innerText = "previous";
b.style.position = "fixed";
b.style.right = "200px";
b.style.bottom = "0px";
b.style.cursor = "pointer";
document.body.appendChild(a);
document.body.appendChild(b);
window.skeleton = 1;
window.change(0);
a.onclick = function(){window.change(1)};
b.onclick = function(){window.change(-1)};

>implying I'll download your botnet

>not webassembly

>program something for a deadline that was much tighter than it should have been
>no peer review
>only other person on the project was in process of leaving

>months later, customer finds five robustness faults

Feels so bad, man. My pride has really taken a hit. I'm not even sure how to make up for it (to myself).

What should I read if I want to learn C#? Know C++ and OOP, I just want to learn the language.

Probably a textbook or something

dont listen to this user, there are many pdf documents and powerpoint presentations that you could learn from just as well, if not better,

You may want to start simpler, referring to HTML as "the source code" and questions like "Can you open stuff into a browser from C?" indicate you have a lot to learn about these various technologies, let alone how to interact with them in C.

If you would like to make a try of it, I would recommend using their API instead of scraping HTML (if you don't know what an "API" or "scraping" is, these are other concepts you will need to learn)

myanimelist.net/modules.php?go=api

This returns data in XML, so you will need to learn the basics of XML, and then how to use it in C
xmlsoft.org/

Sauce, please, OP. Please.

ReLIFE

learnxinyminutes.com/docs/csharp/

If you just need syntax, read this and then scrounge MSDN for definitions.

strawpoll.me/11545470

Don't know how much machine learning is going to help you. Your problem isn't a learning problem, it's an optimization problem. Yes most machine learning is optimization, but they are different.

For this type of problem you have your naive packing solution (similar to the naive solution to the knapsack problem), some kind of first fit linear algorithm, or the combinatorial solution.

whats an xkdc?

>no ritchie

What's a paladin?

a word that's the same forwards and backwards

that would be a palindrone

Is upgrading to code academy pro a worthwhile investment for learning how to program? I'm asking mainly because of the access to projects and I personally feel I'm learning a few things with the introduction courses.

...

i just want to breed all anime posters

it's a reflex

I hope this is a joke.
Codecademy doesn't teach anything, it just has you copy and paste some contrived examples and CONGRATULATIONS YOU'RE A CODER NOW :)

a scary picture

don't know what codeacademy pro is like, but I don't think u need it since u can download books and watch tutorials on youtube. If u prefer courses take presencial ones

wtf. Since when does strawpoll does IP checking?
curl -d 'options=116316442' strawpoll.me/11545470 didn't work

There is a built-in class called Scanner in Java to easily get the user input. What it does is it acquires information from the input stream, either from the keyboard or a file, and stores it in a variable. However, the Scanner class is not part of the core Java language so you need to tell the compiler where to find it.

import java.util.Scanner;

Yep, I'm going through books and youtube videos myself along with using the CA's introductory courses. I was wanting more hands on with projects, I'm under the impression there will be enough to get me fluent in Java.

Not sure where else I can look

>referring to HTML as "the source code"
Yeah, that was a blunder. Wrote that since "View page source" in Firefox is written as "Show source code" in the Swedish version.
Will look up those things though.