/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

benchmarksgame.alioth.debian.org/u64q/performance.php?test=knucleotide
benchmarksgame.alioth.debian.org/u64q/performance.php?test=binarytrees
arstechnica.com/security/2016/08/code-dumped-online-came-from-omnipotent-nsa-tied-hacking-group/
twitter.com/AnonBabble

where can i get a qt anime gf(male) ?

>catalog
>ctrl-f
>challenge
>no challenge
>disappoint.jpg

>His function doesn't even have multiple return values
I hope you aren't using a shitty language, /dpt/

>Filthy obsolete peasants
tuple!(int, float, char[]) function(int kill_me){
return tuple(just, fuckmy, shitup);
}

>civilized and modern languages
while _,indes in range x: {
do(stuff)
}

One of my few regrets for D

Do you guys do fun output while debugging?
So funny, right guys?

I feel like that would be a larger project than whatever I was doing before.

Where were you when C was kill?
benchmarksgame.alioth.debian.org/u64q/performance.php?test=knucleotide

this link should be on autoban

...

Where were you when Rust was kill?
benchmarksgame.alioth.debian.org/u64q/performance.php?test=binarytrees

You'll need an array of strings containing the names of each day (starting with Sunday of course) and the modulus operator

This is with Python. I don't know how to solve this problem. Can someone point me in the right direction?

I was thinking about some way to cycle through a list. I get an error "beyond the max range of the list". Or maybe there is some other way to solve this? Please don't solve it for me just tell me what to look into to get started to solve it.

...

d=x.getImageData(0,0,w=c.width=256,h=144);for(i=0;i

Where were you when C was kill?
>Binary expressions and function arguments are evaluated in strictly left-to-right order. This is similar to Java but different to C and C++, where the evaluation order is unspecified...

char *days[] = { "mo", "tu", "we", "th", "fr", "sa", "su" };
printf("%s\n", days[(3 + 137) % 7]);

>general version of the program
>spoonfeeding

dont worry he's retarded and won't get it

How do I create a dynamically growing buffer for large amounts of data

In?

create a vector object that doubles in size whenever it's at least 75% full

Queue = new ConcurrentLinkedQueue();


:^)

>code pauses when laptop is in sleep mode
Are you fucking kidding me?

what do you think suspend does?

List

Easy enough.
Any day + 7 days is equal to the same day next week. Use the modulus operator to determine how many remainder there is and work from there.

Sleep and suspend are two different thing, user.
Stuff are supposed to work in sleep mode.

Maybe the other user isn't using his sleep mode properly.

C

in the beginning, mans programs crashed

I-Is that so? How do I make sure that my code runs overnight?
I'm using cygwin+gcc to compile C++ btw.

I understand how heaps work, but how do grow/shrink the size of the heap dynamically in C???????

No, that's how it works.

I'm still getting the same error index out of range
days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']

def weekDay(x):
return days[x + 4 % len(days)]

print(weekDay(int(input("Input number of days: "))))

That's something that the malloc implementation does.
You don't need to fuck with the heap yourself.

no one cares about how elegant or smart your code is only that it works

The cold hard truth

>Being a communist/socialist in 2017
Back to Raddit with you

poorly written code doesn't work very well

because you're doing x + (4 mod 7) instead of (x + 4) mod 7

Fucking with total size of heap is what OS does for you, with malloc you only claim parts of the heap that you actually intend to use (if available).

>tfw used to be super good at programming in high school
>hit university and now I'm hilariously below par grade wise

Anyway, how can I get myself more comfortable with recursive programming? I can get a loop solution fairly easily, but I have trouble translating that into a recursive solution.

>no MULTIPLE-VALUE-BIND
>no DESTRUCTURING-BIND
>no VALUES
Into the trash it goes.

Order of operators still apply in programming

>total size of heap is what OS does for you
Normally (on Unix-likes), brk/sbrk needs to be called so that the OS will resize the heap, but that's something the malloc implementation will do.

Practice. Recursive programming isn't hard. The hard part is spotting the right situations to use it.

there's almost no valid situations where recursion would be useful unless you're using trees, and those have very limited use cases where they wouldn't degenerate into a straight linked list.

>very limited use cases
What?
Trees are useful as fuck, and are used all over the place.

Anyone here ever hard such a horrible programming teacher that you never got programming but when you finally did get a good programming professor you actually understood how to program and the fundamentals of programming?

