[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

/dpt/ - Daily Programming Thread


Thread replies: 345
Thread images: 26

File: wow dude.jpg (178KB, 934x1000px) Image search: [Google] [Yandex] [Bing]
wow dude.jpg
178KB, 934x1000px
old thread: >>53541936

What are you working on, /g/?
>>
File: 1457869672782.png (178KB, 1280x720px) Image search: [Google] [Yandex] [Bing]
1457869672782.png
178KB, 1280x720px
>>53549267
Where's that webm of that tranny getting his delusional head stomped when you need it?
>>
File: golly.jpg (156KB, 660x440px) Image search: [Google] [Yandex] [Bing]
golly.jpg
156KB, 660x440px
Jeez, oh man! Am I first?
>>
>>53549267
Teaching my wife's son COBOL
>>
Going to re ask this one here

>>53549281
>>
>>53549313
>wife's son
>>
File: 1447791570888.jpg (41KB, 360x360px) Image search: [Google] [Yandex] [Bing]
1447791570888.jpg
41KB, 360x360px
>>53549313
You could try a bit harder than that.
>>
>>53549267
import faggot
print kill you're self
>>
File: output.webm (3MB, 640x480px) Image search: [Google] [Yandex] [Bing]
output.webm
3MB, 640x480px
Does opengl have some kind of text primitives?
Because I tried drawing text with GL_LINES and failed hard.
>>
>>53549402
>text primitives?
pullin me leg ther m8?
>>
>>53549402
>OGL
>anything but barebones
good laff
>>
>>53549402
Simply create a texture with glyphs (a'la bitmap fonts), then generate UVs for them and draw that instead or go a step further and use libttf.
>>
>>53549402
>>53549463
How do I become as cool and smart as you?
>>
>>53549597
fucking lots of bitches and smoking lots of crack
>>
>>53549597
get good
>>
File: Capture.png (189KB, 685x618px) Image search: [Google] [Yandex] [Bing]
Capture.png
189KB, 685x618px
>>53549619
Is that like pair programming?
>>
>>53549641
this beta jap culture makes me irrationally angry
>>
>>53549641
wh-
y
do
we-
eb-
s
th-
in-
k
th-
is
is
le-
gi-
bl-
e?
>>
>>53549768
Because they aren't retarded and editing the bubble would be more work than it's worth.
>>
>>53549787
we-
ll
be
ho-
ne-
st,
ho-
w
mu-
ch
lo-
ng-
er
do-
es
it
ta-
ke
yo-
u
to
re-
ad
th-
is

than it takes you to read this?
>>
>>53549805
Not much longer at all. Also notice in the picture the shortest word is three, meanwhile you made yours two.
>>
>>53549787
Because the manga is designed for text to be written vertically, not horizontally, and it's a tradeoff between size, wordwrapping, and legibility. What does that have to do with programming though, other than your irrational hatred which you let everyone know about every thread.

Back on topic, why do programmers break their lines as X characters? Is using a scrollbar more work than it's worth? It seems to me that fancy typesetting and alignment of broken lines is a lot harder to maintain than simply letting the line go on as long as it needs to.
>>
>>53549805
it only starts cutting words off past 6 letters, and then the shortest cut-off word is 3 letters, so the actual equivalent of your post is:

well
be
honest,
how
much
longer
does
it
take
you
to
read
this

which isn't much longer at all
>>
Trying to learn Spring for Java. Need a project to actually cement my knowledge and have something to put on my resume.

Of course all the Java projects on github are mostly for Android phones so the search isn't working out as I had hoped.
>>
>>53549267
A script that can auto generate cover letters and also throw in keywords in certain places.

I find that I send so many cover letters that it's something worth automating.

Right now it just inserts the company name, location, and job title. I want it to also be able to include keywords like "I'm very comfortable working in X language with Y framework in a SCRUM/AGILE environment"
>>
>>53549919

>all the Java projects on github are mostly for Android phones

Because that's all it's good for.
>>
>>53550014
Yeah probably but most of the places i've seen that have asked for it are using it for some kind REST based web stuff or something.

I'm just trying to broaden out since it looks like a lot of enterprise java uses Spring but on the same token there's not a lot of enterprise java open source projects that I've found yet.
>>
What if we made a game in Powershell?
>>
File: 3x3.jpg (11KB, 268x188px) Image search: [Google] [Yandex] [Bing]
3x3.jpg
11KB, 268x188px
Hullo, /dpt/
So I am trying to make a 3x3 puzzle in JavaScript. The rough setup would be:

onTileClick {
if top = blank space then move up;
else if left = blank space then move left;
and so on...
}

but the thing is I'm having problems on how to apply it to each particular tile when clicked. I'm running out of logic for this. I know the solution could be googled easly, but I learn better by squeezing spoilers little by little. Pic related
>>
>>53550079
C and you got a deal.
>>
>>53550090
either convert mouse coordinates to board coordinates on click or retrieve the tile id from the sender object
>>
>>53550090
The easiest way to do this would be to make each tile it's own DOM element and attach onClick listeners to them individually.
>>
>>53550093

The Powershell idea was mostly a joke. Like... let's make .NET hack.

I don't have any good ideas for games, and if I did, I'd be implementing them in C++14, not C.
>>
>>53550258
How do I become a C++ master?
>>
>forced to use Swing in this one course
i feel sorry for every one of you faggots who has to do anything involving interface god fucking damn can anything get more boring?
>>
>>53550090
Write a findTileById() function. It doesn't matter if it's an expensive O(n) function, it's just a 3x3 puzzle.
>>
>>53550284
After you're finished Swing, learn a bit of Qt. You'll end up not hating interfaces again.
>>
>>53550314
I'll look into it if I ever feel like doing something with a GUI on my own. Figure the day will come
>>
>>53550223
>>53550234
>>53550304
Thanks fellow JavaScripteurs. I am trying them at the moment. Long live /dpt/ ! How long u guys doing JS?
>>
>>53550269

You don't. Not even Bjarne is a C++ master, and he made the damn language.
>>
>>53550355
Wish I hadn't done it at all.
>>
File: whyyoufuckstick.jpg (8KB, 342x44px) Image search: [Google] [Yandex] [Bing]
whyyoufuckstick.jpg
8KB, 342x44px
newfag here on /g/, can someone please tell me why my fucking simple as fuck python script is fucked?

def moon(string):
print(string)
x = input("What is the closest moon to earth called?")
if(x == 'Mun' or 'Moon'):
print('well done, good sir! Next question!')
elif(x == 'shitlord'):
print('fag')
else:
print('you bad at dis')

moon('ready')

?pic related is what happens
>>
>>53550406
>if(x == 'Mun' or 'Moon'):

That should be:
if(x == 'Mun' or x == 'Moon'):
>>
File: code.jpg (37KB, 540x238px) Image search: [Google] [Yandex] [Bing]
code.jpg
37KB, 540x238px
>>53550406
no damn formatting

>pic
>>
>>53550414
ooooooooooh, shit. Thanks...I should be more perceptive.
>>
>>53550429
You should lurk more before posting you fucking retard.
>>
>>53550429
Alternatively you could:
if(x in ['Mun', 'Moon']):


So it checks if the list contains what's in x.
>>
>>53550434
yeah fair enough
>>53550436
thanks, ill need to try both systems in the near futur
>>
man 2 is so much better than man 3.
man 3 sucks balls.
>>
>>53550367
>tfw you're better than bjarne
>>
>>53550355
About a year now, although I messed around with it way back in middle school when I was starting out. The language is exactly as awful as people say it is, but if you avoid the bad parts it can be alot of fun.
>>
File: wIBBG2R.webm (2MB, 480x360px) Image search: [Google] [Yandex] [Bing]
wIBBG2R.webm
2MB, 480x360px
Ask your much beloved programming literate anything (IAMA)

>>53549313
>cobol
>not ABAP
meh

>>53549402
>Does opengl have some kind of text primitives?
no

>>53550269
http://www.cppgm.org/

>>53550406
>>53550414
if x in ("Mun", "Moon"):
>>
>>53550647
Suggest to me a smallish project doable in the C programming language.
>>
File: dragoncolors.gif (599KB, 794x795px) Image search: [Google] [Yandex] [Bing]
dragoncolors.gif
599KB, 794x795px
>>53550654
A program that will read any file as a binary file to transform its bytes into audio samples. You could then listen to "song" of any file (could be fun with
program < /dev/random
)

https://en.wikipedia.org/wiki/Audio_bit_depth
>>
>>53550714
Sounds too hard.
>>
>>53550714
Do you remember dialup modems and fax machines? Do you remember that godawful sound they make?
>>
I've just started tracking users on my company's website. Is it bad that I've chosen to ignore DNT requests? I track our customers using only their UA and IP - it's good enough for the business requirements.

Just wanted to tell someone.
>>
>>53550730
Are you on unix ? it's quite easy with alsa

http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_min_8c-example.html#a6
>>
Wrote one of those tile swapping games

solved state is
1 | 2 | 3
---------
4 | | 6
---------
7 | 8 | 9


now I can't solve it
someone please tell me there aren't unsolvable configuration in this and I'm just a retard
>>
File: test.webm (1MB, 320x320px) Image search: [Google] [Yandex] [Bing]
test.webm
1MB, 320x320px
how do I learn to bash skript
>>
>>53550855
If you don't move pieces outside of the allowed moves then it will be solvable by simply reversing the moves.
>>
>>53550855
There are unsolvable configurations.
In math terms, you can only do even permutations. That is, it's impossible to swap any 2 tiles.
>>
>>53550855
wait no I solved it never mind

anyone know any more of those kinds of puzzles?

>>53550872
That's not how I wrote shuffling though

char[3][3] randomise(in char[3][3] input)
{
char[3][3] output = input;

for (int y = 0; y < 3; y++)
for (int x = 0; x < 3; x++)
if (uniform(0, 2) == 1) // pick either randomly
swap(output[x][y], output[next(x)][y]);
else
swap(output[x][y], output[x][next(y)]);

return output;
}

int next(int x) { return ++x < 3 ? x : 0; }


if you number the grid
1 | 2 | 3
---------
4 | 5 | 6
---------
7 | 8 | 9

it could swap 2 and 8 for example, or 1 and 3

in retrospect I have absolutely no idea why I wrote it like that
>>
>>53550866
what is this, food fetish stuff? a fuggin shovel though??
>>
>>53550866
it's been a while since I've had a boner I didn't want
>>
>>53550916
This will produce solvable states iff you do an even number of swaps.
>>
>>53550934
Wait, no, you need an even number of swaps not involving the blank tile.
>>
Hey /dpt/ give me some direction if you can. So Im in my final year of Int Relations at uni but I have no delusions of finding a job (working on a book thats irrelevant). Ive got one more elective left and I want to maximize its use. Since theres no point chasing science/maths related stuff, I was looking at something comp sci related.

Was wondering what programming was like, how accessible it is and whether or not its worth dumping a lot of my free time into.
>>
>>53550855

From the configuration
1 2 3
4 _ 6
8 9 7


To the configuration
1 2 3
4 _ 6
7 8 9


The problem can be solved in the following steps:

Move 6 left
Move 7 up
Move 9 right
Move 8 right
Move 4 down
Move 6 left
Move 7 left
Move 9 up
Move 8 right
Move 7 down
Move 6 right
Move 4 up
Move 7 left
Move 8 left
Move 9 down
Move 6 right
>>
bool is_adjacent(point a, point b)
{
return (abs(a.x - b.x) + abs(a.y - b.y)) == 1;
}

r8
>>
>>53550916
https://www.youtube.com/watch?v=GXJOVoyZcXQ
>>
>>53550855
read first chapter of "think like a programmer"
>>
>>53550943
Urgh, its not that simple at all. Swapping the empty spot with an adjacent tile is an even permutation, swapping it with a tile that is a 2 squares away is an odd permutation.

I'm going to stop thinking about this now.
>>
>>53550991
Why are you so epic? Whats your daily diet consist of? No sarcasm, mang. I Kinda adore you
>>
>>53551065
it's called autism
>>
>>53551065

It's not that difficult a puzzle, and I've had to deal with a few similar puzzles back when I played Runescape, which used a 5x5 tile puzzle (although the method of solving it is pretty much the same any size). Basically, you solve all rows except the last two (which, since you already had the first row solved, was fine), then solve the last two piecewise (divide into left and right side). In the case of this one, it's just "get the 7 and 8 in the right spot, and the 9 will slide back into place."

As for my diet... I eat a dead animal every day. Today was meatballs and fried ramen.
>>
>know D pretty well
>want to learn another 'we want to replace C++ but never will' language for meme purposes
>Go has no generics
>rust's syntax is goofy looking for no reason
>D is literally perfect
I know of only one way to motivate myself to bother
1-4 learn go
5-9 learn rust
>>
>all this left over course literature from my CS studies


is natural language processing worth getting into as just a hobby?
>>
>>53551236
>rust package is 120mb
what the fucking shit? I have literally 3 D compilers installed right now and they don't add up to half of that
>>
>>53551276
>write a generator that takes /dpt/ as an input and generates shitposts
it's worth getting into just for that
>>
ethereum is going down the drain

ahahahahah fucking cucks, i've been saying it all along that ethereum is SHIT
>>
>>53551276
it's hard to get good results out of it, you could do it if you're interested in it but there are other things you could be doing like game dev or whatever
>>
>>53551290
to the moooooooooooooooooooooooooon!
>>
>>53551288
That was one of the things I had in mind


n-gram models seem fun and easy and relate to a lot of web stuff
>>
>>53549267
is this going to be a regular thing?
is there really one dedicated autist who intends to photoshop hime's face onto traditional /dpt/ pics?
>>
>>53551360
>is there really one dedicated autist who intends to photoshop hime's face onto traditional /dpt/ pics?
yes

and he always posts the lowercase "old thread:" followed by "What are you working on, /g/?"
>>
>>53551360
>traditional /dpt/ pics
weeb...
>>
>>53551408
The meaning of 'traditional' doesn't change if you don't like something.
>>
Who the fuck keeps making threads at 300 posts?
>>
>>53551278

Rust has a dependency on LLVM. No idea how big that is.
>>
>>53551433
the obsessive trap fag
>>
>>53551453
one of those D compilers I have installed is LDC
>>
>>53551408
Kill yourself and fuck off.
>>
>>53550714
>>53550730
aplay can already do that since it can read on the standard input.

Yet, if you want portability, go the SDL route. I already did a similar program as a CD player (the input could be either a true CD driver or a CD image).
>>
>>53550736
but it's
A E S T H E T I C
E
S
T
H
E
T
cetera
>>
>>53551510
fuck off meme boy
you're the reason vaporwave is dead
>>
>>53551541
It's dead because it's shit. The meme was all that kept it going.
>>
>>53551541
it's deliberate
in 20 more years it'll be vaporvaporwavewave and AESTHETIC^2
>>
>>53551236
Swift m8
open sores as well
>>
Is there a way to call an instance variable in another class without making a method that returns it?
>>
>>53551236
Syntax is a far smaller problem than the lack of generics.
>>
>>53551741
Oh dear. I should probably specify that I mean in Java.

Thanks in advance.
>>
>>53551751
yeah but it's also a problem D doesn't have (well, not to the same extent as rust anyway)

the :: is pretty much a deal breaker for me desu
it's just so hideous

Is there any actual reason to learn rust if I know D? I pretty much just wanted to learn it so I could compare it to D
>>
>>53551741
>>53551755

This is literally what the "public" keyword is for.
>>
I need to read in a bunch of user options from a file, and set the appropriate variable to the value they specify.

They should be able to put the options in any order, and should be able to add comments and blank lines.

What's the best way to do this? I've just been using blank lines so far.
>>
File: Koala.jpg (763KB, 1024x768px) Image search: [Google] [Yandex] [Bing]
Koala.jpg
763KB, 1024x768px
What's the best way/book to learn C++, /g/?
>>
>>53551879
>What are you working on, /g/?
Trying to fight through this hangover so I can go to work. After work I'm going to take back my 400 or so empties that are polluting my closet, then get more beer.
>>
>>53551741
Java doesn't have friend classes?

The 'pure OO' answer is to restructure your code so you don't need to do this.

If you don't want it to be public, you could do package visibility.
>>
>>53551879
Didn't mean to reply to you. Fuck you.
>>
>>53551853
I understand that, but that doesn't actually help me use something.

Say I have a constructor in one class that names 4 strings, and I want to refer to them in another class. How would I go about doing that?
>>
>>53551943
show us the code
>>
Rate my prime number calculator. Is there a more efficient way of doing this?

#include <stdio.h>

/* Assess if p is a prime number by dividing it by all numbers from 2 to p-1 */

int main(){

int p = 0;
int div = 0;
int prime = 1;

printf("Enter number: ");
scanf("%i", &p);


for(div=2; div <= (p-1);)
if(p%div == 0){
printf("Not a prime number");
prime = 0;
break;}
else
++div;

if(prime==1)
printf("Prime number");

return 0;
}
>>
File: 1456522578409.png (565KB, 785x453px) Image search: [Google] [Yandex] [Bing]
1456522578409.png
565KB, 785x453px
>>53550866
>>
>>53552139
That is pretty fucking terrible.
>>
>>53552040
import java.util.*;
public class customer
{

String name;
String address;
String phone;
String custID;
public customer(String nameIn, String addressIn, String phoneIn, String id)
{
name = nameIn;
address = addressIn;
phone = phoneIn;
custID = id;
}

public double chargeForDamages()
{
Scanner in = new Scanner(System.in);

double charge;
System.out.println("Please enter damage charge amount");
charge = in.nextDouble();
return charge;

}

public void call()
{


System.out.println("Hello, " + name + " This is a courtesy call made out to " + phone + " to inform you that you have a overdue video rental.");
}
}


basically, I want to make reference to these 4 variables in other classes.
>>
>>53552139
You = stupid fuck
>>
>>53552171
put 'public' in front of the ones you want to be visible outside
i.e.
public String name;

etc
>>
>>53552187
>>53552187
Thank you, I appreciate it, but...how do I invoke them?
>>
>>53550919
it's pretending to be retarded for youtube bucks
>>
>>53552217
in your other class
customer foobar = new customer("John", "123 Fake St.", "12345678", "0987654321");

System.out.println(foobar.address); // prints 123 Fake St.
>>
>>53552139
Ok, for a start you only need to check divisors up to sqrt(p). Second you only need to check prime divisors. Go google Sieve of Eratosthenese.

Oh also
>Didn't indent the body of main
>div <= (p-1) instead of div < p
>++div in the loop body rather than the for statement
>No explicit block on the loop
>Closing brace on same line as last statement
>if(prime==1)

This code is a mess, did you come from Python perchance?
>>
>>53549313
ur funny
>>
>>53552277
Also real prime testing algorithms typically do some kind of pseudo primality test first (if the test fails, its definantly not prime, if it succeeds you don't know either way) which speeds things up a shit ton.
>>
>>53552344
Definantly? Really?
>>
>>53552392
defiantly
>>
>>53552392
I do math not English ok?
>>
>>53551475
>the cancer of /g/
>>
>>53551431
Embrace the new tradition.
>>
https://www.gnome.org/outreachy/

:^)
>>
File: Penguins.jpg (760KB, 1024x768px) Image search: [Google] [Yandex] [Bing]
Penguins.jpg
760KB, 1024x768px
>>53551879
Bump.
>>
>>53552277
>This code is a mess, did you come from Python perchance?
Yes, I learned a bit of Python before starting with C, though I have only been programming in C for about a week.

>No explicit block on the loop
Could you give me an example of one?
>>
>>53552601
Explains some things.
Your code looks like you wrote Python and then added braces to things to fix the problems. You want to be adding braces to pretty much everything.
for(div=2; div < p; ++div) {
if(p%div == 0){
printf("Not a prime number");
prime = 0;
break;
}
}
>>
I want to try out programming but not sure what I want to begin with. What is the most beginner friendly language to start out with, and where do I start?
>>
Learning about piping in C, anyone have a good resource they recommend?
>>
>>53552890
Python or JavaScript.
>>
> only 3/8 test cases pass
How many i supposed to make my nlog(n) solution run faster ):
The problem wants me to get the highest number add it to a sum, subtract the highest number by 1. Then repeat. Currently using a maxheap
>>
>>53552242
>>53552171
Isn't Java standard to capitalize classnames?
>>
>>53553520
yes, eclipse usually yells at you for it
>>
>>53553520
yes

also the curly brace style is the one used in C#, but for some reason a lot of schools use that style for java
>>
>>53553556
the google style for java is an absolute mess, I don't understand why people use it.
>>
>>53553556
Allman braces is best braces.
>>
>>53550406
if x == 'Mun' or x == 'Moon':
>>
>https://sites.google.com/site/jailanguageprimer/

is it just me or does it look like shit
>>
>>53549313
cuckbol
>>
Is C# worth learning?
>>
>>53554192
No, go for Java instead.
>>
Can this be optimized?

        void LoadEvents() {
string[] files = System.IO.Directory.GetFiles(filepath).ToArray();
int filecount = files.Length;
Array.Resize(ref alarms, filecount);
displaybox.Items.Clear();

for (int i = 0; i <= filecount - 1; i++) {
string[] file = ReadFile(files[i]).Split(new string[] {Environment.NewLine}, StringSplitOptions.None);
alarms[i].realname = file[0].Trim();
alarms[i].type = file[1].Trim();
alarms[i].thedate = Convert.ToDateTime(file[2].Trim());
alarms[i].active = Convert.ToBoolean(file[3].Trim());

if (alarms[i].active == true) {
alarms[i].name = alarms[i].realname + " - ON";
}
else{
alarms[i].name = alarms[i].realname + " - OFF";
}
displaybox.Items.Add(alarms[i].name);
}
}
>>
>>53554282
> == true
>>
>>53554282
looks like c#, why not use a generic list instead of resizing the array?

also, why not store the alarm you're accessing temporarily, change the values and overwrite the index with your new object? Saves having to access the array in every step.
>>
>>53554236
this
>>
>>53554372
>looks like c#, why not use a generic list instead of resizing the array?
Isn't an array more lightweight and faster?

>also, why not store the alarm you're accessing temporarily, change the values and overwrite the index with your new object? Saves having to access the array in every step.

Not sure what exacly you mean, but that array is where all the data is stored while the program is running, it's not just there to populate the displaybox.
>>
>>53554192
Absolutely, but it depends on what you want out of it.
>>
>>53554282

 if (alarms[i].active == true) {
alarms[i].name = alarms[i].realname + " - ON";
}
else{
alarms[i].name = alarms[i].realname + " - OFF";
}

is the same as
alarms[i].name = alarms[i].realname + " - " +(alarms[i].active) ? "ON" : "OFF";

not an optimization though
>>
>>53551916
>keeping empties in your closet
underage confirmed, 4chan is 18+
>>
Hey, autists.

How do I set the file value of an input tag in JavaScript using the Chrome API?

You can't normally set the file value of an input tag using JavaScript due to security reasons, but surely you can do it with an extension API.

document.querySelector('[type="file"]').value = 'this throws an error'; 
>>
>>53554827
I have a two bedroom apartment. One is for the computer, one is the bedroom. The closet is a good place for the empties because there isn't much else in there, I keep my clothes in the living room closet so they don't smell like cigarette smoke.

Eat dicks, fuckboi.
>>
>>53551801
learn rust if you intend to use rust

the only thing it has over D is actual memory safety. also a bit better library design and documentation
>>
>>53555024
>smoking indoors
>storing empties in your closet instead of taking them out

absolutely disgusting dogg
>>
what's the three episode rule of trying out new languages?
>>
>>53555353
nice numbers, fizzbuzz numbers only
>install
>make a fizzbuzz
>uninstall
>>
How do i go from VIsual c++ Command line to GUI what do you recommend me ?
inb4
>Just use foo language XDD
>Install bar ;)
>>
File: Animation.gif (983KB, 429x281px) Image search: [Google] [Yandex] [Bing]
Animation.gif
983KB, 429x281px
There was a guy on here that suggested diego's book on webgl, so I decided to check it out and it's help me understand some stuff I didn't really get. So I'm working on a video game idea I have and the attached gif shows my progress.
>>
>>53549267
markdown->latex program in scheme
>>
File: 1440681123843.png (80KB, 211x176px) Image search: [Google] [Yandex] [Bing]
1440681123843.png
80KB, 211x176px
>>53555490
SEND HELP /g/
>>
>>53555490
learn MFC or ATL/WTL

