/dpt/ - Daily Progtamming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

twitter.com/japaricious/status/841165373663793153
pastebin.com/hJAg0qDH
gtk.php.net/manual/en/tutorials.php
pecl.php.net/package/sdl
twitter.com/SFWRedditVideos

First for Rust.

second for Rust

Third for C#

Fourth for Forth.

Fifth for Swift

>tfw swift is now faster than Go
>Even Java is now faster than Go
ayy

Nice image OP

FUck you''re nigger moms

In Javascript, how do I run make a for loop that does something to every image with the class "book"?

for (let element of document.getElementByClass("book")) {
}

Something like that I presume

var books = document.getElementsByClassName("book");
for (var i = 0; i < books.length; i++) {
console.log("ur a faget");
}

What can I read about embedded development in Java?

The whitest languages currently available:
Functional - Idris.
Imperative - Rust.
Anything else is a pleb filter and complete trash.

twitter.com/japaricious/status/841165373663793153

...

That's pretty God awful if it's intended to be performant.

Opinion discarded

>it's intended to be performant.
>CPU usage less than 2%
>Literally 160MHz

>performance
>In this scenario
wew lad

>ARM Cortex-M3 microcontroller @ 8MHz
>CPU usage ~1.5%
>That's pretty God awful if it's intended to be performant.
What.

You just confirmed my suspicion that you along with most of this thread are straight from reddit. I wasn't even stating a Sup Forums opinion, you have to go back.

meant 1.60MHz

>Functional - Idris
Barely

You mean .16MHz

oh yea

>8mhz*0.015=120khz
>32hz refresh
>120/32 kHz per update.
>3750 cycles per update
>to increment two indices and produce the simple data pattern
Really now.

I'm not saying that it's bad or anything. I'm just saying that the presentation of 1.5% usage leads me to believe that it was an actual concern and the person presenting isn't just showing some nice LED pattern but is rather proud of this very mediocre accomplishment. And I'm fine with undeserved pride. He's happy, that's nice. It's just not impressive in that aspect.

That's just printing an LED pattern your performance concern in there is baseless

>your performance concern
No clearly its the person who posted that Twitter post who has a performance concerns. I didn't measure CPU usage on that stuff.

It's clearly good enough for the task. Standards for performance aren't high for simple embedded applications.

I've tried that before.
books.length is 0.

Lel
It's most likely is using 3x dma streams to control the ws2811, so all the mcu does is setup the streams on startup and then just write to a buffer.
Literally no achievement. You have to be retarded to manage to make it use more than "1.5%" of the cpu.

Which programming language is best for mathematics, specially combinatorics and automata thoery??
I would like it to have C/C++ binding so that I can make opengl, directX programs.

My aim is to make open source matlab.

>when in doubt
Java

>Which programming language is best for mathematics
Julia or Python.
> My aim is to make open source matlab.
Why? GNU Octave is a thing, you know.

>manage to make it use more
Oh don't worry about that. I can fire up those transistors for you buddy.

