/dpt/ daily programming thread

First for Julia.

Previous thread:

Other urls found in this thread:

danluu.com/julialang/
tpapp.github.io/post/orphaned-lisp-libraries/
tpapp.github.io/post/common-lisp-to-julia/
mitpress.mit.edu/books/functional-differential-geometry
semtech.com/uploads/documents/sx1230.pdf
github.com/dmpe/JavaFX/blob/master/src/ex/BackSpace.java
github.com/JuliaLang/julia
github.com/scala/scala
books.google.com/books?id=iJzje_1tJA4C&pg=PA44&lpg=PA44&dq=baud rate lsb msb
design-reuse.com/articles/25090/dynamic-memory-allocation-fragmentation-c.html
udemy.com/getting-started-with-julia/
en.wikipedia.org/wiki/Memory_management_unit
mathoverflow.net/questions/81443/fastest-algorithm-to-compute-the-sum-of-primes
people.freebsd.org/~lstewart/articles/cpumemory.pdf
mentalhealth.gov/
twitter.com/SFWRedditVideos

>Julia
danluu.com/julialang/

Rust :)

>> Quotes a five year old post about a pre-1.0 language.

>quotes a quotes quotsey quotes

>MSB is 0x1A
>LSB is 0x0B
>somehow this translates to 4800
I don't get it, what am I missing?

>five year old article
Yet another lie from the Julia community. The article mentions the author having last used the language in October 2014, so the article is less than four years old.

Daily reminder that even people who have used common lisp for decades are jumping ship to Julia:
tpapp.github.io/post/orphaned-lisp-libraries/
tpapp.github.io/post/common-lisp-to-julia/

What is not soy for stats then, if not python?/

I haven't been to Sup Forums and /dpt/ in over a year. What's with this new hatedom for Python?

>near-C performance
Slower than python

The article was written in october 2014. Scroll down and you will see the responses that were made to it in november/december 2014. It mostly talks about github issues from 2013 and early 2014.

>soy
oh do fuck off

Does any1 have experince with apache POI for excel documents??

what are some good resources to get into embedded/micro-controller + peripheral programming

Post your benchmark. Numbers or GTFO.

post context

Learning php as I start a web developer apprenticeship next week and they primarily use drupal.

>The article was written in october 2014.
It is currently February 2018. The article is not five years old. The dates of the github issues are irrelevant. What matters is that yet another Julia shill has been caught in yet another lie.

retard

By the way, if the Python code is unidiomatic (i.e. faster than the Julia code) then it doesn't count.

you poor soul

Waiting Julia 1.0
I want implement this book in like-lisp Lang

mitpress.mit.edu/books/functional-differential-geometry

Jewlia

If you'd said 0x12 and 0xC0, we'd believe you had a big-endian short int (of unknown sign).

post moar code

...

The average quality of the community will go to shit in the next few years as Pythonlets make the jump to Julia though.

There will be heaps and heaps of "why is my code slow" posts from people who don't understand static typing.

So, we all know that Ruby is the most enjoyable language and it's super quick to learn, but how does one go about learning Rails just as quickly? I've been following their tutorial, and it's great and all but at times they completely omit information about what something is doing. I feel like reading the docs would be quicker to learn rails than their posted tutorial.

>asks for more code posts
>posts faggot shit webm
is Sup Forums dead, boys?

>Ruby is the most enjoyable language and it's super quick to learn
citations very much fucking needed for both those statements

what is ruby even used for except for rails?

In JavaFX, is a method in TextField that allows me to detect if a certain key is pressed, like Backspace?

I love ruby but isn't rails dead already? everything is js now

>most enjoyable
>super quick to learn
that's scheme, haskell, agda, or idris

much better

it's a divisor
some_freq/divisor = baud_rate
note how in Table 7 the BrMSB:BrLSB numbers decrease in value as the Rb Actual increases (product staying the same - the frequency of some clock):
semtech.com/uploads/documents/sx1230.pdf

