/dpt/ - Daily Programming Thread

Anime edition

Previous thread: What are you working on Sup Forums?

Other urls found in this thread:

msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
blogs.msdn.microsoft.com/oldnewthing/20041222-00/?p=36923
youtube.com/watch?v=lO1z-7cuRYI&feature=youtu.be
twitter.com/AnonBabble

...

Lisp

sometimes i feel lonely so i write some javascript that creates a promise that never returns

then i can say i made a promise to you, just like in my japanese animes

What's the source on that manga?

Is it normal to feel gross after using javascript?
The dynamic typing system just keeps rearing it's ugly head and idiomatic use of js is essentially chaining together multiple array prototype functions like
return parseInt(num.toString().split("").sort().reverse().join(""));

Ok, so I need to create multiple drop down lists for my webpage, but only after given how many I need in an input box. Just need some sample code or a link. I can't seem to find a good example anywhere.

I am using html/css/js

Yes.

Is it true that wearing a skirt will make me a better programmer?

No. Learn Lisp.

Test it and see

Absolutely nothing.

what the fuck are you talking about ニッが
even a child could manage that

var c = function() {
var d = document;
var e = d.getElementById('a').value;
while(e-->0) d.getElementById('x').appendChild(d.createElement('select'));
};

b

I've made my bot that streams a video game communicate with my IRC bot.
But I'm not feeling well enough right now to clean up the mess so I can actually make it robust.

socks make a bigger impact

teamRepository.findAll().stream().map(Team::getName).sorted().collect(Collectors.toList())

Noob question
Can anyone explain me what each method does after the findAll() ?

user you're betting people will know the context here.
Not a good bet.
Also I think you should look to your documentation for that.

.stream() puts it in a different type like a stream or an enumerable or some shit (depends on the language)

.map(Team::getName) applies the function getName to each

.sorted() sorts the list

Well it's in Java. The rest is pretty self-explanatory Well to be honest, I just don't understand what the map function does and what is a Stream.

Thanks user.

you da man

what do you mean? I thought AI is going to replace literally every job over the next 25 years. Are you telling me that's B.S. Silicon Valley hype in order to get investmentbux?

I just want to know what hot field to go into to make all the hotbux while still having fun. Machine Learning seems really cool. Why am I wrong?

Automation isn't AI
Advanced automation via a feedback loop "Machine Learning" isn't real AI.

robotics is way behind ai so you can be assured menial labour jobs are safe
i recommend forestry

so you really think Machine Learning is a meme and not worth my time?

Machine learning isn't a meme but it is overhyped.

This is how you generate numbers through a range in Python:
range(10)
and this is the same range, except in reverse:
range(9, -1, -1)
Notice something?

>Notice something?
Python is shit?

looks inconsistent as fuck, reasonable humans would type range(10).reverse()

so do you think I should focus on software development principles instead of data science-y stuff.

AI, on the whole, really interest me. I think it'd be a lot of fun to work in Robotics.

I noticed Python is trash. What else?

takes twice as long.

Do what you like. Both will have jobs available to you as long as you are competent.

at least its readable, writing the shortest hardest to understand code possible is a sure sign of an edgy teen haxxor

>ニッが

Dat mix of hiragana and katakana, it's like you're trying not to be 上級人種

no, I mean it has to create the list, and then reverse it, instead of just creating the reversed list.

you're wasting precious milliseconds. If I ever saw someone do that I would slap them across the face.

dude if i slap space and my ime doesnt get it right first time im not going back to correct it

o well fair enough then
it still looks inconsistent, i dont know python but the first arg looks like the number of elements
youre saying the reverse version is the same yet you only specified 9

>ニッが
Combined kana is vomit-worthy. Please stop.

>AttributeError: 'range' object has no attribute 'reverse'
It only looks inconsistent if you don't understand start-stop, and steps. Why use anything other than a built-in?

range takes aruments (start, end, increment)
start is inclusive, end is exclusive.

that is weird.
In R the equivalent (because it is 1 indexed and I want to convert it to 0..9)
#assuming integers:
0:9
9:0
#but using the range:
seq(10)-1
seq(9,0,-1)

guys what's the best meme-functional language in terms of fun, usefulness, and employability?

I'm leaning F# because .net but idk

>meme, fun
>usefulness, employability
pick

then the reverse would be
9,8,7,6,5,4,3,2,1,0
and original would take argument of.. either end exclusive or size and increment from 0
not sure, it doesnt feel right to have the end arg first in one and second in another, should totally just be
range(size) -> increments from 0
range(size, start, inc) -> adds inc to start until size number of elements created

well it's not that way. You could do range(0, 10) or range(0,10,1) to accomplish the same way.

ok meme, fun. are there any hot new hipster functional languages with small communities that would be fun to learn?

haskell!

>start is inclusive, end is exclusive.
This is a retarded inconsistency.
for i = 1, 10 do print(i) end
for i = 10, 1, -1 do print(i) end

f# sounds like a good one, i had a play but havent taken the time to really use it.. especially now netstandard is here and we can compile for linux without mono

but haskell is old, grampa

you can use recent GHC extensions

