/dpt/ - Daily Programming Thread

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

Attached: gnu emacs yohane.png (1000x709, 974K)

Other urls found in this thread:

play.golang.org/p/Ga59qzLwe2t
godbolt.org/z/479XEm
twitter.com/SFWRedditGifs

Does someone know a shitty http website I can use for testing my socket programming

4channel.org

Is fuzzy logic just magic?

remember to use const to help your compiler help you!

Attached: 1556809840052.webm (1280x720, 1.93M)

>direct ip access not allowed
mean

Immutability should be the default

actually I got it

FUCK WPF FUCK GUIS FUCK .NET FUCK EVENT HANDLING FUCK XAML

College made me think I'll have to write optimised ways to print the first one million prime numbers, not drawing fucking buttons in fucking XML to make your fucking menus pretty!

Code shouldn't be allowed to have literals

>thinking wageslaving is anything like academia
lmoa

I just made a program that scans every ipv4 for the open ports you specify, for example I tell it to scan for port 8080 and it scans from 0.0.0.0 to 255.255.255.255, it takes some time but...

prefer constexpr to const

So much for "zero cost" abstractions.

welcome aboard

At first I was like "eh I don't need this stuff", and now I just miss it so much.

It is
Just put 4channel.org in the http header

Mutability was a mistake.

be careful guys you are being watched

Attached: Screenshot from 2019-05-02 17-38-48.png (1040x586, 135K)

what does that have to do with anything?

What's the point of this? The assembled code is effectively a NOP?

Look into actual network stuff. Certain ranges are reserved, and scanning those would get you into a lot of trouble, or conversely just not work because they're local-only.

?

then embrace the philosophy of lambda calculus through the practice of functional programming.

Attached: normiesunwanted.jpg (1131x1600, 512K)

>http/1.1
"no"

showing how to remove overhead, it's just one part of the final program

Probably. Going from O2 to O3 can cause a lot of unexpected changes in behavior. I'd assume on one setting or another the compiler could determine what's used/unused and hack it all away.

The array is not modified so the compiler can optimize based on a detected pattern instead of having to consult some table or something

Reminder that C is a cult.

Yes I know, It also has a delay of 7 seconds per scan, so if I don't get a acknowledge in less than 7 seconds it will continue with the next ip

Functional programming is nice, but SML is the only good functional language and it's dead.

Name a better language

>can't even do basic string operations without null terminator fuckery
it's hard for the sake of being hard

*

It is called a useless hairball.

Is it useless if I want to cuddle it?

>using *

Attached: 1753971086905.jpg (600x611, 53K)

>anime again
Oof and gross

>>can't even do basic string operations
What did he mean by this?

senko-san

Attached: 1549565582062.png (1051x874, 426K)

>anime again
Cute and delicious

Read the rest of the sentence

I want to learn emacs but don't feel like spending all that time on the customization

Attached: 1555167201067.jpg (345x300, 13K)

C++

sorry, there is a null terminator in the middle of the sentence. can you pass me the length of the sentence in 8-bit bytes?

What makes you think that?

Spacemacs (or doom emacs if you want something more minimalist)
also, use evil mode

Hello you goyim
I play a video game called dwarf fortress often. It has a number of key combinations and shortcuts, so I thought of making an app which would display all controls in a nice UI and a python script on my computer would simulate the correct button combination. This way I will be able to play fr my couch while the game is running on 40' TV.
Now I'm horrible at making GUIs so all I could come up with is this noodle mess. Any other way to design this? It has a lot of multi layer menu that I wish to automate

Attached: Screenshot_20190502-212810.png (1080x1920, 83K)

Oh
It's 71 bytes including the null terminator in the middle, for the first line.
The second line is 36 bytes.

I don't even know vi binds so why bother learning that as well

Attached: 1554733990090.png (514x492, 103K)

Woah! Is that JavaScript? It totally rocks!

Attached: w66P3pnMlBk.jpg (853x1280, 136K)

>maintainer still hasn't replied about my code

send help, i'm having a panic attack
he just told me to mail him the patches then disappeared since days ago
i just wanna hear that its ok

Attached: 1553188071014.jpg (600x600, 55K)

>GUI for DF
>has a billion key combinations utilising the whole keyboard
>18 preset buttons

A'ight

If your code isn't cute, you should stop programming.

Sure it can. I wrote my own libc and a non-shit string/memory type is the main feature.

>since days ago
Learn how fucking English works, Francois

How do I write cute code senpai?

t.

Attached: 1555330294757.jpg (3024x4032, 2.12M)

Just learn the vi binds instead of the normal emacs shit. Even if you move to another editor, vi binds are worth learning.
Vimtutor is included in spacemacs and takes like half an hour. It will take a while until you're proficient, but you just learn as you go. Also, rebind the capslock key to escape.

Leave him alone faggot, at least he knows some English

People have lives, you know. Occasionally it takes me weeks to reply.

what is your opinion on this code:
public void isThingsExistsInList(Thing t1, Thing t2){
int a = 0;
for(Objects obj : objList){
if(obj.getThing1().equals(t1) && obj.getThing2().equals(t2)){
a++;
}
}
return a > 0;
}

>askToProm(string)
what a fucking pseud

>answer is a property of Hannah and not a return value of askToProm
>askToProm asking for a string and not a person object
>mood is not an enum
>answer=="yes"
it's shit