public void handle(KeyEvent keyEvent) {
if (keyEvent.getCode().equals(KeyCode.BACK_SPACE)
|| keyEvent.getCode().equals(KeyCode.DELETE)) {

github.com/dmpe/JavaFX/blob/master/src/ex/BackSpace.java

umm....rails?
Very much no.
>everything is js now
Node has come a long way but rails is still going strong for people who don't want to work with Node. There's nothing stopping you from using rails and js on the same site though.
>quick to learn >haskell
hmmm..

Julia development has picked up like crazy since I last checked it out.

github.com/JuliaLang/julia
github.com/scala/scala

The Julia repo has twice as many contributors as Scala, and 40 k commits as opposed to 28k commits.

Scheme yes. The last three no. They can be enjoyable but they are not quick to learn.

got the hint by googling "baud rate lsb msb" and noticing "baud rate divisor" in this book:
books.google.com/books?id=iJzje_1tJA4C&pg=PA44&lpg=PA44&dq=baud rate lsb msb

Are you looking for a new powerful scripting language? Check out Perl 6!

>what is hype

I disagree. I think *unlearning* Java-style programming can be slow, and that that is often conflated with learning a functional language with an advanced static type system.

Thank you

This is a dumb question but I'll ask it anyway. In C is there anyway to take 2 separate sections of memory and make them contiguous without copying them?
My mind is saying that any method of moving memory is inherently a copy followed by a free so it can't be possible but maybe I'm wrong and there's some arcane spell I could invoke.

For simplicity assume I want to take 2 uint8's and put them into a contiguous 2byte block of memory. I could do this but I'm wondering if there's a faster way. In reality I'm going to be serializing a ton of shit in a loop.
uint8_t x, y;
x = y = 129;
void *z = malloc(2);
memcpy(z, &x, 1);
memcpy(z+1, &y, 1);
printf("%d\n", *(uint16_t*)z); //do something with z
free(z) //done with z

Thanks for the help.

design-reuse.com/articles/25090/dynamic-memory-allocation-fragmentation-c.html

Close thing use linked list to store start and end segment memory and give interface to list to show like memory contiguous, but is slow.

Some security system disallow use direct memory access and use pointer isolate directions.

Thanks user, I didn't think to use some kind of memory pool from the start, I think I can work it into my system in a way that will mitigate most of the copying. I'll have to do. I've heard people talk about this before but never actually had a use case for it myself so it slipped my mind.

Does anybody else love std::intializer_list or is it just me?

This is a really good Udemy course on Julia for those who cant stay focused on books:
udemy.com/getting-started-with-julia/
watch the promo video

Use some bitshifts

I am fucked up currently so this is probably the wrong way around

```
uint8_t x, y;
uint16_t r;
r = x;
r = r

lol

You got yourself a solution I suppose but there is an arcane spell. Just not in (portable) C.

en.wikipedia.org/wiki/Memory_management_unit

It's not about unlearning. It's about the massive piece of abstraction you need to learn in order to understand most of the real-world code that's written in Haskell.

Getting to the point where you can grok Yesod or Reactive Banana is hard.

How can I make this faster, Sup Forums?

I remember seeing a blog post by some dude at google who wrote a prime sieve in Go and summed the primes up to like 10 trillion or something crazy like that.

Anyway, what I'm using is a pretty basic sieve over the odd numbers, anyone know some ways to make it better?

mathoverflow.net/questions/81443/fastest-algorithm-to-compute-the-sum-of-primes

jesus the archfag meme is real, they can't do anything without including a desktop/screenfetch

ASM wizardry is what I was looking for, that could help me here. I can always have the portable C version with ifdefs for platform specific optimizations. Thanks user, I'm gonna look into this.

I considered this but I think the performance might be worse in some cases and it gets unwieldy when you have to concatenate a lot of elements. I might still experiment though. I might go to jail if I make some macros around this though.

>not doing it generically
>not saving obvious operations

pleb/10

template
T fib(T n)
{
T a = 1, b = 0, p = 0, q = 1, t{};
while (n)
{
if (n&1)
{
t = a*q;
a = b*q + t + a*p;
b = b*p + t;
}
t = p= 1;
}
return b;
}

#include
#include
using namespace boost::multiprecision;
using uint8192_t = number;

int main()
{
std::cout 560099116857419990464943760131738213410973574450557569045176277.......77759151745760167318600853713004609154694001

jej

I'd be shocked if you were able to do that. You'd have to be writing a kernel or some homebrew console game or something. It's not really assembly wizardry but hardware wizardry.

Listen, it's very important that this project I'm writing that nobody but myself will even even see, is very performant, my clients might complain! Entirely rewriting how the kernel handles memory to make my meme data transfer 3 pico seconds faster is obviously worth pursuing.

Seriously though I think bitshifting into a block of memory may be the way to go here since most of my values are literal constants and fixed size, so I'll just OR bits into it, shift left, repeat, use the data and free it. Does that sound sane?

>falling for such obvious b8
Enjoy your first day on 4gag

>b8
>giving people the benefit of the doubt
Stop that.

people.freebsd.org/~lstewart/articles/cpumemory.pdf

If you want performance, optimize code,data structures,cache levels,branch predictor,algoritms,using intrinsic CPU instructions.

what are equivalent of "perl -e 'print "A" x 65' in C programming user?

That does sound sane. But be careful of endianness. A struct might be better depending on what you're doing.

Enjoy your down syndrome.

#include

int main() {
int i;
for (i = 0; i < 65; i++) {
printf("A");
}
puts("");
return 0;
}

thanks user, if I want a manual input the number? how is the way user?

I don't want to change the source code everytime

Cool pdf, I'm going to read this for sure when I get a chance.

In this particular case I'm targeting a specific endianess. So as long as I get the byte order correct I think I should be fine but to be honest endianess is something that has always confused me, not the concept but, when it matters, as in I don't know what operations can cause problems. It's not exactly something that I find easy to test since I don't even have a big endian machine with shell access. Everything I read online is either "don't worry about it until you have to" but never "here are the cases you have to" outside of simple socket hton type stuff.

Maybe I need a data structures book or something.

Example of endiannes fucking you:
#include
#include
#include
int main() {
signed char a = 2;
signed char b = 1;
short * c = malloc(2);
short * d = malloc(2);
memcpy(((void*)c) + 1, &b, 1);
memcpy(c, &a, 1);

*d = (a

#include

int main() {
int i;
int number;
printf("Number: ");
scanf("%d",&number);
for (i = 0; i < number; i++) {
printf("A");
}
puts("");
return 0;
}

Any time you cast an array of small numbers into a big number pointer, or if you cast a big number pointer into an array of small ones, you've fucked up endianness 9 times out of 10.

You should consider binary data nonportable unless you've given endianness care and have special readers which take the endianness of the data into account.

Employed Haskell programmer reporting in :)

Employed Idris programmer reporting in OvO

thank you user

Is this a good enough "highlight" ?

what is this 1995?

In page 154 of CLRS' book, they are showing how max-heapify is done in a max binary heap. Why do they assume that a node at 2i + 1 exists?

what library is this?

inside that function, LEFT or RIGHT they check if the node iexists

if (i == null)
....

Qt.

Make the color red to stand out more.

...

It can be the same as left.

what is this a retard?

I noticed my usual clothes shop was having a sale so I decided to get some more stuff.

What does /dpt/ think of my new programming dress? Hopefully it gives a bigger full than my other ones.

I like it desu. Fapping to it as we speak.

mentalhealth.gov/

Has one project gone wrong ever made you go from being completely in love with a language to absolutely despising it?

i don't program

I've never had a fizzbuzz go wrong

Binary tree to array transformation
One tree must had a least one root.
Left or rigth children exist
1 is root address
2 times root must be left child
2 times plus one 2i+1 must be rigth child
Using induction could prove if next root become left node 2i will be left child and 2i + 1 must be rigth child

found the user who only wears clothes his mom bought him

> $ 9̶9̶.̶9̶5̶ 38.95

Programming clothes are so cheap! One pair of my jeans cost $90, I can literally buy three programming dresses for that.

>Using induction could prove if next root become left node 2i will be left child and 2i + 1 must be rigth child
I'm not arguing that though.

nvm goys,I figured it out

>new