or Qt or Wx
>>
>>53555699
What would you personally recommend me
MFC or Qt?
>>
>>53555725
not him but qt. At least you can try to be portable that way
>>
>>53555081
I work full time, I don't always have time to take them back. Besides, when they pile up the return is great. Gonna be $40.
And yeah I smoke beside the window; air purifier in there as well. Anything else?
>>
>>53555803
Alright thanks i'll try with Qt
>>
>>53555803
Another thing now how would i go from my command line code to qt gui? I have to rewrite everything right? Any guideline to port them?

Been reading and trying qt for some days but don't know about porting from my command line program to qt gui, also searched and nothing
>>
>>53555896
Hopefully you kept the business logic and display logic of your program separate. Then, its just a matter of rewriting the display code to work with qt.
>>
>>53555613
>webgl
>video game
epic
>>
>>53555613
nice raytracer, mate!
>>
which one is the best?
class Test:
def __init__(self):
self.a = 0
self.b = 0
self.c = 0
self.d = 0

OR
class Test:
def __init__(self):
self.a = self.b = self.c = self.d = 0
>>
>>53555951
>tfw i have a greenlight game on steam made in open GL
>>
Lets collab on an android app and make money
>>
>>53556255
the latter
>>
>>53556255
the former
>>
File: CPlusPlus.jpg (36KB, 433x455px) Image search: [Google] [Yandex] [Bing]
CPlusPlus.jpg
36KB, 433x455px
>>53549267
>>53549267
Hi guys.
im a high school student.i program Pascal and i got an invitation to participate against teams of universities in the ACM ICPC national selection. the thing is, im not even that good. i have 4 days to fully learn C++ and understand the implementation of advanced algorithms, especially DP.
4 days. can i do it guys?
>>
>>53556267
webgl is shit though
>>
>>53556417
No.
>>
>>53556417
no. also underage v&
>>
>>53556417
>m a high school student
goodbye
>>
>>53556255
self.a, self.b, self.c, self.d = 0, 0, 0, 0
>>
>>53556255
neither
>>
>>53556441
>>53556447
being in high school doesn't necessarily make you under 18
>>
>>53556436
>>53556441
>>53556447
rude :/
>>
>>53556255
either
>>
>>53556255
which ever you prefer
>>
i only know C# and i have to develop an application in Python, i don't even know which version of it to use, much less which platform, OS or anything. what's a good place to start?

