/dpt/ - daily programming thread

oop is pajeet-tier edition

old:

Other urls found in this thread:

github.com/deeepaaa/hachidori
quickanddirtytips.com/education/grammar/ie-versus-eg
stackoverflow.com/questions/31282297/render-template-takes-exactly-1-argument
jetbrains.com/clion/
twitter.com/NSFWRedditImage

Wrong, OOP is based.

Second for D

Third for Go

Wrong, at least if your D unironically uses the factory pattern

Correct

DAILY PROGRAMMING CHALLENGE

A simple program that shows all the prime numbers from 0 to a user inputted integer.

If OOP is so bad then why do unis teach nothing but OOP?

No. I've written the isPrime function too many times

because they are training code monkeys, and code monkeys use java

>that pic
literally the projects in my work, down to the logging framework. Holy shit OOP is a meme

>DAILY HOMEWORK ASSIGNMENT

It takes less than a minute to write it

Unis are pajeet-tier.

Self-teaching is the way forward.

Without OOP, we wouldn't have the Power of .NET(TM) at our fingertips.

I don't care, I've done it too often.
It is literally below me.

>.NET
disgusting

>disgusting

You are mistaken. Please see this graph.

>some random square grid means something
disgusting

>2002

glorious

>As of October 2002
Yepp

>Power of .NEET
but you already had the power of making dog slow applications thanks to java

What exactly is Microsoft's vision?

This graph confirms that there is a high ROI if you go with Microsoft _and expect results_ (TM)

Yes, unfortunately. But Based Microsoft explains to businesses looking to make the switch that your job will remain intact even if you're maintaining some old pile of garbage Java application. .NET is the future.

Per Microsoft:

How to Get Started with .NET

Moving to a new technology is always intimidating for organizations. While .NET is very large, it is not that hard to migrate to. Since it will co-exist with your existing applications, there is no need to rewrite old applications. Simply write new applications in .NET and leave your older applications alone. However, there are several things you should do to prepare for your move to .NET.

Complete dominance

...

It used to be "a computer on every desk" but that one's done so they moved on to the next one: "money for our shareholders"

>oop is bad
Yeah thats why everything is written in oop and very few things are mad in lisp and haskle

>.NET ecosystem

>there is only OOP and FP
k

>.NET is the future of garbage

Oh yeah procederal, thats better than oop too right? Kek. Any other programming model is a fuckin meme lang

>there is only OOP, FP and procedural
lmao

rate my isprime!
int isPrime(const int n)
{
if (n < 2)
return 0;
int i;
for (i = 2; i < sqrt(n); i++)
{
if (n % i == 0 && n != i)
return 0;
}
return 1;
}

>Implying Java's is better

>Checking even numbers
It's shit.

then you can do a different challenge: calculate the cross total of the factorial of a given number.

i.e: 5! = 120 -> 3

but your implementation should work for something like 5000! as well
(I once wrote it in js, took about 30sec for 5000!)

If he didn:'t check all numbers he'd have to add a workaround for the number 2.

>he'd have to add a workaround for the number 2
That's perfectly fine as a special case. By not checking even numbers in the loop, you reduce the number of comparisons you have to do by half.
You just need
if (n % 2 == 0)
return n == 2;
after the (n < 2) case.

Why even modulo it?
If you already know 2 is prime, just return true if it's 2.

By handling all even numbers outside of the loop, you can change it to
for (int i = 3; i

why don't you write a better language then?

>i.e
You mean "e. g."

well alright.
the first one took 50 seconds to find the nearest prime starting from LLONG_MAX, 9223372036854775783

Yours took 25 seconds.

forgot pic

B-but user, Microsoft (TM) already has:

"Leggable" Ahahha

I clearly expressed anything other than these 3 are a meme and you fail to name anything else or even come close to how they could ever be superior to the 3 previously named. Go study for comp sci II faggot and quit shitposting

I need an algorithm that keeps my period roughly the same depending on the input size of a signal.

How do I do this? Pic related.

Either cos or sin solution. Shouldn't matter.

Preferably in Matlab, that's what I'm trying it in.

I only have experience doing work in kernels and desktop applications, but I've been approached recently with making small websites for people (small as in I can probably get away with making it all static). I muck around with userstyles and scripts, but I've never really developed a formal stack or workflow from scratch.
Do I just go to town with simple hand-made html/css/js files or should I pick up some other stuff? It seems like if I actually want to impress people I ought to be using React, node, etc.

Birth control is an effective way to regulate tour period.

...

Haha trolled u

multiply x by a number to normalize the period.

For example, if the period is 2, multiply by x by 2. If the period is 5, multiply x by 5. That way the period is always 1.

I have a programming assignment for a small game that allows you to tap cells in a colored grid to make them disappear. I'm having trouble keeping the score. The method for calculating the score is run at the end of the game.

I'm currently calculating score by running through the entire grid and counting all the empty cells. However, this doesn't keep track of all the rows that have been eliminated. Any tips?

How come every time I get stuck and want to ask a question I figure it out immediately after I hit post?

Try jquery it does all the things

Give more detail and post code. It sounds like you need to update the score when a row is eliminated, not just at the end.

pretty vague gonna need to see your code.

Yeah, I was just having trouble as to where to keep track of eliminated rows because the method has to be run at the end of the game. But I just got a surge of inspiration that I think will work out. Thanks.

>Fun fact: Even the pro C programmers use oo techniques when developing software

>Fun fact: OOP is a just a software pattern it has little to do with the language

>Fun fact: Javascript wouldn't be so shit if it implement real oop and not shitty prototyping

>Fun fact: Dlang master race

>Fun Fact: git gud

true

U combo breaker :/

Math is Pajeet-tier.

trying to wrap my head around python 3.5's new coroutine packages so I can be in control of the future

>general relativity
>QFT
not math

>weab shit is kill
Based op.

>futures and promises
Python's "future" is Javascript's past ;^)

