/dpt/ - Daily Programming Thread

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

Attached: 1559189910609.jpg (3035x2149, 2.2M)

Other urls found in this thread:

pastebin.com/k3pbiGPG
code.org/
cs.rpi.edu/~moorthy/Courses/os98/Pgms/socket.html
scratch.mit.edu
studio.code.org/hoc/1
github.com/rootcoma/cclife
reddit.com/r/voidlinux/comments/ajp3xz/chaosesqueanthology_200_weapons_100_maps/
twitter.com/NSFWRedditGif

First for breeding more Chino's with Chino.

My daughter Chino is so cute.
What are some project examples with beautiful modern C++?
kys

XTest extension also made it very simple. I am doing both keyboard and mouse input. That list is my entire keyboard. Things like shift and alt modifiers just work. The only thing is windows still picks up a few hotkeys like ctrl+shift+esc or shift+tab or windows+d. It would be great to find out how to ignore those if possible (probably not).

Attached: 1522248961221.jpg (700x671, 206K)

>Bool is_down = down ? True : False;
As expected from an um*ru poster

Attached: stallman.jpg (460x276, 10K)

Actually, forget what I said about xkbcommon. Don't use any x11 shit at all.
Use libevdev and create a uinput device instead.

Even if you were to keep using xtest, use xcb instead of Xlib.

I'm not drawing anything though. Just injecting mouse and keyboard input. XTest Extension does exactly what I need. Xcb is great I would use it if I wanted to draw anything.

That type is retarded, don't know why X11Test extension decided to use that. There is objectively nothing wrong with Umaru posting.

Attached: 1522475435930.jpg (1024x877, 140K)

xcb is not a drawing library. It's an X protocol library, but a much better designed one that Xlib is.
In fact, these days, all uses of Xlib just go through a compatibility shim to xcb.

If you're going to be an autistic pedant, you could at least have the decency to bother paying attention to context.
In the context of
>If in the future there will be a language which is as "easy" to use as Python and as fast and powerful as the most optimized C code you've ever seen, all done automatically, you people will still shit on it and its users because it's not hardcore.
the definition of easy means easy from the perspective of individuals who primarily use python, aka retards.
Your own personal definition of easy with respect to yourself is completely irrelevant to the contextual one.

Here is the full code pastebin.com/k3pbiGPG

Makefile
source_files = \
src/main.c \

GXX_FLAGS = -O2 -Wall

all:
mkdir -p build
gcc -o build/TimesNineInputServer $(GXX_FLAGS) -lXtst -lX11 $(source_files)