also, python is so fucking ugly and it's hard to read with its identation system
>>
>>53556496
That's AWESOME dude.

programming competitions are fun!

i would suggest you to take a look at these:

https://www.codechef.com/wiki/tutorials
http://codeforces.com/
>>
Imagine i have this vector:
std::vector<std::vector<int> > test;


how can i know the size of test without using the test.size()?

cause looping through a giant array its always calling that method and that takes time. :\
>>
Lets collab together guys seriously lets program something
>>
>>53556417
I can help you understand DP :)
>>
>>53556618
i'll make the logo
>>
>>53556569

I already program on codeforces. my rating is pretty low (1200) , but my main problem right now is mastering c++, I know the basic syntax, loops and conditions but all the libraries and predefined function will take time to master.

thanks man I appreciate it
>>
>>53556617
const int size = test.size();
for(int i = 0; i < size; ++i)
>>
File: kek.png (3KB, 245x70px) Image search: [Google] [Yandex] [Bing]
kek.png
3KB, 245x70px
>>53556617
>not writing your own data structures for C++ programs that do not link to C++ standard library
It's like you want to be called pleb
>>
>>53556632

that would be great
>>
>>53556658
thats nice bruh.

then check this: http://codeforces.com/blog/entry/15643
>>
>>53556693
>trusting the compiler and not writing your C++ meta templates for a simple program like hello world!
plebs i swear
>>
>>53556672
 warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