range(0,10,1) resulting in 0..9 is not clear.
range(10) resulting in 0..9 is somewhat acceptable, but I would prefer require 2 arguments and then return a..y both numbers inclusive.

Does this print 1..10?
In Python it's like the user said, inclusive, exclusive, so to get 1..10:
[i for i in range(1, 11)] # From 1 (inclusive), stop before 11 (exclusive), step = 1
[i for i in range(10, 0, -1)] # From 10 (inclusive), stop before 0 (exclusive), step is negative
What is the inconsistency, besides Python being too hard for you?

-> 《

The thing about neural networks/machine learning is that the theoretical promises are very high and the practical reality is that it's very hard to attain something good.

I think NN will just be there for optimizing already established systems for quite a while before we start doing serious software using NN.

One parameter is inclusive, the other is exclusive. This makes reversing unobvious as we've seen. Whatever. I guess it suits a 0-based indexing shitlang.

>masking flaws with an iterator function
Nasty language goblins need to be exterminated.

>be brainlet
>blame the language

>This makes reversing unobvious as we've seen
But I just posted how obvious it is. There's nothing to wrap your head around.
>0-based numbering
>bad
Imagine being this wrong.

>Defend 1 == Truethon
>Not a brainlet

Google and saucenao return nothing back.

Bool are a subset of int. In an equality, 1 == True evaluates to True, because you test the value of each. However, 1 is not True, e.g.:
>>> 1 == True
True
>>> 1 is True
False

>Bool are a subset of int

>bool is an int
why tho, bool should be a bit

0, 1 ∈ a

Can someone explain the programming socks meme to me?

They are, False == 0, True == 1

>why tho, bool should be a bit
The smallest addressable unit of memory on most shit is a byte.

I name all my global variables after past girlfriends

heat (energy) leaves the body through extremities. Your head has hair on it, so the energy meets the hair (no conductivity) and heads back down. Usually, most of your energy leaves through your feet, because your socks conduct too much energy. If you have resistant programming socks, the energy will go to your head, see the hair and head down, go to your feet, see the socks and go back, and leave through your fingertips.

That way you have more energy in your fingertips, and are a better programmer.

you tuck your nut sack in and that stops them from flopping about on the chair and accidentally sitting on them

>0 and 1 are bools

am I good enough to start looking for a programming job yet? i've been practicing for 7 hours a day every day for the last 3 years. I been doing some research and apparently they ask questions in interviews to test your skills, I decided to give the one called "FizzBuzz" a try. Here's my implementation, please tell me if there's any way I could improve it. Also not exactly sure how you'd want fit the entire thing on a whiteboard, is it normal to just write first few lines to show you get the idea?

Print("1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n31\n32\nFizz\n34\nBuzz\nFizz\n37
\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n46\n47
\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz")

wouldnt a compiler (or in this case an interpreter) pack 8 bools to a byte?
seems like a pointless optimization to me but you never know, some knob is going to write a program that absolutely needs 10^20 bools in memory and complain that python isnt memory efficient

not bad except the interview is on a windows computer which required \r\n for a break

You need to iterate it to 450 and check for errors.

Try harder next time.

> wouldnt a compiler (or in this case an interpreter) pack 8 bools to a byte?
No, it would be too slow to access them.

>wouldnt a compiler (or in this case an interpreter) pack 8 bools to a byte?
No, it would be more memory efficient but it'd be less CPU efficient. I think that happens if you use vectors with bools in C++ though and there's a lot of issues caused by it.

specialising vector was a retarded decision, they should have just made a separate std::bitvector or something

It's legit twice as slow to access if not more.

i guess, should be a processor instruction to pull a specific bit at an address.. when i write my compiler it's going to store bools as a long i swear

>Each bit gets a unique address
fucking lol
just use a bitmask you moron

>store bools as a long
Well, Win32's BOOL is defined as a full-sized int: msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx . For some reason, they also have BOOLEAN which is BYTE.

MICROSOFT, ladies and gentoomen!

no you dingus, still byte address but hardware bit level access so
cpb offset,0
would grab the first bit at offset
sasuga windows

Wew, it looks like they also have VARIANT_BOOL : blogs.msdn.microsoft.com/oldnewthing/20041222-00/?p=36923 . WTF MS, get your shit together.

so just combine your load instruction with a bitwise AND

yeah.. oh well, there's no way around it, if you want to pack 8 bools in a byte you need to wait an extra cycle to read it

I do coding interviews with new hires and I am going to say, this is probably one of the best implementation of Fizz Buzz I've seen. I would probably hire you on the spot if I saw that.

what game is that?

zelda wind waker


▲ ▲

are you sure? the hud, the aliasing, and the colors looks messed up. could it be one of those episodes released on the nintendo dual screen?

You're looking at a 640x480 image stretched to 1372x767, of course it's gonna look like shit
As for the colours, it's probably dark because it's taking place during a storm

youtube.com/watch?v=lO1z-7cuRYI&feature=youtu.be

I'll tell you what I think an hour from now.

But when will you tell us?

...

that introducer is CUTE

>you can just use this iterator and it gives you Parallelism!!!
No. Fuck off with that shit. That's for apes. If you care about performance you can't do things like this. You will be slow. If you don't care, well I suppose you might gain something from it? A better program in an aspect you don't care about.