/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

youtube.com/watch?v=-4SoT77acZM
github.com/vhf/free-programming-books/blob/master/free-programming-books.md
yoda.arachsys.com/csharp/teasers.html
wiki.unrealengine.com/Building_On_Linux#Distro_Specific_Instructions
lkml.org/lkml/2014/7/24/584
llvm.linuxfoundation.org/index.php/Main_Page.
youtube.com/watch?v=ypGEkDIsO_Q
youtube.com/watch?v=Q0q1gCsZykg
youtube.com/watch?v=8MC0G-Lbuuk
youtube.com/watch?v=36211-ul46k
twitter.com/NSFWRedditImage

First for Deadlang.

Implementing useless features in my flash card game.

Image segmenter. Takes scanned document of written words, splits it into individual characters.

>converts image to 2D vector
>splits into lines
>splits into characters
>both splitting algorithms ignore noise through a dynamic noise filter
>secondary noise check is done on split characters, removing characters smaller than (μ - 2σ)
>normalize characters to a square aspect ratio (by padding cols/rows)
>write individual images to disk

youtube.com/watch?v=-4SoT77acZM

Currently trying to optimize it so it's quicker. The bottleneck is file I/O, surprisingly. Input images are generally 120-150mb in size. 3/4ths of the time is just reading that fucken image. It takes 20x longer on Windows without altering the code, not sure why.

working on this. not really sure what's going on here.

I hope you all have short compile times and no errors :)

thanks mr shark

Rust is shit

thanks Mr shark

nothing but thanks for asking

i appreciate it

thanks mr shark

What's the minimum "good" size for a TLB?
pic semi-unrelated

thanks mr shark

thanks mr shark

ba(){
matf(!wx);
if(r=0!=n)

pop ax=al // inline
pop bx=dx
pop cl=al
ax=al;dummy
nan.nocwa
wtf is this supposed to resemble?

How meme is it to program in Mathematica?

very

just dont do it man

thanks mr shark

Wolfram Language is incredibly terse and difficult to understand.

Lisp.

Help

what the fuck

what the fuck is this shit?

Uhh....

It looks like some curly brace language using inline x86-16 assembly. It's pretty bad code because the ba() function doesn't specify its arguments or return type, uses poorly named variables and functions, and includes assembly code without a proper inline assembly syntax.

Also, having an equivalence statement in a pop assembly instruction makes no sense. Maybe they mean pop the first, then mov the result into the second?

Never again I thought I would see that tongue being spoken

Some good C# intermediate books?

github.com/vhf/free-programming-books/blob/master/free-programming-books.md

work hard

thanks mr shark

xD

what are some nice programs to practice learning C# on? I'm not new to programming, but I just need some ideas of things to practice the syntax with to retain it.

Is everyone here a fucking code monkey? That's plan imperative style implementation of a basic root-finding numerical scheme with decorated symbols. Nothing surprising.

uh.. t-thanks

the syntax is absolutely disgusting

Anything that involves CRUD.

yoda.arachsys.com/csharp/teasers.html

try this out

how much memory should ncurses use?
I wrote a basic thing to test it out and it uses ~4mb of ram and doesn't nicely clean up after itself according to valgrind, but it doesn't seem to increase or go through more than the one set of allocations

OOP is the way God meant for us to program. Accept it.

Is the urge to kill yourself everyday a feature or a bug of a webdev career?

it's a bug that can be fixed
hang in there =)

Wrong thread
But feel free to kill yourself

Looks like it no longer crashes when I stop doing console i/o at interrupt time (how surprising)
Still I'm not getting any tx irqs, otherwise it would've returned my input without std::flush.

io::rs232_config cfg { };
cfg.set_com_port(io::com1);
//cfg.flow_control = io::rs232_config::rts_cts;
io::rs232_stream s { cfg };
s input;
s

>~4mb
I'm a proponent of programs being mindful of memory usage, but that is nothing to get worked up over.
>doesn't nicely clean up after itself according to valgrind
Are they actual leaks or just "still reachable" stuff?

Actually, I just looked it up, and the manpage for _nc_free_and_exit has a justification for why ncurses doesn't free all of its memory.

okay

rude

Non-trolls, what's the current state-of-the-art/approach for doing .NET(ish) under Linux (ie. no Win vm / dual-boot). Is it ".NET Core"? Still good ole Mono? MS Visual Xamarin 2017? What's the ticket. Haven't done .NET in years but wanna sharpen up the old skillset, get up to current-year speed and play with F# too

what should i read if i want a detailed breakdown of how to impliment goal based agents? norvigs AI a Modern Introduction is pretty light on details on this as far as i can see

Thanks Mr shark

Okay, so I have hte page source for a particular webpage, and as part of the page's source, I have botht he HTML and some other stuff (including some JSON).

How would I be able to retrieve the JSON?