i thing the size( ) method is a
 size_t 
type
>>
>>53556758
put the value in an int or unsigned int if you know it will fit so you can get better performance
>>
I'm writing a content generator that fools Google search robots into ranking my pages higher. That's not an easy task...
>>
File: 14321349231350.png (538KB, 603x453px) Image search: [Google] [Yandex] [Bing]
14321349231350.png
538KB, 603x453px
Been learning Python vigorously since the new year.

Starting to grasp it.
Post some code I can read or some hints that will aid me.

Thank you, and back to work.
>>
>>53556918
https://docs.oracle.com/javase/tutorial/
>>
>>53556918
        globals()
.update({ "______":
lambda x: globals()
.update(( dict([[x]
*2])))}), ______(((
"Just")))
,______(( "another"
)),______ ("Python"
),______( "Hacker")
];print ( " ".join(
[(Just),( (another)
),(Python ),Hacker]
));______

>>
File: 1457550501120-1.jpg (344KB, 780x520px) Image search: [Google] [Yandex] [Bing]
1457550501120-1.jpg
344KB, 780x520px
Working on my file manager with torrent support. I started over again because I fucked up some stuff.
>>
>>53557044
Don't forget to add mail support.
>>
>>53557195
I'm planning to send a daily status report by mail.
>>
seriously guys seriously lets collab and make a program together please
>>
>>53557231
Okay
What kind of program?
What language? (Not C++, Lua or Pyshit)
What license? (AGPLv3+ ofc)
>>
>>53557231
you need a leader but then it's going to be like "help anon for free" and no one is going to put much work into it
>>
>>53557231
Business application
Java
lets make cash
>>
>>53557251
it should be in C++ with BSD license you dick

