/dpt/ - Daily Programming Thread

previous: What are you working on, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=iDj8U_xRKyI
en.wikibooks.org/wiki/Java_Programming
codeproject.com/Articles/25057/Simple-Example-of-MVC-Model-View-Controller-Design
youtube.com/watch?v=65KhNiYZajg
twitter.com/SFWRedditGifs

I have a python/maths question I'm wondering if I can compress this code, here's the relevant code
e = (a+c)/x
f = (b+d)/x
g = 100*(f/(f+e))

I'm fucking slacking!

Me too :(

I've always wanted to write a toy emulator but I don't know where to begin.

g = 100*(b+d)/(a+b+c+d)

is there a way to have vim do syntax highlighting? i'm finally comfy with the commands but it'd be helpful in using it to code

Is it possible to train a machine learning algorithm that would recognize a character from an anime on pictures (with different drawing styles) ?
Has this been done ?
I know it can be done with normal photos but can it be done with faces in drawings ?

that can't be right. where's X

sounds possible to me

:syntax on

thanks, i assume it just goes off the extension?

it cancels out.

We should make a bot that gives a 10 minute ban and deletes the thread when people accidentally make a thread with /dpt/ in the title that doesn't have anime in it.

Why aren't you programming on an e-ink monitor friends?

shit did they finally come out with one? just in time for me to have completely lost interest in e-ink. how much is is this time? last time they came out with one it was like $800

>type a word out
>whole screen flashes
no thanks

I'm pretty sure it might be the same on. they're expensive.
youtube.com/watch?v=iDj8U_xRKyI
also they're chink shit that needs its own software so you know there'll be all kinds of issues.
but E-ink definitely is more pleasant

>open image
>chinkshit
ehhhhhh

see clearly false.

Wrote a little ruby script to generate random names using markov chains. The names are of "shitty fantasy novel" quality.

A few favorites
Stefferson
Tylanarquiellai
Books

Is they a more elegant way to do

public void removeEdge (V from, V to) {
if (!(this.contains(from) && this.contains(to)))
throw new IllegalArgumentException("Nonexistent vertex");
neighbors.get(from).remove(to);
this.remove();

}

public Map outDegree () {
Map result = new HashMap();
for (V v: neighbors.keySet())
result.put(v, neighbors.get(v).size());
return result;
}

public Map inDegree () {
Map result = new HashMap();
for (V v: neighbors.keySet())
result.put(v, 0); // All in-degrees are 0

for (V from: neighbors.keySet()) {
for (V to: neighbors.get(from)) {
result.put(to, result.get(to) + 1);// Increment in-degree
}
}
return result;
}

public void remove(){
Map indegree = inDegree();
Map outdegree = outDegree();
for (V i: indegree.keySet()) {
for(V o: outdegree.keySet()){
if ((indegree.get(i) == 0 && outdegree.get(o)== 0))
this.removeVertex(i);
}
}
}

public void removeVertex(V vertex){
if(!(this.contains(vertex)))
throw new IllegalArgumentException("Nonexistent vertex");

for(Entry v: neighbors.entrySet())
v.getValue().remove(vertex);
neighbors.remove(vertex);
}


So that

The current graph:
1 -> [2]
2 -> [3, 4]
3 -> [1]
4 -> [1]


1 -> [2]
2 -> [3, 4]
3 -> [1]
4 -> []


1 -> [2]
2 -> [3]
3 -> [1]
4 -> [1]


1 -> [2]
2 -> [3]
3 -> [1]


When I remove the edges?

ah, yeah dasung. seen it. i just download redshift, step outside and rest my eyes for a bit, and call it a day.

what I'm interested in is when they can make big e ink devices for cheap. they have a few our but they're super expensive. E ink is great, just as easy as reading a book, but it has to be strictly text so usually no educational books or most PDFs because the formatting will just be unbearably bad and impossible to read.

Why has gaming become so shit?

educational books would be alright in a big clipboard size reader like this one. It'd just be like a black-n-white copy of a page in an educational book

i'm doing the Java Course on Code academy and i can't understand this answer. Shouldn't it be "print true" since 10 != 0

No. 110 % 100 evaluates to 10, as 10 is the remainder of 110 divided by 100.

110%100 = 10, nigger

Jesus fucking Christ... i was doing 110 % 10 loool thanks for pointing how stupid i am. better go and get some sleep cause it seems i can't think straight anymore

what gaem

code academy user here.... btw is there any good book/other resource to learn java other the code academy?

>Code academy

sorry mr. trump. i voted for you

Classes in school? I've used Java since high school sophomore year. All my college classes use it too.

en.wikibooks.org/wiki/Java_Programming

if you just arbitrarily chose java as a first language to learn then read SICP instead

>Blue revolver, least retarded game recently released
Everything else is either candyclick simulator or truckfuck saga

lol, I think I contributed to that book >10 years ago when I was in high school and learning Java.

looks like one of the games i played in middle school on newgrounds

Lads, any MATLAB'ers here?

Really need some help

t. brainlet

haha, funny picture. I hope you find someone that can help you :)

Really though lad, wouldn't mind my neurons being stimulated .

i would heem you instantaneously if you asked me this in real life

Thanks friend.

