/dpt/ - daily programming thread

CS is a subset of math edition

Old:

Other urls found in this thread:

reddit.com/r/programming/comments/4s6qth/the_rustonomicon_the_dark_arts_of_advanced_and/d573ta6
ondras.zarovi.cz/sql/demo/
youtube.com/watch?v=0waQT2A17aI
en.cppreference.com/w/cpp/language/converting_constructor
en.wikipedia.org/wiki/Lambda_calculus#Informal_description
twitter.com/AnonBabble

Making a game and playing a game are two very different things you know. The possibilities when making a game are literally boundless.

Stop making threads before the bump limit please.

>The possibilities when making a game are literally boundless
so they are when making any computer program, lol

Also why make a game when it's probably going to be shit anyways, instead of just program something applying to real world problems instead of wasting time on developing the game.

Because one person can make a small game, whereas the smallest real-world problem requires a team of programmers.

I can take your logic and apply it in reverse. Why program a real world application when everybody has already done it better. Might as well make a game because it will be fun to make and at the very least may be fun to play even if it isn't very creative or new.

Why make anything for literally any reason when it might be shit.

Would this be the right thread for mysql questions?

Jack Stouffer, I know you browse here

if it's very simple go to /sqt/

if it's actually interesting and you have done proper research then ask here

> the smallest real-world problem requires a team of programmers
make a program to convert the output of for example 'objdump -d [whatever]' into a more readable form.... you don't need a team for this, still it's a real world problem

IT is the greatest thing ever. You literally work 1 hour a day and get 100k a year.

Also, I'm glad we all agree that KDE > Gnome.

> using a DE

>Also, I'm glad we all agree that KDE > Gnome.

LXDE is better than both.

>Answering to an obvious bait.

All shit

i3 m80s

it'll take a new person way to long to get anything done
I've been programming for 15 years and I wouldn't program in raw opengl
it's just a waste of time for any hobby programmer

bait? KDE is way better than Gnome, still why would you even use a DE, it's just a waste of memory

>it's just a waste of memory

Unused memory is wasted memory.

My thinking as well. If you make a game then it's at least original in some sense. Even if it is highly derivative, nobody really cares.

With a useful application, first you have to start with research. Find the company that's already done that program, and then after that there's no legitimate reason to duplicate that effort.

>LXDE
>not LXQt
>says the C# anarcho-statist-christian-libertarian-capitalist-militarist

I completely believe you have been programming for 15 years and would dissuade people from programming in OpenGL. Clearly you are on the up and up.

>Using 100 of memory at all times

Any Android developer lurking here?

great, I'm glad we settled that, then.

why do i even NEED math when i just want to make games?

If there are they probably won't respond to you due to captcha.

> android dev
> java code monkey
lmftfy

You're right, text-based games are always an option.

Ok...

I don't have to like Qt, do I?

Or you just use Unity

Is PySide / PyQt the best GUI library for Python despite being so unpythonic?

Should I when writing a PySide program follow Qt conventions or should I follow PEP8, and make exceptions whenever I need to call a Qt method?

Unity is for shitdevs.

Also fucking John Riccitiello is the CEO of Unity.

Qt is the anti-capitalist UI for the masses, so yes, you DO have to love it, or you get sent to the gulags, fucking capitalist pig

I've spent a couple hours searching through docs and Google searches without any results. Is there a quick and easy way for humans to enter into a mysql database? I'm not just talking about things like PHPMyAdmin or MySQL Workbench, I've already got both of those running and I can't find the feature I'm looking for.

Let's use product orders as an example.
>Bob buys 200 foobars
How would I add this without either memorizing the customer_id for Bob as well as the product_id for foobars or needing to look them up every time?

Is there an easy way to do this or do I have to program something from the ground up?

>Sup Forums
>36 posts and no anime
Fucking summerfags

suigin?

> KDE>Gnome
>both of them are not Unity
why even compare them?
:^)

>gulags

Not anymore.

...

Is Haskell the comfiest language?

super comfy
even refactoring is comfy

To insert the values into the table you can do something like
insert into orders(primary_arbitrary_key, order_number, product_id, customer_id)
select **arbitrary_key_value**, **order_number_value**, prod.product_id, cust.customer_id
from (
select product_id
from products
where product_name = 'foobar'
) as cust,
(
select customer_id
from customers
where customer_name = 'Bob"
) as prod


The problem here isn't whether you select the values every time or compute it beforehand, at least for a simple schema like this. The Optimizers are quite good and can produce good running times if the logic in the provided qurey isn't weird or extreme. The problem is that there is no way in the provided schema to store the information about the amount of products in the order. there is only the 'kind' of the products in the order

>not using a tool because of some no-doubt petty grudge against the tool's developer

* Correcting myself, I'm too tired for this shit
as prod in the first
and
as cust in the second inner select

Well I learned to use Git today, now I'm pushing my shitty attempts at CS50's psets to github.
I feel like a pro, man.

reddit.com/r/programming/comments/4s6qth/the_rustonomicon_the_dark_arts_of_advanced_and/d573ta6

which one of you is this?

>Screw you, mozilla and rust are run by the ideological equivalent of struggle-session tier red guards and you fucking know it. I'll never understand why these pathetic SJWs felt the need to attach a shitty programming language to their propaganda campaign, but there it is.

Word

>The problem is that there is no way in the provided schema to store the information about the amount of products in the order. there is only the 'kind' of the products in the order
Sorry, I whipped it together in 5 minutes as an example.