>>53557259
retarded memers won't/can't use java
>>
>>53557280
fuck C++
>>
>>53557280
no thanks
>>
>>53557289
fuck C/python/lisp/haskell etc
>>
>>53557280
I can use any language and am willing to program any kind of program that will make us money
>>
>>53557305
We should do C#, IMO
>>
>>53557317
fuck no

C++ or java
>>
>>53557325
fuck C++

fuck java
>>
>>53557342
fuck C#
>>
>>53557289
>>53557290
>>53557305
>>53557325
>>53557342
>>53557349
Guys seriously stop arguing and lets make some deals we can do this
>>
how to translate this vector to C?
std::vector<std::vector<int> > values;


?
>>
>>53557325
>>53557366
going java is shit. the fucking out of you number by divisors. go google style for "free" and also:
>didn't much beloved
programmers using and i'm just so hideous
>>
fuck <every programming language except my personal favorite>
>>
>>53550757
everyone ignores DNT. Don't feel bad. They should be using disconnect. DNT was an idea that was never going to fly anyways.
>>
>>53557372
double (*matrix)[N] = malloc(sizeof(double[N][N]));
>>
File: 1458312697295.jpg (38KB, 600x380px) Image search: [Google] [Yandex] [Bing]
1458312697295.jpg
38KB, 600x380px
could we make an ethereum clone or something? like a distributed paid-for webshit service provider
>>
>>53557406
>disconnect
Useless
>>
>>53550866
it's not one of those languages you learn. In my exp. You just start using it for shit when you need it. Or try and write a cli app or something.
>>
>>53557424
Any alternatives?
>>
>>53557451
ublock, the build in firefox list, umatrix
>>
>>53557474
already using ublock, I'll check out umatrix. Thx
>>
>>53557491
Remember to add more filters to ublock. The default ones are not enough.

