/dpt/ - Daily Programming Thread

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

Attached: 1541483607240.jpg (1000x1100, 114K)

Other urls found in this thread:

foolfuuka.readthedocs.io/en/latest/code_guide/documentation/api.html.
nuitka.net/pages/overview.html
youtube.com/watch?time_continue=10&v=HgtRAbE1nBM
a.4cdn.org//threads.json
khanacademy.org/computing/computer-science/algorithms#asymptotic-notation
wolframalpha.com/input/?i=m=n(n-1)/2; O(m*logm); O(m*log(n^2)); O(2m*log(n));
twitter.com/SFWRedditImages

finally put up one of my screen in portrait mode
bretty dank

Reading docs for the E1000 network card so I can add a driver for it to my OS

im sick of people talking about big o notation and me not understanding it and feeling like a retard


how do i learn it in depth

haha brainlet
>>>/wdg/

big o is a meme, the modern CPUs are reaching near infinite computing speed, there is no need to optimise anymore

nothing
i've dropped almost every hobby project i had since i started working

>hit F12, intellisense takes me immediately to declaration
>go back, hit F12 again on the same symbol, intellisense takes 10 seconds to go to the same declaration
epic

Attached: 472384237.jpg (500x667, 35K)

With n inputs, how many operations does your algorithm perform? Take the fastest growing function at n->inf, remove the constant multiplier, and that's the time-complexity of your algorithm in O-notation.

For instance
3n^2 + 5n + log n = O(n^2)
5000n^25 + 2^n = O(2^n)

Congratulations, now you know big o notation.

Just google it, it's not that hard. If you have concrete questions I can try to answer them.

Attached: bjarnes.png (645x185, 15K)

JavaScript rocks!

Attached: js_rocks.png (1433x779, 473K)

Consider starting out by refactoring code for open source projects.
Nice OP

Attached: 1552213076254.jpg (1280x720, 73K)

>be big O brainlet
>read that arrays and linked lists have O(n) for search
>hurr they must be the same
laughs in prefetcher instructions

I will turn your mommy's pussy into a big O

>modern CPUs are reaching near infinite computing speed
r u 4 real

I bet I can make every program on your computer basically unusable by replacing only a handful of algorithms with ones with slightly worse O

I am working on a saurce finder script for videos from /gif/ and /wsg/ in lua.
Does anybody know if the desuarchive api have rate limit?
If you're interested in this little script reply to me and I will post it on github.

Attached: lua.gif (256x256, 97K)

Literally first year scientific university knowledge in Europe.

>having intellisense installed
moron

also it probably flushes everything when you go back, before that it's stored in memory
why you would program it like that? no one will ever know

why lua my fren

>desuarchive api
Why would you need that? You only need apis for saucenao/iqdb/yandex/whatever.
Unless you spcifically want to search the videos in the archives.

Anyways, you can read the foolfuuka api (which is what desuarchive uses) at foolfuuka.readthedocs.io/en/latest/code_guide/documentation/api.html.

It's a language I enjoy writing.
Very comfy, easy, yet powerful.

1 loop = O(n) 2 loops = O(n^2) 3 loops = O(n^3) etc.

It's easy

Here, let me give you the first lesson.
1) Don't waste time on that rubbish.
Here's your CS degree

>1 loop = O(n) 2 loops = O(n^2) 3 loops = O(n^3) etc.
interesting.
so how do check if the code takes 0(log n) or 0(n*log n) for example?

>Why would you need that? You only need apis for saucenao/iqdb/yandex/whatever.
>Unless you spcifically want to search the videos in the archives.
I am doing this to make my process of finding the song of ygyl threads faster. So it's not about the image it's about the audio. But it could also be used for finding a porn video for example.
I search the video on desuarchive, check every reply to the posted video, if the reply contains sauce, source, name, plz or please if show the replies to the reply, if not it just prints the reply.

