/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: conquistadora the explorer.jpg (470x291, 40K)

Other urls found in this thread:

github.com/johnch18/vm_v1
youtube.com/watch?v=t0mhvd3-60Y
twitter.com/SFWRedditGifs

I'm this fag:
github.com/johnch18/vm_v1

what does this image have to do with /dpt/? i guess at least it's anime and christian but it seems kinda off topic

Attached: 1547874937181.png (1024x768, 384K)

>What are you working on, Jow Forums?
robotics. I am afraid to break things. That's why only small small steps.
Maybe i should start simulation before rl hacks, but simulation is so fucking time consuming

Attached: smallsteps.webm (1280x720, 738K)

It doesn't look like there's too much to break, honestly.

>its a Jow Forumsnigger episode

what hardware are you using?
what are you programming it in?

>...and then consequently enslaved them myself

I'm gonna have to get my hands dirty with the frontend
What is the patrician's choice of minimal, reliable SAP framework with decent ecosystem?

inb4 >>/wdg/
i said patrician's choice

It doesn't, but those servos can break that plastic really fucking fast.
I mean it's not a big problem, but time consuming.
Either way: I somehow want this to get a "real" robotics project and not only some lame arduino hack. So basically a second reason to go small steps.

PS: I am using ROS2 and as it seem there are close to 0 open source project with it yet (it's still beta). Maybe I can be one of the first ones and help the community or something. Starting with old ROS1 didnt sound motivating

Jow Forums hates God
things that never happened

>what hardware are you using?
x86 (my desktop. Raspi or odroid h2 in the future. not sure yet)
pololu mini maestro pwm controller
counterfeit towerpro mg996r servos (real ones are on their way)
>what are you programming it in?
ROS2 (aka c++17 for now. Later maybe python too)

Circular queues (and other basic data structures) in python because I'm doing the CS degree meme. In a few week they'll let me start oop with java. How accurate are the java horror stories?
That's a really cool looking project - how long have you been doing robotics stuff user?

Attached: Drunk_Kobayashi_Python.png (640x362, 220K)

Serious question: why do people on this board WORSHIP C?

They like larping as embedded devs

java is very verbose and ugly but you can generally tell what a java program means by reading it. It's certainly not arcane, it's just boring.

that's a strong word to be using in all caps

High performance web api for websockets
Nim or C#?

Is SICP not the hot meme on Jow Forums anymore?

>how long have you been doing robotics stuff user?
since oktober 18 or something lol.
I shitposted here quite often with my first shitty prototype which was a real hacker solution. webm related.
Since one more servo fucked itself and i didnt have anymore spare ones i moved on instead of buying new ones of those shitty plastic servos.

Attached: stable.webm (1280x720, 2.5M)

Attached: 1547816204146.jpg (1280x720, 356K)

size comparison

Attached: size.jpg (3000x2000, 1.03M)

vue.js

Is the visitor pattern useless now that C++ has std::variant? They accomplish essentially the same thing.

.

Trying out Rust, the build tools are nice, but the syntax seems off at times.
Going restart my Roguelike project in it and look at the language more deeply.

Attached: 1549542259826.png (697x493, 184K)

Not really? The visitor pattern is a hack for languages that lack multimethods. std::variant is the closed polymorphic analogue to base classes.

I meant they both allow me to easily add operations to a data structure but reduce flexibility in adding types. When is a visitor better than std::variant?

What keyword is the best keyword for declaring linear types?
lin
linear
unique
uniq

linear

-o

youtube.com/watch?v=t0mhvd3-60Y

And God hates niggers

There is no god

linear and unique aren't always the same though

...

Can one of you Cniles explain what's happening here (or how it's called so I can look it up on google).
char *something[] = {
[FOO] = "ur waifu a garbage",
[BAR] = "blah";
};

specifically that weird [FOO] here ? what's the type of FOO?

Attached: 1539382155556.jpg (1200x1730, 481K)

designated initialiser

nice

This is a designated initializer. FOO and BAR are (I presume) macros containing integers. This initializes those specific elements of the array.

Go

T:1

fuck

thx

I wrote 99 bottles of beer in my toy language.
func beer(int i) -> char[]
guard
i > 2 : "{i} bottles of beer on the wall, {i} bottles of beer.\nTake one down and pass it around, {i - 1} bottles of beer on the wall.\n{beer(i - 1)}"
_ : "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall."

func main()
print beer(99)

The fuck?

>Don't speak to me or my son ever again.

Hello, could someone please tell me why in the ever loving fuck I can't simply write it like this?

Attached: hellopleasewtf.png (256x109, 4K)

>{ on own line
Kys

Thanks!

>that 2 1 0 case
Absolutely disgusting.

Attached: 1548244378016.jpg (563x530, 76K)

Pointers do not have a size member function - or any member function. They are not aware of their size in any capacity.

It is typical to pass a size with a pointer to a function. Use the size_t typedef.

Because C doesn't have methods

a doesn't have a .size() method. Cause it's a raw array.

Is that C, C++ or Java?
Java -> it's a.length
C -> you can't

1) Does a lot of work in a seemingly simple statement (contrary to C principles)
2) When people nest this stuff it gets very involved, unintuitive and inflexible like R

my boomer-ass teaching assistant gave us this assignment like that, the int v[] stuff is me tho.

in what language?

