/dpt/ - Daily Programming Thread

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

Attached: hidamari_dpt_waifu2x_traps.png (1618x1308, 1.95M)

Other urls found in this thread:

youtube.com/watch?v=TylgU3tUSE8
cns.iaf.cnrs-gif.fr/files/CELLS/pyramidal264L.geo
github.com/torvalds/linux/blob/master/include/uapi/asm-generic/posix_types.h
lwn.net/Articles/113349/
man7.org/linux/man-pages/man1/perf-top.1.html
twitter.com/SFWRedditImages

Lots of memes

Attached: 1523040413844.png (587x756, 208K)

This is the wrong way around desu
Anime isn't programming related, but traps are


2nd for rust

typedef struct chuck {
int feed;
int seed;
} sneed;

In about an hour and 30 minutes I will be doing some comfy lisp programming of a project I'm doing to migrate my 1000+ tabs to a wiki utilizing org-mode. Max comfiness
youtube.com/watch?v=TylgU3tUSE8

P.S. I'm the guy that met Terry A. Davis.

Attached: comfypepe.png (600x579, 271K)

How do Java getters and setters work on a ListArray? If I have something like:
public static void main( String args[ ] )
{
ArrayList listhing = new ArrayList();
readListhing( );
}

public static void readListhing( )
{
Scanner in = new Scanner( System.in );
listhing.add( in.nextDouble() );
}


How do I make it so that I can access to the list thing from the other function? Oh and I can't use variables to pass anything as argument.

Nobody cares, you frog scum.

You don't use list thing in another methods.

*downvotes*

make it a class member

cool desu
may watch

You are retarded.
Just declare and add values to the listhing in readListhing and return it to main

I don't understand why people on here get so buttblasted over condition == true

It adds absolutely nothing over just having condition.
Also in C, it can actually lead to errors.

So my C library is running on x86_64 Linux. I want to port it to ARM Linux. How do I do this? I've never dealt with ARM before.

In particular, how do I test my code?

>and in c it can lead to errors
I doubt that. I've written lots of C and I can't say I've ever seen an error from == true. And == true makes the code read slightly more naturally for a mere price of 7 characters that won't cause any line wrapping or extra lines. I'm not going to demand it, but I'm not going to discourage it.

Assuming you wrote your code properly, and didn't make any dumb architecture specific assumptions (e.g. size of pointers), you shouldn't have to do anything.
Compile it on an ARM computer and just use it. A raspberry pi or something similar would be the easiest.

If you aren't doing any retarded things that involve endianness or inline assembly or relying on long being an exact size, it should just werk when you successfully chant the magic ritual to get it to cross compile.

Truthfulness is C is non-zero. Comparing to 'true' will only compare it to 1, which will "fail" for every other true value.

I'm following the stanford version of Andrew Ng's course and implementing the various ML algorithms in Julia.

It's honestly a lot nicer than Matlab for this. I have fast for loops so I an try out different algorithmic improvements. I'm also planning to get properly into CUDAnative.jl eventually to play around with GPU stuff and flux.jl when I'm done. I want to play around with a framework where I can read every line of code and fully understand it inside and out rather than dive into a huge opaque framework like Tensorflow or pyTorch immediately.

Attached: Julialogo.png (320x216, 11K)

>I've written lots of C
result = foo();
if(result) { }

Stop using fucking c89 then. flip on that -std=c99 and change those int returns to _Bool returns. When you cast to bools, true values are converted to 1.

Programming challenge

Write a parser for the Yale NEURON geometry format and use it to output an image of this neuron:
cns.iaf.cnrs-gif.fr/files/CELLS/pyramidal264L.geo

It should look like pic related.

Attached: neuron.png (986x3742, 281K)

bool foo();

I can't just change the return codes of every library I use.
Also, not every function is suited to having its return code changed.

>architecture-specific assumptions

I'm letting Linux handle that for me. It exports lots of useful typedefs and macros to user space.

github.com/torvalds/linux/blob/master/include/uapi/asm-generic/posix_types.h

For example, I use typedef __kernel_size_t size_t; so when the architecture changes Linux will supply a different typedef.

>inline assembly

I do have some assembly code and of course I will take the time to port that code to ARM.

>Compile it on an ARM computer and just use it. A raspberry pi or something similar would be the easiest.

That's just the thing, I don't have an ARM computer. Well I do: my phone and my nintendo ds, can't imagine either of them being comfortable development environments...

I was thinking maybe I could run virtual box in ARM mode or something, and install some ARM Linux distro on it. Note sure if that exists.

Why the fuck do you space your posts like that?
What the hell are you writing that requires you to use kernel-defined types and inline assembly?

Are you using closed source libraries or something?
>return code
Not a boolean then. Do != SHITTY_LIBRARY_SUCCESS or whatever if it's a function returning error codes.

if (isPresident = true) {
launchMissiles()
}


// returned error code is not 1
if (err == true) {
recover()
}

dumb frogposter

movslq (%rbx),%rax
What does this mean?

>error codes are booleans

>Are you using closed source libraries or something?
No, but do you seriously expect me to modify the 10 or so C libraries I'm using, and then expect users to need to use my shitty patched versions?
All for what? So I can do "== true" for no fucking reason?

>What the hell are you writing that requires you to use kernel-defined types and inline assembly?

A C runtime library.

>> doesn't use true == isPresident to make accidental assignments more obvious.

can your PL make the console beep user?

how good do I have to be at math to learn programming? I have high school level knowledge.

>A C runtime library.
You should still be using (which is provided by the compiler) instead of going to kernel types.

Trump was an accidental assignment.

That's probably enough. You really just need a decent understanding of algebra.
Only when you try specialise in shit do you need to know a lot more maths.