>Anyways, you can read the foolfuuka api (which is what desuarchive uses) at foolfuuka.readthedocs.io/en/latest/code_guide/documentation/api.html.
I was already using that. I just wanted to know if they had a rate limit (like 4plebs, which they indicate in their faq).

Just use the next degree polynomial, user. O(log n) = O(n). O(n log n) = O(n^2)

>O(log n) = O(n)
> O(n log n) = O(n^2)

what?

>I search the video on desuarchive, check every reply to the posted video, if the reply contains sauce, source, name, plz or please if show the replies to the reply, if not it just prints the reply.
I always wanted to do that, since image searching in the archives is a lot more effective than the usual sites for cropped images.

Also I can't find anything about a rate limit, but you can always ask on the internal boards.

Well I think that if I get blocked I will just add a tor proxy for the request, with a different circuit every time.

5n = O(n) like 1000n and 5n are the same

>????????

theres nothing to learn just read the wiki article

Yes

not they're not the same
it's just that when you have an algorithm that is O(kn), k becomes insignificant as n increases so it is disregarded.

Attached: truth.png (540x397, 83K)

yes yes 1000infinity is the same as 5infinity

it's dumb though

Python and what?

nuitka.net/pages/overview.html

It really isn't, it's a good way to look at the problem, even if it doesn't tell you everything.

Knowing if it will be 5n or 1000n is also often impossible because the constant part can vary by language and so on.

Meh, just compiled AOT shit.
PyPy is seems much better.

just count the instructions in the binary output :^)

Big O measures change. For example, take O(kn). If n doubles, kn also doubles, no matter what k is. O(kn^2l): if n doubles, kn^2 quadruples, for any k. That's why constant factors disappear.

well now I actually learned something
god damn you dpt

its time to write the OS in Rust
youtube.com/watch?time_continue=10&v=HgtRAbE1nBM

What's the current opinion on Rust? Is it still a complete joke? I haven't been on /dpt/ for a few months.

language, not completely
community, entirely

Not him but is it true that they stopped using IRC for their dev channel and only use Discord now?

I have absolutely no clue, I'm sorry, not involved

I have a friend that does Rust, last time we talked (today), he told me that he asked a question on IRC and that it was a very active community.

from pprint import pprint
import requests
import operator
import sys

BOARD, AMOUNT = sys.argv[1], sys.argv[2]
# BOARD, AMOUNT = 'g', '10'
URL = "

a.4cdn.org//threads.json

yeah but I think that is just by last reply, I'm trying to base it on all replies, because a single reply is enough to affect threads.json, but still not a good measure of "activity" imo

Reading Intermediate Perl.

Don't do it unless you are insistent on actually using the language.
I read a couple of Perl books once because it looked like a cool language, and when I decided to use it for a non-trivial program just a year later I realized I had forgotten most of how it worked entirely.

O(logn) only realy shows up when you use trees,
>Looking up 1 item in a tree: O(logn)
>Looking up all n items in a tree: O(nlogn)

Thanks. That's a great high level overview. Now I know what to look up and study. And yeah I always hear that nvidia is a pain in the ass. To this day I have no idea why they can't simply release their stupid firmware as a loadable blob so that nouveau can become usable.

>What are you working on, Jow Forums?
We are preparing some (((exit game))) (but in reverse) for a fren and I am doing a bit for it.
This is a lot more /diy/ than /dpt/, but /diy/ is ded. That's why I am shitposting it here.
The Key has a magnet on it. I want to hide it underneath some closet or something where he can't see it, but should navigate towards it with a remote controlled car with a magnet on it to get that key out.

But i should stop myself from trying to be perfectionistic again. That's why i'll wire this thing up before i work on the next idea.

Attached: alarm.webm (1309x720, 2.57M)

PS: Those lasers have an alarm if triggered and going to be made visible with fog shit

Read the Khan academy article

khanacademy.org/computing/computer-science/algorithms#asymptotic-notation

Really easy

The constant factor doesn't matter for computer science but it does matter in practice. Sorting algorithms have very different constant factors and it matters a lot

it does matter just not for asymptotic complexity which ignores constant factors almost by definition

