[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
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 41
File: dat boi.gif (91 KB, 312x420) Image search: [Google]
dat boi.gif
91 KB, 312x420
Previous thread: >>54614329

What are you working on, /g/?
>>
>Posting before the bump limit
>Frogposting
Report this thread.
Do not post in this thread.
>>
>>54625663
>butthurt trap poster
what a surprise
>>
File: 1463357385851.jpg (47 KB, 480x611) Image search: [Google]
1463357385851.jpg
47 KB, 480x611
>>54625663
Don't you ever tell me what to do faggot
>>
File: dat boi.jpg (73 KB, 680x632) Image search: [Google]
dat boi.jpg
73 KB, 680x632
>>54625682
o shit waddup!
>>
OH SHIT HERE COME DAT BOI
>>
how do i make a program with lisp? racket particularly. as in, a file that you can run. right now i'm still just doing the line by line thing
>>
>>54625733
you don't
>>
File: 1463210410094.png (1 MB, 1000x1400) Image search: [Google]
1463210410094.png
1 MB, 1000x1400
You have been visited by the crossdressing C programmer of Shimoshina Academy!

Good performance, triple indirection, and tail call optimization will come to you, but only if you post "Keep overflowing the stack, Hime!" in this thread.
>>
>>54625749
DELETE THIS

this cancer is not acceptable just because it has some programming lingo in it! this has gotten deletion + ban before and it should again!
>>
Why is cout so fucking gay? printf is much easier to use
>>
File: 1463436940821.jpg (74 KB, 640x400) Image search: [Google]
1463436940821.jpg
74 KB, 640x400
>>54625749
>crossdressing
>>
>>54625749
Keep overflowing the stack, Hime
>>
>>54625782
c++ is a meme
http://www.snopes.com/computer/program/stroustrup.asp
>>
>>54625747
really?
>>
I need a full text adventure game, but there is a caveat. It has to be written in a language where it can be edited and compiled from. Practically every one I can find that prints in console is pre-compiled or has some library that isn't compatible with my system. Or it runs in dosbox which I can't seem to access the memory in.

The idea is for it to accept an input and me modify the program so it dumps the response to file
>>
>>54625811
I like C++ otherwise but cout is just fucking stupid
>>
Trying to come up with some code that'll let me play music from another laptop on the same wireless network as mine. I'm a noob so I have no idea where to start. I want to integrate this into another project of mine, any suggestions?
>>
>>54625859
>any suggestions?
start by posting in the right thread and describing your problem properly
>>
>>54625749
Keep overflowing the stack, Hime!
>>
>>54625810
>>54625917
nice samefag retard
>>
>>54625648
Dumbass frogposter
>>
File: playboi.jpg (107 KB, 600x795) Image search: [Google]
playboi.jpg
107 KB, 600x795
>>54625962
this is a frog thread deal with it fag
>>
File: 1456447572777.jpg (20 KB, 456x456) Image search: [Google]
1456447572777.jpg
20 KB, 456x456
>>54625855
You don't like using meme arrows when coding?
>>
>>54625733
You compile a file.

I don't know how to compile files with racket but it's pretty simple with chicken scheme
csc -o foo foo.scm
>>
>>54625852
write your own
>>
>>54626083
considering that but it would take forever to write a proper one compared to adding a few lines to an already finished program
>>
>>54626114
I didn't understand what you were trying to do from your original post, mind explaining more?
>>
File: Screenshot_2016-05-18_17-06-12.png (837 KB, 1366x768) Image search: [Google]
Screenshot_2016-05-18_17-06-12.png
837 KB, 1366x768
Does anyone know a good algorithm for scaling down images? Images I print in my console have to be pretty damn small.
>>
>>54626151
Average color in successive rectangles
>>
File: Capture.png (22 KB, 782x616) Image search: [Google]
Capture.png
22 KB, 782x616
Wow it's really that easy?

I thought it had to do with maths n stuff
>>
>>54626142
well this is a project for /qst/

I wrote a scraper a week or two for a thread which takes each line as a command
ultimately I'd like to write a bot so that people can just respond to the thread and create their own text games, and the bot would act as a console.

So to do that you need a scraper to get the inputs and feed them to a program (which I have), you need a way of processing your inputs (a game which dumps to file, since merely printing it is useless), and a way of returning to the people that post. Two ways to do this, the first I'll try is a pastebin which edits itself and creates sessions. The second would be to buy a pass and create a bot that way. Unfortunately I could get banned for that so I'll go with the pastebin idea first.

See most text games run on dosbox or are in archaic languages that can't be run any more. So I've been looking for a good one for a while

Have found a promising library in python though, just looking for other options.
>>
File: 1403317853854.jpg (36 KB, 848x900) Image search: [Google]
1403317853854.jpg
36 KB, 848x900
This is one of the worst /dpt/s we have had for quite awhile.
This is what happens when you allow pre-bump limit threads and frogposting.
>>
>>54626220
bait
>>
i want to learn c# but i can't find a begginer (to c# and programming in general) book/site that looks good.

got any suggestions?
>>
File: 1439289978214.jpg (276 KB, 1066x1600) Image search: [Google]
1439289978214.jpg
276 KB, 1066x1600
tell me why JavaFX is bad
you can't, right?
>>
>>54626225
Can't you redirect output of [text adventure engine] to a file?
>>
>>54626239
https://learnxinyminutes.com/docs/csharp/
>>
>>54626237
>pre-bump limit threads
this includes the trap threads, fag.
>>
>>54626264
because it's outclassed really hard by swing
>>
>>54626282
isn't JavaFX supposed to be easier and better? ie: supporting css styling
>>
>>54626267
no, because none of them technically run from the command line. They run within their own environment

like once you've written a command starting their process and beginning the game you can't access those outputs by piping to file or anything, because it just doesn't accept console commands anymore.

Like it would be nice if, for example you could write
>emacs dunnet -nogui > out.txt
and have every command written there but you just can't
>>
>>54626264
>Java
>>
>>54626239
took like 3 seconds to find this
http://libgen.io/book/index.php?md5=E0DBBC1DEE5C29C92EF6FDB6B80359DA

you should learn programming first then pick up a book on any language you want. learning a new language isn't that difficult
>>
can /dpt/ recommend a book for GUI design?
i've finally learned layouts and writing GUIs without a form designer but i don't know how to make a GUI look good.
>>
>>54626360
what's bad about it?
>>
>>54626387
It's a gift, you either have it or you don't. You can't learn.
>>
>>54626410
what's good about it?
>>
>>54626410
he's memeing
>>
>>54626483
No, I honestly think Java is awful.
>>
>>54626151
c-can I get that script?
>>
>>54626499
because you fell for the meme

especially if you think C# is good but java is bad you're just stupid or misinformed
>>
>>54626515
No, C# is shit as well.
Any object oriented language is shit, especially languages that force it.
>>
>>54626545
>what are static methods and fields
>>
>>54625648
aaaaaaaaaiiiiiiiiiiiii itttssss da boooyyyyy
>>
>>54626549
>static methods
Pointless. Why do I have to create/define a class just to use a function?
>static fields
A global variable.
>>
Anyone here has before writed her own customized controls for XAML? There's a good book for that?, so long I've only learned about built-in controls.
>>54626545
C# is pretty good desu, I mean, i can pinpoint like 10 things I don't like about it, but I can do the same for every language I know, even C (my favorite).
>>
>>54626576
class ProgramName {
// ...
}


so this is all you've got, the "forced OOP" just because you have to write this "boilerplate"

idiot
>>
>>54626609
Who the hell writes their programs this way? That's just fucking stupid. I would just use a language that I don't have to fight to do even the simplest of shit.
Even with that shit, I would have to define ALL of my functions in a single file.
>>
>>54626368
I went through the codecademy course for python but c# is recommended by a bunch of people I know so I figured I'd give it a shot.
>>
What's wrong with my function?
Its telling me it can't convert explicitly from the linq type to the generic type or something
IList<IList<string>> scores = new List<IList<string>>();

public void Pull()
{
//get message
string response = netInterface.Get();
//parse location field and add scores
string[] responseCSV = response.Split(',');
foreach (string item in responseCSV)
{
List<string> score = new List<string>();
scores.Add(item.Split(':'));
}
scores = scores.OrderByDescending(x => int.Parse(x[1]));
}
>>
>>54626626
kill yourself IDIOT, you're stupid and wrong, i'm not gonna waste more time on you, enjoy your shitty C
>>
>>54626344
Actually I've done this before- there's a Z machine out there that takes a commandline option to output text to the terminal and no fancy GUIs.
>>
>>54626641
Enjoy your OOP and hidden mutable state, you shitty cargo cultist.
>>
>>54626659
fuck off and die, retard
>>
File: Screenshot_20160518-195644.png (69 KB, 540x960) Image search: [Google]
Screenshot_20160518-195644.png
69 KB, 540x960
>>54625957
Pssssh I wish I was dedicated to that
>>
>>54626673
Why do Indians get so defensive?
Can't you find the nearest designated street, Pajeet?
>>
>>54626682
more than an hour later you come up with this edited screenshot lmfao you're pathetic dude get a life
>>
>>54626690
stay delusional, nathaniel
>>
Which programming languages have the most jobs? I'm going to try to learn two or three this summer.
>>
>>54626712
java
C++
>>
Alright you wet socks, answer me this:

I am cucked into working with java. Is Scala worth learning, or is it just another epin maymay?
>>
>>54626723
Okay mom, which should i learn first? Any books I should buy to help me on my journey?
>>
>>54626695
Dude I was sleeping. Can I not praise Hime and take a quick nap?
>>
>>54626741
java and then C++

java is like a simplified C++

https://docs.oracle.com/javase/tutorial/
>>
>>54626766
only 1 or maybe 2-3 fags in total unironically praise hime, the hime poster was revealed to be samefagging
>>
Are there any good resources that show the underlying logic behind C++ abstractions? I'd like to be able to compare what I write to equivalent C and assembly code to see if stuffing my programs with a bunch of convoluted garbage is actually beneficial.
>>
>>54626784
Guess im one of those "fags" but I wouldnt doubt that Hime poster would samefag
>>
>>54626801
which abstraction in specific would you like to know about? I can take a stab at explaining it if you've got a specific one or couple in mind.
>>
>>54626784
>Keep overflowing the stack Hime!
>unironically praise hime
You're an idiot.

>>54626801
Compile your code with -S and be disgusted.
>>
>>54626784
Don't worry about it, they're all worse than a pure C implementation.
>>
>>54626801
Look at the assembly of your compiled c++ program. There is an option in gcc.
>>
>>54626828
Not any one in specific, I was looking more for something like a reference.

>>54626833
>-S
Fuck, using it didn't even cross my mind, thanks.
>>
>don't want to write function to do thing
>have to get around to it sometime
>just start writing up everything else that can be done without writing said function
>now can't really progress without writing function

In other news, I have written over 350 lines of C in the past 4 hours!
>>
File: 1461187505713.gif (364 KB, 250x222) Image search: [Google]
1461187505713.gif
364 KB, 250x222
I made a small SDL2 + GLEW / OpenGL program in linux (compiled with clang 3.8) and I'm trying to port it to windows, fucking visual studio is shitting itself.

Is mingw a better option? I just want this shit to work.
>>
File: car_desktop.png (640 KB, 1366x768) Image search: [Google]
car_desktop.png
640 KB, 1366x768
>>54626506
It's too damn messy
>>
File: gentoo_is_haram.png (188 KB, 255x345) Image search: [Google]
gentoo_is_haram.png
188 KB, 255x345
What OS do you use /dpt/?
>>
>>54626978
yes mingw should be much less painful.

What are you working on? I'm working on SDL + OpenGL program too. Mine is a minecraft clone.
>>
>>54626998
Arch GNU/Linux
>>
>>54626998
Debian GNU + Linux
>>
File: shit.png (189 KB, 1445x796) Image search: [Google]
shit.png
189 KB, 1445x796
>>54627000


just a small 2D framework, I want to make a geometry wars clone

the fucking compiler is throwing so many errors, might as well try something else before I even start debugging that shit
>>
>>54626998
Lubuntu
>>
>>54626998
Gentoo
>>
>>54626998

Windows 10 right now. Will be switching back to Linux at the end of Spring quarter.
>>
>>54626998

xubuntu and windows 10
>>
Does anyone here know what the inner `static` in the following C code means:

void f(int x[static 2]);


I'm not asking because I want to know what it means. I'm asking because I'm wondering if anyone here knows about this obscure feature that I've never seen in real C code. So please only reply with "yes" if you don't have to look it up.
>>
>>54626998
MacOS
>>
>>54627151
Without googling: If I recall correctly you're saying that the array is of a minimum of two items?
>>
>>54627151
I know what it means. It means that x must point to an int array that has at least 2 elements.
Yes, it's a very obscure feature. I only know that because sometimes when I'm bored, I skim through the C standard.
>>
>>54626998
OSX
>>
>>54627178
Correct.
>>54627179
Me too.
>>
>>54627195
Wow, I haven't touched C code in the last two years. I'm amazed I remembered that fact, but yeah, C is fairly simplistic.
>>
>>54625855
Nothing stops you from using printf
just #include <stdio.h> nigga
>>
>>54626998
templeOS
>>
>>54627151
ye I knew it was some constraint on how many elements x has, but I thought it was had to have exactly 2.
>>
>>54626712
full stack web development

I know >webshit and all but it's in huge demand.
>>
>>54627277
real programming is more viable long term, it has more depth to it and takes more skill, while web dev languages and frameworks and web startups have very short lifespans
>>
>>54626998
Gnu/Linux/Redhat/Fedora and Win7
>>
Despite the great amount of time spent studying them in school, I have never had to use a sorting algorithm to program anything.
>>
What do you make of the following quote:

>Dynamic typing is the idea that explaining types to the compiler is hard but keeping types types in your head is easy.
>>
>>54627338
Seems pretty accurate. Hence why scripting languages are usually dynamic, and languages meant for larger projects are not
>>
>Patrick raises hand
Is LaTeX a programming language?
>>
>>54627331
School is about learning how to learn.

Also, your school was probably just using something simple like sorting to explain things like invariants, asymptotic complexity, and divide and conquer.
>>
>>54627306
>real programming

What makes you think web development isn't real programming? The web is taking over, and as long as you use a stable technology (like java or something) it'll be fine.
>>
>>54627331
pseudointellectuals in the programming community put way too much emphasis on sorting, sorting is just one little thing, maybe if you're doing CRUD or something it's good to know your sorting algorithms but there are so many other things that are much more interesting than putting things in order
>>
File: out.png (29 KB, 621x727) Image search: [Google]
out.png
29 KB, 621x727
>>54626151
make it use half blocks ▀▄
>>
i took apart an apk and put it into android studio.

I get all sorts of errors and cant compile it or make it work correctly.

I just want to change a few things and repackage it and sell it. Im selling game expansion packs and the app is supposed to install shit to a specific path.
>>
>>54627331
What's important is that you understood computational complexity, not how to write them. Sorting is the best way to teach computational complexity since it's the most intuitive. 2 nested loops is O(n^2), searching binary tree is O(logn), etc. How it works gets really important when you go to write libraries for doing k-means clustering or matrix mulitplication or something.
>>
>>54627364
Java is such a horrible language. I recently read a book about Java because I thought that maybe there might be something there. But the book was horrible too. I stopped reading when it said that
x.f().g().h()

was considered bad style.

I don't know what Oracle is doing. C# was a better language in 2005 than Java is today.
>>
>>54627331
Sorting is there to teach you about Big O and an example of recursion. It's like complaining that you never had to implement a temperature converter in real life.
>>
>>54627398
it's obviously bad style you fucking retarded Cshart
>>
>>54627398
I think that's some Pajeet's opinion. I never read anything about that being bad style, but after learning ruby, I do it all the time.
>>
>>54627430
don't do too many things on one line, jeez, how is this hard to understand
>>
is it good practice to stack string replacing functions after eachother?
eg.
string = string.replace("A", "B").replace("C", "D");
.... >
>>
File: AAAAAAAAAAAAAAAA.jpg (78 KB, 970x771) Image search: [Google]
AAAAAAAAAAAAAAAA.jpg
78 KB, 970x771
How do I get over the learning curve of using dynamic types in javascript?

Since everything is fucking dynamic, I have no idea what the return type of functions are, and so I have no idea what i'm actually assigning to variables.
Am I assigning struct pointer analogues?
Do they all have dozens of member functions?
How am i supposed to know what they are?
I have no way of knowing what is portable and what isn't.

I can't deal with this shit, C was never this obtuse.
>>
>>54627445
t. never used closures
>>54627430
This book: http://www.amazon.com/Java-Complete-Reference-Herbert-Schildt/dp/0071808558
>>
>>54627450
in that case you can do it but you'd be better off using a char array/StringBuilder if you need performance
>>
>>54627445
Definitely. If it makes it harder to read I won't do it, but if there's a logical ordering, I might do it as it can explain the process better.
>>54627450
At that point make a new method that replaces things from one array with elements from another, or find a better method for that.
>>
>>54627445
>don't do too many things on one line, jeez
.().().() usually models some sort of stream, so I think it's perfectly acceptable.
>>
>>54627461
maybe put the return type somewhere in the function name

eg str_get_next_name()
>>
>>54627496
ok but if you're doing foo.getFoo().getBar().doThing() you should probably rethink your design
>>
>>54627398
what did it suggest instead.

ive done something like this with c++ first/second shit all over
map.emplace(this,that)
/* it, bool */ .first
/* key, value */ ->second
/* etc */
/* object i need */ .foo();

not really needed if the member names are good enough.
>>
>>54627587
A a = x.f();
B b = a.g();
C c = b.h();

Since Java doesn't have type inference you have to write down the type name.
>>
File: PTC juggling.jpg (73 KB, 640x960) Image search: [Google]
PTC juggling.jpg
73 KB, 640x960
>>54626151
>ptc
Is it really you?
>>
>>54627613
The type is in the method definition.
>>
>>54627668
No shit. I guess that is supposed to mean that I don't have to write the type down.
>>
>Install eclipse
>New Java project
>NullPointerExecption
Memory errors don't happen in safe, modern programming languages, they said.
>>
>>54627689
java doesn't even have pointers
>>
>>54627696
NullPointerExecption is thrown when you access a null object, retard.
Do you even know your own language?
>>
>>54627696
it does, however, have NullPointerExceptions.
>>
>>54627689
They don't. But in any case Java is not a modern language.
>>
how do i get a trap gf
>>
>>54627752
Step 1: Go to a board with traps.

/fit/ and /pol/ come to mind.
>>
>>54627736
did java rape you or something, you sure are butthurt
>>
>>54627736
Then explain how a language that doesn't even permit pointers, that compiles to a standard fucking VM, fuck up this badly?
All the other software on my machine that is written in C or C++ do not have this problem, they run very good without crashes.
Is it just Java programmers? how can someone fuckup so badly without even being allowed to use pointers? this is a fucking joke language for joke programmers.
>>
>>54627696
Yes it does, it's just all done under the hood. Everytime you type "new" you're allocating memory from the heap. There's even a way to get ghetto pointers using System.out

>>54627689
Java isn't modern, if you want modern Java you'd go with Scala.
>>
>>54627752
(4+4=?)chan has /cuteboys/
>>
>>54627776
fucking idiot, if you dereference a null pointer in C/C++ you have the same problem, what do you expect a "safe language" to do when you derefence a null reference, fucking idiot

FUCK OFF

>>54627786
>Scala
laughing irl, you're pathetic
>>
>>54627786

Get with the program. All the cool kids are using Sun.misc.unsafe.
>>
>>54627764
As a matter of fact. Java rapes my PC every time I have use a program written in it. Luckily that is never.
>>54627776
>Is it just Java programmers?
Mostly likely this.
>>
>>54627713
'my own language' is scheme because i'm not a peasant like you who takes pride in being a poo 2 loo. i do, however, know that java doesn't have pointers
>>
File: mount stupid.jpg (23 KB, 600x338) Image search: [Google]
mount stupid.jpg
23 KB, 600x338
>>54627776
kill yourself

>>54627816
kill yourself
>>
File: 4459353701_826a3c120d.jpg (126 KB, 489x400) Image search: [Google]
4459353701_826a3c120d.jpg
126 KB, 489x400
>>54627824
ok, thanks for sharing
>>
>>54627829
Lad, I see the value of many languages. C# is a very nice language. F# is a very nice language. The JVM is a nice platform that hosts nice languages such as Scala and Clojure. But Java's only quality is that it's Pajeets language of choice. Apart from that it's 1970s technology: VM edition.
>>
>>54626344
php
>>
File: 18211.png (98 KB, 400x300) Image search: [Google]
18211.png
98 KB, 400x300
>>54627866
damn what a stupid fag you are
>>
>>54627802
>>Scala
>laughing irl, you're pathetic
>implying I use JVM trash
sorry bud, I was just giving a suggestion of a modern language.

>>54627812
Never even knew that existed, might actually make java a fun language
>>
>>54627879
Take it to >>>/qa/534854
>>
>>54627890
yeah keep sharing those hot opinions i'm sure you're getting a lot of out it sperg
>>
>>54626997
post that i3status.conf
>>
/dpt/ how often do you use programming to actually make your own life easier?
>>
>>54627890
>Never even knew that existed
you're fucking clueless get a clue
>>
>>54626997
post it, faggot
>>
>>54627908
>>54627975
am I on /b/?
>>
>>54628026
>>>/global/rules/3
Friendly reminder.
>>
>>54626772
because it's just C for retards , that's why pajeets love it idiot
>>
>>54628055
kill yourself
>>
>>54628060
you should kill yourself anon. It would improve society so much
>>
>>54628055
just dont respond to him if hes acting retarded
>>
>>54626151
quad-trees with pruning
>>
Building a Sudoku solver in rust
>>
>>54628139
Show your work.
>>
>>54627445
(define (sum-sq-2-max . args)
(define (sum-squares . args) (apply + (map square args)))
(apply sum-squares (take (sort args >=) 2)))

How does this make you feel then?
>>
>>54626220
What site is that, you slightly nigger?
>>
File: Screenshot_2016-05-18_19-17-06.png (39 KB, 462x299) Image search: [Google]
Screenshot_2016-05-18_19-17-06.png
39 KB, 462x299
>>54627382
Thanks! Much more compact now

>>54627655
Oy vey, which volafag are you?

>>54628136
I'll look into it. I think sharpening the image beforehand might help.

>>54628008
Just use something like this https://github.com/enricruiz/ansify

>>54627916
I don't have one
>>
>>54626225
Holy shit that's a good idea and I hope to make money off it...
>>
>>54628172
Not him but that looks like wizardry.
>>
What are some good test cases for a 2-3-4 tree? Everything looks like it works good just looking for some edge tests to see if it has any bugs
>>
>>54628236
Memory allocators.
>>
>>54628188
>make money off it
literally how
>>
File: confussed.png (110 KB, 1366x768) Image search: [Google]
confussed.png
110 KB, 1366x768
Can someone explain to me why strcat isn't working? it works in all my other projects except for this one.
>>
>>54628500
strcan(cuck, c)
>>
>spend two hours trying to understand why a credit card checksum algorithm wasn't working
>i was adding the inner digits from left to right
>it was from right to left
I feel so fucking dumb right now.
>>
>>54628500
char *strcat(char *dest, const char *src);
>>
>>54627461
help
>>
>>54628546
Tried that also, the program runs but doesn't concat anything.
>>
File: confussed.png (70 KB, 1366x768) Image search: [Google]
confussed.png
70 KB, 1366x768
>>54628546
Actually, forget this>>54628568
Doesn't even compile, pic related
>>
How do you think you would try to estimate the value of a variable in a system of equations that is overdefined and has many variables? Something with like 20+variables, but like 100+ equations. At first I thought linear algebra might be a good idea, something like linear regression?

For example: 2*x+2*y+z=2
2*y+3z+5m+2x+4t=3 ... etc.

I think I had a decent idea of using python to read in the text file of these sets of equations, but I couldn't find anything that would deal with the symbolic math. I decided to parse it myself and just treat each variable as an entry in a dictionary.

I then thought maybe just an average would be good enough. So I thought I could just divide the right side of the equation by how many different variables there are (also taking into account multiplication). All the variables in an equation would be weighted equally and maybe with enough equations this might be good enough.

Is this maybe a statistics question? I can't find anything in my google searches that would be relevant to my question at all. Anyone even get what I am talking about and could point me in a direction to read more about my topic? Thanks.
>>
>>54626978
how
use nuget to install sdl2+glew

or use clang and compile it
>>
>>54628500
Help plss
>>
>>54628500
post the code so i don't have to type it all out from a picture to help you debug pls.
>>
>>54628689
>>54628500
You already have the answer: >>54628546
You're not calling it correctly.
>>
>>54628689
Lmao
>>
>>54628718
So how do I call it?
>>
>>54628660
If the equations are linearly independent, then why not just take the first 20 and calculate the inverse?
>>
>>54628727
See >>54628546
>>
>>54628718
And it also doesn't make sense because it works in every other one of my programs.
>>
>>54626282
But hey, JavaFX has functional interfaces which allow you to implement your event-handling code with lambdas. I think that's pretty neat. Plus it has support for Swing if you feel like it
>>
>>54628731
My understanding of linear algebra is pretty meh. Do you happen to know why I wouldn't want to use more equations if I have them available? To be honest I think it might be hard to try to figure out how to get 20 equations in which all my variables are contained and I don't think the value would be what I want as much as taking into consideration the whole dataset. I feel like this would be a estimate and not have a single solution like linear algebra might seem to assume is what I would want.
>>
>>54628660
Make a matrix with the coefficients, a matrix with the result (rows in the same order of course) and then just use something like http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.linalg.solve.html

It's Ax = b so if you can parse the equations to make A and b the rest would be reinventing the wheel if you don't use a library
>>
>>54628760
Were you using strncat in the other programs, by chance?
I really hate to spoonfeed this sort of simple shit, but just to shut you up, the answer is
strcat(cuck, c);
>>
>>54626626
Confirmed for failing his OOP class
>>
>>54628764
A system of equations is overdetermined if you have more equations than you need to determine the exact value of all variables. You need exactly 20 linearly independent equations to determine the value of 20 variables.
>>
>>54628500
Why would you not want to use cuck=&c+1; instead of strcat(); ? I tried to find what the heck strcat was, but I can't figure out why you would want it.
>>
File: confussed.png (70 KB, 1366x768) Image search: [Google]
confussed.png
70 KB, 1366x768
>>54628748
It works in all my other projects, I don't think you understand my problem. Only in this project does it not work, see pic. Works perfectly fine, but in the other project, it does not work, I want to know why. It has nothing to do with the syntax.
>>
>>54628805
The problem with your approach is that some of the equations may be linearly dependent. You have no way of knowing beforehand is the first 20 eqs are independent. So just make a big matrix with all of them and let the library do its thing like I said here >>54628774
The algorithm is most likely going to find a triangular matrix and discard the useless equations anyway.
>>
>>54628805
Do you know if my question is actually a linear algebra question? Could I figure out my answer in statistics or something like that? I feel like I would want an estimation with a statistics method, but I don't know how to solve my problem. Thanks for taking the time to answer.
>>
>>54628821
You should give up programming.
>>
>>54628821
Probably because your shitty compiler is letting the incorrect function call pass.
I can think of why your code might accidentally work.
>>
File: confussed.png (67 KB, 1366x768) Image search: [Google]
confussed.png
67 KB, 1366x768
>>54628790
No I wasn't using strncat, see >>54628821

i'm not a fucking retard, I just have never encountered this problem before. you can clearly see that is not the answer.
>>
File: 1456900338668.jpg (114 KB, 970x880) Image search: [Google]
1456900338668.jpg
114 KB, 970x880
>>54628821
Congratulations, you're retarded.
>>
>>54628858
Im using gcc like everyone else who uses visual studio so Idk why it would be doing that.
>>
>>54628874
Give up programming brah, it's too hard for you.
>>
>>54628774
Thanks for your reply. I'll try that out. Do you happen to know if my problem could be solved in a different way? Some statistics method or something?
>>
>>54628900
>>54628878
I've never ran into this error and that makes me a retard? This is literally the only thing in my whole program that doesn't work and that makes me a retard? /g/ really doesn't know what the fuck they are talking about
>>
>>54628874
Let me guess, you did something retarded like not save the file?
>>
>>54628874
>>54628928

>i'm not a fucking retard

Yes you are, you can't even read what your compiler is telling you.
>>
>>54628874
And this, Ladybirds and Gentlemen, is why you don't ride the hell ride that is Visual Studio.
>>
>>54625648
Currently a Bash script that changes my IP address every X amount of seconds, and a Python script on a Raspberry Pi to shut down nearby baseball park lights.
>>
File: dumbfuck kill yourself.png (64 KB, 673x584) Image search: [Google]
dumbfuck kill yourself.png
64 KB, 673x584
>>54628936
>>54628928
>>54628874

Here, I made you a pretty picture that shows how retarded you are.

Please go and stay go now, Aaron.
>>
File: confussed.png (86 KB, 1366x768) Image search: [Google]
confussed.png
86 KB, 1366x768
>>54628935
Nope, everything is saved, program runs fine without the strcat, pic related.It dumps usernames and passwords you have saved on google chrome and firefox(had to color out my users and passes
, but once I add strcat to it, it goes to shit
>>
>>54629052
Post log
Try strcar_s
>>
SEND HELP
How do i print a FILE on Qt?
I'm lost somebody send help
>>
>>54629072
>strcat_s
Don't encourage that retardation.
>>
>>54629052
Hi Aaron, why do you need to use strcat at all? Why not just concat with cuck+=c or something?
>>
>>54629104
That's not how C works, idiot.
>>
>>54629110

Using C for this was the first mistake.
>>
>>54629123
>Using C for this was the first mistake.
if I had a nickel for every time I'd heard/said that
>>
>>54629104
lmfao what is this python? it's an array, you can't do that
>>
>>54629110
Is this a meme for these daily programming threads or something? Why the heck would he code this in C?
>>
>>54629123
>Implying that anybody gives a fuck about your opinions
>>
>>54629140
Using a language that treats strings as pointers is so fucking retarded when you're going to do a lot of concatenation and shit.
>>
>>54629148
C is alot easier to do actual programming then something like python, I have to decrepyt shit and that would take a while in an interpreted language
>>
File: 1434930581047.jpg (146 KB, 671x765) Image search: [Google]
1434930581047.jpg
146 KB, 671x765
>>54629167
Using a language that's interpreted is so fucking retarded when you actually care about performance.
>>
>>54629235
If you're having trouble concatenating two strings then it's way too early to care about performance.
>>
Let's play a game: /dpt/ describes its own programming language, one line at a time. It'll be fun.

I'll start the syntax spec:

start ::= block
>>
>>54629258
Just because some VS babby can't concatenate two strings, it doesn't mean that everyone else can't handle strings properly.
>>
>>54629267
block ::= ε
>>
>>54629163

nuh-uh, you're stupid!
>>
>>54629284
ε ::= e
>>
>>54629302
Mate, you can't define the empty string to be something.
That's like defining zero to be one.
>>
>>54629310
it's just a symbol, you can do whatever you want

e ::= identifier | dat<type> boi
>>
>>54629325
>it's just a symbol, you can do whatever you want
In formal computer science, ε has a specific meaning. It's the empty string.
>>
File: looksdontmatter.jpg (224 KB, 595x894) Image search: [Google]
looksdontmatter.jpg
224 KB, 595x894
>>54629073
Please anybody here knows how to achieve this?
>>
>>54629338
and lots of people use lambda instead of epsilon

it's literally just a symbol. it might be unusual, but there's nothing intrinsically incorrect with repurposing it
>>
>>54629310
Since when does epsilon mean empty string?

Normally it just means a small number.
>>
>>54629267
TRUE ::= FALSE
FALSE ::= TRUE
>>
>>54629359
>i have literally never been in a computer science department: the post

don't poo in the street, pajeet
>>
>>54629359
>Since when does epsilon mean empty string?
https://en.wikipedia.org/wiki/Empty_string
Even the wikipedia article uses it.
>Normally it just means a small number.
People reuse symbols in different contexts all of the time.
>>
>>54629267
JUST ::= while
>>
>>54629386
fugg forgot the code tags
>>
Am I allowed to ask for help for my shitty neural network evolution simulator in here?

My bucket collision system is screwing up and I'm pretty sure it's how I'm allocating memory.

Class Bucket
vector of pointers to objects

Class BucketList
//array of pointers to arrays of buckets
//deleted and re allocated every frame
Bucket ** buckets


The general idea here is that the world is separated into a grid of buckets. For each frame the world is run, objects detect collision with these buckets. Buckets colliding with objects store pointers to those objects.
This way, when an object wants to run collision against all the other objects, it need only run against those objects it shares one or more buckets with.


I don't think I'm deleting buckets correctly, I'm not sure how the vectors inside each bucket are supposed to be handled, and I have no idea where class destructors fit into all this.
I tried google and nothing helps.

Here's how I allocate memory for the buckets array

BucketList()
{
//allocate memory for the buckets


int bucketW = 10;//width and height
int bucketH = 10;

cols = screenx / bucketW;
rows = screeny / bucketH;


buckets = new Bucket*[cols+1];
for (int i = 0; i < cols; i++)
{
buckets[i] = new Bucket[rows+1];
for (int j = 0; j < rows; j++)
{
//buckets[i][j] = Bucket();//I don't know if I should use this line
}
}

}


At the beginning of each frame, I want to start the BucketList over fresh, so right now I'm trying to do this to delete it

    void clear()
{
// for (int i = 0; i < cols; i++)
// for(int j = 0; j < rows; j++)
// delete &buckets[i][j];

delete [] buckets;

}


Anytime I do this, the program hits a break at
delete [] buckets;


Maybe I should just empty the bucket vectors

https://youtu.be/zBN3V68wcNs?t=6s
here it is in all its low res low framerate glory
>>
>>54629403
oh yeah, what you're seeing is creatures learning (ideally) to get food
>>
>immutable strings
who in the FUCKING HELL thought this could, ever, be a good idea, and WHY?
>>
>>54629504
Enjoy you're reallocations :^)
>>
>>54629376
Neat :^).

>>54629403
That line you have commented out in your first example is useless because the C++ compiler is going to call that constructor anyway when you create the array.

As for that for loop in clear(), you shouldn't be iterating over the j's and calling delete.

If I'm reading your code correctly the data structure is a pointer to an array of pointers to arrays of buckets. So you should do:
for (int i blah blah blah)
delete [] buckets[i];

delete [] buckets;
Thread replies: 255
Thread images: 41

banner
banner
[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.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.