That one's discontinued. Sony Digital Paper. Only one I know of that currently exists and is big enough to read PDFs is the Goodereader one on Indiegogo for $700+

It would probably be real nice to have, but I don't care enough to spend that much on one, my PC costs less. I hope big ones come down in price and more people make them.

sure are talking the piss there m8

if you tried anything you'd be eating pavement in under a second

Can someone explain to me how the listener workers in codeproject.com/Articles/25057/Simple-Example-of-MVC-Model-View-Controller-Design
I'm trying to learn MVC, they added the controller as the listener in the view section of the code. So when a button is pressed isn't the listener suppose to handle the action? The controller(listener) doesn't handle the events, view is the one that actually handles the button clicks events.

You guys should all join codingame, it is probably the best online programming challenge site out there.

>MATLAB
literally worse than the worst programming languages combined

>let's completely change the standard every new release to throw off pirates but also put a huge burden on paying businesses who now have to relearn the standards
>let's also do it in a convoluted way so that nobody can do shit

It's also only Turing complete in theory. I'd honestly, HONESTLY, unironically rather you use fucking Python or C++ or Java or Fortran or assembly or fucking ANYTHING other than Matlab.

What are they saying, Sup Forums?

woman: hello girl are you making a nice code
girl: yes
woman: you are good with programs

...

Should constants be all caps, or should they follow naming convention of variables?

ThEy ShOuLd AlTeRnAtE cAsE.

autism

Literal faggot.

ok kid

Only an autist would care

It's one thing being gay, but trying to pretend that you're straight and goes on the internet to flaunt how delusional and insecure you are is another.

>goes
going*

who said anything about being gay?

are you ok user?

Projection.

who said anything about pretending to be anything?

>who said anything about being gay?
Are you going to try and argue that liking traps is not gay?
Seriously?

The meme is about BEING a trap, not liking them.

>BEING a trap
That's clearly a sign of a mental illness.

it improves your ability to write machine code though

XDDD UR SO FUNNY XDDDD!!!!11!!1!!!1!

What is the purpose of threading in Python? My understanding is that GIL prevents two threads from running simultaneously, so what's the point of calling a thread rather than just a function?

It's very funny, you're just autistic. This is an excellent meme, tremendous, maybe the best of all time.

>It's very funny
How is meme-spouting funny? It's literally the lowest form of humour.
In fact, you can't even consider it humour.

It creates a sense of community and builds some culture to jump off on in banter. it's not like it's a super hilarious joke by itself, just a template. Also it's cute.

>just a template
How is it a template? It's been the exact same shit over and over for the last several years.
This is reddit-tier garbage.
>Also it's cute
>Calling a sexualised canonical guy cute
That's pretty gay, mate.

youtube.com/watch?v=65KhNiYZajg can you guys do all this?

...

>>Calling a sexualised canonical guy cute
Didn't you hear?
When you're wearing a skirt, you're a girl.

I'm still not seeing the issue with it being gay.
Also, the meme is just about wearing cute clothes while programming, no one said anything about being a guy.

I'm trying to get better at Java. What are some projects that I can work on that I can also use to build a resume? I plan to use these experiences in order to qualify for internships.

>When you're wearing a skirt, you're a girl.
XXDDD SO FUNNAY
IT'S JUST AS FUNNY AS THE LAST 100 TIMES I HEARD THAT XDDD

>no one said anything about being a guy
This board is almost entirely composed of males.

what, are you retarded? there aren't many programmers on Sup Forums

i think it's funny

>This board is almost entirely composed of males.
IT and compsci are one of the more well-represented stem fields by women, although people tend to think of it otherwise

Nobody cares about your video game shit.
Go back to your containment board.

Hey guys I haven't used Java in a while and I was still a semi beginner when I was using it. I'm looking for a quick refresh guide on it if anyone has a link to one.

if you keep being mean to me I can't guarantee your safety

The lazy way is to run it through a CAS. It will do the algebra for you.

$ maxima
(%i1) e: (a+c)/x;
c + a
(%o1) -----
x
(%i2) f: (b+d)/x;
d + b
(%o2) -----
x
(%i3) 100*(f/(f+e));
100 (d + b)
(%o3) -----------------
d + b c + a
(----- + -----) x
x x

No simplifying here, the way you wrote it is better.

Fucking millennials.

pls don't bully the hime

...

>that awful latency.

you're writing code, so what? it's not like you even need much visual feedback

>This is reddit-tier garbage.
Lurk moar, newfag.

complete beginner learning sql

I can tell you've never typed on a kindle before, the refresh rate is utter trash.

Neat.

i've had to program with latency an entire year in my retarded intro to csci class. you can feel free to buy it, but i won't

Sure I don't really need it when typing, but 1 second latency is no excuse. A daisy wheel printer is faster.

no I've never typed on a kindle, I use it for reading.
there's also a difference in their refresh rate, a kindle could refresh much much faster if it didn't have to limit itself for its battery

Yeah, but the other one is a monitor. It's still slow as fuck.

Refinement typing is neat because you can integrate it with unification with SMT.

Running functions in a separated thread can be useful both in organizing your code in a sane way and running "blocking" functions (e.g. waiting for network input).