Also use CanvasBlocker, Decentraleyes, Google search link fix and https everywhere
>>
>anime
>java
>full on nerd look
>nigger music
this guy is literally /dpt/
twitch.tv/sanjaro
>>
>>53557615
Only OSGTP listens to nigger music. We listen to Touhou OST.
>>
>>53551801
Only if you want to feel permanent rage. You will spend like 2 month to learn it properly and understand how it works so you wouldn't fight with compiler.
Syntax is very different from c/c++/..., but they made it the way it exists not because they are hipsters or something, it helps to avoid a lot of problems according to them.
2-3 years and Rust would be fully usable, I think.
>>
Why do the majority of software companies still use shit languages?

It's like a hospital still using ether to anesthetize people.

I keep getting messages from recruiters trying to get me to take jobs using Java and Python.
>>
File: browser.png (47KB, 250x250px) Image search: [Google] [Yandex] [Bing]
browser.png
47KB, 250x250px
tweaking browser #112. the thread preview window no longer gets covered up by other windows. that's been annoying me for a long time.
>>
>>53557719
Because software companies are run by 'change is bad' managers.
>>
>>53557754
How can so many managers get away with fucking up the companies they work in for so long?
>>
>>53556617
>
vector::size()

Obvious baseless assumption which happens to be wrong: it is clear that a vector must somehow know its own size, otherwise it can't implement half of its methods, so the complexity of the method can't be but constant. Thus,
the performance gain you're making by caching size here >>53556672
is negligible, and it is also a good source of bugs, in case you change the size of the vector while iterating, for example. Maybe you were asking for iterators? At least you should look into them. Finally, remember that if premature optimisation is bad, clueless premature optimisation is even worse.
>>
>>53550757
webcancer being cancerous as usual
>>
Dear lord someone help me. Trying to do c++ polymorphism for the first time and I have no idea what the fuck is going on.
>>
>>53550757
You are ethically obligated to refuse to do it or quit.
>>
>>53549641
https://www.youtube.com/watch?v=1Y2zo0JN2HE
>>
>>53557795
Because the only person higher than a manager is the owner. Managers care about making as much $ in the shortest amount of time. Owners care about keeping the boat afloat by making sure there's a steady amount of cash flow and hauling in new clients.
TL;DR managers only care about short term. Owners care about long term.
>>
>>53557825
fuck off back to stackoverflow
>>
>>53557887
Why the fuck hire managers then? They're completely at odds with long term survival of the business, by your description.
>>
>>53557719
nothing wrong with java, in fact it happens to be possibly THE best programming language currently in existence, epic fag memer
>>
>>53557908
that's because his description is wrong
managers are assholes but they can have different goals for companies, not only short term
that was just some bullshit he pulled out of his ass
>>
>>53557929
The JVM is alright. Java the language is shit. Piss off, Pajeet.
>>
>>53557963
the only complaints against java you can come up with are based on inane personal preferences or misunderstandings

python is a terrible language but idiots can get things done with it so it's still useful for businesses
>>
>>53557645
>Only OSGTP listens to nigger music.

What nigger music?
>>
>>53557908
At my company, poor programming with a good talk become managers.
Managers make sure the cogs keep turning as fast as possible. They don't try to innovate, because that could bring to process to a halt if it backfires. They only care about products getting shipped as fast as possible.
>>
>>53557989
It doesn't have higher-kinded types
It doesn't have tail call optimization
It has a pathetic attempt at functions
It has virtually no type inference
It doesn't have typeclasses
It doesn't have structs
It's basically garbage that belongs in the 90s
>>
>>53558050
those are some epic hot opinions lmfao k tard sperg
>>
File: Varg-smiling.jpg (11KB, 320x350px) Image search: [Google] [Yandex] [Bing]
Varg-smiling.jpg
11KB, 320x350px
>>53558024
Gangsta rap boyo. To keep da booty shakin.
>>
>>53558050
>tail call optimization
>language property
>>
so i have this:
std::vector<std::vector<int> > items;
items.push_back(std::vector<int>());
items[id].push_back(something);


