/dpt/ - Daily Programming Thread

󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦▲󠇦
󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦▲󠇦 󠇦▲󠇦 󠇦▲󠇦
󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲
󠇦 󠇦 󠇦 󠇦 ▲󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲ 󠇦▲󠇦
󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
▲󠇦 󠇦▲󠇦 ▲󠇦 ▲󠇦▲󠇦 ▲󠇦 ▲󠇦 󠇦▲󠇦

Sierpinski edition

Previous thread: What are you working on, Sup Forums?

Other urls found in this thread:

stackoverflow.com/questions/39212693/clojure-data-structure-translation
twitter.com/KatherynWinnick
twitter.com/SFWRedditImages

>󠇦 󠇦 󠇦▲
>󠇦▲󠇦 ▲
this

Anyone here knows your clojure wanna help me with this?
stackoverflow.com/questions/39212693/clojure-data-structure-translation

▲󠇦
󠇦▲󠇦 󠇦▲󠇦
▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
▲󠇦 󠇦▲󠇦 󠇦▲󠇦 󠇦▲󠇦
󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲
▲󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲ 󠇦▲󠇦
󠇦󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
▲󠇦 󠇦▲󠇦 ▲󠇦 ▲󠇦▲󠇦 ▲󠇦 ▲󠇦 󠇦▲󠇦

>implying you're not just trying to turn this into a newfags can't reinforce thread

Name of girl in OP?

>inb4 'girl'
>inb4 "just reverse image search, user"

Katheryn Winnick

>tfw no beautiful non-pleb gf

▲󠇦
>I posted it again daddy!

󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
󠇦 󠇦 󠇦 󠇦 ▲󠇦 󠇦▲󠇦
󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
▲󠇦 󠇦▲󠇦 ▲󠇦 ▲󠇦
󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲
󠇦 󠇦 󠇦 󠇦 ▲󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲ 󠇦▲󠇦
󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦 󠇦 󠇦 󠇦 󠇦 󠇦▲󠇦
▲󠇦 󠇦▲󠇦 ▲󠇦 ▲󠇦▲󠇦 ▲󠇦 ▲󠇦 󠇦▲󠇦

How would I go about making a good hash function for lookup tables, or at least finding one. I search for it and I either get stuff for cryptography or just a bunch of cs class slides on "yeah uniform distribution is good"

nice right angle triangle user

how to solve towers of hanoi?

non photoshoped picture

>Katheryn Winnick
thank you user.

Also wtf she's 40? I'm like 10 years younger but I look 10 years older than her.

Be honest Sup Forums, do you write comments on every program you make?

What's a good VPS host that lets me pay $10-15 a year for some decent hardware and 1 ipv4 address?

...she still looks 100% semen demon, I can't tell the difference user.

furk

Recursion. Think about it this way. You have 3 discs. You move 1 to the target stack and the rest to a spare stack using the third tower to make the bigger on smaller switches. Then you have two discs left. You do the same thing till they're all on the target stack.

first time to this board, so i don't know shit

how do i get started to learn how to create my own 'sneaker bot'

Does scripting in GameMaker with GML count as programming? Am I allowed in this thread?

Why not just use SHA1 or similar? The risk of collisions is minimal.

[Python 3.5] Can someone help an user out?

Let's say I have a .txt file containing:

