/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

sqlite.org/appfileformat.html
sqlite.org/aff_short.html
hi.cs.waseda.ac.jp/~iizuka/projects/completion/en/
twitter.com/AnonBabble

rewriting my gui in gtkmm
i only did it because I thought it would let me put data in the treeview because of the power of cpp but it turns out u cant do that unless u write 1000 lines of boilerplate into every class u want to use

I need a font that's legible at small sizes, smaller than this. What's a good one? I can't read 5x8 or whatever it's called.

Or, I can, but it's uncomfortable. Will I get used to it? It also looks really horrible in bold.

i like sourcecode pro

ProFont or Gohu

Can I write OpenGL 2.1 compliant code using only the modern pipeline (no display lists, immediate mode, etc.) and have it work on environments that only support forward compatible 3.2, ES 3.0 and onward?
Will I have trouble using my GLSL 1.20 shaders on modern machines?

I'm stuck on 2.1 because my thinkpad is 10 years old.

Here's a small ProFont sample, it's pretty small & I prefer it, but some of the symbols could be better.

I'm specifically wondering about fonts that look good at small sizes, those aren't bitmap fonts. What do they look like when you scale them down? I tried to zoom out on the wikipedia image for source code pro, and it just became a blurry mess. How good is the hinting?

I wonder if I actually could use my white daddy connections. my friend got his SQL job without anything, but he moved down to the southern US where nobody has a brain so I guess it makes sense.