Should I drop out of uni? (CE)
I feel I don't get anything out of it. But then again, every workplace wants a fucking bachelor's degree. Shit's fucked.

Better to have a degree than no degree at all.

Feels like it slows me down though. 3 years is a long time to feel like you do nothing.

I think you should stick with it just a little bit longer, perhaps another semester or year just to see how things go- maybe your mind will change, maybe it won't. Just see how it goes, I trust that you'll make the best decision for yourself when the time comes.

Improved my AmericanByte patch for GNU coreutils
I abandoned precise units (like 5 inchbyte + 372 byte) and instead opted for rounded ones, similar to -h.

$ src/ls --imperial -l /usr/lib/thunderbird/
total 1.1 milebyte
-rw-r--r-- 1 root root 526 byte Feb 15 00:46 application.ini
-rw-r--r-- 1 root root 6.0 yardbyte Feb 6 16:48 blocklist.xml
lrwxrwxrwx 1 root root 30 byte Feb 15 00:46 chrome -> ../../share/thunderbird/chrome
-rw-r--r-- 1 root root 4.0 inchbyte Feb 6 16:50 crashreporter.ini
lrwxrwxrwx 1 root root 32 byte Feb 15 00:46 defaults -> ../../share/thunderbird/defaults
-rw-r--r-- 1 root root 66 byte Feb 15 00:46 dependentlibs.list
lrwxrwxrwx 1 root root 20 byte Feb 15 00:46 dictionaries -> ../../share/hunspell
drwxr-xr-x 2 root root 4.1 inchbyte Feb 19 15:39 extensions
lrwxrwxrwx 1 root root 27 byte Feb 15 00:46 isp -> ../../share/thunderbird/isp
-rw-r--r-- 1 root root 5.2 yardbyte Feb 15 00:46 libldap60.so
-rw-r--r-- 1 root root 10.3 inchbyte Feb 15 00:46 libldif60.so
-rw-r--r-- 1 root root 1.5 yardbyte Feb 15 00:46 liblgpllibs.so
-rw-r--r-- 1 root root 1.9 footbyte Feb 15 00:46 libprldap60.so
-rw-r--r-- 1 root root 1.1 milebyte Feb 15 00:46 libxul.so
lrwxrwxrwx 1 root root 31 byte Feb 15 00:46 omni.ja -> ../../share/thunderbird/omni.ja
-rw-r--r-- 1 root root 48 byte Feb 15 00:46 platform.ini
-rwxr-xr-x 1 root root 7.3 yardbyte Feb 15 00:46 plugin-container
-rw-r--r-- 1 root root 2.0 footbyte Feb 15 00:46 removed-files
-rwxr-xr-x 1 root root 8.9 inchbyte Feb 6 16:50 run-mozilla.sh
-rwxr-xr-x 1 root root 3.5 yardbyte Feb 15 00:46 thunderbird
-rwxr-xr-x 1 root root 3.5 yardbyte Feb 15 00:46 thunderbird-bin

I goofed off for 3 years easily, coded/learned my own stuff, just made sure I pass enough modules/exams to just-about-make it to graduation (12 years ago tho).. depending on your uni/country it can be done and seems "preferable" to dropping out and flipping burgers (not really 100% sure about that yet tho)

>progress

Next two semesters do look more interesting, but I'll see what happens during the summer. If I manage to find a job, I might honestly just take it.

Writing a lisp macro to generate a simulation e.g.
(define 1d-motion
(generate-sys
(cfg a)
(d/dt v) = a
(d/dt x) = v))
(define 1d-sim
(make-sim 1d-motion
#:dt 0.1
'((a . -9.8)
(v-init . +8)
(x-init . 0))))

