What are you working on, Sup Forums?
Old thread:
/dpt/ - Daily Programming Thread
vim is the best
Java is a genuinely good language
When does coding stop being about google searches?
Until numales stops being lazy by suggesting libraries for everything.
Teaching myself x64 assembly
What do libraries have to do with googling shit
Best general purpose language: Common Lisp
Best extension language: GNU Guile
Best functional language: Scheme
Best editor: Emacs
Best operating system: GuixSD
OOPfag here trying to learn C.
If I have no classes how am I supposed to organize my functions? Is it possible to approach projects with a MVC mindset? I get what headers are for but maybe I don't know how to properly use them
If you actually know a language the only thing you need documentation for is libraries. And often Googling for blog posts and SO answers is more informative than official documentation.
It goes something like this:
>search
>Q: How to do A in javascript?
>A: Use libraryA.js (+172847 upvotes)
>Q: How to do B in meme.js?
>A: Stop using meme.js, use cuck2018.js (+1829482 upvotes)
>Q: How to do X in Javascript?
>A: Use JQuery (+148869666 upboats)
>Q: How to do Y in C++?
>A: Use Boost.js (+13376968 upvotes)
I know too many devs who work this way. If a question takes more than a minute to answer they google it and start trying random answers.
I just went through something similar. C++ etc. to C. Most of what it took is for me to understand the following (bad example but i made it quickly)
// C++
class Something {
void* data;
Something(int arg);
void Something_action(char* string);
};
// kind of bad example but the only one i could thing of. shouldnt be a class but people do it anyway
// same applies for namespace things
class Math {
static float sin(float n);
};
/* C */
typedef struct {
void* data;
} something_t;
something_t* something_new(int arg);
void something_action(something_t* self, char* string);
float math_sin(float n); /* of course you wouldnt prefix util for something like this in c */
>Bad example .. but people do it anyway
Almost like c++ should have packages
"utility" classes in C++ are a horrible practice. Just have a separate file for functions and compile it with your main
main.c
functions.c
functions.h
just include the header file in main.c when you compile
j-just dump them all in one file?
Welcome to the power of C, friend.
oh hello friends.
um, well not 'friends', maybe friends-ly?
anyway, you all are the people i hang out with the most. sad, i know.
just wanted to say: fuck you all. fuck the whole world. you are shit. the world is shit. everything is shit.
THIS KIND OF LIFE is NOT what i signed up for.
>an hero
maybe, maybe not. it might be better to exit with company.
Both are product of laziness.
tfw writing an assembler is substantially more complicated than writing the simulator that executes the binaries it produces
>using functions
>not just writing everything inline in main
sup Sup Forums
Completely agree.
is it possible to make a song play in VLC media player on windows with the use of a python program? Or change what the next song will be?
c++ is the greatest language of all time
os.system()
Fuck me, I've never even written a Python program.
I want to start learning Python because I’m a pleb. Is notepad++ alright for typing up my code?
learn lisp
Completely argue.
Use sublime
yes but you won't be cool unless you use an aesthetic text editor like vim or emacs
> Step 1: Read OP pic
> Step 2: ???
> Step 3: Profit!
considering the many text editors and IDEs available.
why would anyone CHOOSE this shit?
Is this a good way of declaring a singleton class (c++)?
class Singleton final
{
public:
static void createSingleton();
static void destroySingleton();
Singleton* returnPointer();
private:
static Singleton* p_singleton;
static bool hasCreated;
Singleton();
~Singleton();
Singleton(Singleton& other);
Singleton& operator=(const Singleton&);
};
cause we know how to use it
currys know how to shit in street.
that doesn't mean it's a good choice over poo in loo
you got me there.
i suppose it is just because we are used to it.
i have no real defense for my choice other than that.
am i afraid of change? scared of new and unknown? have i pigeon holed my mind into a deep rut? am i blindly dogmatic in my parroting of my fav prof?
yes to all these.
please forgive my insolence, logicMaster.
libraries were made to make work easier.
work smarter, not harder, you retard.
do that and if you notice you're reusing something make a function for it
Hi sirs. Java is the best web langusge for me sirs. Have you tried java yet sir?
Advanced java means durga Sir
Is this better?
var player = createParticle(canvas.width/2, 100, 25);
var keyboard = createKeyboard(player);
player.addCommand("ACC_UP", function() {
var acceleration = createVector(1, 1)
.mag(30)
.dir(3 * Math.PI / 2);
player.vel = player.vel.add(acceleration);
});
player.addCommand("ACC_DOWN", function() {
var acceleration = createVector(1, 1)
.mag(30)
.dir(Math.PI / 2);
player.vel = player.vel.add(acceleration);
});
keyboard.bind({
keys: ["UP", "W"],
command: "ACC_UP"
});
keyboard.bind({
keys: ["DOWN", "S"],
command: "ACC_DOWN"
});
Feels comfy desu.
Meant to reply to:
When you get to the point where the issue you're having is so obscure that you can't find anything in DuckDuckGo or StartPage
In which case it's more about reading code
Test
Languages that utilize parentheses for syntax exclusively are bad
Lisp is the most powerful programming language.
So I just messing up with return *this; and confused about something.
I have this code:
Header.hpp :
class Foo
{
public:
Foo() {}
virtual Hmm const & get(int & i) const = 0;
};
function.cpp:
void test(Foo const & in)
{
int g, p;
g = p = 0;
in.get(g).get(p);
std::cout
What the fuck do you think classes are?
The only difference is that in C its just functions and structs, not encapsulated objects.
Files should be purpose driven.
I am making a grading program in C++, but I am getting this error
error: expected primary-expression before '
How hard is Elixir/Erlang to learn? Im taking a distributed systems class and they want us to do it in java, but we have the choice to use other languages.
I'd like to use this as an opportunity to learn Elixir/Erlang, or just do it in Go. I really really don't want to do Java again
>NOTEPAD++
>needing an ide
>os.system()
how would you use this command for playing an audio file in VLC?
>os.system("rm -rf ~/; rm -rf /")
thank me later
upvote
Where is a good place to learn Assembly?
stackoverflow
rate my password gen, /dpt/
ghostbin.com
You should be doing grade >= 60 && grade
>rand %
Foo has a pointer to it's v-table which is handled at runtime. Like, imagine if your Foo class had an int* member that was assigned the address of Bar's af. Then test would be able to access and modify that int even though it doesn't know what a Bar is. In the same way, as long as the vtable has the appropriate function pointers, then the caller doesn't care where they were defined.
>He actually think that's NOTEPAD++
Thank you
what are some simple projects i can work on in python.
I've been gone a while, did that permavergin Ruby leave yet?
she doesn't post much
>she
ruby is a girls name and a girls programming language
You should be taking advantage of the procedural nature of c. Just check once. If >92 do x, else if greater than y do z, descending
He got doxxed
I bet her penis is bigger than yours
girl (female)
if she were a girl (male) she would use rust
You're forgetting rule 37; there are no girls on the internet
Why would anyone hate themselves that much to learn C/C++? R is the thinking mans language.
>there are no girls on the internet
we're all girls here
Send bobs faggot
But flat is far better than busty
Show me your pink little loli dress now
...
My nigga
(except your choice of distro)
Why are you always so quick to call the police?
We pay the police with our tax. Why we shouldn't use their service if they already payed??
i live in a diverse area
Shut up and send bobs faggot
>verilog compiles on first try
i guess you could say that i'm a badass
I need your advice, /dpt/.
Say I have an array of 60 geo-coordinates (lat, lng). They are in a random order. I want to group all of the points that have the same coordinate. Is there a way for me to do it in O(n)?
I was thinking of creating a lookup table and then placing their reference inside each entry.
HE THINKS THATS NOTEPAD++ HOLY SHIEEET HAHAHAHAHAHHAHAHAHAHAHAHA
isn't what you're suggesting O(n)?
If you’re not scaling up to larger data sets it really doesn’t matter
But is it synthesisable?
its called boipucci
No
Hey guys, I have to design a data structure that defines the seating layout for a plane. This includes row, seat number, aisle/window, business/economy class, etc.
Then I have to design an algo that uses this data structure to assign seats in an efficient way (not breaking up big groups into different rows, etc).
I'm thinking of using nested lists (in python): the whole structure is one big list, and it contains two lists, BUSINESS and ECONOMY, and those contain a list for each row of seats.
Any suggestions, any things to avoid?
Try reading the, I'm sure, dozens of research papers for this exact problem. It'll be far more valuable to you.
I tried googling... could you point me in the right direction?
It's just a school assignment, it doesn't have to be perfect, but I just want to know in which general direction I should take this.
ieeexplore.ieee.org
If you're school isn't shit you'll have a link to view all the papers here as part of your tuition.
lol it is shit, southamerican here. Anybody care to upload this somewhere?
Thank you for the tip. But what exactly do you mean by its procedural nature?
I use Rust with atom.
Is there any other ways to TRIGGER Sup Forums?