/dpt/ - Daily Programming Thread

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

First for D

Thanks dude

Why no love for Lisp in these threads?

Fourth for JAI.

this

Java is shit

fuck's sake i meant to quote anyway fuck you faggot OP and the rest of you pathetic newfag """"programmers""""

Because they are all dumb memesters.

Is it possible to turn plain html that i downloaded from an xmlhttprequest into a DOM object so I can insert it into the page?

Yes.

no
you have to parse and recreate every element individually

This is the only way to do integer average
template < class T,
class = typename std::enable_if::type>
T average(T a, T b)
{
return a / 2 + b / 2 + (a%2 & a%2);
}

Also we have parallel functional programming thread:

$('body').append(yourhtmlstring);

The people in these threads or people who use Lisp?
I'm not sure who you're replying to so I'll assume it's me

Depending on dialect lisp is object oiented, functional, imperative, or whatever really

it was about time for haskell (and whatever the fuck shitlangs) tards to fuck off to their own thread

erlang

next we need a pair programming thread to fragment dpt even more

Yes. The safe way is DOMParser(). The fast way is creating a div, setting its .innerHTML and retrieving the children. The former is preferable for for external content.

It's not like /dpt/ suffered much, since it keeps going at 3 threads per 24 hours.

Why do you hate Haskell fags so much? I would understand if it were Java or C#..

Two extremes of the spectrum. Both think their over-engineered crap is the saviour of humanity.

(defn exponents
"rases a base to a power"
[base power]
(def total base)
(loop [pass 1]
(if (< pass power)
(do (def total ( * total base))
(recur (inc pass)))
total)))

(defn powers
"Raises a number to a power and appends all given powers into a vector"
[base power]
(def total base)
(def factors [total])
(loop [pass 1]
(if (< pass power)
(do (def total (* total base))
(def factors (conj factors total))
(recur (inc pass)))
factors)))


I couldn't find an exponents function so I wrote one, took longer than it probably should have and it's clunky as hell but I'm pretty proud of it

It isn't over engineered at all

>GDI is unbearably slow

Thank you migrosoft.

Just another useless abstraction that complicates windows APIs

Correct.

wouldnt have happened with java

what are you trying to do?

Why are you comparing Java to C/C++?

I agree. there is no comparison. java is superior to sepples in every way.