Lua is best. Lua is insanely fast. Lua plays nice with C.

There is something called master theorem.
Usually you just think about it logically and make a semi mathematical argument.

For example if you have a list eith length n and you loop over it, it's O(n), If you have a nested loop it's often O(n^2)

Lookups in arrays are constant time, lookup in a sprted tree is O(log n), this makes sense when you think how a tree looks.

>C
WARNING: Deprecated language. Use Rust instead. This language will be removed with the next release.

faster than Python is not "insanely fast"

You also have log in sorting.

Not him, but it is lol. Python is fucking fast nowadays. You know that, right?

>I have a friend
norman reee

retard here
if m=n(n-1)/2, is it valid to say O(mlogm)=O(mlog(n^2))=O(2mlogn)=O(mlogn)?

fucking node is faster than python

My goal is to start working on my own projects in Perl once I finish reading this book. I've used Perl in the past, years ago, but forgot most of it after such a long break. I like the language though. I think I need to learn Git also, since I've never used version control before.

yea

Then drop perl and learn git immediately.

wolframalpha.com/input/?i=m=n(n-1)/2; O(m*logm); O(m*log(n^2)); O(2m*log(n));

kys

>Python is fucking fast nowadays
What's fast? It's slower than nearly every other language in use, like ten times slower than a compiled language

>I think I need to learn Git
Don't try to learn it.
Just use it. Use it for yourself. because it's comfy af. The first four command you need are just clone, commit, push, pull. That's it. If you need more then just look it up quickly, but do not "learn" it for the sake of learning it.

Doesn't matter what it is, if you're not using it, you're going to forget it.

Another Perlfag hooray.

My use was mostly system-level applications that read files and ran commands. Never used Perl for "real" programs, for that I use C.

and maybe $ git reset HEAD~1 --hard

How long does it take to learn how to use Git?

I don't know what I'm looking at

Attached: b.png (802x441, 27K)

how does electron work? is it possible to make small, portable, modular webkit-based framework for makeing cross-platform desktop applications?

>small
lord no, electron ends up vendoring multiple different versions of chromuim due to shit devs

depp

Lol it's an upper bound, not defined how tight

you should say subset
O(log n) =/= O(n)
O(log n) ⊂ O(n)

I mean from scratch. In my perspective, electron is monolithic resource-hungry piece of garbage. Is it possible to make webkit-based modular alternative to it?

What did he mean by this?

Attached: 1551962531717.png (583x482, 119K)

Maybe a real basic one, but given how much junk is in the standards now there'd be a lot of ground to catch up on.

Can the OS/Kernel know what process is invoking what sys call? Is it possible to prevent certain processes from doing certain sys calls? How expensive would that be? Is it better in terms of security to have processes in a VM instead?

Attached: .png (463x492, 205K)

retarded frogposter

Just another CS-fag thinking their computer has infinitely fast infinite memory, and memory operations don't count in O notation.

Considering an application requests the use of the system to know where applications are, yes. You'd have to have access to a raw interface to a raw memory device to an exact location and directly load and inject data into the cpu. That'd be very wrong and insane for an operating system.

Can someone help me understand how the following code works? Why isnt A::someFunction being called? Also is the use of delete[] here correct? Using delete[] list throws an error.
class A {
public:
virtual void someFunction(int i) { std::cout

rude

Attached: mpv-shot0005.jpg (1920x1080, 406K)

Protip: use the override keyword rather than the virtual keyword when overriding a method.

Why would A::someFunction ever be called?
No, delete[] should only be used on a pointer acquired by new[].

Virtual functions dont call the parent class' implementation.
The runtime type is B so that is called. What did you intend to do?

so is there no need to delete list ?

That's right. It's automatic (on the stack) rather than dynamic (on the heap).

But you do need to delete the two pointers you newed.

Just found something similar in an example for a raycaster. Never used OOP so I tried to understand it.

List is a fixed size array on the stack. Like for exapmle an i t on the stack it gets deleted when you leave the scope.