------------------------------------
textline1
textline2
textline3 = [PLACEHOLDER]
textline4
------------------------------------
(tha brackets are actually part of the file, not the placeholder

and a list of dicts :
[
{"A1":1, "B1":2, "C1":3},
{"A1":4, "B1":5, "C1":6},
{"A1":7, "B1":8, "C1":9}
]

how do I print the list into the placeholder?

What I am expecting in the resulting .txt is:

textline1
textline2
textline3 = [
{"A1":1, "B1":2, "C1":3},
{"A1":4, "B1":5, "C1":6},
{"A1":7, "B1":8, "C1":9}
]
textline4

it's borderline, either /dpt/ or is ok probably

python (even though i hate python), it has like the easiest web scrape type stuff

There's a question on stack overflow that literally gives a table of non crypyographic functions. I used FNV hash for my project.

use a combination of readlines() and __str__()

nice try OP

twitter.com/KatherynWinnick

thanks mate. gonna go start researching this

I'm no python expert but search the stream/buffer/string for [PLACEHOLDER] and replace the placeholder with your list. I'm certain the file io and string libs have examples similar to that. Then just write the entire stream/buffer/string to disk.

who /amphetamine/ here?

...

is there a http python lib that also executes javascript

me

amphetamine != methamphetamine

read a book.

>implying amphetamine isn't bad for you as well

who /cocaine/ here

Too slow for a hash table.

anything can be bad for you if abused, what are you trying to say? what is your argument? cot dam youre an idiot

fuck off straight edge faggot

Is there a such thing as "no a such lib doesn't exist for python"?

Makeup.

>this butthurt
enjoy your comedowns

they aren't even that bad desu senpai

I barely even notice them, straight edge pussy.

So what you're saying is that you're incapable of focusing on your work without the use of drugs? Did you know that long term use of amphetamines significantly increases your chance of a heart attack? Honestly, maybe you should consider a different profession if that's the risk you're taking.

does the hackerrank sample test give you points or anything? i completed it and i don't see any way to view my results

5% of the population is willing to do whatever it takes to win, be that in school, at the job, or in the gym. i AM a 5%er

Tower of Hanoi in Python


def printMove(from, to):
print ("move from {} to {}".format(fr, to))

def hanoi(n, from, to, spare):
if n == 1:
printMove(from, to)
else:
hanoi(n-1, from, spare, to)
hanoi(1, from, to, spare)
hanoi(n-1, spare, to, from)

hanoi(3, 'Mid', 'Target', 'Spare')

>he needs drugs in order to "win"
git gud fgt

again, if youre not an idiot and use it responsibly you are fine. Look at caffeine addicts.... caffeine then no caffeine can cause really bad comedowns. You're basically saying "oh you drive a car?" enjoy filling it with gas every 2 weeks and cleaning it".

i was diagnosed with adhd when i was younger. I absolutely need it when learning new stuff, i was never a good reader either in terms of comprehension because i would also forget what i read.

Can someone help me find a middle ground between these two algorithms? My algorithm was supposed to be in python 3, the second I believe was intended to be in python 2.

The idea is that it takes a string of numbers like "56 65 74 100 99 68 86 180 90", and returns them ordered by number weights: "100 180 90 56 65 74 68 86 99". It also sorts number weights that are equal as a string: 180 before 90.

I wrote an algorithm after looking at it, it seems quite redundant.
def order_weight(s):
x = s.split()
y = [sum(int(digit) for digit in item) for item in x]
z = list(zip(y, x))
zsort = sorted(z, key=lambda tup: (tup[0], str(tup[1])))
return " ".join([x[1] for x in zsort])


another person wrote a one-liner, and I'm not sure if it's any less redundant.
def order_weight(_str):
return ' '.join(sorted(sorted(_str.split(' ')), key=lambda x: sum(int(c) for c in x)))


They both sorted 57 random strings of 255 characters in ~200ms (on a server). Is one better than the other?

I'm still learning.

youre the faggot because you cant understand people are born not only physically different but also genetically, chemically, etc

would you become a tech billionaire if in order to do it you had to sacrifice all of your friends for your 'dream'

it's one thing to take amphetamine on a doctor's recommendation and another to use it illegally

>friends

what friends

not i don't have "friends", but i don't give a flying fuck about them

i used to take the now banned version of a preworkout called cannibal ferox multiple times a week and it turned out it was basically meth. the amount of focus it gave me was insane. i just stared a hole into the wall at the gym between sets. i realized when i got hooked on it and had to throw it away even though i only used half the container
/blog

What is the correct grammar for naming typedef functions?

Actually, I can see why the second one is better now. The second one is essentially two steps, whereas the first is doing a lot more.

Trying to further improve performance of my mbox parser.

Done some more profiling and the current bottleneck is the library I'm using to do case conversion for header keys.

Turns out it's pure shit, so I've been working on a very optimized one myself.

Currently beating the shit out of str::to_lowercase and str::to_uppercase in most cases, and on par with it on the worst case (which is always the worst case in libstd).

test unicode::bench::capitalized_borrowed ... bench: 17 ns/iter (+/- 1)
test unicode::bench::capitalized_owned ... bench: 149 ns/iter (+/- 5)
test unicode::bench::lower_borrow_long ... bench: 176 ns/iter (+/- 0)
test unicode::bench::lower_borrow_short ... bench: 32 ns/iter (+/- 1)
test unicode::bench::lower_owned_all ... bench: 4,197 ns/iter (+/- 303)
test unicode::bench::lower_owned_early ... bench: 574 ns/iter (+/- 27)
test unicode::bench::lower_owned_late ... bench: 281 ns/iter (+/- 14)
test unicode::bench::lower_owned_std ... bench: 4,083 ns/iter (+/- 10)
test unicode::bench::upper_borrow_long ... bench: 174 ns/iter (+/- 1)
test unicode::bench::upper_borrow_short ... bench: 32 ns/iter (+/- 0)
test unicode::bench::upper_owned_all ... bench: 4,202 ns/iter (+/- 78)
test unicode::bench::upper_owned_early ... bench: 589 ns/iter (+/- 2)
test unicode::bench::upper_owned_late ... bench: 281 ns/iter (+/- 5)
test unicode::bench::upper_owned_std ... bench: 3,832 ns/iter (+/- 7)

>Adhd
You just need to die to not pass your shit genes. I bet you're white too. Only whites have adhd.

>mbox parser.
?
what are you using to do those unicode tstes?

The mbox file format is used by mutt and other mail clients/servers to store emails in; it's a retarded format but it's what's in use.

That's the output from running:
cargo bench

say I made a program in python. Is there any way to hide the source code from others when distributing it. I know you can pack python with your program to a certain extent. But I really do want to give out the source.

I assume the ones in std are using the full unicode rules for upper/lower case. Is yours the same, or is ASCII enough for what you're doing?

this desu, i was diagnosed with ADHD a while back and prescribed was Vyvanse. it doesn't really make me feel like i can do anything or like i hit the easy button like most people who got it without being diagnosed say.

why does the masterrace have adhd problems, user?

Mine uses unicode too, it's just the libstd one is the ultra naîve code, this is literally it:

self.chars().flat_map(|ch| ch.to_lowercase()).collect()

Holy shit. I thought I remembered reading a PR adding an optimized implementation, but obviously that must have been some other function.

>Only whites have adhd.
Wew lad.

Keep in mind I'm also returning a Cow instead of a String, so my version couldn't be pushed upstream as-is (I do not allocate anything if the string doesn't change).

I could extract the code that always re-allocates and send it upstream tho, I'll check that out and see how performance fares in those cases.

>only whites have adhd

>tfw the ANSYS fluent API uses scheme
Feels so fucking good man

I'm white and I have a legitimate diagnosis for autism. I fully intend to spread those autistic genes. You mad?

>implying you could get a gf

Working on a note taking system for books, just for shits and giggles. How's it looking so far? Suggestions?

like half of the autistic people i know have gfs. hambeasts, but gfs nonetheless.

add some information when you hover the book or something

as long as youre intelligent and have your shit together, you can be autistic and have gf

just dont become a cuck

wjhat language is this?

>Finishe
Make that a checkbox instead of a text field.

>justifying degeneracy
haha

>Master race

Corn syrup and diet as well as distractions. You're supposed to not give a fuck about civil wars and american colony at an age where you are noticing girls and have tons of energy. Also over diagnosis is capital for health care.
You don't see those exchange students having trouble concentrating or needing a crutch.
Half or almost all kids on the honor roll was on amphetamines.

I made it a checkbox instead of a text field originally, but Flask has a problem with accepting unchecked check boxes (it doesn't actually post anything if it's unchecked, which makes Flask throw a proxy error and shit itself). It's a temporary workaround.

It's also "Finishe" because the label positioning isn't quite right so the forms overlap the labels slightly when resized (it was "Finished" originally).

Hell become a cuck. It's in the cards. He's likely to have stepchildren from some guy name Juan. But that's not a bad thing, whites are after all responsible to help raise children.

Rust.

> Work out 6 days a week
> Diet is cleaner than a Barbie dolls taint
> Drink a gallon of water a day
> Perfect posture
> 8hrs+ sleep every night
I can guarantee I'm much healthier than you. My resting heart beat is 40bpm it only goes up to about 65 when I take vyvanse.
>BTFO neck beard

>Flask has a problem with accepting unchecked check boxes
Freaky.

>

>program on amps
>8hrs+ sleep
Either you're NEET or lying.

I'm going to be honest with you, user. I'm not a virgin. I had a girlfriend for 3 1/2 years for part of high school and part of college. She left me, and now that I've had time to reflect on her, I'm a bit glad, actually, because she could be a real fucking bitch at times.

I'm working on a master's degree right now, user!

the internship i applied for requires us pass a hackerrank test, and i didn't know this until now but it pays $28/h so i'm certain it's going to be very hard and i want to be prepared. after cutting through the boilerplate, the things i can see they expect from me is experience programming in java (i have this), knowledge of SQL and databases (i don't have this), experience with linux (i kind of have this) and experience with web services (idk what this is)

i have until September 11th to finish the test and email them i've completed it. how do i best learn about sql, linux, and web services in that time frame?

>have to take Vyvanse
You disgusting degenerate.

>You're supposed to not give a fuck about civil wars and american colony at an age where you are noticing girls and have tons of energy

what are you suppose to be doing then? i agree the US education system is retarded tho

> Wake up at 630am
> Oats, banana and coffee
> Gym or run at 700am
> Get back at 730-815am
> Pop vyvanse right then
> First class isn't til 11
> Study between classes
> Either program or study from 4-7pm
> Watch movies or chill with friends
> In bed at 10pm


>>> Fatty with no self control BTFO

...

learning python

so basically you live your life as if you were in prison

what does your day look like?
pls greentext

>uses a drug to perform normal functions
You're the one without no self control

so even if you have a gym in your home you only work out for 25 minutes?