Also when programming math equations

Kind of, but I got gud on my own

I had that happen except I didn't understand shit until I taught myself C.

Java is such a horrible beginner's language.

if your brain is too small to use Rust, then you need to head on back to Sup Forums

I had an indian professor that no one understood.
Luckily I already had prior knowledge. Easiest A of my life.

>having the compiler babysit you makes you "smart"

If you don't have a degree from MIT, then you need to head back to Sup Forums as well

t. brainlets

why do unis hire immigrant trash that can barely speak English?
this happens all too often, tbqhf

MIT became trash the moment 6.001 switched to python.

>MIT
pleb trash.

This.

Quick reminder that C toddlers are actually too dumb for Rust.

Because they pay out of state tuition, usually at a rate 4x more than you do.

Why do you care? You are going to go to a uni that employs jews and niggers. Why would you cuck yourself like that.

Take some pride on yourself and drop out.

*tips*
See

I went on exchange to MIT during my university days. That was prior to them switching to python. I don't understand why they would switch it but most of the people there are already smart enough that it doesn't matter if it is coded in Python or Rust or even in Assembly. One of the few places I have been to that made me feel stupid but I did love America a lot.

The same reason other places hire them. Because they do it so much cheaper than a local would that the decline in quality is deemed acceptable.

That feature is necessary for C toddler refugees so that they can learn how to write programs.

It's literally nurturing a C infant

So you're saying you'd be able to program safe programs without the borrow checker? Why not just use C then?

Because C has fuckton of undefined behaviors

And? Are you trying to say UB is bad?

Does anyone know how to open up a file browser in Android so the user can select a file to user for whatever reason?

The more undefined behavior the more broken the language is

>tfw too dumb to avoid UB

>If I just ignore and pretend UBs (that are well defined in good languages) it's not a problem

BAN C PROGRAMMING
arstechnica.com/security/2016/08/code-dumped-online-came-from-omnipotent-nsa-tied-hacking-group/

>undefined
You mean platform dependent?

UB allows the compiler to generate a lot more efficient code.
UB allows the language to be much easier to implement.
UB allows the language to not have to define ridiculous situations where there is no reasonable answer.

The thing which is actually a pain in the ass is implementation-defined behaviour.

Bout to make my first issue in an open source problem

If you are depending on UB to generate "efficient code" you really need to rethink your algorithm

By installing gentoo

This is stupid of me but how do I use two inputs as arguments for a function call without setting up variables?
def weekDay(x, y):
return days[(x + y) % len(days)]

weekDay(int(input("Input number of days"), int(input("Input starting day"))))

It has nothing to do with my algorithms. It's to do with the compiler.
A compiler is allowed to assume that UB can never happen, and is allowed to optimise based on that assumption.
So it can take statements like (x < x + 1), and just replace that with (true), as it can assume that signed integer overflow can never happen.

Anyone, the original discussion before the Rust user derailed it was that Rust users aren't actually smarter for having the borrow checker do the thinking for them

jesus fuck you're too stupid for this

drop out right now

What are you talking about? Can you re read If you are looking to improve your efficiency, optimize your model, do not defined on the fact that the language is broken and produces unspecified behavior

lmfao

>defined
depend*

...

>falling for the bait

don't do that. it makes your code harder to read

p.s. it's already hard to read

> used to be super good at programming in high school
>how can I get myself more comfortable with recursive programming

Brah...

...

...

>unspecified behavior
Don't use your terms incorrectly, idiot.
That is something else.
>If you are looking to improve your efficiency, optimize your model
How is forcing the compiler to add more checks going to make the program more efficient?
Some languages might be able to add more to the type system to try and remedy that, but Rust certainly isn't the shining example of a type system that is going to generate efficient code.

I just started. I'm a beginner. I can't help not knowing things I haven't learned.

Stop.
Why the fuck are you doing this?

You're cute if you're sincere user

Explain what is wrong with declaring two variables and having inputs assign values to those variables before passing them into the function.

Is it because the inputs are temporary and not stored?

You are not going to get real help in 4chen.

Go to python beginners IRC

Why aren't you solving math problems right now? Is that not enough of a challenge for someone of your intellect?
for i in range(10001, 1000000):
if str(i) == str(i)[::-1]:
for m in range(100, 1000)[::-1]:
if i % m == 0 and 100

it uses way more memory if you do that