Those are the apps. Math is the framework.

>javascript
nice meme

thanks

How do people get out of high school not knowing this basic shit?

I always read i.e. as "in example" and e.g. as "example given".

You are wrong. Dummy.

github.com/deeepaaa/hachidori

>implying goverment school teach rather than indoctrinate

Blah, fuck Latin.

quickanddirtytips.com/education/grammar/ie-versus-eg

Grammar girl suggests to use "in essence" to remember the difference. So I'm just going to read them as "in essence" and "example given."

...

got it thanks. Not sure if your method was what I used, made me think about it more though.

a=1;
x=1:1:col;

p=col;
y=cos((2*pi)/p*x);
plot(x,y);

Congratulations, you're retarded!

"Example given" doesn't make any sense. E.g. should be read as "for example".

It's worth remembering it just like that so you don't do something really stupid and use "For e.g." which reads as "for for example".

Whats the best edge detection algorithm.
Also I need to get into making programs with guis. Should I get good with opengl. making your own widgets sounds like a pain but I dont want to deal with c# for winforms

matlab edge(); LUL

jesus fucking christ, >>>/9gag/

Google doesn't give me anything on this specific error, similar errors are usually resolved by adding parenthesis to the method

TypeError: delete() takes exactly 1 argument (0 given)


Here is my route for delete in the controller:

@app.route('/delete', methods=['POST'])
@login_required
def delete(job_id):
if request.method == 'POST':
job = JobPost.query.get(job_id)
db.session.delete(job)
db.session.commit()
return redirect(url_for('home'))


Here is my view:


{##}
Delete

Any reasons why this bullshit exists?

Hey someone give me an alternative IDE to Visual Studio for C++

stackoverflow.com/questions/31282297/render-template-takes-exactly-1-argument

A cross-platform IDE for C and C++ by JetBrains

I posted this in the other thread but got fugged by the split threads.

What's a good scripting language alternative to Python, which has easy FFI like Python does, but which actually has good capacity for multithreading, like Python doesn't?

Alternatively, what's the best Python-without-GIL implementation? Is it Cython, PyPy, or one of the weird fuckers which runs Python on another language's interpreter like Jython?

forgot link
jetbrains.com/clion/

>Congratulations, you're retarded!
Not really, that was how I was taught.

>"Example given" doesn't make any sense.
Well, if you're going to interpret it as something English that can be given an initialism, it's the only phrase that makes the most sense. Reading it as "for example" is counter intuitive because the first letter isn't f, and the second letter isn't e.

>It's worth remembering it just like that so you don't do something really stupid and use "For e.g." which reads as "for for example".
"For example given" also sounds retarded. Reading it as "example given," one further expands it out to "the example given is..."

>US $199.00 /1st year'
Fuck that

>Needing an IDE for C++
Its not Java, kiddo. Learn your shit

Are you poor or something?

Not willing to pay $200 for something I can do for free... Code::Blocks is capable, or just, like Vim or something.

poor, got it

>that was how I was taught
>Taking lessons from retards

>something English that can be given an initialism
Firstly, Latin doesn't map to English without adding in filler words, it's about as least verbose as you can get (in western languages anyway).
Secondly, why do you need an initialism, are you dyslexic? Not everything needs an initialism to be remembered, especially something this basic.
Besides, just say example in spurdo-speak and you get eggsamble, which starts with "eg". There, I made it memorable even for a dyslexic 4channer.

>one further expands it out to "the example given is..."
You're reading it as example given, but that alone isn't enough for it to make sense, so you have to add in "the" and use 3 words to explain a 2 letter initialism.
"For example" is already grammatically correct, probably because it is the English meaning of e.g.

This doesn't help, I already know how to troubleshoot with which that post details, there is a problem with delete so I removed the job_id in the function, then I get a NameError: global name 'job_id' is not defined because it doesn't hook onto the variable in my view. I posted this because it's a uncommon issue, not because it's something that can be simply looked up on SO