`a' is just a pointer under the hood

I suppose the int n parameter is what's telling you the size of the array that a points to. It's assuming that your boomer is doing its job properly ofc.

VLAs are terrifying. Please, think of the stack frames and reconsider.

stfu this MIT nigger is clearly a beginner and the nigger shepherd clearly set it up that way so who gives a shit.

Happy?
func beer(int i) -> char[]
guard
i > 2 : "{i} bottles of beer on the wall, {i} bottles of beer.\nTake one down and pass it around, {i - 1} bottles of beer on the wall.\n{beer(i - 1)}"
i == 2 : "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n{beer(i - 1)}"
i == 1 : "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n{beer(i - 1)}"
_ : "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall."

func main()
print beer(99)

>allocating to heap when you could just use VLA

>what is K&R coding style
kys moron

The stack is already a dynamic data structure if you're using function pointers. Embrace it.

slightly less shit / 10

myFun :: Int:1 -> Int

i have weekly seminars and i need to represent their starting times. how do i represent them when they only consist of a day of week and time? (eg. monday 8am). both in sql and in the application layer. preferrably something, that could be queried for example "give me 5 upcoming events from today"

You probably have to type (a.size()-1) cause a.size is probably the legit size but the last index is most likely one less than that cause it probably starts at index 0

why not just natural numbers? e.g. monday = 1 (or 0 if you prefer), tuesday = 2, ... friday
7am or 8am (whenever earliest possible is) = 1 (or 0), 7:30 = 2, etc

How would that work for local variables that aren't parameters?

How do you guys get in the flow of learning new things, when you're not feeling it?
I've been in a slump with learning iOS development for the past week, I haven't really done much.
Breaking my routine surely hurt that a lot, but I also lost both discipline and motivation for it.

I know discipline is more long-term and important than motivation, but how do you guys motivate yourselves in the short-term, to get back in a good routine to become more self-disciplined with learning, again?

querying that would be pretty gay but i guess that i have no other option

just translate back and forth
hell you could even use another table to store the text Monday ... Friday and the numbers, then do a join or whatever bullshit SQL programmers do

okay thanks user

double thanks senpai!

Attached: 1519365489772.gif (350x197, 353K)

Attached: 1547981901101.jpg (1280x720, 103K)

myFun :: Int:1 -> Int
myFun x = x + y
where y :: Int:1
y = 2

self-hypnosis

I fake it until I get the motivation back. Try to get yourself to stick to something for as long as you can, and remember that any work you put into it is still work (ie. spending a few hours to accomplish something small seems poor and you generally would beat yourself up over it, but compared with no progress its still net better. Or maybe you could only stay focused for 15 minutes before getting pulled away, 15 minutes is still time spent and now you have a goal to beat).

I generally go to the library to work on anything important. Helpful because its quiet and its an easy escape from big distractions like porn/vidya/youtube/etc. Do whatever you can to elimizzle distractions, make your bed, go work outside, etc

Posted without looking at the reply count because I'm dumb as hell

Anyway hit me with those sweet embedded programming resources

fn rot13(string: String) -> String {
let alphabet = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];

string.chars()
.map(|c| *alphabet.iter()
.chain(alphabet.iter())
.skip_while(|&x| *x != c)
.nth(13)
.unwrap_or(&c))
.collect()
}

Attached: 1546314710936.png (1788x990, 607K)

I'm fucking retarded, I had used malloc like an idiot and had structured the function around that. What a waste of time, holy shit.

looks like java and scala mashup. yuck

what about it looks like java and scala?

how do I start learning to program? I'm a complete novice with no experience, I want to use programming top make video games and such.

Find an introductory book on Python programming with detailed guides, bone up on the programming basics with that. Once you can start writing simple programs on your own for your own needs move on the more theoretical computer science literature. Data structures and algorithms will be super helpful to understand (if you aren't going into CS worry more about algorithms and their applications instead of the implementation minutia), and start looking into how game engines work. From there you can explore Python libraries for that or you can embark on writing your own engine for some game.

I made console ASCII Flappy Bird in Python. I guess it could use a bit better ascii graphics, though.

Attached: Screenshot_20190212_000021.png (1638x938, 54K)

>python
Don't do this.
Before I'm called a Cphile. Learning python gives you a horrible first impression on programming. Not only that but it's so unreadable. I started with python it took me years to get on anything else

Euphoric atheists are as NPC as it gets, user.

>it's so unreadable.
You're just plain disingenuous.

>mfw pajeet c++ code that arbitrarily leaves out braces for conditionals just because there is a single line in the code block
>and in cases where there are braces they put the opening brace at the end of the first line, often just barely visible inbetween other parentheses and comments
>macros copiously sprinkled all around

it is like they want future people adding lines to the code to mess up

and there are people who think this style is more legible

Attached: Untitled.png (1129x1192, 226K)

There's literally nothing wrong with that, you retard.

String and method chaining

Several levels of irony are applied when atheists claim to be enlightened free thinkers but mostly just parrot each other and books they've read.

>it's so unreadable
He's probably a faggot but it doesn't help that epic one liners are so popular in python.

Of course, he wouldn't be having so much trouble if he understood basic functional programming principles.
...It's just mathematical notation converted into code.

if ast.contains("String"):
assert language == Java
if ast.contains(Ufcs)
assert language == Scala

Attached: 1549351854287.png (246x205, 6K)

Scala doesn't have UFCS dummy

That was not method chaining either

Method chaining shouldn't remind you of "scala", it should remind you of declarative languages. SQL, C#'s LINQ, literally any functional programming language.

Of course the fedora uses Rust.

Intersectionality is their religion