>I/O

Attached: 1513763670899[1].gif (200x270, 1.12M)

move the longword pointed by register rbx to register rax and sign-extend to quadword

>accidental assignment
>not using a pure language

BEEEEEEEEEEEEEEEEEEEEEEEEEEEP

That looks so retarded, and just makes the code more annoying to read.
Compilers easily catch that shit, so there is no point doing it that way.

So it does a pointer dereference? Cool.
For some reason my code is taking an absurd amount of time to run and 75% of my time is spent on this instruction. So it's probably not utilizing cache well.

if (donald_trump.isPresident = true) {
launchmissiles()
}

>tfw i will restore the golden age of hacker culture to our current, iron age
It's truly something.

post the asm snip
is it inside a loop?

Yes it's traversing a linked list.

If you have a job your company is shipping the libraries too so don't act like it's such a fucking burden. And I do expect you to stop using c89.

>at&t style

Attached: wow anon.jpg (884x574, 78K)

How do I use intel style in perf?

linked lists trash the cache since they're probably not localized, so you have to fetch from main store each time you traverse one fully; even more so if elements are fat and/or you're not doing something clever with allocation (multiple links close by, etc.)

>Comparing to 'true' will only compare it to 1
You don't know what I #defined true as.

I'm an open source developer using open source libraries. I do not distribute my program; I expect people to compiler it themselves, or get it from their distro package manager.
According to my build system, I have over 20 dependencies.
It sure would be worth ALL of that effort just so I can use == true.
>And I do expect you to stop using c89
I'm already on C11.

I need to though.
>Just declare and add values
I need to read different values every time, I can't declare them statically.

True, I could use have used that. The kernel developers could have used it, too. It's available in freestanding environments. They had reasons, though:

lwn.net/Articles/113349/

>One part of the idea which did not get very far was using standard C types (such as uint16_t and such) for the user-kernel interface.
>The problem with that idea is that the kernel cannot count on those types being consistently defined for all configurations, and cannot create its own definitions for the standard types.
>So the kernel/user interface must continue to be defined using kernel-specific types (__u16 and such).

I wanted to make sure the kernel and my library would always agree on stuff such as system call parameter types. The right way to do this is to use whatever the kernel itself exports.

Yep, I had a suspicion the linked list was the problem but I just had to confirm it. I'm gonna swap it out for a dynamic array.

Attached: 1522100194895.jpg (245x246, 18K)

why the fuck do people still use vim use fucking vscode like a normal fucking person god damn get your head out of your fucking ass you mong

How to detect whether an user is memeing or being serious?

i hate twitter and i hate that i have to use it. and twitter as a company makes dumb decisions like killing their mac app. so i'm in the process of writing one in js and html5

Use Cunningham's law

I need to develop something in haskell on windows.
What's the best text editor for haskell on there ?

Thanks, I logged into @dpttxt just to tweet your shitpost.

>Cunningham's law : people are quicker to correct a wrong answer than to answer a question
OK. C++ is trash

man7.org/linux/man-pages/man1/perf-top.1.html

>-M, --disassembler-style=
> Set disassembler style for objdump.

try with -M intel

VSCode by a mile

>> Julia for ML on the GPU
Neat. Keep it up user, it's a lot of fun.

Haskelly w/ vs code

started good, but then
>PS give me attention, I pretend I'm famous
*report video for being a fag*

How do I use intel syntax with gcc inline assembly or .s files?

>M$
fugg.

Right unemployed.

VS stopped being good after 6.0

>le microshit xdd
This isn't the 90s. Have a proper reason to not use a product and then fuck off and don't use it.

either you compile with -masm=intel or you add the directive .intel_syntax noprefix at the top of your assembly code.

Attached: 1522002278486.jpg (645x968, 153K)

dunno what you mean but name something better

There are tons of "proper" reasons to hate microsoft products.
But it's not like any would get through a corporate cuckold.

Most people don't fucking give a shit about what you do, and phrasing it as being "against corporations" just makes you sound like a fucking hippie

(i mean about what you give a shit about, in relation to the topic)

>Most people don't fucking give a shit about what you do
>implying I use my text editor based on what people might think of me
U w0t

I know it takes more than one neuron to separate the shitty parts and the good parts of Microsoft but it's really not that hard.

Yet here you are expecting others to choose their text editor based on what you think of them

can't because .NET is in everything now

And at which point was that ?

IOCPs are great, for one.

why do you hate .NET brainlet?

Their money is a good part.
The millions of slaves that suck M$ dick and will defend it no matter what could be very useful if "rewired".
That's about it, though.

the point where you attacked opposition

Tons yet you can't name one without bringing in your fanboyism and retarded prerequisites but that is just fine as long as you don't go full street shitter 2.0 on other products because 'your favorite dildo color is purple'.
I find it funny you are hating on things because 'corporate' even though we wouldn't have the pleasure and honor of reading retarded seething posts made by people such as your imbecile self without them.

Nobody fucking cares

your right.
MS & Co. Built everything.
Nothing we have today would exist without Bill Gates and the likes.

>Nobody fucking cares

Attached: pepto.jpg (700x641, 46K)

:^)

Attached: gets.png (644x120, 9K)

Indeed. TO THIS DAY I still don't fucking understand why I can't give a fucking buffer to the Linux kernel, get an fd back and epoll it to find out when the kernel has read or written the data I requested to/from the buffer. It's fucking insane how they still haven't implemented this and have this broken posix AIO user space garbage instead.

I don't even understand

10 DELETE NEURON.DAT
20 PRINT POTATO.IMG
30 GOTO YALE

ought to be close enough