bufferedGDI(fileGDI(intGDI(

2/10 troll

If you're talking about monads etc. in Haskell, that's not really engineering. Guys like Wadler didn't invent monads for IO (they're an abstract mathematical concept) but rather saw how e.g. IO in Haskell was an example of a monad. It's more scientific.

Yep.

C >>>>>>>>>> Erlang > Haskell > Python > Java > C++ > C#

if every custom class in Java inherits from Object, can I add a list of Substances (custom class objects) to List ?

int i = 0;
cout

sure

>writes the shittiest possible code

>wtf why is x-lang so shit?

pixels

>UB
>why does it do this wrong?

because all the real programmers get tired of newfriends and memes and go to lainchan

anyone know a good netbeans plugin to edit the same file in two windows?

...

meh

>her IDE can't do this by default

tfw when you make an overcomplicated piece of code to then find a simpler way after all is done.

ah cool works in netbeans too
view -> split -> horizontally

>her

>her
did you just assume my gender?
btw

how much should cpu cache affect performance of insertion into a linked list?

SAY IT WITH ME


POO

not much because it shouldn't take much and more would have no effect

IN

next time ask rsm for advice first

HASKLEL

or
>tfw you write code for hours and then look back and optimize it yourself and it is cut in half or more
orgasmic tbqh

LOO

Are you the guy in AGDG boasting about your performance while using linked lists for an ECS?

anyone here working as intern?

what pay do you get?
$13, feel like that is a bit low. actual employees start with $30 here.

No i don't do agdg
give backstory

post some memes desu

You're lucky to be paid. I didn't get that chance...

C++ is so horrible.

What's the benefit of C++ over C?

Currently learning how to create Android apps through the AndroidStudio and the android website. All based on Java obviously. Am i doing wrong? Anyone have objections?

>muh OOPeh

He's railing on about how his game will be 5x faster than if it was made with e.g. Unity yet he's using linked lists where he should be using vectors and doesn't know why.

To answer your question, not much. Unless you're constantly inserting to the same place and touching the same nodes over and over again, it's unlikely anything will be in the cache in the first place and the nodes aren't contiguous so they won't be prefetched.

clearly you should use Corona SDK so you can develop in cool, refreshing Lua instead

RAII
lambdas
templates

I'm sorry. I'm a complete noob. What are you getting at?

RAII, template metaprogramming, better compile time computation, a standard library that isn't shit, etc.

It's alright desu. Personnaly I don't if it's worth it to make a complete app in java on android instead of making a webapp that you could that way run on all platform.

Android Studio / Java is the "right" way to develop for Android, but there are enough frameworks and shit floating around now that you can choose from several other languages if you wanted to.

That's all.

>a standard library that isn't shit

T O P L E L
O
P
L
E
L

it took decades for sepples to include hashmaps and other basic stuff.

You might have a point if he said "a standard library that wasn't once shit".

developing for mobile is like having aids and cancer at the same time

Oh. Honestly I'm just trying to be as hire-able as possible. I'm trying to tackle this whole thing as honestly as possible. Don't want to venture into Linux and pick up on C++ or whatever just because Sup Forums agrees with it or whatever. Just curious if there's a good reason why this is a bad way to learning.

First, this is a comparison to C. Second, so what? The entire STL could have been written yesterday and it would have no impact on an evaluation of its current strengths and weaknesses.

hey guys is there a chatroom that i can join that can help me wiith android development using androidstudio?

>The people in these threads or people who use Lisp?
in these threads, Lisp is the ultimate programming language.

...

>Lisp is the ultimate programming language
No it's lambda calculus

No, Ruby is :3.
Because Ruby is also the name of the only girl we have here :3.

Guess what I'm making fun of

>)))))))))))))))))

Made a little PBM-drawer tool. It's just part of a bigger project (sampling entropy from zener-diode-noise) but i'm stuck having fun drawing some bitmaps

#include
#include
#include //time()
#include //uint8_t
#include

#define WIDTH 400
#define HEIGHT 400

int main(int argc, char **argv)
{
srand(time(NULL));

std::ofstream pbm("bitmap3.pbm", std::ios::out | std::ios::binary);

//write header
pbm.write("P4 400 400 ", 11); //To Do: Pass as string so my defines are actually usefull

//data, body array
uint8_t data[WIDTH * HEIGHT];
int bit;

for (int i = 0; i < WIDTH * HEIGHT; i++) //for every bit (pixel) in bitmap
{
for (int j = 0; j < 8; j++) //for every bit in byte, since pbm is drawn byte per byte, rep. 8 pixel
{
bit = (j / M_PI < sin(i)) ? 0 : 1; //drawing logic here

/**
* little trick we need since .pbm files represent
* pixels as bits - but we write bytes to our file.
*/
data[i] = (data[i]

j/PI < sin(i)

I've programmed in quite a few languages, the ones I found fun were Common Lisp, Racket, Scheme, & Clojure

C/++ were pretty good man, but I wouldn't call them fun

Python and Lua were alright

Java made me want to feel the cool touch of a shotgun barrel on my tongue

awnn tru tbqh senpai she is co qt gurl power gurl boss

your pathetic life

No it's SK combinator calculus

None.

Just retards pushing the "better C" meme.

Wrong.

That's not valid, it needs to be
((((((((((((((((faggot))))))))))))))))

Neat. If you're using C++ you should use instead of C's random number generation, it's much better.

>I've programmed in quite a few languages, the ones I found fun were Common Lisp, Racket, Scheme, & Clojure
Never used clojure but seems about right.

>Java made me want to feel the cool touch of a shotgun barrel on my tongue
pic

Any reason you're not doing this with full-color bitmaps?

>Mfw C/C++ can't even do the average of an int

explain this meme pls.