I know, it's just... It's my first contribution ever, I dunno what to expect.

What's wrong with my sentence

Attached: 1552049621313.png (1920x1882, 2.64M)

Some buttons lead to other menus
Honestly it doesn't scale well at all, there has to be a better way to do it

Attached: Screenshot_20190502-214831.png (1080x1920, 163K)

Mate you should create a phone interface for aircraft cockpits
You'll make a killing

Shorter and more obvious:
return objList.Any(obj => obj.getThing1().equals(t1) && obj.getThing2().equals(t2))

Slam them in parallel. Most won't respond anyway, so you can do estimates based on capacity (you'll be limited a lot more by capacity than by processing capability). You could probably easily do 65535 with a 1-5s timeout.

public bool ContainsThings(Thing t1, Thing t2) =>
objList.Any(obj => obj.Thing1.Equals(t1) && obj.Thing2.Equals(t2));

Why is that a problem? If and when I need lengths I'll find those, otherwise every single operation you're expected to verify and update an endpoint, or at least, a virtual endpoint (if you don't reallocate on every change). Using null-terminators is much, much easier and better performing than you think.

It's called a "cheat sheet" or "reference sheet". Muscle memory is unironically one of the things humans actually do really well, so just learn them.

>You'll make a killing
He would, literally

Attached: 1503562104881.gif (500x281, 1.51M)

Should I wait until my initial patches get reviewed/accepted before sending more or should I send in my patches as soon as I have finished preparing and testing them? In order to add the feature I wanted I created like 5 small patches. I thought it would've been easier to review that way.

>a function to draw figures only does so without whitespace if I subtract the length by 5, 10, and 8 respectively
>there is literally no reaosn for that
>the only way the three inputs differ is the angles, which seem to have no relevance to those numbers at all, and the number of figures, which is 10 for the middle result and 5 for the others
>which is even more mysterious, since the results requiring 5 and 8 both draw five figures
Lmao programming. I know that I'm just too retarded to see why, but it's amazing how I can fuck with this shit for two hours and then when I try it with random integers, it suddenly works perfectly.

lads, my shitty chess now has an emotional labeling of moves and pick based on emotions.
It's much more smarter, even if is simple fuzzy logic.

Now some pieces even run to cover.
I want to implement some defence cover step, but it seems unnecesary.

Attached: 1556328034817.gif (480x264, 3.24M)

If you submit a patch that has no obvious purpose, and adds nothing on its own then it will probably be rejected.
It sounds like you should have made 1 patch with 5 commits instead of 5 patches with 1 commit. But I'm just guessing.

>without whitespace
What did she mean by this.
>there is literally no reaosn for that
I guarantee you that is not true.

t. first year CS student

Because they are used in tons of shit outside of Vim and they are really efficient. Plus they don't even take that much time, the abbreviations make sense.

std::optional result = std::ask(this, hannah, std::prom);

if (result) {
result->~Date();
mood++;
}

hannah.reset(nullptr);

while (true) {
if (backlog.empty())
backlog = fetch_new_anime();
}

std::anime_viewing_session avs(backlog.front());
as.main_loop();

if (auto a = backlog.front(); a.cast.num_cute_girls() > 0) {
mood += a.cast.num_cute_girls * 10 + a.genre.is_cgdct() ? 20 : 0;
}
else {
mood -= 5;
}

backlog.pop_front();
}

ftfy

Seperating them is a good idea as long as you don't go too granular, but send them as a set.

Is using "this->" a bad habit for C++? A friend made fun of me because of it, but I like the autocompletion I get from it.

Not at all. Your friend is a retard.

he sounds like a massive autist

I wouldn't say it's a bad habit, but I hesitate to call it a good one.


It's still a hell of a lot better than naming all your variables m_foo.

public boolean isThingsExistsInList(Thing t1, Thing t2) {
return toParallelStream(objList).reduce( 0,
(a, o) -> o.getThing1().equals(t1) && o.getThing2().equals(t2) ? a + 1 : a).intValue() > 0;
}

this isnt cpp, but it pretty much serves as pseudocode.
I commented it, but if anything is unclear just ask

play.golang.org/p/Ga59qzLwe2t

when I use a blocking linux socket how can I tell if there is any data in its buffer?

What's worse,
being a Cnile? or being severely mentally impaired?
That was a trick question, they're the same thing.

Attached: hasegawa c# 153735.png (1406x2846, 861K)

What is "this"? Just use a fucking name. It's a retarded Python thing isn't it?

huh?

>What's wrong with my sentence
The use of a simple past verb ("disappeared") in combination with "since"
Everyone understood what you were talking about but no native speaker would say that, just like no native speaker would say "many sand" (except in doge memes as a joke)
Just say "disappeared days ago"

>is X a bad habit
Can you not think for yourself? It is excellent for specifying where something comes from. Is it a member or some global state? And it also gives you autocompletion in an IDE as you said.

what's the source for that image?

Are you using "this" as the literal name of whatever you're acting on/calling from? I've seen that in examples. Otherwise struct-> has a specific syntax meaning, and presumably a class is nearly a struct, so you have to call through a reference or pointer or maybe a vector that way.

hmm... huh?

>C# in Depth
it is more of a history book

Is Perl the best language to parse large text files?

godbolt.org/z/479XEm
it generates the same code
your friend is being pedantic