[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/
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: 30
File: dpt.jpg (51 KB, 604x504) Image search: [Google]
dpt.jpg
51 KB, 604x504
old = >>51392062
What are you working on, /g/?
>>
>>51397656
If you like traps, you're gay
>>
File: ng_lg_clr.gif (78 KB, 156x221) Image search: [Google]
ng_lg_clr.gif
78 KB, 156x221
>>51397680
>mfw this is more readable than Python
>>
>>51397664
trap('INT') { server.shutdown }

oh nooooo
>>
File: fp.png (957 B, 300x168) Image search: [Google]
fp.png
957 B, 300x168
>>51397656
I'm working on a programming language. It's called Valutron.

Valutron is a Lisp. It has two key differences to many other Lisps: it has actual syntax instead of S-expressions all the way down, and I place emphasis on the dynamic Object-Oriented system that is available.

Here is a code example:

// let's define a 'get-hello-world' generic
defgeneric get-hello-world (object some-object) => string;

// let's define a 'hello' class
defclass hello (object)
{
slot string hello : initarg hello:;
slot string world : accessor getWorld, initarg world:;
}

defmethod get-hello-world (hello some-object) => string
{
let result = copy(some-object.hello);
append(to: result, some-object.getWorld);
result
}

let aHello = make-instance (hello: "hello", world: "world");
// the arrow -> is an alternative form of method dispatch syntax
print(stdio, aHello->get-hello-world());


Here's the same expressed in CL with CLOS:

(defgeneric get-hello-world ((some-object object)))

(defclass hello (object)
((hello :initarg :hello)
(world :initarg :world
:accessor getworld)
)

(defmethod get-hello-world ((some-object hello))
(setq result (copy (hello some-object)))
(append :to result (getWorld some-object))
(result)
)

(setq aHello (make-instance 'hello :hello 'hello :world 'world))

(print stdio (get-hello-world aHello))


My other projects include an Objective-C (dialect slightly differs from Apple ObjC) compiler, an IDE for ObjC inspired by the Smalltalk environment, an instant messenger, and more. Feel free to query me on things.
>>
Is Emacs a programming language?
>>
File: 1447638526447.jpg (74 KB, 960x714) Image search: [Google]
1447638526447.jpg
74 KB, 960x714
where do these leggy spurdos keep coming from
>>
>>51397661
even though there aren't a lot of use cases for this sort of function, it looks nice
i'll start writing code like this from now on.
>>
>>51397724
That's not a new language, that's opendylan. Lmao!
>>
>>51397724
>defclass
>defgeneric
>defmethod

why
>>
>>51397772
You defined methods on generics, not on classes. Methods require classes to dispatch on.
>>
File: img000014.png (689 KB, 1046x1500) Image search: [Google]
img000014.png
689 KB, 1046x1500
>>
>>51397656
WHAT THE FUCK YOU FUCKING RETARD STOP POSTING THREADS BEFORE THE OLD ONE HITS THE BUMP LIMIT

THE BUMP LIMIT IS 310

FUCKING REEEEEEEEEEEEEEE

SAGE
>>
why does this loop forever?
    public static String Y(Scanner input){
String X;
while(true){
System.out.println("Input true or false:");
X = input.nextLine().toUpperCase();
if (!X.equals("TRUE") || !X.equals("FALSE")){
System.out.println("Please enter either true or false");
} else{
break;
}
}
return X;
}
>>
>>51397793
>having to put `def` before every defining statement
what is this meme language you're using
>>
>>51397808
because your while loop condition will always be true
>>
>>51397656
Other thread only has 276 replies.
Why is there a new thread?
>>
>>51397808
>why does this loop forever?
>
while(true)


>>>/trash/
>>
>>51397820
>not calling a cat a cat
Who's the meme exactly?
>>
>>51397825
I thought break broke that, thanks
>>
>>51397808
input.nextLine() maybe includes garbage like \n at the end or something
>>
We're only at 264 replies fuck you OP.

get back in here and finish your dpt.
>>51392062
>>
File: 1447303163787.png (15 KB, 917x1186) Image search: [Google]
1447303163787.png
15 KB, 917x1186
>>51397733
>>
>>51397841
>having to explicitly call a cat a cat when everyone in the room can clearly say that it's a cat

I don't give a shit that what you're point at is a cat, I want you to tell me ABOUT the cat. You and I both know that there's a cat there, why bullshit my time with such meaningless filler?
>>
>>51397808
>people replying to this and not seeing the break
SHOULD'VE USED GOTO
>>
>>51397808
>if (!X.equals("TRUE") || !X.equals("FALSE")){
>how do i stop being this retarded
>>
>>51397875
rude???????
>>
>>51397867
this. goto is far more legible
>>
>>51397892
faggot
>>
>>51397892
IDIOT
>>
>>51397867
it's java
>>
>>51397892
KEKOLDRY
U
C
K
L
R
Y
>>
>>51397912
If you knew what the problem was, why didn't you tell him the answer straight away?
>>
>>51397892
https://en.wikipedia.org/wiki/De_Morgan%27s_laws

educate you'reself
>>
>>51397808
Your first problem was using Java. Here's your solution in based C#:
public static String Y() {
String x;
while(true){
System.Console.WriteLine("Input true or false:");
x = System.Console.ReadLine().toUpper();
if((!x == "TRUE") && (!x == "FALSE")){
System.Console.WriteLine("Please enter either true or false");
} else {
break;
}
}
return x;
}
>>
>>51397808
>!X.equals("TRUE") || !X.equals("FALSE")
there is no god
>>
>>51397977
such an original programming language
>>
>>51397977
>using break
>not using the condition built into the while loop
>>
>>51398018
>>51397867
Java doesn't even have a do-while loop, let alone based goto. Lel
>>
>>51397762
It's quite close to OpenDylan in its ideals. But I have my own ideas and plans.

>>51397820
Common Lisp Object System. I inherited its characteristics.
>>
>>51397977
And here's a less retarded way of writing it:
public static string F(){
string str;
while(!(str == "TRUE" || str == "FALSE")){
System.Console.WriteLine("Please enter either true or false.");
str = System.Console.ReadLine().toUpper();
}
return str;
}
>>
>>51398044
seriously?
>>
>>51397731
no its an OS that runs on other OSs
>>
>>51398045
So, are you the fifth language designer?
>>
>>51398044
>Java doesn't even have a do-while loop
yes it does FUCKING RETARD NEWFAG

and java has labeled break/continue, unlike PLEB SHIT TIER python... goto almost never has a valid use case
>>
>>51398048
your solution is not equivalent.
>"Please enter either true or false."
should only come after an invalid entry
>>
>>51398078
Only a newfag would know how to program in Java.

If you don't know when to deviate from structured programming into GOTO heaven, then you will never be a good programmer.
>>
Decent languages to start learning for someone with no experience? And best materials for learning said language? Pls no memes I just want to learn.
>>
>>51398078
>java is so shit that it has to be compared to python in order to look good
BAH
>>
>>51398097
java

https://docs.oracle.com/javase/tutorial/

ABSOLUTELY DO NOT start with python or haskell. no scripting or "functional" languages
>>
>>51398092
I didn't say it was equivelent, I said it was less retarded.
There's no real difference between printing "Input true or false" and "Please enter either true or false" in the beginning. They both get the point across. One is even more polite.
>>
>>51398097
C++
http://www.cplusplus.com/doc/tutorial/
>>
>>51398113
the condescending politeness doesn't come into play until AFTER the user has given an incorrect input you fucking autist
>>
>>51398097
C++
>>
>>51398097
Java is terrible to start out with. It would like learning to read in preschool and the first book you start with is a manual for a lawnmower. Verbose, boring garbage.

Get started with Think Python. (The one with python version 3.)
>>
>>51398142
>Java is terrible to start out with
>use python

Honestly the most accurate part about your post is when you compared Python users to preschoolers.
>>
>>51398142
ok if you have ADD and no real aspirations in life maybe you should start with python
>>
>>51398153
>Honestly the most accurate part about your post is when you compared Python users to preschoolers.
kek
>>
>>51398097
C++
>>
>>51398097
Learn C if you want to learn the common foundation most devs started with

Learn go if you want to actually write something that's performant and readable

Learn Java if you want to be an expert in meaningless Enterprise OOP Bullshitâ„¢ ceremony and slowly slide into irrelevance.

Learn Haskell if you're not a self-conscious imperitard that panics at idea of being exposed as a code monkey that doesn't understand math.
>>
>>51398153
pythontards #BTFO
>>
Looking back at my first programming assignments is painful.
int main()
{
// actual datas
const int MINIMUM_SIZE = 20;
vector<struct customerUnit> customerDB(MINIMUM_SIZE);
for (int i = 0; i < MINIMUM_SIZE; i++)
{
customerDB[i] = {"NEW","NEW",0};
}

int c = 0; // customer page counter
int d = 0; // deletion counter
// manually keeping track of customer count

do
{
switch(menu(c-d))
{
case 1: newEntry(c,customerDB); break;
case 2: viewEntry(c,customerDB); break;
case 3: deleteMode(c,d,customerDB); break;
case 4: reportMode((c-d),customerDB); break;
case 5: return 0; break;
default: continue;
}
} while(1);
}
>>
>>51398191
no bias: the post
>>
>>51398212
How much did google pay you to samefag like that?
>>
>>51397656
SICP, exercise 1.3... Is my code cringe worthy?
(define (xor a b) (or (and a (not b)) (and (not a) b)))
(define (my-and a b) (and a b))
(define (test i j) (> i j))
(define (sq n) (* n n))
(define (find t x y z) (sq (cond (( t (test x y) (test x z)) x) (( t (test y x) (test y z)) y) ( else z))))
(define (sum-of-squares a b c) (+ (find xor a b c) (find my-and a b c)))
(sum-of-squares 3 1 2)
>>
>>51398259
'bout three fiddy, interested?
>>
>>51398292
Very. Want my email?
>>
>>51397800
Alright, what's this from? I can only find korean hits.
>>
>>51398324
please, google already know your mail
>>
>>51398350
Awaiting my shilling job offer :^)
>>
File: sussman shig.jpg (71 KB, 500x375) Image search: [Google]
sussman shig.jpg
71 KB, 500x375
>>51398048
>str not initialized
>not knowing de morgan's laws
>not using do-while
>>
>>51398284
What's the point of sq?
>>
>>51398228
It just werks

>>51398251
No garbage collection at all. To express a structure like a linked list, you need pointers, exactly as they are in C, just with (a lot) more type safety.

When you allocate, you get back both a pointer value and a linear capability "bound" to that specific pointer using dependent types. That capability is also "bound" to a "reference count", which only exists at compile time to make sure that you aren't doing something silly like writing to the same memory from multiple threads without the necessary safety primitives.
new : {a : Set} -> (ptr : Ptr a) & Cap ptr 0
delete : (ptr : Ptr a) -> Cap ptr 0 -> Unit


You can "fork" a capability, which increases the reference count by 1 and gives you back two capabilities for that pointer. "Joining" does the opposite.
fork : Cap ptr n -> Cap ptr (succ n) & Cap ptr (succ n)
join : Cap ptr (succ n) -> Cap ptr (succ n) -> Cap ptr n


You can load from any pointer given the capability to do so, but you can only store to a pointer with a unique capability.
load : (ptr : Ptr a) -> Cap ptr n -> a & Cap ptr n
store : a -> (ptr : Ptr a) -> Cap ptr 0 -> Cap ptr 0


The fact that capabilities are linear, i.e. must be used once and only once, means you can't leak memory, use a pointer after its memory has been freed, introduce memory hazards, etc.
>>
>>51398284
(define (1-3 a b c)
(+ (square (max a b))
(square (max (min a b)
c))))

Or you can compare your code to
http://community.schemewiki.org/?sicp-ex-1.3
>>
File: 1445288964588.jpg (36 KB, 640x480) Image search: [Google]
1445288964588.jpg
36 KB, 640x480
>>51397858
>>
>>51398467
I should note (and this is pretty important, I guess) that all that stuff about capabilities is totally elided at run time. Once compiled, you're just playing with pointers.

Of course, if you are doing some kind of run time reference counting like a shared_ptr, in which case the Cap type is dependent on a reference count not defined at compile time, you obviously need to keep around that count value and do conditionals on it like you would in any other language.
>>
File: 1447782630696.png (19 KB, 640x480) Image search: [Google]
1447782630696.png
19 KB, 640x480
>>
File: 1447802531603.png (627 KB, 1038x1500) Image search: [Google]
1447802531603.png
627 KB, 1038x1500
>>51398334
http://bato.to/comic/_/comics/se-r9011
>>
C++ is retarded, bloaded crap. There shouldn't be a billion redundant ways to do everything.
int a=5; 
int b(3);
int c{2};
>>
>>51398774
First is assignment.
Second is construction.
Third is construction via initialization list.
>>
>>51398774
The first isn't what you want in all situations (implies a copy), and the second has been deprecated by the third. Of course it looks silly when used with a fucking primitive type.
>>
>>51398774
First one allocates an int and sets its value to 5.
Second one allocates an integer object, passing 3 as the argument to the copy-constructor.
Third one creates a single-element int vector with value 2.
>>
>>51398728
Thanks. I'm gonna procrastinate with this.
>>
>>51398823
You're welcome, crotch-loose woman.
>>
>>51398804
int's are primitives not objects u fool
>>
Where do I get started if I want to start playing with graphics?
I only know C.
>>
>>51398873
C++

or alternatively
Win32 + OpenGL
Maybe SDL or GLFW
>>
>>51398909
>win32
>ever
LMAO kid
>>
>>51398873
>I only know C.
dun goofed
>>
>>51398873
C and OpenGL is all you need.
OpenGL is state based and not object based.

It works fine with C.

The C++ kids don't know what they are talking about and are used to use OpenGL wrapper libraries.
>>
>>51398951
>OpenGL is state based and not object based.
>implying this is a good thing at all
>>
>>51398951
>>51398909
I only mentioned C libraries
Besides, I'm literally the only one that mentioned C++
>>
>>51398467
K.. KEEP ME POSTED
>>
File: 1443740640089.jpg (34 KB, 493x533) Image search: [Google]
1443740640089.jpg
34 KB, 493x533
>>51398673


mor

bls :Ddd:Dd:
>>
>>51398975
>>
>>51398951
How is SDL with C?
>>
>>51398993
shit.
put into >>/trash/ it goes
>>
>>51398929
Found Anonymous
>>
>>51398999
>>51399000
>>
>>51398974
I'm past the biggest hurdle, which is figuring out how to properly integrate linear types into dependent type theory (which seems to be a novel contribution). From now on, it's really just the busywork of writing a parser, implementing a suitable elaborator, fleshing out the type checker with things like variable usage counting and totality checking, and working on the LLVM backend, and probably iterating on the type theory itself to improve how it's being represented and manipulated (which I'm never really satisfied with).
>>
>>51399024
Congrats anon, now commit suicide
>>
File: f_g.png (9 KB, 513x285) Image search: [Google]
f_g.png
9 KB, 513x285
>>51398673
>>
>>51398989
Dolan?
>>
File: fugbenis.png (60 KB, 1152x720) Image search: [Google]
fugbenis.png
60 KB, 1152x720
>>
>>51397656
#include <iostream>
using namespace std;
void count(int [], int, int&, int&);

int main()
{
int numpos, numneg;
int* pointer = 0;
cout << "Enter the number of elements: " << endl;
int input;
cin >> input;

pointer = new int[input];

int temp;

for(int i = 0; i < input; i++) {
cout << "Item " << i+1 << endl;
cin >> temp;
*(pointer+i) = temp;

}



count(pointer, input, numpos, numneg);

return 0;
}

void count(int numbers[], int length, int& numpos, int& numneg) {
for(int i = 0; i < length; i++) {
if(numbers[] < 0) {
numneg++;
}
else{numpos++;}


}
}



so I have a dynamically allocated array in my main function, and I want to pass those inputs as a parameter into the function count.

how would I use those inputs in an if, else statement?

like in my program, I want the inputs to be separated into two categories: positive and negative values.
>>
>>51399063
Does it have type inference (Hindley-Milner style) or does it require explicit type annotations? I feel like it would be really difficult to do anything to do with pointers without explicit annotations.
>>
>>51399459
Why would it? The type of dereference(reference(y)) is typeof(y), the type of reference(y) is reference-to-<typeof(y)>. Ezpz.
>>
>>51399486
Don't you have to infer number of references, possibly life times, etc?
>>
>>51399459
Sort of. While you can't infer the full type of a lambda expression when dependent types are involved, you can often infer things like type parameters in polymorphic functions (which are just regular value parameters with dependent typing).
// fully specified identity function
// "-<>" indicates linear usage
id : (n : Level) -> (o : Linearity) -> (a : Set n o) -> a -<> a
id _ _ _ x = x

// what the programmer can get away with writing and using
id : a -<> a
id x = x

A process that runs before the type checker called the "elaborator" is responsible for dealing with this. Languages like Agda and Idris do this, too; it's not a new concept.

>>51399507
What Rust (and others) call a "lifetime" is encoded using capabilities in this language, and you pass those around as you would values. The type checker itself only cares that you're satisfying linearity.

Since I'm going to allow what basically amounts to "inline LLVM" in the language, the whole concept of pointers and their capabilities will be part of the standard library, not the core language itself.
>>
>>51399507
>>51399682
Oh, and reference counting is dealt with since you explicitly have to write "fork" and "join".

I'd like to move away from using the term "reference counting" as that instantly sets off the garbage collection alarm bells in people's heads. I don't have anything better to call it, unfortunately.
>>
How would you approach creating the AI behind a simple game like tic-tac-toe? For user vs cpu, is there a good algorithm for deciding the cpu's moves, or just a lot of if statements and given moves for every situation?
>>
>>51400034
Tic Tac Toe is far too trivial to practice writing AI. Given the current state of the board and nothing else there is always a best move.
>>
what does this mean?

"Create data model for your project. This includes all the entities (tables) you need. Include this model in a text file"

how do i model in a text file...?
>>
>>51400146
ASCII art.
>>
File: 1442729347672.jpg (3 MB, 3504x2336) Image search: [Google]
1442729347672.jpg
3 MB, 3504x2336
I have a file with these contents.
18 19 18.5 13.5 14
16 19.5 20 18 12 18.5
17.5


I have the following code.
    double value;
double sum = 0.0;
int count = 0;

infile >> value;
while (infile.good()) {
++count;
sum += value;
infile >> value;
cout << value << endl;
}
Works mostly fine, but it starts at the 2nd number '19' rather than the first '18'. Any idea why this is?
>>
>>51400201
Probably because that's exactly what you're telling it to do?
>>
>>51400201
++count makes count 1 before it's being accessed.
You probably meant count++.

Also let me once again express my disgust for all things C++.
>>
>>51400201
How come you get 2 (two) slide bars faggot?
>>
>>51400231
likely he forgot the closing slash on the second [code ] block, which then creates two inside each other
>>
>>51400224
That doesn't matter in this case. The difference between c++ and ++c only matters if it's part of a larger expression. When it's a single statement the order doesn't matter.

>>51400213
I don't know what you mean. I just realized the cout was called after i read the next part of data, so I fixed that, but count is still one value off.

>>51400231
>>51400241
>>
>>51397724

>it has actual syntax instead of S-expressions all the way down

Then it's not a Lisp. Homoiconicity is the key defining trait of a Lisp.
>>
>>51400244
You should be counting from zero, not 1.
Put your count incrementer at the end of your loop.
>>
>>51400244
>I don't know what you mean.
Read your fucking code to yourself. Put yourself in the computer's shoes.
>>
>>51400165

srsly what the fuck does he mean?
>>
>>51400268
you have data, yes?
create a method to store/retrieve that data from a text file.
e.g. comma separated values.
>>
>>51400259
>You should be counting from zero, not 1.
But i already read one part of data prior to the loop.
I tried your suggestion anyway and nothing changed.

>>51400267
I'm not a computer. I don't know how they work. I wouldn't be asking here if I wasn't fucking stumped.
>>
>>51400252
We've already tried to tell him this, he just responded with "lol".
>>
>>51400292
>I'm not a computer. I don't know how they work.
he means, imagine if you were a computer processing each line
after each line, write down (manually, if needed) the state of the program
e.g. what the values of the variables are.
you'll figure out the error very quickly if you learn debugging techniques like this
>>
>>51400292
You do one more read than you increment "count". It's right there. I think that anon meant to count from 1 and not 0. Or just don't do the read outside the loop in the first place, it seems pointless to me.
>>
>>51400292
honestly i have no clue what your code does
write it in a more sane language
>>
>>51400289

so there should be code in the text file?
>>
I want more leg spurdos
>>
>>51400318
your question:
>Create data model for your project. This includes all the entities (tables) you need. Include this model in a text file
so you have entities/tables, right?
create a way to represent that data in your program, and also save and load those tables to/from a file.
the file should contain data, not code...
>>
>>51400316
You're right, that doesn't make much sense.
I've revised it to this and it's working now. Thanks to all the anons
do {
infile >> value;
sum += value;
cout << value << endl;
++count;
} while (infile.good());
>>
>>51400334
/int/ has a designated gondola thread all the time now tbqh
>>
>>51400335
>>51400318
actually, on a second look, the wording of "include this model in a text file" is very ambiguous. I'd ask for more info.
>>
>>51400201

Well let's walk through the first iteration of your loop
infile >> value; // value = 18.0
while (infile.good()) {
++count; // count = 1
sum += value; // sum = 18.0
infile >> value; // value = 19
cout << value << endl; // prints "19"
}


Try removing your initial file read and re-ordering the statements in your loop.
>>
>>51400351
>it's working now
but you introduced another bug
try reading a blank file.
>>51400360
dumb tripfag doesn't press update before posting
>>
>>51400367
I've addressed that earlier in the program. That was just a small code snippet.
#include <cstdlib>

if (!infile.is_open()) {
cout << "Failed to open: " << filename << '\n';
exit(EXIT_FAILURE);
}


>>51400360
I like your approach. I should've walked through the program and realized it didn't make sense.
>>
>>51400391
>infile.is_open
that doesn't tell if you if it's EOF.
a blank file will cause your program to crash.
>>
>>51400335

i dont know if we have entities/tables yet.

my app so far lets you add things to a cart but now i need do a login feature so im assuming i need to store the username and password in the db?
>>
>>51400447
yep
so your data model in that case for logins would include two fields, username and password
>>
>>51400471
I just watched this and I think you would all appreciate it.
https://www.youtube.com/watch?v=wASCH_gPnDw
The first part is about clojure and lisps, whatever. But then he goes into how the data structures in the languages are all tries so that structures are immutable whilst retaining near mutable runtime guarantees. Also goes into the concept of reference timelines which are important for implementing lock-free data structures.
>>
>>51400648
>>51400471
Sorry, wasn't supposed to be a quote.
>>
File: 1446486004619.jpg (91 KB, 700x1000) Image search: [Google]
1446486004619.jpg
91 KB, 700x1000
Should I bother trying to learn SDL with C?

The tutorials for it seem to be written with a heavy lean toward idiomatic C++ and the very second tutorial program I wrote segfaults upon exiting.
>>
>>51400733
Anything that actually deals with SDL is directly transferable to C. Just don't expect to learn good ways to write C programs (which is a separate issue) from C++ tutorials.
>>
>>51400471

sounds like i need to make a database with a table in it then. Where does the text file come in?
>>
>>51400750
It's mostly shit like this
HEAP SUMMARY:
==6719== in use at exit: 550,672 bytes in 3,350 blocks
==6719== total heap usage: 13,461 allocs, 97,403 frees, 43,110,516 bytes allocated


All this program does is display a picture for 2 seconds and exit, what the fuck is it even doing?
>>
>>51400775
A lot of that is probably from the SDL internals.

Though I can't see why something that works in C++ would segfault in C if directly "ported".
>>
import std.stdio;

void main()
{
writeln("Good night /dpt/!");
}
>>
>>51400733
If you want to write SDL in C, then the official examples provided at the SDL wiki ( http://wiki.libsdl.org/APIByCategory )already gives you a good idea on how to do it. Just make sure to combine any new knowledge of SDL that you learn with existing knowledge about programming that you have in order to learn well, don't lean too heavily on tutorials and the like.

>>51400775
Make sure you clean up after yourself before you exit. Any allocated resources should be deallocated before you call SDL_Quit().
>>
Is desktop software kill?
>>
>>51400733
Post segfaulting code
>>
>>51400956
Do you want the whole thing or just the part that segfaults?
SDL_Window *gWindow;
SDL_Surface *gScreenSurface;
SDL_Surface *gHelloWorld;
...
void close(void)
{
SDL_FreeSurface(gHelloWorld);
gHelloWorld = NULL;

SDL_FreeSurface(gScreenSurface);
gScreenSurface = NULL;

SDL_DestroyWindow(gWindow);
gWindow = NULL;

SDL_Quit();
}

>>51400892
i'm pretty sure i've free'd every SDL_* whatever pointer I made, yet it still segfaults.
>>
File: load.png (109 KB, 194x269) Image search: [Google]
load.png
109 KB, 194x269
>>51400398
this to be honest family
>>
i've been /kind of/ learning a bit of php when i have the time, mostly just dicking around with some website i use to play a random webm out of a library of them that my friends upload to.

i've had no problem with using rand but until the library gets big enough, duplicate videos are playing pretty often on refresh, so how can i get a refresh to choose a random webm from the array, without showing duplicates until every webm from the array has been shown?

this is what i have right now

<?php
$videos = array('aaa.webm', bbb.webm', 'ccc.webm', ddd.webm', 'eee.webm', 'fff.webm', 'ggg.webm', 'hhh.webm');
$video = $videos[rand(0, count($videos) - 1)];
?>
>>
how the fuck do i do 3d graphics programming without ever having worked with matrices
this shit is too hard
kill me
>>
>>51401067
fucked up while editing out the actual webm names fuck
>>
>>51401072
Learn the math first then.
>>
>>51400231
                                                        
                                                                                                                :^)
>>
>>51401072
Learn about vectors and matrices then, you idiot.
>>
>>51401087
>>51401090
k.
>>
is VS the most idiotic editor ever? I cant even add a html file simply by right clicking and chosing to create a new file. So i went to the original project located on my desk top, added the file there then opened the project back up in VS and its still not showing

i just dont understand
>>
>>51401279
>is thing the stupidest thing ever? I don't understand how to use it so it must be the stupid one
>>
>>51400990
I cant tell from just that snippet why it segfaults.
>>
>>51401313

it should be much simpler to add a file


other editors ive used its so easy
>>
>>51400990
The point of SOGSEGV isn't "you forgot to free something" but rather "you're trying to access sonething you've already freed or never allocated"
>>51401366
Kudos I cant
>>
File: Huntington 1928.png (159 KB, 460x306) Image search: [Google]
Huntington 1928.png
159 KB, 460x306
Hey /g/ where do you keep all your passwords safe?
I have an encrypted file in a USB flashdrive I carry with me, and the same file in my computer.
>>
>>51401460
KeepassX, family member
>>
I code a lot for school, but not enough for pleasure.

How do you motivate yourself to code outside of work / school?
>>
>>51401404
visual studio's projects do not represent the file system
you need to create a file, then add an existing file in VS.
>>
>>51401482
If you don't write code outside of class, you're gonna become a worthless codemonkey with a degree but nothing to show for it.
Enjoy mcdonalds.
>>
>>51399344
Do you realize you're making it much harder on you'reself (and others) by writing this in C anon? If you just used C++ instead, it'd much cleaner and easier to get right.
>>
>>51401528
>c
>uses cout, cin
you're dumb.
>>
>>51401552
streams are of little good if you drown you'reself in pointer mismanagement anon.

It's C, not C++.
>>
>>51401517
thank you desu senpai kek
>>
>>51399344
>dynamically allocated
>no stdlib.h
what are you doing faggot
>>
>>51401517
That's very true. I can never decide on what to write though. I know java, and some python and c.
>>
>>51401592
Find some repetitive task you do multiple times a day and automate it.
Or think of some program you wish existed and go make that.
>>
im thinking about changing careers
ive fucked around with programming for a few years now but never could land that job

in the midst of an internship but the lack of feedback im getting and communication.....i just feel like they wont end up hiring me. I got a few hundred bucks for the internship but this is my last straw with the whole programming thing

anyone in a similar feel?
>>
>>51401619
>I got a few hundred bucks for the internship
Why the fuck do you tards work for pretty much free?
>>
>>51401619
>working an unpaid internship
your resume is pretty much worse off now than if you had just sat around at home eating bonbons and watching anime.
>>
>>51401642
>>51401652

i could not land any full time work, plus they needed help with the project. I don't see the harm. I needed SOME experience. I was desperate
>>
>>51401693
You're doing work for free you fucking kek.
>>
>>51399344
>"using namespace std;"

replace this line with

#include <vector>


and then reimplement your shit using std::vector
>>
>>51401693
>plus they needed help with the project
If you're helping them why aren't they paying you a decent wage?
>>
>>51401719
>>51401739

its common for companies to give you an internship first to see if they want to end up hiring you
>>
>>51401784
>hey retard, do this work for free then I'll just say I didn't feel like hiring you unless you're a fucking genius
No.
>>
File: 1447819146189.png (319 KB, 740x926) Image search: [Google]
1447819146189.png
319 KB, 740x926
>tfw you're too dumb to implement half the things on this pic
>>
>>51401784
Internships are fine.
You should never EVER accept an unpaid internship.
Unless you live nextdoor to their building, you are literally paying money out of pocket to work for them.
How much of a kek do you have to be to work FOR FREEEEEEE
>>
>>51401780
>infile >> value;
>file.write(value);
woooooooooooooooooooow
>>
>>51401807

youre taking out the possibility they might hire you full time

its not like youre busting your ass for free. Its a small amount of money for some bug fixes and tweaks. Relax.
>>
>>51401823
>>51401832
Oh, input file, I'm silly.

while ((line = reader.readLine()) != null) 
{
value = line;
}

Slightly modified off the oracle website.
>>
>>51397656
I am working on a rss torrent downloader in python.
>>
>>51401872
Why would they hire you full time? They've got full time applications which get full time employees for that.
They got you for pretty much free work.
>>
>>51401903

lel

you think i would do this for years and years? the internship is 2 months. Either they hire me or not. If not, Im moving on with some experience. No big deal.
>>
>>51401936
2 months of pretty much free work.
>>
>>51401956

lel

youre acting like internships never happen or thats theyrre so bad

quit whining
>>
>>51401936
You saved the company 2 months salary.
Congrats.
I'm sure they'll show their gratitude while their security guards are escorting you out of their building.
>>
>>51401972
Don't worry anon, I'll support you from now on.
Hey, how about I give you an unpaid internship for being a maid? It's only 2 months so that's nothing to worry about, right?
You'll get great experience in fields such as cleaning a house, cooking food and being a retard. You may even get a full time position afterwards!
>>
>>51401424
Well if that's SOGSEGV than what's SIGSEGV for?
>>
>>51401973
>>51401995

butt hurt detected
>>
>>51402024
Worked for pocket change for 2 months detected.
>>
>>51401995
>tfw you will trick a stupid qt maid boy into cleaning your house for free
>tfw you will never bully him sexually while he does his chores
>>
>>51402047

now i can put some professional experience on my resume detected
>>
>>51402059
Can't put actual projects he's worked on on his resume detected.
>>
>>51402059
I work in HR
We trash all resumes with unpaid internships listed.
The rationale is that you must not be worth jack shit if you couldn't get paid employment anywhere.
>>
>>51401814
only one i'm missing is "Contributed to a FOSS project" (^:
>>
>>51402085

yes i can since i contributed to the app detected
>>
>>51402088

i'll be honest im def not the best programmer out there detected
>>
sbardo zbard
>>
>>51402094
>ok, show us what you contributed
>uh, I fixed like 50 simple bugs over 2 months, none of it's actually my work
>get out
detected.
>>
>>51401739
>If you're helping them why aren't they paying you a decent wage?

It depends on how much "help" this guy is.

Most new grad types have no idea how little they know. I mean, seriously, I've never interviewed one that I would hire. Ever. They're just completely useless.

Personally, I was *years* ahead of my peers, with real-world experience on APIs that were important at the time, because I worked year round putting myself through college, and because I'd already done most of the CS covered in my college courses when I was still in high school.
>>
it was yli tire
>>
>>51402112

you're right for the most part and there are some really tough bugs i cannot fix

detected
>>
>>51398097

Python. Then C if you want to learn fundamentals. Then C# or Java so you have usable professional skills.

Never C++. It's a bloated, confused pile at this point. Actually, it's just started to get good with C++11 and 14, but it's too little, too late.

Go on to functional and whatever else strikes your fancy after getting good with C# or Java.
>>
>>51402122
>It depends on how much "help" this guy is.
If he isn't doing enough to get paid a decent wage he isn't going to be enough "help" next time either.
>>
File: VisualStudio_AddExistingItem.png (7 KB, 654x95) Image search: [Google]
VisualStudio_AddExistingItem.png
7 KB, 654x95
>>51401279
>I cant even add a html file simply by right clicking and chosing to create a new file.

Right click in the project, select Add, then Add Existing Item.

How retarded are you?
>>
File: PMTAppSM001.gif (6 KB, 300x300) Image search: [Google]
PMTAppSM001.gif
6 KB, 300x300
>>51402148

when i was taking c# classes all we did was shit like this

is that good enogh experience to land a job?
>>
>>51402153
>If he isn't doing enough to get paid a decent wage he isn't going to be enough "help" next time either.

Huh? Are you implying that he won't be learning valuable, real-world skills while on his internship?

Look, I agree that all internships should be paid, but the reality is that many aren't. And I can't really blame employers, ever new grad I've interviewed has seemed borderline retarded, but hilariously confident.
>>
>>51402189

for some reason the the option wasnt there under "add". It only showed some azure shit. Idk
>>
>>51402190
>is that good enogh experience to land a job?

If your standards are low enough, maybe.

When I went to college, we had a senior project. You formed a team, went out and found someone in the community who needed a software project, spec'd it out, built it, documented it, and presented it.
>>
>>51402206

Did you right click on the project, or the solution?
>>
>>51402203
If he's learning valuable information and putting it to use then why isn't he being payed?
The only reason is he isn't learning valuable information or putting that information to use, either way he'll probably be in the same situation with the next company (maybe even worse, we don't know if the information was good or not).
>>
>>51402054
underrated post
>>
>>51402260
>If he's learning valuable information and putting it to use then why isn't he being payed?

Because you're paid for already having valuable information that you can put to use.

Chances are he's a net drain on the team. They're making an investment in their shared future. His investment is his time.

>either way he'll probably be in the same situation with the next company

Again, you seem to assume he's not learning anything. Weird.
>>
File: 1418952802479.jpg (29 KB, 669x255) Image search: [Google]
1418952802479.jpg
29 KB, 669x255
I want to make a website, but i'm not sure what language to go with. I've had a bit of experience with making CGI scripts in Perl/Python, but I want to make something while using mySQL in the process for practice. What kind of languages/frameworks are best for this kind of project?
>>
File: 1441017291745.png (38 KB, 275x414) Image search: [Google]
1441017291745.png
38 KB, 275x414
I know how to program in C and I've worked on projects
I know how to program in Java, worked on projects (and fucking hated it)
I know how to script in Javascript, PHP, and Python (many projects)
I know functional programming in Lisp from Uni
Where do I go next?

An object oriented language?
Which one? Absolutely do not suggest C++ please

Another scripting language? Considering Ruby but I actually don't like it at all...plus it's dying

A functional language? Will it actually benefit me learning something like Haskell?

At what point am I not considered a scrub by /dpt/ standards?
>>
>>51402333
>hated Java
>didn't hate Javascript/PHP
Pick up one of the more recent languages, Rust/Go/etc.
>>
>>51401072
>how the fuck do i do 3d graphics programming without ever having worked with matrices
>this shit is too hard
https://handmadehero.org/
https://www.youtube.com/user/handmadeheroarchive/playlists
>>
>>51402333
>Where do I go next?
If you want something even more different you could consider something like Prolog or Coq.
>>
>>51402380
>>51402414
Thanks for the suggestions
>didn't hate Javascript/PHP
No, I absolutely hated PHP but I used those languages for what they were designed for, scripting
>Coq/Prolog
Both look really interesting actually :^)
>Rust/Go
This is where I'll probably go next. Now to decide which one, the one backed by Google or backed by Mozilla
>>
>>51402190
no
>>
>>51402506
I know neither language but from what I've heard Go is shit (but will be usable with android).
Rust is good as long as you don't plan on contributing to them.
>>
>>51402190
>C#
>the language with arguably the best IDE for GUI design for any language
>labels aren't aligned
>buttons aren't centered
>text boxes aren't centered
>>
thinking of learning a new language, whats the differences between C and C++
>>
>>51402637
C++ is old, C is older.
C++ is meant to be C but more.
>>
>>51402333
Learn Lua.
Lua is neat.
>>
>>51402333

Erlang.

Code related. Reading a series of packed structs from C and parsing it in one line.


<<_Version:8, _LeafType:8, _Timestamp:64, _LogType:16,
_ASNLen:24, Cert/binary>> = PemBin2,

>>
>>51402658
>C++ is meant to be C but more.
Anyone who knows anything past C++98/C89 can't possibly believe that.
>>
How would you write a simple Todo List CLI in C?

Curious to see how neat C code can be made
>>
>>51402732
Make a nice data structure.
Maybe write a way to serialise that data structure if you want to.
Add a way for a user to add/remove/query things from the data structure.
The end.
>>
is codecademy shit? I feel like the stuff I'm doing isn't sticking and then when I go too long without working on a course I feel like I've forgotten what I learned before and it's harder to progress
>>
>>51402700
>is meant to be
Can you write anything in C in C++?
Yes?
Then it's C + more, although I guess you could argue it's no longer C + 1, it's more C + 10 or so.
>>
>>51402732
>neat

http://oclint.org/
>>
>>51402813
>Can you write anything in C in C++?
No.
>>
>>51402330
Just go with .net, mate.
>>
>>51402862
the .05% stands strong friend.
>nevar give up, nevar surrendar!1
>>
Hey guys.

I just finished my COSC101 course of programming last month, and really enjoyed it. It was in python, and I got quite high grades. Really would like to do more. It's covered all of the basics, up to pretty much OO and tkinter.

I'm doing a next semester on Algorithims/Data Structures, but that's quite different of course, and although I'll be studying for it I have a big break with nothing to do. I really enjoyed programming and would want to do more, so I'm wondering, where do I progress on the programming side of things?

What should I continue to learn about? Just learnt about generators briefly today, and it makes sense, although I haven't really had anything to practice/do much on. Or do I start learning another language (C is what I'd be interested in.). How should I go about practicing what I've learnt?

Thanks.
>>
>>51403271
Find a need you have and build a program to solve it.
>>
I wrote a 40,000 line program in Python, but I don't like how slow it runs on laptops and potatoes. Is there a program I can use to convert all of the source code to C/C++? I tried Cython and Nuitka, but the source code it outputs isn't really usable - each file is 30k lines and is really hard to edit because of all the temporary variables and other junk.
>>
>>51403397
Why do you have to edit the output?
>>
>>51403426
Because I don't just want to "compile" the Python code, I want to convert it all to C/C++
>>
>>51400224
Pretty sure it comes from C
>>
File: cat_contemplating_suicide.jpg (53 KB, 495x490) Image search: [Google]
cat_contemplating_suicide.jpg
53 KB, 495x490
>vld doesn't work
>AppVerifier only works wrt DLLs, evidently
>DebugDiag refuses to watch process
>C++ Memory Validator only works for 32 bit applications
>Dr. Memory only works for 32 bit applications
><crtdbg.h> just barely works, but requires the use of VS because no external tool wants to jest werk.

I don't even hate Windows, family! I s-swear, it's good!
>>
How the fuck do I find inverse trig functions with pen and paper? Arctan most importantly.

Pls help. Will suck dick.
Thread replies: 255
Thread images: 30

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.