/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1564824401741.png (696x984, 958K)

Other urls found in this thread:

en.m.wikipedia.org/wiki/Human-readable_medium
twitter.com/NSFWRedditImage

fuck opengl

Have you read your WEPSKAM today?

Attached: s.gif (450x591, 77K)

fuck hiroshima nagasaki

Unpopular opinion: anime and programming are not related at all.

Let the downvotes come

I'm having problem with an interview type question, target language Python or C++ but that's not the point:

Given a list of intervals given as pairs,
Eg.
[(0,1),(0.5,10),(11,20),(31,100),(-7,0.1),(99,300),(0.8,0.9)]
return the list with all overlapping intervals merged.
E.g.
[(-7,10),(11,20),(31,300)]

I can write the isSeperate helper function easily, as well as a mergeTwoPiars. But my loops don't get lots of unnecessary pairs and the size changing range is a pain.

Attached: answer.jpg (407x325, 68K)

Based

python can do this in one line

Does Rust work on old computers?

working on making the single greatest piece of software ever seen by mankind

Attached: 1544261467431.png (498x707, 368K)

Yep. Certified braindead. Not convinced you even read the post. But maybe you did by your limited idea of reading.
>you need to give the structure format or type of the data
You absolutely do not. Why would you? What does that have to do with human readability? It doesn't have anything to do with that. It has to do with your requirements on structure between sender and receiver. You can remove the human readability from json and it'd fit your requirement since you used it as an example.
A hypothetical interchange format which doesn't have a human readability requirement and that has an installed decoder/encoder can absolutely do all that. Its without question because the constraints are so few. At least assert that no formats can do this. If you're gonna be this insane. To confuse human readability with this is just stupid.
>if you decode a message but give it as another type
If you're intentionally corrupting your files of course you get garbage. It still has nothing to do with human readability.

I'd like to hear your delusions about human readability. What property of a format being human readable makes it define the structure, format or type of data in a way that a non-human readable format could not?
Before you answer I suggest this article:
en.m.wikipedia.org/wiki/Human-readable_medium

Everytime a thread is made I hope the doll user is going to tell me to program in Javascript.

no, rust is unemployed on old computers

>2007
Seems too old to actually tell me anything I don't know. On this topic.

Learning latin language. Someone told me it will make learning JS easier.

I just did this in Haskell
One thing I noticed (or thought of when implementing) was that it didn't matter if you took 1 range and merged it into 5 ranges, because they would end up all being merged anyway. So you can do it like this:
Take 1 range, and try and merge it into every other range. If you didn't merge it, then it is a distinct range and you need to keep it (in your final output), otherwise don't keep it, because it has been merged. Repeat until empty.
thanks for using a non-anime image

It has worse compile times than C++ iirc.
I say that disqualifies it.

what I mean is, can a decade old laptop handle compiling Rust and does it suppoet the CPU.

nigga x86 has been standard since 8086

Rust uses the llvm backend so it supports a wide range of platforms.
I would expect your laptop to be x86 or x64 still.
This would be a big issue though.

>doesn't say what cpu
>doesn't give specs
retard
also, probably yes

nobody noticed the hidden text in last OP

i can haz pair programming

I post the animal OPs to mix it up but the anime OPs are fine too.

mildly amusing but prepare to be accused of cringe

Attached: 75636628_p0_master1200.jpg (850x1200, 782K)

funny

>But my loops don't get lots of unnecessary pairs and the size changing range is a pain.
please rewrite this sentence understandably

Literally one the most deadbeat interview shit, just like google it senpai

Hi everyone. I'm making a Jow Forums inspired website that will allow users to post, create accounts, and more. My question is, how does Jow Forums's bumping/weight system work? And how can I implement it?

For example, posts that are new and receive replies are usually at the top of the page, meanwhile posts with a lot of replies already require more posts per minute to be bumped to the same place. Now that I think about it, it sounds a lot like mass and constant acceleration.

Is it really that simple? Do I just calculate a mass (the number of posts in the thread) and then multiply it by posts per minute? This way, "heavy" threads would need a lot more energy to be near the top, whereas "lighter" threads can be thrown to the top relatively easily. Where does this leave new threads? Should I throw new threads near the bottom of the page?

I loop over the long list and then I need to also take into account the already merged intervals - and thus I must check that I don't loop over an ever growing list (getting non-termination)

just start by putting the thread with the most recent post to the top.
After that you can still assigns weights to each threads and make the weight depend on post count and post time deltas

Sort by left coordinate,
check if left coordinate is less than right coordinate of previous interval and merge if true.

i'm ready

Attached: grit.jpg (500x300, 19K)

Okay, but how to treat the list of already merged intervals. One must with each new pair check against that one.

Each post bumps to the top of the list.

I unironically like javascript, its so comfy to work in and i get stuff done fast

you want to subvert coder culture?

i want to nakadashi remilia

What I would do is sort by the start value then grow a new list at its end while consuming the old list at its front—using a while loop.
If you're doing this in python, I don't remember exactly how it handles lists but if it makes it any easier then sort backwards and consume from the end.
Let me know if something in this explanation is confusing.

Not working on anything specific, just trying to get better at Rust.