clean:
rm -rf build/*

>xcb is not a drawing library. It's an X protocol library.
I will definitely have to take another look at that. For now this solution seems to work.

Attached: 1522203751485.webm (640x360, 2.17M)

tips for learning c++ when you spent the last 4 years working with lua and c#?

Attached: 1535978084649.jpg (320x320, 17K)

just embed lua into it

>the definition of easy means easy from the perspective of individuals who primarily use python, aka retards.
This definition is idiotic and doesn't matter. I am not replying in context to the original question either.

WTF why is this animal so bloated

What would be the best place to start learning programming from the most basic shit?

Attached: 1535887416442.png (632x465, 194K)

code.org/

>71263309
Start with something fundamental like c and sockets. It's not easy but it is basic.

cs.rpi.edu/~moorthy/Courses/os98/Pgms/socket.html

Based frogposter.

A book for beginners. Stay clear of videos. That stuff is still encoded most efficiently in books.

scratch.mit.edu
recommended for frogposters

they feed and inject them with some pretty fucked up shit

pesky noobuntu at it again

So in my CMake file my source file lisrt has "../Folder/" before every single file. Is there a way of saying that all the sources are in some relative folder or would I have to have some sort of loop to prepend each source file with "../Folder/"?

that is what code.org uses. angry bird tutorial is truly well done.

studio.code.org/hoc/1

justu se make

Why? I'd probably have the same question.

.. means the directory below
So if you were in /usr/bin/ ../ would be /usr/
hence ../Folder/ means Folder in the directory below
You can use cmake and set it to output objects to a build dir rather than using ../ to access source.

Right. My point is that it seems dumb that if I have 100 source files that I'm listing the folder that they're all in each time.

is uploading your shitty scripts on your github a good idea?

how cmake is usually used is like so:
mkdir build
cd build
cmake ..
hence everything has to be relative to build, so ../src/ for example is needed rather than just src/
you can use make to compile all the source files into a build directory for them.

example:
EXEC = main
OBJ = main.o
OBJECTS = $(patsubst %, $(BUILDDIR)/%, $(OBJ))
all: $(EXEC)
build/%.o: src/%.c
mkdir -p $(BUILDDIR)
gcc -c -o $@ $^ -I.
$(EXEC): $(OBJECTS)
gcc -o $@ $^

yeah, just remember not to leave them shitty or everyone will think youre a retard

Only if you don't mind being ridiculed and harassed daily for how shit your scripts are.

my question was specially that, a script that does almost nothing or very little, and uploading it to my git with all bells and whistles to make it look like a proper repository. will it seem like tryhard shit. i am under the impression this will give me job fast for making an impression. just imagine a hiring manager going to my github and seeing all the green dots and go "woooah this dude is cool

Upload all your shitty scripts to a central repository, with each language getting its own folder, is how I recommend you should do it.
If you care about getting a job, properly explain everything, along with being consistent. Nobody should care if you use tabs or spaces for example, but do not mix them together.

Do whatever makes you happy. Github is a great place to store stuff and forget about it for years. Here's a "tryhard" repo I made, I think it shows the project well if I wanted to look back at what my previous projects did.

github.com/rootcoma/cclife

yeah thats a good idea, i am actually working on kind of like a hotkey controller for a game and came up with an idea of a different mode for it and thought creating another repository would be cool but i think thats just a waste

makefile
not python
a nice gif showing it off
its a pretty nice project, you do it show well.

just create a new branch of the repository

How hard is it to write GUI in modern Ada?

I refactored my DLL and now it doesn't work
Replaced the DllMain with code that does nothing and it still crashes

Attached: 1543502945450.gif (326x314, 19K)

disabled a line of code I've done nothing to and it works
for fuck's sake

"dont remove, it doesnt work without it"

Attached: mao.jpg (220x291, 17K)

"don't uncomment this line, i have absolutely no idea why it breaks with this in but it does"

Attached: pea irl.png (809x700, 904K)

>tfw work on project so fast I can't keep up with uploading them to github and need to hire someone to manage my repos for me

Attached: 1461042795993.jpg (654x867, 153K)

Starting SICP today. Some anons recommend the lectures too but I just can't stand videos on technical subjects. I rather just read whatever there is to be said, so I'll only be reading the book. I might try to find some homework and projects from MIT so I can LARP as a CS student.

Are you going to use the SICP-package for Racket?

No, I'm using Chez. Not sure if I'll run into any problems.

Depends. If you're completely new to programming then maybe yes. Otherwise probably not as you're capable of reading the docs and finding/implementing adequate replacement functions that the book wants.

The first chapters of SICP are a drag, but it really opens up later on when you first implement the evaluator.

>have makefile
>cpp in makefile has (non-header) dependencies
>edit dependencies, makefile still says it's up to date
>edit cpp, now it compiles the dependencies too
>add those files to the makefile, get an error
>it's not even a large project just my college homework
I don't get how people make non-trivial C++ programs in anything less than Visual Studio

You may be laughing now, but try implementing std::invoke_result and std::is_invokable from scratch on msvc 2015 and you will come to understand that sometimes this comment is legitimate.

He's just swole from working out, you should try it some time user

make clean
make clobber
make

I'm not completely new, I've done/I do some Common Lisp programming, CL was my first language. I'm sure I'll be able to translate anything specific to SICP.

>non-header dependencies
You fucked up. Makefile isn't magic, it just checks if the target file's date matches with the date of the last make invocation. No? Invoke the target.
>I don't get how people make non-trivial C++ programs in anything less than Visual Studio
By maintaining good physical design, though that goes for any language. For C++ specifically, you can read Large Scale C++ Software Design. While it's an old book, nothing's really have changed in the compilation model (aside from upcoming modules, but that's another matter entirely).

>, it just checks if the target file's date matches with the date of the last make invocation
Scratch that. Make checks if the timestamp of the target is smaller than one of its (transitive) dependencies, and works from that.
Same result, though.

I want to smell Chino

remake: clean clobber all

What would Chino smell like?

Wouldn't this recompile everything? Then you lose the point of using makefiles

yes, if you dont know what is causing it.
If you do know what the depencies are, add add them to the target.

show/post screenshot of your makefile.

Job interview
>Reverse a string using O(1) space!
>Check if this is a valid Sudoku board!
>Count the cycles in a graph!

What you'll actually be doing
>await task();
>return count > 0;
>finding "smart" algorithms with magic constants and optimisation trickery, deleting everything, and replacing with some OOP meme that might be twice as slow, but makes sense and doesn't break

all of those problems you listed are legit easy as fuck tho.

Fuck off.

This was about a year ago, I just wanted to start a conversation. Besides it was called "university-server.com/user/anon'sprogram.cpp" so I wouldn't post it either way.
It was a compiler using bisoncpp, that program has its own generated ic and ih files that you can edit, that was causing the issue. In the end I just did the clean solution, the program was tiny enough not to take too long to recompile everything

?

javascript/python bad
c++/rust/lua good
>omg so hard
go back to plebbit and brag about your 400k salary writing javascript backend

Reverse a string with a million characters using O(1) space.

do it

I want to rape her so hard

All interview questions are either easy or require knowing some famous algorithm

nonce

probably delicious and robust like mocha

>like mocha
so like semen?

nys degenerate

void reverse(std::string &s) {
int i = 0;
int j = s.size()-1;
while(i < j) {
char c = s[i];
s[i] = s[j];
s[j] = c;
i++;
j--;
}
}

That is extremely fucking simple.

#define million 1000000
char the_big_one[million] = {0};
char *p = &the_big_one[million-1];
for(;p>=the_big_one;p--)
printf("%c", *p);
printf("\n");

std::reverse(begin(str), end(str));

Why does the piece of code on the left print fug?
This is in C#. The enum (seen on the left) is defined in another class. Special is a public property defined with a { get; private set; }.
It's also worth noting that I never initialized the Special enum before, meaning that it should never have the "Ladder" value to begin with.

Attached: huh.png (799x98, 7K)

class ReversedAccessor {
private:
size_t m_length;
const char *m_data;

public:
ReversedAccessor(const std::string &data)
: m_data(data.c_str()), m_length(data.length())
{}

char index(size_t offs)
{
if (m_length == 0 || offs > m_length - 1)
return '\0';

return m_data[m_length - 1 - offs];
}
};


do i pass?

don't call us, we'll call you

Ladder = 0 = None

enum auto-numbering starts from 0 and you specified Ladder = 0
try Ladder = 1, Other = 2 : )

>class ReversedAccessor

Attached: 1487731530420.jpg (516x485, 25K)

Ah, I thought it would auto-number with whatever is left after my "overload values". Guess I'll just put None in the bottom then.
Thanks.

How useful are actually numpy and pandas if useful at all

very

reddit.com/r/voidlinux/comments/ajp3xz/chaosesqueanthology_200_weapons_100_maps/
go back to plebbit, GamerOfLibre.

lmfao imagine dedicating your life to something you could have done in roblox

omg did you say 50 spells? 50 spells for me to try and use?

and Vevnicc.

Ironically you'd be fired from your job if you started writing your own string reverser function instead of stl
Truly we live in a society

I tried this game. It has really bad graphics (unlike AAA games). Also it was super laggy, I think it was the shitty interior of the buildings that were generated. Worst of all there was nothing to do because the game is shit.

>, where the code I added is worth 4 to 6 million dollars.
what

How many cute girls?

Don't reply to it

Real questions need real answers.

Attached: real_answers.png (886x190, 11K)

>it
My pronouns are she and her, thank you very much

take your pills you fucking schizo

>, where the code I added is worth 4 to 6 million dollars.
what

ultra kek

Attached: tiananmen square massacre 1989.png (330x330, 72K)