actually I already had a short-lived art career (I'm sure some people are annoyed if they recognize my pattern of asking about switching to programming). So I'm past the living with my parents stage, have debts and obligations (not kids thankfully) that I can't support on minimum wage, definitely can't save/ get ahead. I have a minuscule amount of savings that's letting me live a bit longer.

okay I'll look around. If their claim isn't feasible then I may as well continue my other plan, which is continue python and then start C# for games in unity. If it's all the same in learning, I may as well do something I have inherent interest and experience in.

but any suggestions like specific books or lectures that could even get close to that guy's udemy claim (a month of training to get job-qualified) would be cool.

thanks for the bro-sponses, guys

Oh, it's a bitmap font. Gohu looks incredibly comfy, but it's just 11px. Ideally, I would want something smaller - I can fit in 2.3 terminals vertically with 6x13 (768px), I would want to get in 3 instead. Profont looks okay, but it's not smaller or more legible than 6x13. Thank you for the advice.

Sorry, I tried. I've been looking for good smaller Bitmap fonts forever and haven't found anything. I would use something smaller if there's a suitable TTF version.

@62644436

shut the fuck up, no one cares about your blog

>start C# for games in unity
Don't do that. C# doesn't offer anything of value besides being fast to write and meshing well with windows, Unity is the same thing - good for quickly making something, bad for making it well, bad for learning. Learn python, and create some projects (it's not enough with the theory, you need to get the actual "software engineering" practice down) and put them on github, then move over to C to learn the painful memory management parts. When you're done with that, you can go back to python.

>any suggestions like specific books or lectures
Some of these are good, depends on what you want to do. Some of them are hot garbage, and some of them are not beginner level, look them up on wikipedia first.

I think khan academy has some lectures, you could look around on youtube too.
I might try using some of the smaller Fixed fonts, it's possible you get used to them after a while. They can go ridiculously small. Pic related, 5x8

how do I go about picking a format for storing data?
Use somethign simple like csv at first maybe?

>I might try using some of the smaller Fixed fonts

I've contemplated that, but I can't use FON fonts on most applications, only TTFs. So I'd have to convert them, and that never seems to work.

SQLite.
sqlite.org/appfileformat.html
sqlite.org/aff_short.html

I am writing a version of diff to deal with huge xml flatfiles.

multithreaded emacs when?

Enjoy your eye cancer

Why not just regular diff?

I am using python 3 for educational purposes and I'd like to avoid floating point inaccuracies. What's a way to do that that wouldn't be distracting for the kids ?

I don't want to ask them to type Decimal(0.1) for every number literal.

Is it actually bad?
math.isclose

Avoid situations where floating point arithmetic can be a problem
Ignore it until it becomes a problem

Maybe you should teach them what floating points are and they'll start avoiding them on their own.

write your own repl, it is trivial to fo so due to lisp's homoicon-

oh. python. I misread it, since you were pretending you gave a damn about actually educating the kids. carry on with your shit tier pajeet language that reinforced bad habits

regular diff doesn't have enough logic to handle all the differences. xml files also follow a custom xml schema so either way I'd have to code those in somehow.

Python is acceptable for learning
t. currently have a sepples class taught using C material written in the early 90's

Part of my uni course assignment I have to create a room with objects in it. I'm being asked to make sure the object has a reference to the room it's in but I'm struggling with how to do this. The rooms have assigned objects in a array but I have no clue how to have a single object return the room it's in. Some kind of getmethod maybe?

no

python is a messy piece of shit, the next worst language after the whole javascript diaspora

if you want to teach kids, you use a scheme and start from first principles. if a kid doesn't get excited after using scheme for a few minutes, then he's not cut for programming or cs anyway

>I'm being asked to make sure the object has a reference to the room it's in
Nice, the OOP professors are already getting you to break it.

haha

Wouldn't it be better to start off with C? I did and it gave me a really good understanding of the underlying concepts that almost all programming languages share somehow. Also, as you can't do much with it (at least not in a sensible way) it's perfect for getting to know common algorithms and "thinking in code" along the way.

It has to be a reference? Otherwise weak_ptr seems alright

Why?
Pls don't bully

If you want to teach kids in 2017, you should use perl+cgi script. Fast to learn, fast results if you're allowed to give them bootstrap templates to copypaste from, easy to show results, easy to set up an enviroment.
C is good too. You should start with C, Python, or Perl. It shouldn't be too far off from other languages. Sepples could be okay depending on the teacher, as long as they don't go overboard with the sepples.

python is good for understanding lots of common programming paradigms and features; like I think you're a better C beginner if you've seen an object before because itll encourage you to use structs
youll be trying to replicate the easy feeling and features of python, but in C

I forgot to mention it's a java class.
Yeah, the object needs to know which room it's in. It's weird because the room knows what objects are in it but I can't seem to figure out to do the opposite.

>perl

not giving you any more yous. you're a retard and have no place teaching kids

If the room owns the object, you can't get to the object without knowing the room, so there's no use in being able to ask the object which room it's in.

If the room doesn't own the object, to get the room based on the object, the object needs to refer to the room, but that's a massive spaghetti mess. Have fun.

Ignore it or just tell them that computers are bad at decimals.

But I am not teaching CS user

Hmm I'll try to do this but in maths a lot of theorems/methods involve equality between real numbers.

Thanks. Can I redefine == for floats as math.isclose ?

I can't do that, I am not teaching them cs.

someone else asked about starting with C. if I insisted on games, what is your opinion on starting with C++ and Unreal? I have no unreal experience and do have plenty of time Unity.

I could ask the same for games + python + pygame. But I already own a few courses (like 80+ hours worth) of general python which all starts at a beginner level.

Computer science has absolutely nothing to do with the implementation details of computer programming languages.

I don't think you understand your domain well enough to teach it.

>I forgot to mention it's a java class.
Everything is pointers in Java isn't it. Just add a Room member to the objects and assign to this to it when you add objects to the Room through a method

I guess

I wish I had friends to write OpenGL code with.

>your domain
Do you know what's my domain ?

>OpenGL
NOT PORTABLE

is this the right idea for the tic tac toe minimax AI solver?

minimax(depth, board) // minimum maximized
if win(board) return MAXSCORE - depth;
if loss(board) return depth - MAXSCORE;
next_states = a list of all valid next board states
for i in range(len(nexts))
score[i] = maximin(depth+1, next_states[i])
// maximin: an analogous function which does the inverse of this one
best_move = score.index(maximum(score))
return next_states[best_move]

desu I'd rather be using DirectX. There are a few good resources for getting familiar with it. But MS's own docs for it are horribly organized. I'll fuck with it when I have the time.

This might actually work for what I need. There's several objects extending a parent class so I'll create a string array and a method to add the room name to it.

why does c++ have a string type if its so shit?

std::string is decent though

imo its far worse than c# and java string classes, you can't even use spaces inside your string without doing stupid unnecessary code

>you can't even use spaces inside your string
?????

If anyone's wondering about how the hentai decensoring neural network is progressing, it's not. Grad school is raping my ass. If I had a month where I could do nothing but work on that project, I could have it done.

I'd love it if there's any anons here who could help me finish implementing the neural network, but I doubt anyone here knows pytorch.

What's this? I must know.

how big's your data set? there's a guy who made a program that de-blurs images so it may be along the same track as that

Is such a thing even possible? Seems like it would be enourmously inaccurate

Java/C# and C++ are two completely different varieties of language. The string type makes sense in each.

it's mostly tiny black lines

What should I use to generate C code docs?
I want something like Sphinx for Python and I hate Doxygen.
qdoc seems okay, but mainly focused on C++

int main() {
std::string s1;

std::cout > s1; //i.e: "fuck this shit"

std::cout

>you can't even use spaces inside your string without doing stupid unnecessary code
What do you mean?

I agree that they're shit in C++ though, there are so many missing features

i mean this

That's because of how streams work. Your're looking for std::getline(std::cin, s1);

// Example program
#include
#include

int main() {
std::string s1;

std::cout

change line 5 to:

std::getline(std::cin, s1);

>and getline
why do you lie

i've tried before in other example i was making to post here, and what i got was the compiler jumping the next line

It's as big as I want to to be. I trained a neural network to detect penises and vaginas so I can scrape a bunch of images and extract the penises and vaginas as needed.

See hi.cs.waseda.ac.jp/~iizuka/projects/completion/en/
Sadly, they haven't released their code EVEN THOUGH THEY SAID THEY WOULD. Annoys me that I have to implement it.

#include

struct people{
std::string name;
int id;
};

int main() {
int n;
struct people p;

std::cout > n; //ie 12

std::cout p.id;

std::cout

Getline will work perfectly, as long as you don't mix it with std::cin (well you can, but you need to flush the buffer and reset the flags).

I was away for a while but here's my script
str=""
while(((1))); do

read -e -i "$str" -p "Match string: " str;
stc=$(echo -n $str | tail -c 3)
sth=$(echo -n $str | head -c -4)
if [ "$stc" = "all" ]; then
prg=$(wmctrl -l | grep -i $sth);
else
prg=$(wmctrl -l | grep -i $str);
fi
if [ "$stc" = "all" ]; then
echo $stc
wmctrl -lp | grep -i $sth | while read identity desktop_number PID window_title; do
wmctrl -ia $identity
done
break;
elif(($(wc -l

ok, thanks
so should i use getline always and then convert it to other data types?

as a general rule, id recommend using getline for strings and cin for everything else, providing the appropriate overloaded extraction operator when necessary

Employed Haskell programmer here

can anyone here help me with regex?
basically my goal is to get anything that matches the pattern except some particular strings. so i decided to go with negative lookahead. let's say my pattern is .+ and my exception word is nigger.
>>> import re
>>> s = 'nigger'
>>> re.findall('(?!nigger).+')
['igger']

why does this happen and how do I prevent it?

Employed dragon here

>try to read beginner level programming books
>it's always boring shit about syntax
I'm never going to learn

>it's always boring shit
find a new hobby, chad.

regex101.com

Literally read SICP.

this is the wrong way to do it user. You should instantly start with what you plan to use. Do you plan to use the file system? Learn the part of the standard library that related to this. Want to make a script to get dubs all the time? Learn the part of the standard library related to URLs and HTMLs. Programming is pointless if you don't plan on using what your learning

Anyone here has any idea how's Rust for game development?

I want to use something other than C++(I'm using it 8 hours a day at work) for my hobby projects, yet I want to keep the performance close to C++ rather than what VM based languages have to offer. Does Rust offer enough abstraction for a 3D game? Should I use some wrapper for OpenGL or just bindings? Are there other languages you'd suggest? I want to explore cool and non-mainstream languages.

>#include "file.h"
This gives me a 404 error.
>#include "include/file.h"
This works.

Why? This project is set up exactly like my other C++ projects, and I don't have to write "include/" in them.

>t. Cuck++

import java.util.Scanner;
public class Program02
{
public static void main (String[]args)
{
Scanner stdIn = new Scanner (System.in);
double length;
System.out.print("Given a length of: ");
length = stdIn.nextDouble();
double width;
System.out.print("Given a width of: ");
width = stdIn.nextDouble();
double height;
System.out.print("Given a height of: ");
height = stdIn.nextDouble();
double area1 = length * width;
double area2 = length * height * 2 + width * height * 2;
System.out.println("The room's floor surface area is " + area1 + " meters squared");
System.out.print("The room's walls total surface area is " + area2 + " meters squared");
stdIn.close();
}
}

How does /dpt/ like my area calculation program

>inb4 java

Python:
LENGTH = input('Length:')
HEIGHT = input('Height:')
WIDTH = input('Width:')

AREA = LENGTH*HEIGHT*WIDTH

print('Area is:', str(AREA))


This is why people make fun of Java as a shit tier language

>Does Rust offer enough abstraction for a 3D game?
Absolutely.

>Should I use some wrapper for OpenGL or just bindings?
glium is a safe wrapper that is barely any higher level than the API besides eliminating globals and those kinds of things.

is this your first time writing code

babby tier script shit

Did your other projects give the compiler an include flag? You might have just forgotten that.

Obviously this non-code user typed is fake and gay. Type real code n00b!

Python
>takes 60 seconds to make a program
Java
>"let me spend the next 30 minutes making and compiling a Hello World program for you"
how efficient

Python
>take 60 seconds to write a program
>Wait a few hours for it to finish running

>gets outsourced by the "non-code"
>"HA! look at you pathetic employed non-coding! I am way too superior to write anything like this! Thats why they won't employ me, becuase I am worth too much"

Forgot to convert your inputs to ints, if only you could somehow know that before runtime

Java
>takes several hours to write
>program needs to be modified
>spends the next 6 hours modifying it
>"but it runs 4 seconds faster than Python, so it pays for itself after thousands and thousands of runs!"

>press f5
>notice the error with 4/5ths of a second
>spend the next 3.1 seconds fixing the error
wow, what a hassle