have an output list separate from the input list
you take one interval from the input and try to merge it with the rest of the input list
if you didn't merge it, then you add it to the output list
repeat

Well im not sure. That depends on how you define intervals merging. For instance, using real numbers

(-1, 34), (3, 40)
has an intersection (3, 34)
removing the intersection you get
(-1, 3], (3,40) i believe so actually the algorithm i told you night not even work depending on what you are trying to do

this guy has the right attitude

No I get you but it doesn't solve the issue:

If the target list is
target = [(0, 3), (1, 4), (900, 999), (2, 5), (3, 6)]
then youd get
merged_list = [(0, 3)]
merged_list = [(0, 4)]
merged_list = [(0, 5), (900, 999)]
merged_list = [(0, 6), (900, 999)]

and so you must actually have merged_list involved in the algorithm during the target loop itself. And during this procedure, it grows/changes.

>repeat
Yes of of course that's possible - during the naive way iteratively until you get a fixed point - but then the runtime is ridicuous

The task is to merge the intervals when they overlap, so (-1, 34), (3, 40) becomes (-1, 40)

this is why you sort before you begin merging

it's O(n^2) at worst

if you sort in O(n log n) then the merging part will grow in O(n)

Hey, Anone! I came over again to learn JavaScript with you! This time I brought snacks!

Attached: c4898763e485dd9cbb384db1b3f4f61e.jpg (682x1024, 90K)

how the fuck have you not been banned yet

Lisp is the most powerful programming language.

Sorry, I meant to say that C++ is the most powerful programming language

sepples is just a lisp in disguise

do you two need a new /mlc/ thread?

Thank you for making me smirt like an idiot with your dollposts everyday, user.

fuck off with your shit thread

maybe you're not fast on the uptake but it's a containment thread for idiots

lisp is just an underpowered subset of C++

How do you implement eval in C++?

c++ is just an inexpressive subset of Lisp

What’s your favorite code font, Jow Forums? I’ve been using mononoki.

how big is your doll folder bro? what sites do you like to collect from?

then you'll be in good company there

Based RemiOP.

Attached: __remilia_scarlet_touhou_drawn_by_sakusyo__440092ba8f418ffa9c39f52e1bbb1758.jpg (907x1267, 197K)

Okay faggots. I have a couple of weeks of programming experience doing R on swirl. I am not a CS major but I wanted programming experience to boost my job prospects so I took OOP. Now they expect me to code right off the bat. Its taking me alot longer to struggle through the first weeks assignment compared to everyone else. They also say all this should be individual and there shouldn't be any group work together wtf.
Now the week after next there might be an early exam.
Does anyone know how to quickly get to the level of everyone else?
For most people this is their second programming course in their second semester.

Btw we're doing C+=

>I took OOP
there is a whole class devoted to just object oriented programming concepts? what school is this

any fucking school

typically, these are taught through a language specific course, like sepples or java.

brainlet non-programmer here

I want have an excel "database" file that I want to make a program for that will a bookmark file from the entries, then import that into my webbrowser

I know literally nothing about programming but I've been watching some python tutorials. What else do i need to learn to do this? HTML?

It's just one course out of 4.
Btw we're doing C++

what do the entries contain that would warrant creating bookmark files? URLs?

I'm sure you'll figure it out

so it's a C++ course, not an OOP course

They call it OOP

>OOP class
>just teach broken sepples OOP

we had a course called OOP as well and it used C++.
Since C++ wasn't covered yet lots of people were learning c++
what the fuck else do you expect, pure theory on OOP using some meme lang or no lang at all?

name
website
tags
notes
social media accounts
brand image

pretty much, on the same level as a typical ds&a course
there are enough concepts to fill a semester

did you get it figured out?

smalltalk would be cool (but that aint happening)

>Sort the intervals based on increasing order of starting time.
>Push the first interval on to a stack.
>For each interval:
>>>>If the current interval does not overlap with the stack top, push it.
>>>>If the current interval overlaps with stack top and ending time of current interval is more than that of stack top, update stack top with the ending time of current interval.
>At the end stack contains the merged intervals.

might as well just read a book and not have any classes at all

you could say that for anything
i would probably supplement the course with a project developing an object system, analogous to Closette in AMOP

I'm supplementing the course with introduction to machine learning which also requires C++ which I do not know.
Am I fucked

export a csv of the excel file and then learn how to parse a csv file. that will be your first step.

if you're not a retard then probably not.

knowing C++ is still useful, it's used in academia

i suppose, but i wouldn't conflate a pure OOP theory class with sepples. in my experience, you get a watered down "C with classes" course

rust doesn't work on new computers

does it work on transcomputers?

Checking out Datomic.
I got started just recently, but this might be the first database that I actually enjoy working with.

remilia is garbage

>interview goes really well
>gets praised about my resume
>good match with the culture of the company
>apparently exactly the profile they're looking for
>"we took a look at your github and noticed you didn't have an anime profile picture, could you explain why"
>tell them I don't like anime
>"thanks you for your time"
>never gets called back

bullshit

What would they ask if you had github anime profile pic?

true

This happened to me too.

Can you suggest a way for me to learn C++ quick in like 5-10 hours?

brain transplant