how can i transform this into C? i'm trying to test something. but i don't know much about arrays in C
>>
>>53558050
Java does suck IMO.

But the things you listed are why it's successful -- some Pajeet doesn't understand any of those things. All it will do is confuse his lesser mind.
>>
>>53558101
>doesnt realize some languages explicitly require tail call optimization
kek
>>
>>53558101
Scala has it.
>>
>>53558122
only megafedoratipping memelangs
>>
Anyone have an orchestration tool they recommend? Mesos looks like shit and the other tools most people use are ramshackled tools with other specialties (Jenkins/Hudson, your config management tool of choice, etc).
>>
>>53558148
Hope you enjoy writing the same code again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again and again because your favored language can only support the most basic of abstractions.
>>
>>53558138
*A Scala implementation has it.

>>53558122
And that's absolutely stupid.
>>
>>53558165
>Not using go
Sensible.
>>
>>53558138
Do they use trampolining or something?
I thought it was a defect in the JVM that prevented its implementation (last I heard, the JVM engineers were taking it seriously, which is excellent news)
>>
>>53558103
Forgot C++ when you do C.
>>
>>53558165
e.g. haskell code is ugly as fuck and even if some code is shorter it's not necessarily better
>>
>>53558168
No, there's an annotation
@tailrec
in the language. If you use it, then compilation of the annotated method must fail if it could not be transformed into a loop.
>>
>>53558165
Metaprogramming saves you from that.
TCO helps save you from rigid looping constructs and stack overflows in linear-recursive processes
>>
>>53558103
Just make a 2D array and download valgrind because if you can't even figure this out the bugs you'll create will cause some fireworks.
>>
>>53558183
but calling those methods to push_back something is slower than C. that's why i wanted to know
>>
>>53558211
why not write a loop in the first place fucking FAG
>>
 
for(var i = 1; i < 29; i++) {
console.log("REEEEEEEEE");
console.log("Number:" + i)'

}
>>
>>53558178
It transforms methods marked
@tailrec
to while loops or fails to compile them.

For anything non-trivial, you need to use a trampoline, sadly.

I wouldn't hold my breath waiting for JVM support for it.
>>
>>53558222
>but calling those methods to push_back something is slower than C. that's why i wanted to know
Whoever told you that is a retard. C++ is zero-overhead, and often faster than C due to a stronger type system (no void* everywhere).
>>
>>53558229
Easier to get wrong.
>>
>>53558222
Learn C and forgot about C++.
>>
>>53558251
no
>>
>>53558270
yes
>>
>>53558260
c++ is fine as long as you're not working with Pajeets
>>
>>53558260
C is fucking garbage, it's for spergs who can't into C++ or any of the higher level languages
>>
>>53558237
Eh, I'm a CL fag
But I'd hop right the fuck on ABCL for that sweet java lib interop once that gets fixed (though, I'm just as comfortable using LOOP proper as I am taking advantage of recursion, so I may as well stop being a bitch about it)
Also, Scala looks like a pretty sweet non-lisp.
>>
>>53557989
go back to CS102, John
>>
>>53558260
C is for simple minded people.
>>
>>53558300
You're funny little code monkey.
>>
>>53557825
>and it is also a good source of bugs, in case you change the size of the vector while iterating, for example.
Changing the size of a vector (or any container) while you're iterating over it is a recipe for disaster because it invalidates all iterators.
>>
>>53558322
you're fucking delusional, you're not anything special for using C, in fact i'm using it right now because i don't need C++ features for the thing i'm working on
>>
>>53557989
Java is an extremist OO language.
Having to make a boilerplate class just so you can create a static function, really?
>>
>>53558339
>calls out C programmers
>programs in C
Ayy.
>>
>>53558352
it's the same as C++. it's object-oriented in syntax only
>>
>>53558091
>Gangsta rap boyo.

I listen to prog rock, lad.
>>
>>53558352
class Foo {
static void Bar() {
System.out.println("wow so much boiler plate, not. kill yourself");
}
}
>>
>>53558379
Calling Java the same as C++ is a little bit insulting for both languages.
>>
>>53558362
>can't tell difference between calling out language and its programmers
>thinks hypocrisy makes him correct

This anon is a special kind of retard.
>>
>>53558306
Yeah, despite its flaws, Scala is a good language. You can get really far with it in terms of what abstractions you can express, but you have to be really careful and disciplined in places where you just wouldn't have to in Haskell because the language just wouldn't let you get it wrong.

I'd say it and Clojure are the top 2 languages on the JVM today. It'll be interesting to see how Frege (a Haskell implementation on the JVM) matures.
>>
>>53558384
Good to hear you're on the right track my friendly Drumpf voter. Before you know it, you'll be singing along with Kyary Pamyu Pamyu.
>>
Great. Now I have to come up with a name for the useless Bar class that just hosts the function Foo I care about, probably ending up with a FooManagerBeanFactoryFacade or some other Entreprise Quality crap.

This is stockholm syndrom at its finest.
>>
>>53558384
Why not prog-rap?

>>53558395
Java, C# and C++ are three sides of the same failed coin.
>>
>>53558446
>>53558392
>>
>>53558433
>Good to hear you're on the right track my friendly Drumpf voter.

I'm not voting Trump.

>>53558457
>Why not prog-rap?

Absolutely disguting.
>>
Hi guyz Pajeet here I will program yur programs for $5 dollars
>>
>>53558457
>Java, C# and C++ are three sides of the same failed coin.
Way to show you have zero clue about any of those languages.