>The problem here isn't whether you select the values every time or compute it beforehand, at least for a simple schema like this. The Optimizers are quite good and can produce good running times if the logic in the provided qurey isn't weird or extreme.
The compute time isn't what I'm concerned about, it's the time it would take a human being to enter each order. Needing to type out 12 lines for every order is kind of time prohibitive.

tl;dr: Is there an already existing feature or program to automatically turn "Bob" and "foobar" into their correct id's and enter them on the correct table, or do I need to write something from the ground up?

>rust

Is that a girl?

that's the most used """"""""""logical argument"""""""""" you'll find in Sup Forums.
it's ironic that these people call themselves """"""""""programmers"""""""""". it's as if they weren't taught some basic logic or something

>Petty
>The guy who cranked EA's Jew mode up to levels previously thought impossible

What the fuck did you just say?
Fucking ultra privileged cis-gendered fascist
does everyone have to conform to your fucking gender ideals or what? Get the fuck over yourself sexist pig.

Fuck off. John Riccitiello has a verified history of launching shill campaigns on Sup Forums.

Unity is shit. It doesn't even support C++.

Never fucking reply to me again unless you're contributing to the thread.

Fuck off kike.

...

...

Fuck off commie.

Pretty sure that's the main guy behind Rust.

If you are talking about having a way for goons to enter data into your db, just make a gui in visual basic with a data grid and auto-completion on the data-entry and you're golden. That way, they can't fuck up the foreign keys. Alternatively, if you want it on the web make something similar in your favorite hipster webdev language of the month.

It shouldn't take you more than a day!

Math people is horrible doing programmin

What are the operators I need to overload in order to use a type as a key in an std::map?

operator < so they can be in some order

<
==

So, I am trying to model a DB for a Shop. It's nothing too complex, I just wanted to keep track of the shop's inventory and sold items.
So far, I got picture related but I am worried about the "Quantity" field in my "Item Table. Will it be enough to keep track of both the quantity of each item sold in a sale and in the shop's inventory or should I add an "Inventory" table?
Tips are welcome.

Thanks

I know it's shitposting, but I had the opposite experience with a few mathfags. One of them was double majoring with CS and was really, really good. The other two still did great despite one being in statistics and the other on pure maths. Goddammit mathfags, join CS, it's basically applied math.

>implying maths isn't applied programming

what tool is that in the pic you posted?

you don't need to overload anything, you specify it in the template

ondras.zarovi.cz/sql/demo/

How do I compile a C program using CC-mode in emacs? I'm just starting to program and read the intro in enacs

Teko a cute. Why not use the terminal and gcc?

Not true.

If you have your own type as a key it should overload some operators so that the map can keep track of it.

How can I program computers?

Mainly because I'd like to use emacs more and learn it better. But using GCC works too.

How do I get rid of dll dependencies? I'm sick of my program folders being filled with shitty dlls.

Alternatively how I access those dlls from a sub folder.

...

what are you using? eclipse? Qt creator ? Visual studio??

g++

youtube.com/watch?v=0waQT2A17aI
Random shitty youtube video that explains your extended problem.
You need to design and normalize your db correctly.

In C++, how can I cast something to my own type?

I want to cast an SDL_Point (just an X and Y) to my own type with some other stuff, all I can find is how to cast to something else from a my own type.

en.cppreference.com/w/cpp/language/converting_constructor

Can SQL Server be run on non-Windows hosts yet?

You could always inherit from SDL_Point, add the functionality you need, and whenever a native SDL function requires it, your type will work as well.

In terms of language design, what would you consider "essential" abstract data types? I'm thinking of dictionaries (cover the same uses as arrays and dictionaries), immutable directed acyclic graphs (cover the same uses as (linked) lists and trees) and sets. What else would you include?

I want to write an emulator, I've already written a CHIP 8 emulator what should I do next?

>Green theorem
just use Stokes nigga.

does this work in c++
for (int i=0, i

So it it generally agreed that the length of a variable name should grow with it's scope?

eg. loop counters being 1 char and global constants being THIS_FUCKING_LONG.

>|=
what is this supposed to mean. cant even google it.

1) Unit type, empty type
2) Sum type, product type
3) Inductive types or some form of Fix type

Fix f = f (Fix f)

x |= y
x = x | y

Didn't even think of that, thanks.

Hey, basic programming question, I'd appreciate if someone could help me out.

in C# and XNA,

Maybe I'm just dumb.

I have a class called Paddle, which I use to generate an object called paddle.

I have another class called Ball. I want a function in ball that puts the location at the middle of the paddle. I can't use the object paddle to reference it though (to find where the paddle is on the screen). Why not? It says "paddle does not exist in this current context", so how do I pass the information to the class?

Maybe someone doesn't mind sharing any info they have about this particular question, and maybe it's a dumb question, but I am trying to write a simple text compression program in java. Yes, I know this is completely pointless from the standpoint that there are a thousand programs that will do this, but I'm sort of just trying to brush up on my programming in general, so bear with me.

I'm familiar the math behind David Huffman's algorithm. I can compute the frequencies of the characters in the source alphabet, and am using a priority queue to generate the binary representation of each character based on it's relative frequency. Here is my possible stupid question: how do you output the 1's and 0's as single bits?

I learned Lambda calculus without realizing that I learned it. It's basically functional programming using only mathematical expressions.

Seriously, if you know functional programming, read this: en.wikipedia.org/wiki/Lambda_calculus#Informal_description

It practically blew because the word "calculus" scares me and I already knew everything there.

Hi. Can you get mad at me too?