>remake make matlab
Yeah you will need C or C++. Or maybe possibly java since the JIT does fit the use case of matlab pretty well (running JIT on long computations can be beneficial, people generally don't care about performance for the trivial cases) but that's speculating.
I think most good math kernels/matrix libraries are for C++ though.

nsp

I think I'm gonna look into reddits programming outlets. I don't have a clue what they're like and I suspect it'd be educational.
Wish me luck.

ok, so I am a n00b and I do not understand why this is behaving so.
Im using rubys 'syntax-sugar'
and it is not consistent ?
class Bank
attr_accessor :balance
def initialize(amount=0)
self.balance = amount
end

def -(x)
self.balance -= x
end

def to_s
self.balance.to_s
end
end

acc = Bank.new(20)
acc - 5
puts acc

This will subtract 5 from the amount
but if I mix -=5 with it, it suddenly decides to only use one "sugared" syntax
why can you only use one style/syntax?

other syntax being
-= 5
.-(5)
all work but not when mixed, no errors..

Have a look in GPU programming - OpenCL/CUDA
The resulting memory buffers can be "easily" passed to an OpenGL rendering context, as they already reside on the GPU, so there is less overhead to the visualization.

Any modern language can be used for the shell program but most probably you should use C++.

>GNU Octave is a thing
It truly isn't.

(cross-post) Hi friends, I'm trying to learn SQL before next semester when I take a class on it.

I currently have a few tables (product, component, consumer, reseller and vendor (vendor doesn't exist as a relation in the DB).

Products are made up of components bought from vendors.
Both resellers and consumers purchase from the manufacturer who purchases components from a vendor.

My relations that I have derived from here consist of consumer_orders, reseller_orders and vendor_items. I'm trying to figure out a way to do product_components (a list of the components in a product) but I'm getting stuck and can't figure out a way to do it that makes sense to me.

pastebin.com/hJAg0qDH

Any tips would be appreciated or if I've just done this completely wrong feel free to tear me a new one.

Sup Forums should be freed from shitskin pajeets.

Are you working on a project in Rust?
Will whatever you know about it now will still be applicable in the near future?
Are you not wasting time?

Learning is not wasting time

>Learning is not wasting time
yes but learning rust is waste of time.

I'm following a course on data-structures being taught in Java, but I'm implementing them in Javascript.

Right now, I'm implementing an array-based stack. In the course, the instructor uses Java's native array to build his stack with.

Is it ok for me to use Javascript's native stack? The exercise produces a redundant data-structure, in the sense that it just wraps the native array's methods. However, it could be argued that I am learning about the capabilities of an array-based stack, as a kind of toy programming exercise.

> Are you working on a project in Rust?
Yes, occasionally I do this personal project of mine just for fun.
> Will whatever you know about it now will still be applicable in the near future?
Yes, why not?
> Are you not wasting time?
In the grand scheme of thing, whatever you do is a waste of time, I just waste it on something I find interesting.

How old are you?

32, go shill rust elsewhere.

So you are "32", shitpost in Sup Forums, concerned about what people like and complain if people like what you don't?

How does being a pathetic manchild treating you?

Or what?

>concerned about what people
Couldn't care less but the rust shilling is getting really obnoxious here.

If that's the case why are you so butthurt?

Why would I not be shilling the best imperative language currently available? Not counting assembly.

How is being literally retarded treating you?

Oh you dodged that bullet didn't ya?

agree, hating on Rust is edgy..we get it.
now can we talk about code ? and not just circlejerk over it.

Please tell us why Rust is a waste of time, reasons someone should not learn it ?
what is time better spent learning ?

>Are you working on a project in Rust?
>Will whatever you know about it now will still be applicable in the near future?
>Are you not wasting time?
>Couldn't care less
Aww never knew children can be so adorable

I'm a second year computer science student, I like programming and am getting much better at it.

Give me a project that I'll enjoy.

I'm starting to expand my MTG collection, a Database could be fun but what's a project I can expand it with?

>Give me a project that I'll enjoy.
Oh boy
I wanted to work on GTK and it gave me mental illness.

Project Management app/ticketing app.

could implement MTG stuff in it somehow also.

That sounds like a big project, what sort of stuff did you try and develop for it?

I just wanted to patch the file picker man. The fucking file picker. After a month I found myself trying to kill myself.

>C with classes
Oh boy. I hate people that try to involve C with EVERYTHING. Not bashing on C, but now I just do not care.

is JavaScript a decent choice if I want to try some functional programming ?

I mean I know it supports functional style so I assume it will be fine for a first look into functional programming...

>classes

If you're mentally handicapped, sure. Otherwise better go with Haskell if you really want to do it just to try some fp.

ribbity ribbit you cannot read

JavaScript is not functional programming.

What defines a functional programming language?

It not being JS is one of the main qualifiers.

Scala is actually really fun!

>POOlang is actually really fun!
nice try, MI6 shill

Being JS is one of the main qualifiers actually.

Gate keeper is back

No, because JS is a programming language. You can do FP in JS tho.

Don't bother replying to him, it's the gatekeeper kid

XdXd Le functionnal maymay XdXD Le programming XDDDDDX le coding!!Xd

is that your friend? fuck off back to your irc.

Programming is a meme!

Keep it up, gate keeper. You are doing a great service

PHP can be functional and PHP is not JS. Therefore PHP is more functional than JS

/fpt/ --->

10% of the people here program, 90% are teenage non-normie epic bros.
fight the good fight.

>90% are teenage non-normie epic bros.
And 95% of them are weeb animoo lovers
And 70% of them have shit animoo taste

Your mum is shit animoo taste

You're mom Schwarzschild radius is infinite

"In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. It is a declarative programming paradigm, which means programming is done with expressions[1] or declarations[2] instead of statements. In functional code, the output value of a function depends only on the arguments that are passed to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) each time. Eliminating side effects, i.e. changes in state that do not depend on the function inputs, can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming." - Wikipedia
TL;DR FP uses expressions instead of statements.

Imagine programming a 3d game in PHP.

gtk.php.net/manual/en/tutorials.php
>there are gtk bindings to PHP
>I don't want to check for bindings to opengl

>Aww never knew children can be so adorable
Biggest objection to Rust? That fags think that programming in it automatically makes their code guaranteed to be safe against all attacks, and that it is the only programming language with this property.

I made a program that is so interesting I feel like I should submit it to an academic journal or something

You'd better believe it sonny.
pecl.php.net/package/sdl

Anything is possible.
It's just that nobody's been dumb enough to actually do it.

>submit it
Well, you obviously need to write a paper explaining your motivation and results then, but why not do it?

because I'm not part of a university
I don't have much money (I looked into it, it takes 1000+ bucks)
I have no idea how to even write a paper
I have nobody who I can put down as a reference

Put it on github, write a blogpost and post it on HN and reddit.

O(1) fizzbuzz?

Not gonna lie, former C programmer here. This is fucking hilarious watching C segfault and crash. But in all seriousness we can't let these buffers get more overflows.

>because I'm not part of a university
Don't need to be, but it will admittedly be difficult unless you know someone in the community. Academic nepotism is a real thing.

>I don't have much money (I looked into it, it takes 1000+ bucks)
You'd need to pay a member fee and then most likely attend the conference. For journals you need to pay some fee as well, but it's more in the ballpark of $20.

>I have no idea how to even write a paper
That's a bigger problem though. However, I was never told how to write them either, I just read enough of them to get an impression of how they were supposed to be. Although collective writing with coauthors help a lot and also you must target your paper to the conference or journal you are aiming for. They usually have trends and stuff they want you to look at.

>I have nobody who I can put down as a reference
You need references, but not in the job application way. You only need references in the sense that you must cite what isn't considered common knowledge.

I did have it on shithub. 3 unique visitors.

also I put it on fractalforums.com.