I also love the irony of calling the top 10 most successful languages failures when you probably use some novelty hipster language nobody needs in the real world.
>>
>>53558446
you will always have a class to put the method in. fucking Ctards, haven't even heard of namespaces
>>
>>53558485
do this pls>>53558103
>>
>>53558215
Metaprogramming has its own problems, being harder to debug and reason about. I prefer to use a language that can express the abstraction I want directly.
>>
>>53558499
I only know Java sir
>>
>>53558484
>I'm not voting Trump.
Why not? Having Drumpf as your eternal president will speed up the downfall of burgistan. Don't you want world peace my friend? You can start all over again and do it right.
>>
>>53558490
How much money do you think has been thrown away on fixing problems and maintaining code written in the three languages?
>>
>>53558500
so Lisp?
>>
>>53558522
>Having Drumpf as your eternal president will speed up the downfall of burgistan.

Sanders will get that job done twice as fast by tanking the economy. That's why I'm voting Sanders.
>>
>>53558534
If there were no better alternatives.
>>
>>53558497
>you will always have a class to put the method in
That's the problem, Einstein.
When every sensible language has a print*() function, Java has some gratuitously verbose System.out.print*(), just for the pleasure of taking things too far.

You will never need two levels of namespaces for the print functions. There is not possible clash, and this is just pointless mastubartion.

This is not useful. This is noise. Boilerplate.
>>
>>53558500
>Metaprogramming has its own problems, being harder to debug and reason about.
Not as hard as you'd think, but Metaprogramming is a tool best used sparingly and with rigerous testing, even in places where it's relatively easy to do.
>>
>>53558564
>Java has some gratuitously verbose System.out.print*(), just for the pleasure of taking things too far.

Learn how to use static imports. Then, take yourself too far off a half-built bridge.
>>
>>53558564
fuck off retard
>>
If you think Java is a bad programming language you are a shit programmer end of discussion it takes real intelligence to program well in Java
>>
>>53558564
tbf, `System` encapsulates environmental settings, `out` is an Object pointing to a PrintStream, and `println` is a method of that object. In this instance it's not unreasonable.

But yea Java does suck.
>>
New thread: >>53558609
>>
>>53558597
this

if you're a retarded Ctard you can still just make a file ProgramName.java and put all your static shit in there
>>
NEW THREAD!!

>>53558628
>>53558628
>>
>>53558523
How much money do you think has been lost funding grand utopian visions of theoretical programming languages that would magically erase complexity and human error?

And how many of those have been successful?
None, zero, zilch, nada, niet.

At some point you need to come back to the real world, where people solve hard problems with usable tools.
>>
>>53558614
thanks based anon

>>53558630
kill yourself
>>
>>53558638
I already solve hard problems at work with my meme languages.
>>
>>53558630
Deleted
Was it by a mod or did anon realised his mistake?
>>
>>53558500
Meta programming makes debugging easier since you can hook into the compilation process for better diagnostics (i.e domain specific error messages, not just generic exceptions).
And similarly it makes profiling easier since you can emit markers and meta data when compiling.

External debuggers and profilers do these kinds of operations for you, but they operate on binary code, or possible generic debug formats, with meta programming directly supported by the language you can easily make your own debug and profiling directives.
>>
>>53558587
You can't even capitalize properly, and your only reply if a generic three word insult.
If you were agreeing with me, I'd think I was wrong.
So thanks, man.
>>
>>53558669
i'm betting it's a mod because the trap fag usually keeps it and spams it
>>
>>53558663
And of course when people have to deal with unmaintanable obscure meme crap in five years, it's totally not going to be a waste of everyone's time and money.
Or maybe you mean nothing you write will be relevant by then ;^)
>>
>>53558700
it was me
new hime thread in 250 posts!
>>
>>53558694
>delusional sperg: the post
hint: i type this way by choice, for my own convenience, and it's fairly common to type in lowercase on 4chan and in other chat-like contexts
>>
>>53558721
It's more maintainable than Java/OO garbage, because there's no pointless boilerplate and indirection, and it has comprehensive yet easily-understood property-based tests.
>>
>>53558732
Oooh! You made a coherent sentence. Even used a comma, I'm impressed.
The weak-ass insults are also by choice or is it just the best you got?
>>
>>53558776
the insults are sufficient to express my opinion without wasting much time on stubborn sperg shitters like you
>>
File: Animation2.webm (457KB, 397x453px) Image search: [Google] [Yandex] [Bing]
Animation2.webm
457KB, 397x453px
>>53555613
webgl game progress:

Multiple objects! yay! Reusable cube primitive! wow! Annoying mouse cursor! ohhhh! Terrible frame rate to reduce webm file size! OMG so good!
>>
>>53558820
why webgl specifically? do you really need it to be accessible through a website? how about the website + an optional downloadable desktop client?
>>
>>53558791
So sorry for expecting a reply with actual arguments.
Keep it up with the insults and hot opinions, great contribution, everyone's proud of you.
>>
>>53558820
How do you reuse cube primitives?
How did you create the cube primitive? Did you define every vertex as GL_QUADS or did you use GL_QUAD_STRIP?

I wanna start playing with multiple models without defining all of them at once and my render_scene function is literally 150 lines of coude
>>
>>53558848
Work on my javascript chops, and I like the idea of not downloading anything and it already working on most platforms. I started using three.js, but there were some things I wanted to do that I didn't really know how to do so I'm just learning this from the beginning. I'm learning opengl in the process, so I can apply what I'm learning here to any other platform that supports that. Also no compiling.
>>
>>53558884
First I created a base class for all game objects that has the objects position and rotation stuff. Then I created a geometry object that holds the vertices/colors/indices. Another class is just the relationship between a base object and a geometry object. You create a scene that has an array of all your objects, and you iterate over them during your render call. You have to use matrix stacks so you don't recalculate the camera stuff for each object. Really that just means you save your camera's translation/rotation matrix so you can reuse it for each of your objects. WebGL is kinda behind the times, but I'm having fun with it.
Thread replies: 345
Thread images: 26
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK