Old thread: What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
First for fuck anime and j*pan.
No thanks for using an anime OP. First for Python is best language for productivity.
give me one reason to learn programming when i can just use the software some dweebs already pulled their hair out for
Actual first for fuck C fags and their cuckoldry
You sound too stupid to try to talk to
do think it's possible to make an ANN that can do abductive reasoning?
i don't know much about ANNs but from my limited knowledge i'm imagining a setup something like this:
>have three ANNs, A B and C, arranged in something like a GAN sort of way except the pipeline is three networks deep instead of two
>C is trained to take in a single hypothesis and a single point of evidence, and produce binary results, yes the evidence contradicts the hypothesis or no it does not
>B is trained to take in a single hypothesis and multiple points of evidence, and select multiple points of evidence that each independently contradict the hypothesis
>A is trained to take in multiple points of evidence and produce a single hypothesis that tries to explain it
>C is adversarial to B, B generates selections of contradictory evidence and C must verify that said evidence contradicts the hypothesis
>B is adversarial to A, A generates a hypothesis and B must verify the hypothesis is possible by failing to convince C that any contradiction exists in the evidence
could it work?
to reiterate, i'm not by any means claiming to be an expert, i'm just shitposting because i had an idea and i'm curious if it could work, by posting that idea i don't mean to try to imply i think i have the authority to declare it would work, in fact if i thought that then i wouldn't be asking.
why is there a new daily thread? the other one isn't even 24 hours old and isn't full, either.
/dpt/ is colonising Jow Forums to re-establish /prog/
Hey Jow Forums rate my code
>sepples
shit / 10
intermediate beginner -level
now add collisions, particles and animations
What the fuck does it want me to do?
>static const string shaderCode
just use a text file
Welcome to Rust.
The for-loop version works fine. This my first day with Rust, yeah.
You don't need to escape the newlines when they're outside the quotation marks.
You'd only need to do that if it were a #define or if you for some reason wanted it all inside one pair of quotation marks.
I'm traumatized by your curly brace/indentation style user. i get that it's personal but you're not even consistently applying it as a rule. Some places have newlines and others don't.
That aside, your Walker can move faster diagonally than horizontally. According to the docs SFML has a trunc method which is probably what you want: github.com
Ideally you should try to separate your rendering/mouse integration and simulation state more, red flags are having them in the same function like that.
New to computer programming. Just downloaded python to start some learning exercises. What text editor would Jow Forums recommend?
wrote a callback registration interface for this stupid program so that the event loop is completely abstracted away like some widget toolkits
i'm getting into react native and electron. what do you guys think is a simple program that will teach me the important stuff that i can put on my resume?
so far i've just been tooling around and haven't made a real app. actually can't even decide what to make, seems like everything i need is already made
VS Code is the jack of all trades and easy to install/use
Nice project, are those white flecks in the original gif?
On Windows - sublime 3, visual code
Linux - mousepad
I just moved from java to c++, maybe i need watch some youtube tutorials.
>are those white flecks in the original gif?
yes
so far gif images with partially changed frames works well, but some images don't have proper delay between frames so it must be assumed or in my case they don't animate
Well, I looked into it for you. You want to use .into_iter() instead of .iter().
Get used to deal with that garbage all of the time; that error message will be your new best friend.
You definitely have a hobby, aren't you? So make an app in this field. For instance, one of my hobbies are flags, maps, countries etc. so my first petproject mobile app was a flag quiz game lol.
If you still don't have any ideas, there are apps like
Weather (you can use openweathermap api)
Schedule
Also pay attention to technologies. E.g. use Typescript instead of JS, reuse components in case you make both mobile app on RN and desktop one on Electron
>java
Explains the everything-is-an-object design.
Use Russian IDE – PyCharm. It is great one.
What is the recommended workflow for working in psql? How do I efficiently write scripts in a text editor and then execute them inside of the repl?
Whoa, finally it works. Gotta look up the difference between the two. Thanks.
>using namespace
>std::string for a constant string
>not using raw string literals
>not using constexpr over static const where possible
>pass by mutable reference
>for lightweight objects
>with void return
I am autosaving every few seconds and I do it with a backgroundworker so that if it runs on crappy systems and the gamedata becomes large, it doesn't cause stuttering or any noticable effect for the player.
So to optimize, I create new BinaryFormatter() once and pass it to the backgroundworker's method with a tuple.
This is faster than doing a new BinaryFormatter() every few seconds, right? or is there something weird about passing stuff into another thread that I haven't foreseen?
Any other optimization tips?
>Get used to deal with that garbage all of the time;
ownership is hard, hopefully you don't program in c/c++ where fucking it up causes undefined behaviour
into_iter() is a "consuming iterator", meaning that whatever you're iterating over is no longer valid after you call it.
iter() is just a normal iterator and leaves the original array/vec intact.
touhou isn't anime
undefined behavior isn't necessarily bad behavior, sometimes it's an optimization
In java, why can't i access parent's private variables from subclass? It would seem intuitive to me, that subclass would be meant to inherit those as well.
I am not saying i could design better language than Oracle, i just wonder what is reasoning for this particular... quirk.
Use protected for that.
>or is there something weird about passing stuff into another thread that I haven't foreseen?
Do you copy the data or use locks or do you just accept data races?
otherwise you could break any form of encapsulation using inheritance
they're still there, just inaccessible
if you want members to be visible only to subclasses, use protected
Encapsulation is a shit.
Think first about testability (in case you aren't using Groovy in your unit tests where you can not give a fuck) over encapsulation
why does g++ always give Segmentation fault errors for invalid memory access? Why can't it just fuckin tell me in which line did I accessed my array out of index range?
fuck g++
contracts will solve this
>use protected
I know about it and i am going to do that. Just wondering what's the logic behind this.
>otherwise you could break any form of encapsulation using inheritance
Isn't that one of points of inheritance? It's not like you could break through encapsulation somewhere else to ancestor classes, no?
Or are ancestor classes often that different that they need protection?
i've actually been wondering about typescript
do we just have to rely on the typescript community to quickly push out a new version whenever there's a new feature in JS? are there any proposals for typing natively in JS?
lmao just use ASan/valgrind
i don't use java, but i think the point of inheritance is to inherit methods, but not the internal state
Compile with -ggdb -O0 and then run your program with:
gdb ./program
run
Then when it crashes you will get the call stack, variables, and such.
Ignore, a lot of it was pointless, re-did the whole thing. Actually don't have to pass it anything
very nice user
this
you should use an ORM. i use sequelize. it's to the point where the app on its own only uses the ORM, and i use the psql shell to quickly verify if the record entered correctly, or to drop and reseed the database during testing.
i don't think many people add tables or rows in the psql shell, but it's good to know the syntax for it. you'd be surprised at the number of programmers that have never used their database's shell before
>get drunk
>it slowly fades
>still somewhat dizzy but somehow energic and awake
Should I study / practice right now? It's also 3am
>Or are ancestor classes often that different that they need protection?
it's all good when you are the only one using the class, but lets say there other developers that may use it and of course they have no idea how to use it so they start changing the internal state of the superclass which may break everything. This is why you may want to hide that state from them and instead provide some kind of safe to use API.
do it user
So i'm trying to make a text editor in Qt/qml.
But getting a textarea or a textedit in qml to behave like any normal text area is way more difficult than expected.
TextArea {
id: textEditor
objectName: "TextEditor"
Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: 5
selectByMouse: true
font.family: "Consolas"
font.pointSize: 10
}
The current stumble is it refuses to set the text cursor if i click where there is no text vertically. It works normally horizontally.
I can't tell if it's because the layout doesn't actually fill out the height or if the TextArea/TextEdit item is just shit. Setting the height property explicitly makes no difference.
Any pointers ?
Ooh, i see. It kinda makes sense, now.
Thanks you all for answers!
>Any pointers ?
0xDEADBEEF
>you'd be surprised at the number of programmers that have never used their database's shell before
That's me, my database course was pure theory. I learned relational algebra and how to craft all of these intricate optimized queries but had no experience using it in a real database outside of a few homework assignments.
34 years later and still no unicode support in c++ std lib?
kind of amazing really
Based and ASCII pilled
ASCII is all you need.
Unicode is just sequence of bytes.
Isn't utf8 is implicitly supported by everything that doesn't autistically police that it is valid ascii ?
*protected static Foo foo; your path*
>What are you working on
I'm working on killing all of you pedo degenerates
aren't you always bitching about bloat
Any opinions about Ibis vs SQLAlchemy vs ... ?
I have a C++ file structure like
src/
libA/
foo.cpp
foo.h
libB/
bar.cpp
bar.h
libC/
baz.cpp
baz.h
Each subdirectory is a library in cmake. I want the headers to be included like #include "libA/foo.h", which I have working. The problem is src/ is now my header include directory for every library. If I have libC has a dependency, now it can mistakenly include libA/foo.h which isn't linked. How can I fix this?
The only solution I can think of is to make the real file path src/libA/libA/foo.h (using a wrapper directory) so that they don't share a parent directory. But I don't like the look of that, is there a better way?
The problem needs to be fixed within g++. I do competitive programming as a hobby and all the online judges use g++. It's a nightmare to debug my code there, always have to copy paste / write my own utility functions and debug offline on my machine.
Alcohol is a depressant, so withdrawal from it causes stimulation.
You mean ES[9000] features?
Then pass the following to g++:
-fstack-protector-all -fsanitize=address,undefined
when does a c++ compiler add vtable to a class?
do they always have them?
are they added when inheriting from any other class?
or are they added when inheriting from a class containing at least one virtual function?
>do they always have them?
no, only if the class contains a virtual function
>are they added when inheriting from any other class?
>or are they added when inheriting from a class containing at least one virtual function?
the vtable pointer of the previous class is inherited along with the rest of its members if it contains virtual function, but an additional one isn't added unless the subclass declares its own virtual functions
all of this is implementation defined, but this is the only sensible way to do any of this
target_include_directories ?
best practice to use the target_XXX commands whenever possible
>when does a c++ compiler add vtable to a class?
it's much more fast than a hashmap (objective-c, python, ...) but static which is all right since c++ has no of dynamic features at all.
go to bed
Let's say I have a python script that handles strings of LaTeX text. I want the script to cound how many instances of placeholder brakets {} are there, and use this info fill a given one or all with some string (or in alternative to replace {} with {something}). How can you do that?
Bonus: is there a way to keep track of depth, i.e. of there are brakets inside brakets inside brakets...
go to sleep
you answered a question that wasn't asked
I'm working on making up my mind what I want to work on.
Fourth week doing this.
Results: none
Obj-C is so cute T_T
Really missing when I used it at work
>you answered a question that wasn't asked
so what? are you in charge of this thread or something? you ain't shit, bro
>What are you working on Jow Forums
Getting closer to getting my camera recording to work. I am still getting a segmentation fault in another process but at least my process isn't crashing :^)
it's too bright to look at
Make a website that helps people discover what it is they really need in their lives. Commercialize it. Make money.
Obj-C's object model is better than c++'s and faithful to smalltalk.
Dragon dildos? Just 301 to bad dragon's site.
>transparent terminal
oof
obj c manages the impressive task of making a language more ugly than C++
it's also way more inefficient than C++'s which begs the question of why it was added to C
What are examples of ugliness?
ur mum m8
- (int)foo:(int)i
{
return [self bar:i];
}
god I had to deal with objective C years ago and even though I used it, I no longer have any idea what the hell this fucked up syntax means. I think that's like self->bar(i) in a sane language but the actual method signature with parameter names is a dictionary lookup, or something fucked up like that
I bought the book