(require plot)
(plot (points (in-sim 1d-sim '(time x)
#:time 4)
#:x-label "Time"
#:y-label "Position")

Hacking some perl scripts go get me the nearest bus for my commute. I plan to make it into some sort of service so my frontend friend can make a nice android app for me.

Will it be on github/open source?

thanks mr shark

Every relevant tool uses Mono, for example when you want to natively develop using Unreal Engine 4 on Linux that's the dependency it requires. So I guess it's still the safest to use.

Do you mean Unity 5?

>typical illustration from a Haskell introduction article
Oh god. Will this language ever become mainstream?

Programmers are not artists

But some would argue that programming is an art.

Only certain languages qualify as art.
C, Lisp, and Piet come to mind.

What introduction article?

No.

#include

No, Unreal Engine.
wiki.unrealengine.com/Building_On_Linux#Distro_Specific_Instructions

#ifndef __STDBOOL_H
#define __STDBOOL_H

/* Don't define bool, true, and false in C++, except as a GNU extension. */
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Define _Bool, bool, false, true as a GNU extension. */
#define _Bool bool
#define bool bool
#define false false
#define true true
#endif

#define __bool_true_false_are_defined 1

#endif /* __STDBOOL_H */

a2cb: 8b 45 b8 mov eax,DWORD PTR [ebp-0x48]
a2ce: 8b 40 04 mov eax,DWORD PTR [eax+0x4]
a2d1: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]
a2d4: 8b 40 18 mov eax,DWORD PTR [eax+0x18]
a2d7: 89 45 c0 mov DWORD PTR [ebp-0x40],eax
a2da: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]
a2dd: 8b 70 1c mov esi,DWORD PTR [eax+0x1c]
a2e0: 8b 40 20 mov eax,DWORD PTR [eax+0x20]
a2e3: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]
a2e6: 8b 40 24 mov eax,DWORD PTR [eax+0x24]
a2e9: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]
a2ec: 8b 40 08 mov eax,DWORD PTR [eax+0x8]
a2ef: 89 c3 mov ebx,eax
a2f1: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]
a2f4: 8b 50 0c mov edx,DWORD PTR [eax+0xc]
a2f7: 8b 40 10 mov eax,DWORD PTR [eax+0x10]
a2fa: 89 45 a0 mov DWORD PTR [ebp-0x60],eax
a2fd: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]
a300: 8b 40 14 mov eax,DWORD PTR [eax+0x14]
a303: 89 45 9c mov DWORD PTR [ebp-0x64],eax
why does gcc emit so much bullshit code?

#include
#include

Yet another "These are called monads, look at them!" newbie crap. Didn't save the link.

lkml.org/lkml/2014/7/24/584

GCC is known to have some weird bugs in its back-end. Can you compare with different optimization levels?

>We're talking "sloth that was dropped on the head as a baby" retardation levels here
I really like reading Torvalds going off at shit. If I saw this out of context, I would have assumed someone from here wrote it.

99% of monad tutorials are garbage and the other 1% are crap

follow the wikibook

y

God bless Torvalds

My fucking side, one more reason to use a linux distro
Linus is God

is it possible to compile the Linux kernel with Clang yet?

Don't think so, from what I know the main project has been dead since 2014.

seems a little better at -O1, but it's still generating a lot of nonsense.
13ac9: c6 45 e5 00 mov BYTE PTR [ebp-0x1b],0x0
13acd: 8a 45 e5 mov al,BYTE PTR [ebp-0x1b]
13ad0: 83 c8 80 or eax,0xffffff80
13ad3: 88 45 e5 mov BYTE PTR [ebp-0x1b],al
13ad6: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
13ad9: 8b 40 68 mov eax,DWORD PTR [eax+0x68]
13adc: 83 e0 03 and eax,0x3
13adf: 83 e0 03 and eax,0x3
13ae2: 88 c2 mov dl,al
13ae4: 8a 45 e5 mov al,BYTE PTR [ebp-0x1b]
13ae7: 83 e0 fc and eax,0xfffffffc
13aea: 09 d0 or eax,edx
13aec: 88 45 e5 mov BYTE PTR [ebp-0x1b],al
13aef: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
13af2: 8b 40 70 mov eax,DWORD PTR [eax+0x70]
13af5: 83 e0 07 and eax,0x7
13af8: 83 e0 07 and eax,0x7
13afb: 8d 14 c5 00 00 00 00 lea edx,[eax*8+0x0]
13b02: 8a 45 e5 mov al,BYTE PTR [ebp-0x1b]
13b05: 83 e0 c7 and eax,0xffffffc7
13b08: 09 d0 or eax,edx
13b0a: 88 45 e5 mov BYTE PTR [ebp-0x1b],al
13b0d: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
13b10: 8b 40 6c mov eax,DWORD PTR [eax+0x6c]
13b13: 83 e0 01 and eax,0x1
13b16: 83 e0 01 and eax,0x1

This looks much saner but I don't know what the context is.

Yes it can. Check out llvm.linuxfoundation.org/index.php/Main_Page.

Is python the easiest language to understand?

No, Lisp is.

No, Haskell.

It's from the same function but I'm not sure if it's the exact same section. The double AND here struck me as odd. Also note how it keeps loading and reloading [ebp-0x1b] which just stays zero the whole time.

Post code. I'm curious as to what would cause this to be output.

What music are you listening to right now user?

I don't know man. Try building with clang or compcert and seeing if your code is too obfuscated for compilation or it's just gcc being retarded.
>The double AND here struck me as odd
Doesn't get much worse than
a2e3: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]
a2e6: 8b 40 24 mov eax,DWORD PTR [eax+0x24]
a2e9: 8b 45 bc mov eax,DWORD PTR [ebp-0x44]

it's in here somewhere.

youtube.com/watch?v=ypGEkDIsO_Q

youtube.com/watch?v=Q0q1gCsZykg

xtal, great ambient music- I highly recommend checking out Aphex Twin's album on YT.

Garbage in, garbage out.

youtube.com/watch?v=8MC0G-Lbuuk

youtube.com/watch?v=36211-ul46k