[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: 26
File: secret saika butt fun.jpg (65 KB, 468x577) Image search: [Google]
secret saika butt fun.jpg
65 KB, 468x577
old thread: >>51718146
secret saika butt fun edition!

What are you working on, /g/?
>>
Honestly I don't get why tripfags even exist.
Unless you've done something worthwhile and everyone knows who you are, you're not important enough to have a trip.
So drop it, Ruby.
>>
>>51723004
wrong thread?
>>
File: 1413775162315.webm (3 MB, 1372x756) Image search: [Google]
1413775162315.webm
3 MB, 1372x756
>>
>>51723032
You've been posting this for several years now.
Are you a neet or something?
>>
//Macgif2webm.swift
import Cocoa
import CloudConvert

class ViewController: NSViewController {

override func viewDidLoad() {
super.viewDidLoad()

}

var chosenFileURL = NSURL(fileURLWithPath: "")

//MARK: Import button, pick a file
@IBAction func chooseFile(sender: AnyObject) {

let openPanel = NSOpenPanel()

openPanel.title = "Choose a file"
openPanel.beginWithCompletionHandler({(result:Int) in
if(result == NSFileHandlingPanelOKButton)
{
var fileURL = openPanel.URL!
print(fileURL)
self.chosenFileURL = fileURL
//do something with the selected file. Its url = fileURL
}
})
}


@IBAction func cloudConvert(sender: AnyObject) {
CloudConvert.apiKey = "ki"

let outputURL = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
let inputURL = chosenFileURL

CloudConvert.convert([
"inputformat": "gif",
"outputformat" : "webm",
"input" : "upload",
"file": inputURL,
"download": outputURL
],
progressHandler: { (step, percent, message) -> Void in
print(step! + " " + percent!.description + "%: " + message!)
},
completionHandler: { (path, error) -> Void in
if(error != nil) {
print("failed: " + error!.description)
} else {
print("done! output file saved to: " + path!.description)
}
})
}

override var representedObject: AnyObject? {
didSet {

}
}


}

1/2
>>
File: chicken hug.webm (618 KB, 320x320) Image search: [Google]
chicken hug.webm
618 KB, 320x320
>>51723110
failed: Error Domain=NSCocoaErrorDomain Code=516 "“CFNetworkDownload_K6mnki.tmp” couldn’t be moved to “anon” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/var/folders/wf/64srckbs1dlbs30tzd8zwjfh0000gn/T/CFNetworkDownload_K6mnki.tmp, NSUserStringVariant=(
Move
), NSDestinationFilePath=/Users/anon/Documents, NSFilePath=/var/folders/wf/64srckbs1dlbs30tzd8zwjfh0000gn/T/CFNetworkDownload_K6mnki.tmp, NSUnderlyingError=0x60000005c2f0 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}

the upload, conversion, and download work perfectly. but the saving of the file throws the error above.
what's going on? the file doesn't already exist.
>>
>>51723125
As I'm becoming more familiar with Alamofire, an underlying HTTP request library, I understand that I need check for and delete a file something like this
//https://stackoverflow.com/questions/27301966/allow-to-overwrite-file-using-alamofire 
//Before return-ing finalPath, check for and remove any existing file at that path using NSFileManager.

if NSFileManager.defaultManager().fileExistsAtPath(finalPath) {
NSFileManager.defaultManager().removeItemAtPath(finalPath, error: nil)
}


but how do i implement that solution in my code?
>>
network analysis/visualisation tool for some data i have

i have to revise java first cause my sack of shit neckbeard teacher taught us horribly
>>
>>51722977

Two threads? Well, I guess it's better than having a code of conduct...

>>51723004

We exist to troll people like you.
>>
>>51723230
>we

the other tripfags on /g/ hate you
>>
>>51723247

Lies.
>>
>>51723175
>using Alamofire
Pray tell, what was keeping you from using NSURLSession?
>>
D
>>
>>51723230
>>51723302
Samefag.
>>
>>51723405

https://www.youtube.com/watch?v=S0K63RYrlXc
>>
>>51723349
>i don't know how to fix your problem
is that what you meant?

anyway, the CloudConvert library uses it as a backend. I just did some digging and found out it uses it. I'm not a good enough programmer to write all that shit out myself
>>
>>51723471
I'm just saying NSURLSession is easier IMO.

Have you made sure you're adding the new name of the file to your path
>>
Good Python resources? I've finished codeacademy and I'm looking to learn more. Any suggestions
>>
Made a widget for Übersicht on OS X today to display iTunes track info in that sweet solarized style.

global aname, tname, alname, is_paused, is_running


on appCheck()
set apps to {"iTunes"}
set is_running to false
tell application "System Events" to set state to (name of processes) contains "iTunes"
if state is true then
using terms from application "iTunes"
tell application "iTunes" to if player state is playing then set is_running to true
tell application "iTunes" to if player state is paused then set is_running to true
tell application "iTunes" to if player state is not paused then set is_paused to false
tell application "iTunes" to if player state is paused then set is_paused to true
end using terms from
end if

if is_running is true then
return true
else
return false
end if

end appCheck

set musicapp to my appCheck()

try
if musicapp is true then
tell application "iTunes"
set {tname, aname, alname, tduration} to {name, artist, album, duration} of current track
set tpos to player position
end tell

if is_paused is true then
return "⏯ = lifestyle.pop()" & " ~ " & tname & " != " & " ~ " & "lifestyle = ['sex', 'drugs', 'rock & roll']" & " ~ " & tduration & " ~ " & tpos
else

return aname & " ~ " & tname & " ~ " & alname & " ~ " & tduration & " ~ " & tpos

end if

else
return "Nothing playing" & " ~ " & "" & " ~ " & "" & " ~ " & "" & " ~ " & ""
end if

on error e
return "SolTunes doesn't work with streaming yet" & " ~ " & e & " ~ " & "Check README.md or github.com/yohnnyjoe" & " ~ " & "" & " ~ " & ""

end try


Then there's a coffee script file with some css that displays pic related (when paused, looks diff when playing)
>>
>>51723530
Particularly about modules. I'm trying to build a simple keylogger, but I'm stuck on importing modules. How hard is it to make your own module?
>>
>>51723498
i'm using NSFileManager to set the output path to the user's documents directory. i looked at the documentation but didn't see a way to specify the file. did i not look hard enough?

am i actually supposed to do this with NSURL?
>>
>>51723530
a book
>>
File: 1448231697956.jpg (58 KB, 500x581) Image search: [Google]
1448231697956.jpg
58 KB, 500x581
>>51722977
She looks so cute :3
>>
you so mediocre
>>
>>51723576
I know that. I'm looking for titles. What did you read that was very helpful and worth your money
>>
File: RoCGc1v.png (210 KB, 1590x1080) Image search: [Google]
RoCGc1v.png
210 KB, 1590x1080
>>51723569
This is some code where I use NSFileManager to save a file.
>>
>>51723635
i never read anything on python
>>
File: cheats.png (3 MB, 1604x809) Image search: [Google]
cheats.png
3 MB, 1604x809
im having second thoughts about creating this, but cheat now works atleast
>>
>>51723700
reported to VAC, Fannik
>>
>>51723056
>1413775162315.webm
might just be someone else reposting it for the lulz. but i think the dev does post from time to time
>>
>>51723700
How do you know you won't get vacced?
>>
> debug mode
22% cpu usage

> release mode
36% cpu usage


Thanks Microsoft!
>>
>>51723032

Delphi 7 literally costs $4000 and has almost 10% of the features of Java, Python and C#

Why even exist.
>>
File: 25.jpg (334 KB, 1247x814) Image search: [Google]
25.jpg
334 KB, 1247x814
What's the perfect programming language?

In terms of aspect, usability, elegance, performance, everything.
>>
>>51723700
Only recently started learning programming, but it kind of interests me how does this hack work. Like where do you take the info where the players are situated?
>>
>>51723790
The one that you create yourself.
>>
>>51723032
Is there a github or anything for this?
I'd like to see how it's implemented
>>
>>51723790
Lua
>>
another thread? dafuq?

>>51723765
kek

>>51723790
perfect? none, the best? Go
>>
>>51723591
>she
>>
>>51723906
fuck off kek
>>
>>51723790
> What's the perfect programming language?
No such thing.

For a start, capability and simplicity tend to be mutually exclusive. As do efficiency and simplicity.
>>
>>51723700
If you are still here, lemme give you a hint: draw a glow around them to create a different type of wallhack. It should be relatively easy and non-VAC detectable.
>>
Why does everybody make a fuss out of certain type theories being undecidable, when all that really means is the type inference isn't complete? Even in a dependent type theory, you should still be able to infer the types of most functions.
>>
void closeBinaryFileRead(BFILE* f)
//This function closes file f. Once it is closed, you cannot read from it again.

can i just reopen it and read from it again?
>>
>>51724021
yeah, you'd be creating a new BFILE pointer to play with.
>>
>>51724021
>>51724021
forgot definition
void closeBinaryFileWrite(BFILE*& f)
{
if(f != NULL)
{
fclose(f->file);
delete f;
f = NULL;
}
}


and this is the opener function

BFILE* openBinaryFileRead(const char* filename)
{
FILE* f = fopen(filename, "r");
if(f == NULL) return NULL;
else return new BFILE(f);
}
>>
>>51723700
please tell me how did you managed to bypass vac please :(
>>
>>51723914
lol the character is *literally* a boy
>>
>>51724045
ty
>>
>>51723644
thanks that looks like it could work, if i could somehow integrate it into the completion handler. when i try, i'm missing the file argument though
>>
everyone report OP for being a subhuman
>>
>>51723790
java for usability and elegance
C++ for performance and versatility
>>
>>51722977
So the purpose of a string of questions I have is to try and do things without using functions that make it easier. (IE, mainly using for loops, if statements, etc. Nothing that automates the whole process. Just basic shit)

So I'm attempting to create a vector of random but unique integers.

Only logical way I can think to do this without using a randperm function of some sort is to just generate a random integer, add it to the vector, then check to make sure that nowhere else in the vector had that value.

Any more efficient algorithm, keeping in mind I basically have to do this as "barebones" as possible?

The actual end goal is just to create an anagram of a vector but once I can randomize the order, it's no trouble.
>>
>>51724104
>java
>elegance
lol.
>>
>>51724130
niceme.me
>>
>>51724114
i can understand trying to learn how to implement them yourself
but don't punish yourself by omitting loops and conditional logic, how else are you gonna do it?
>>
>>51723741
i dont, but its highly unlikely
basically the cheat runs in an external process instead of injecting shit into the game process like most other cheats do, this makes it harder to detect
and on top of that i have written a custom driver that stops any and all processes in the entire OS from trying to obtain a handle to my cheat process

>>51723800
its all from the memory of the process, get good with a reverser/cheat engine and look up ReadProcessMemory in the windows api

>>51723932
it would be just as detectable, just a shitton more work
though i guess it looks a little prettier
>>
>>51724133
He's not wrong
>>
>>51724133
Java being bad is a meme.
Java being inelegant is not a meme.
If java was elegant it would be c#
>>
>>51724142
how is java not elegant? do you even know what elegance means? which language is more elegant than java?
>>
>>51724104
>java
>elegance
Object object1 = new Object();
Object object2 = new Object();
if (object1.isequal(object2))
foo();

beautiful
>>
>>51724157
>elegance = syntax
you just went full retard
>>
>>51724155
EPI CUFKCING MEME FUCKING SHIT TARD
>>51724157
yes everything abides by simple and consistent rules and anyone can read any java code base
>>
>>51724176
Are you implying java is symantically elegant?
>>
>>51724202
it is
>>
>>51724114
>>
>>51724049
your professor is a nigger
>>
>>51724139
When creating a CSGO hack, how do you access stuff like g_pDrawManager, pLocalBaseEntity, etc? (internal game stuff)
>>
>>51723591
anime is so degenerate, I can't wait till it's banned.
>>
what'll happen if i try to use this to write something with less than 8 bits?

/***********************************************
* writeByte *
***********************************************
* Write one byte (8 bits) holding b into open *
* file f. It is requied that 0 <= b <= 255. *
***********************************************/

void writeByte(BFILE* f, int b)
{
int r = b;
if(r < 0) r = r + 256;
for(int i = 0; i < 8; i++)
{
putc((r >> 7) + '0', f->file);
r = (r << 1) & 0xFF;
}
}
>>
>>51724156
>which language is more elegant than java?
C#
F#
Python is in terms of syntax

Java is the most verbose language is popular use. You have to type more code to solve the same problems than in any other popular programming language.
>>
How do you come up with the name of a project?
>>
>>51724261
>terseness == elegance
ok shit tard

>Python is in terms of syntax
not even
>>
>>51724156
C#
java:
Object ob = new Object();
ob.setThing(5);
ob.setOther(10);
try(ClassImplementingAutoCloseable obj = new ClassImplementingAutoCloseable()){
//do stuff in scope
}catch(SomeException e){
e.aids();
}
BigInteger bi = new BigInteger("5")
bi.add(new BigInteger("5);

c#
Object ob = new Object{
thing = 5, other = 10,
}
using (var session = new Session())
{
//do things
}
var bi = new BigInteger(5);
bi += 5;

Java is not elegant
>>
>>51724275
>terseness == elegance
Of course. That's like, almost the definition mate. Brevity is the soul of wit.

What's elegance to you?
>>
>>51724280
>implicit types
>overloaded operators
>contrived example with retarded setters
>implying there is anything wrong with try-with-resources with explicit exception handling
retard
>>
>>51724157
>if (object1.isequal(object2))

There’s a method to his madness.
>>
>>51724307
>comic books are more elegant than a well-written novel
RETARD RETARD RETARD I HOPE YOU DIE IN A FIRE LITERALLY FUCK OFF AND DIE
>>
>>51724242
i dont access internal objects and classes directly, i just reverse engineer the memory layout of any structure im interested in (BaseEntity etc) and then use external api calls to read those structures from the target game into my own process, where i can use the information to draw and update stuff as needed
basically my process is an invisible window that places itself ontop of the game window and then i simply use the information gathered from the other process to draw stuff onto my window using directx
>>
>>51724326
>implicit types
>overloaded operators
those are good things anon. If you ever tried them you'd know.

>contrived example with retarded setters
That's typical code for setter m8.
>>
if I want to do assembly programming and reverse engineer drivers/firmware stuff, what engineering should I go into?
>>
>>51724361
retard
>>
>>51724273
Anime
>>
>>51724366
computer engineering
isn't that obvious?
>>
>>51724372
I don't watch anime anymore.
>>
>>51724366
none. you will not learn much about reverse engineering in college
>>
>>51724377
what would someone with an EE degree do?
>>
>>51724391
maybe you should start then
>>
>>51724135
Well it isn't like i'm not allowed to loops. I just mean I can't use functions that will do the logic for me. Make sense?

Like I can't just use "randperm" or something. Dig?

So yeah, the solution I was gonna use was generate a number, check if it has been genned yet, and if not, gen another one until getting a unique, and doing that until I have a vector of 10 unqiue integers in a loop.
>>
>>51724326
>implicit types
The type it holds is on the other side of the equality. It's great if object has a long name, or could be one of multiple types (like a Collection, List, or Dictionary).
>overloaded operators
Done completely sanely, there's no confusion to what's happening. In fact, it's exactly the what operator overloading exists to do. Make mathematical operations on non primitves more elegant.
>contrived example with retarded setters
It's the only way to do setters in java. You can't use a public field if you need to do validation.
>implying there is anything wrong with try-with-resources with explicit exception handling
There's not, it's just inelegant by comparison.
>>
>>51724348
In this case though I would like to read shorter source code
>>
>>51724371
>I can't defend my meme opinion
>if I say all examples are stupid and all who disagree with me are retards they might forget that I'm completely wrong and I won't have to backup my claims.
>>
>>51724394
this. from what I've heard, some of the best REers didn't even study something related to computers
>>
>>51724399
circuits and shit
>>
>>51724421
then write your own randperm
there's no need to sacrifice readability just to avoid stdlib functions
>>
so I have been playing around, and looking at the lua stack

when I check the stack after I add my three entities, I just see

userdata userdata userdata


when I check the stack after I try calling a function that should be in them (it gets them from a prototype), I see

userdata userdata userdata table 'attempt to call a nil value' table 'attempt to call a nil value' table 'attempt to call a nil value' 


this is how I learn m8, so it would be cool if any of you here tell me whats going on, here is the "relevant" code

typedef struct
{
int prototype;
boolean used;
} entity;

void loadEntityPrototype(lua_State *vm, int prototype, const char *path) {
if(luaL_dofile(vm, path)) {
printf(lua_tostring(vm, -1));
}
lua_pushnumber(vm, prototype);
lua_getglobal(vm, "prototype");
lua_settable(vm, LUA_REGISTRYINDEX);
}

void g_ENT_add ( int prototype )
{
int entity = highest_used_entity;

g_ENT[ entity ].prototype = prototype;

lua_pushlightuserdata(LS, g_ENT + entity);
lua_pushnumber(LS, prototype);
lua_gettable(LS, LUA_REGISTRYINDEX);
lua_pushstring(LS, "new");
lua_gettable(LS, -1);
lua_pcall(LS, 0, 1, 0);
lua_settable(LS, LUA_REGISTRYINDEX);

g_ENT[ entity ].used = true;

highest_used_entity++;
}

void g_ENT_updateall (void)
{
int i;

for ( i=0; i<highest_used_entity; ++i )
{
if ( g_ENT[i].used == false )
continue;
lua_pushnumber(LS, g_ENT[i].prototype);
lua_gettable(LS, LUA_REGISTRYINDEX);
lua_pushstring(LS, "update");
lua_gettable(LS, -1);
lua_pushlightuserdata(LS, g_ENT + i);
lua_gettable(LS, LUA_REGISTRYINDEX);
lua_pcall(LS, 1, 0, 0);
}
}


is it simply where I am checking on the stack that is wrong?
>>
Im making a quiz using windows form on visual studio and im trying to make a method for a timer and when the correct answer is chosen. The form called "question1" has a picture box called "correct answer". Iv set correct answer to hide when the form loads but I want to show it when the right answer is shown. My question is how do I show "correct answer" from my method? Whenever I type correct answer.show () obviously it doesn't work
>>
>javashill still hasn't explained what he thinks elegance means and give and example of it
>>
What would you call a class/struct that just holds a bunch of related stuff? Particularly, SDL's SDL_Renderer*, SDL_Window*, the KeyboardState, MouseState, etc etc. I want to put all of it in one spot, but I can't for the life of me come up with what it should be named.
>>
in c++ with <string>, can i do

myString[spot] == '0'

to test if the character at spot is 0? or would i have to create a new string containing 0 beforehand and test it against that?
>>
>>51724451
>lua_gettable(LS, -1);
Supposed to be -2, because the index "new" is on top of the stack (-1) and the table is just underneath it (-2).
>>
>>51724502
Nope, you can do that, you're good.
>>
>>51724488
CodeSmellSingleton
>>
>>51724529
ty
>>
>>51724371
Go on anon. tell me why
function int add(int int1, int int2) {
return int1 + int2
}

is better than
let add = fun a b -> a + b
>>
>>51724425
>implicit types
will be fun when the type of the right side changes, making the "var" incompatible with other things
>overloaded operators
if you ever see += in java code you will instantly know that it's either a primitive or a string. can't say the same about C#
>contrived example with retarded setters
Object obj1 = new Object(5, 10);
Object obj1 = new Object(5, 10);
Object obj2 = new Object() {
Object init() {
thing = 5;
other = 10;
return this;
}
}.init();
>>
>>51724437
stick to your 100 LOC python shit "projects" stupid kid
>>
>>51724511
there we go, I changed all those instances to -2, I put a print function inside the update function of the prototype, and those printed

I checked the stack again and got (shortened down for redundancy):

... userdata table './objTest.lua:13: attempt to index a nil value (local 'self')' ...


with line 13 being

self.foo = self.foo + 10


so is that just another stack issue?
>>
>>51724582
I don't use Python though
>>
>>51724569
how is it not better lmfao tard
>>
>>51724569
How about
Object operator+(const Object& lhs, const Object&rhs) {
Object thing;
// add things etc
return thing;
}

//...
Object o1, o2, o3;
//...
o3 = o1 + o2;
>>
>>51724280
Also c# has:
structs,
pointers,
reference parameters,
real generics,
generic primitives,
linq,
runtime dynamic types(not sure why you'd use them, personally, maybe for web dev)
Decimal types
datetime as a value type,
various null operators (null coalecing, null conditional)

The most useful one for elegance in my opinion is linq. It's the best way to work with complex datatypes or markup files.

Java 8 did introduce something like linq with streams but it's definitely not as elegantly implemented in my opinion.
>>
>>51724570
>if you ever see += in java code you will instantly know that it's either a primitive or a string
How exactly is this helpful?
>>
>>51724449
Er sorry I don't think I articulated my post well enough.

I am writing my own rand perm function. I just don't know if the algorithm I'm using is the most efficient way.

>create empty vector
>randomize a number
>check if the number has been used in any of the other indicies
>if yes, add it and move to next location, otherwise randomize a new number
>repeat until at the end

Is that the best way to do it without introducing any specific libraries?
>>
>>51724569
It works only with int so it is faster
>>
>>51724612
it's more readable you shit tard. all operators do what you expect them to. for other operations, use methods.
>>
>>51724590
Do the same thing to the table lookup in the update function.

But please, please, try to understand how the Lua API works. I don't want to baby you through this entire process.
>>
I have a question about shading. How do I make separate calls to the shader without my models just drawing in that order. Depth is enabled and all that shit but it's not much use if they are still just explicitly being drawn in the order I call them on top of each other.
>>
>>51724632
What if I know that I and my team have the brain cells to not misuse operator overloading?

In any case, what's the difference between + doing something that isn't addition, and add() doing something that isn't addition? Java doesn't protect you against the latter.
>>
>>51724610
>Also c# has:
>structs,
>pointers,
>reference parameters,
>real generics,
>generic primitives,
>linq,
>runtime dynamic types(not sure why you'd use them, personally, maybe for web dev)
>Decimal types
>datetime as a value type,
>various null operators (null coalecing, null conditional)
>linq

>more redundant features == more elegant
lol wut
>>
>>51724570
>will be fun when the type of the right side changes, making the "var" incompatible with other things
What's wrong with the right side changing? Take your time. Think this one out.
>in java code you will instantly know that it's either a primitive or a string
Wow, that's really useful because... mmm
well.. it's definitely worth writing code like this for
bigInt1.add(bigInt2)

instead of
bigInt1 + bigInt2
>>
>>51724602
shorter, more readable and says everything the first example says with more code needed.
>>
>>51724658
RETARDDDDDDDDDDDDDDDDDDDDDDDDD

with a method call you know that it could do something more than a simple binary operation. with an operator you know that it does not do anything more than a simple binary operation, if you don't have operator overloading.

how is having both add() and a "+" that could do anything more elegant than reserving "+" for "+" and having add() for other things?
>>
>>51724692
You are one dedicated, master baiter. I'll give you that.
>>
>>51724681
>less code == more elegant
>doesn't even specify types
ok tard
>>
>>51724570
>making the "var" incompatible with other things
var is static you idiot. Once it's assigned to a type it can't be reassigned to another. You can do that with dynamic, though I've never seen it used.
>if you ever see += in java code you will instantly know that it's either a primitive or a string. can't say the same about C#
What's your point? How is that superior? You still don't know what the type is. I'd rather look at bignum1 + bignum2 than bignum.add(bignum2). It's vastly easier to read. If it doesnt make sense to overload you don't have to.
>comparing constructors to setters
Idiot. What if I don't want to initialize all fields yet. That's literally the purpose of a setter.
>>
>>51724635
I changed every instance of gettable to
lua_gettable(LS, -2);
, that's what you mean, right?

I've read the LUA documentation over and over again, it's very confusing. Something like SDL2 or SFML or expat, not that confusing.
>>
>>51724692
What if I was to tell you that an operator is just a function/method call with different syntax?

>with an operator you know that it does not do anything more than a simple binary operation
>implying concatenation of strings is at all a simple operation
>>
>>51724666
>>51724703
holy shit how can you be this fucking retarded

i will not waste more time on you
>>
>>51724711
>doesn't even specify types
precisely, I don't have to. Good languages have type inference. All the benefits of static typing with none of the verbosity.
>>
>>51724662
>options to have shorter, more readable code == redundant features == inelegant.
Are you trolling?
>>
>>51724712
FUCKING RETARD KILL YOURSELF

var tard = FUCKINGTARD();
FUCKOFF(tard);


if the return type of FUCKINGTARD() changes, tard will become something else, and FUCKOFF(tard) might not work
>>
>Javafags will prefer System.out.println over something like printf
>>
>>51724692
An operator is just a function
>>
>>51724718
I KNOW THAT YOU FUCKING REEEEEEEEEEEEEEEETARD

THAT'S WHY IT IS MORE ELEGANT TO NOT OVERLOAD OPERATORS BECAUSE YOU CAN STILL USE METHODS FOR EVERYTHING ELSE. MORE REDUNDANT FEATURES DOESN'T MEAN THAT YOUR SHIT IS MORE ELEGANT. FUCKING RETARD
>>
>>51724488
I'll just name it SDL lmao
maybe SDLInterface
eh
>>
File: 5218257_37ca039a8d.jpg (10 KB, 150x217) Image search: [Google]
5218257_37ca039a8d.jpg
10 KB, 150x217
>>51724773
>mad
>>
>>51724751
>and FUCKOFF(tard) might not work
which is good.
If you write
Tard tard = FUCKINGTARD();
FUCKOFF(tard);

and the type FUCKINGTARD() returns changes, it won't work either. So what's the fucking difference?
>>
>>51724782
>literally retarded
>>
>>51724714
Can you post the actual Lua script again? It could just be a problem with that.
>>
File: dan.jpg (42 KB, 270x270) Image search: [Google]
dan.jpg
42 KB, 270x270
>>51724789
>literally mad
>>
>>51724751
As opposed to
Moron you = RETARD();
fuckoff(you)

Because that certainly wouldn't break if RETARD() returned Idiot instead of Retard in java.
In both cases you get a simple compile time error you idiot.
>>
>>51724802
>sub-100 IQ normie pleb
>>
File: 1448411765698.jpg (61 KB, 433x419) Image search: [Google]
1448411765698.jpg
61 KB, 433x419
JAVAFAGS
BLOWN
THE
FUCK
OUT
>>
>>51724812
>still can't say anything to backup his claim
>just calls people retards
Do you enjoy being ignorant?
>>
>>51724809
with "var" you have no information preserved of what it was supposed to be. var you = RETARD() will not give an error in and of itself. Moron you = RETARD() will give a compile time error.
>>
>>51724790
prototype = {
new = function()
return {
name = "Sample",
foo = 0
}
end,

update = function(self)
self.foo = self.foo + 10
end,

draw = function(self)

end,
}
>>
File: download (1).jpg (5 KB, 290x174) Image search: [Google]
download (1).jpg
5 KB, 290x174
>>51724812
There's no need to get so upset over getting btfo.
>>
>>51724818
>>51724832
lel good luck in life if this is what you actually believe, you're gonna need it
>>
>>51724841
I have seen this so many times. How long is this going to take you?
>>
>>51724836
fuckoff(tard) will throw a compilation error if the type returned from retard() changes you fucking idiot. That was basicallly your point to begin with yet somehow you cannot grasp that the result would be identical in both java and c#.
>>
>>51724855
was not OP, but paying attention to you two, you said

>Can you post the actual Lua script again?

his is probably not-vanilla
>>
>>51724851
At least they can actually articulate what they believe. You seem only capable of articulating what oracle wrote on a script for you
>>
>>51724836
but
fuckoff(you)

will give you an error. So what's the problem exactly?
If you get the error at
Moron you = RETARD();
Then you will always end up changing Moron to the new type anyways, so why not just use var and have it change automatically? What's the advantage?
>>
>>51724836
>I don't know what the "var" keyword does

>>51724896
I'm not him.

>>51724841
Okay, well, the Lua is fine. I'd first check to make sure that you're getting a non-nil value when calling the "new" function, then seeing if the registry lookup to get the entity's table is working. Because somewhere along the line the entity table is being turned into nil.

I'm beginning to regret spoonfeeding you. Just FYI. I really hope that you figure this out for yourself at some point because I'm getting kinda tired of debugging code that I can't even run myself.
>>
>>51724887
if fuckoff() takes a parent type and var changes to a different sub type it won't give a compilation error.
>>
>>51724903
k tard

>>51724904
see >>51724913
>>
>>51724913
Which is fine. Why the fuck do you think that's a problem?
>>
Quality thread guys. By the way Java isn't good.
>>
>>51724904
I think he thinks var is dynamic. Despite being told otherwise about 5 times.
He's either a master troll or the single dumbest person on this board.
>>51724913
That's still true in Java you dumb fuck.
>>
>>51724970
>>51724982
no, if you have Tard tard = FUCKINGTARD();
and the return type of FUCKINGTARD changes to Moron (a different sub type) it will give a compile time error.
>>
>>51725010
Except you'd just be turning it into "Moron" anyways. Using "var" saves you the trouble.
>>
>>51725010
And why is that useful if the only thing you do with tard is pass it to a method that accepts a Moron?
>>
>bet you can't do this with C#
>*solves problem that only Java has*
>see Java is superior
>>
>>51725029
>>51725032
Tard and Moron could behave differently. if the distinction didn't matter you would have written Idiot tard = FUCKINGTARD(); in the first place.
>>
>>51724790
>>51724912
someone posted it already, but I have some (minor) changes

-- test object

prototype = {
new = function()
print("new entity")
return {
name = "Sample",
foo = 0
}
end,

update = function(self)
self.foo = self.foo + 10
print(self.foo)
end,

draw = function(self)
--todo: add drawing function
end,
}


it prints "new entity" when called, so perhaps the return {} is not working correctly. i'll play around with that some.

>spoonfeeding

You're not spoonfeeding me, spoonfeeding is where I ask for a finished product without going through the steps to get there.

You don't spoonfeed someone by telling them that their rgb parade needs to stretch out between the values 0-100, you teach them how to do it.
>>
>>51725010
The method signature for fuckoff is
public void fuckoff(Idiot id);

If var takes type Moron, the program will fail to compile at fuckoff(tard).
How is this hard to comprehend. It's literally exactly the same, c# just reads and writes more elegantly
>>
>>51725052
Then why the fuck would you be changing the return type of FUCKINGTARD() if you didn't want it to be different?

>>51725065
>You're not spoonfeeding me, spoonfeeding is where I ask for a finished product without going through the steps to get there.
Oh, I'm not, am I? I believe I've pretty much gotten you through every hiccup you've had, you've made zero progress without my intervention.
>>
>>51725052
>Tard and Moron could behave differently.
and? They'll behave properly where they are used. That's the whole point of polymorphism.

If you have a variable of type Dog and pass it to a function that accepts Mammal, and you are worried about it misbehaving because that function was only meant to work right with Cat, then you have bigger problems in your code.
>>
>>51725073
no it won't fail if Idiot is a parent class of Moron. in java you would specify Tard because you don't want it to be a Moron, and if FUCKINGTARD changes to a Moron you will get an error if you have specified Tard, but not if you just wrote var or Idiot.
>>
>>51725090
>>51725101
RETARDS SERIOUSLY FUCKING DIE

>THIS IS WHAT C# NORMIES ACTUALLY BELIEVE

i will stop wasting my time on you thank you. i'm not here to educate fools that don't want to be educated.
>>
the differences between
C, C++, C++14, C#, D
?
>>
>>51725052
>Tard and Moron could behave differently.
How does the java way prevent this?
if you change
Moron tard = retard()
to
Idiot tard = retard()
and don't change FUCKOFF() to account for this, you're going to get the exact same behavioral error.
If there's any chance var could cause that problem(which is a sign your program is shit to begin with, quite frankly) you're welcome not to use it, and if for some stupid fucking reason FUCKOFF takes the parent class of moron and idiot, then you still have the fundemental problem, and you've got some fucking awful code. If your function takes a parent class, and could break depending on the child class it's given, that's indicative of shitty code, and is one of the reasons things like typeof() exist.
>>
>>51725150
One of them is good, the others are shit.
>>
>>51725133
I can tell you've spent too much time with Java because you're OBJECTively wrong, yet refuse to admit it.

Your entire argument is based around
>var is shit because I made a function that can accept multiple classes, but only actually knows how to use one of them and never checks if it's the right one
>>
if i got an

if(thing=blah){}
else if(fuckshitup){}
else(...){}


if something triggers the if, will it check the elseif condition? i want to be able to make the function recursive but i can't do that if i call fuckshitup when thing is blah because it'll mess it up
>>
>>51725150
C is a primitive old school language
C++ is similar to C but has many more features
C++14 is one of the more recent versions of C++
C# is a crappy java knockoff made by microsoft
D is an obscure meme language
>>
>>51725201
>I made a function that can accept multiple classes, but only actually knows how to use one of them and never checks if it's the right one
>java programmer
Sounds about right.
Lol. The more I think about the more it dawns on me how stupid your argument is. I hope I never have to read code you've written(if you ever even have)
>>
>>51725221
>superior in every way
>javafag BTFO in this thread
>tries to pull this bullshit
>>
cheers anon

why not be billingual?
>>
>>51725242
sure convinced me
>>
>>51725211
No. if-else always breaks when it reaches the right condition.
For both to work it would have to be
if(thing=blah){}
if(fuckshitup(){}
>>
File: D.jpg (42 KB, 512x512) Image search: [Google]
D.jpg
42 KB, 512x512
>>51725221
REEEEEEEEEEEEEEEEEEE
>>
>>51725250
C++ and java/C# is all you need

definitely stay away from:
>python
>haskell
>lisp
>javascript
>php
those are the worst
>>
>>51725133
>i'm not here to educate fools that don't want to be educated.
We're explaining to you why you are wrong. You're not even defending yourself, you're just getting really pissed when we explain stuff to you. I've been using Java and C# for 12 years now. This is pretty basic stuff.

I don't even use C# much these days because there are better languages. But it's objectively better than Java.
>>
>>51725251
>still can't justify his shillery
>>
>>51725271
i don't want it to fuck shit up if thing's blah though, so i would keep it as is yes?
>>
>>51725298
yes
>>
>>51725282
javascript is shit, but don't pretend it's not crazy useful to know these days.
>>
>>51725334
Javascript is an excellent object system wrapped in a shitty language.
Use coffeescript or typescript
>>
>>51725334
only if you're a web dev fag and even then i would recommend against using javascript and do as much as possible in CSS instead.
>>
Is there a K&R-like book that teaches just pure javascript and not javascript plus the author's favorite flavor of the week framework?
>>
>>51725378
Javascript: The Good Parts
>>
>>51725369
web dev touches everything these days

>i would recommend against using javascript and do as much as possible in CSS instead.
... uh...
>>
>>51725403
>Javascript: The Good Parts
>>
>>51725406
at least don't overuse javascript

http://stackoverflow.com/questions/19188419/better-or-worse-styling-with-javascript-vs-css
>>
>>51725356
>excellent object system
>prototypal inheritance with no ability to protect or encapsulate is good
>>
File: 1426705194278.jpg (220 KB, 640x383) Image search: [Google]
1426705194278.jpg
220 KB, 640x383
>>51725403
this is actually a thing
>>
>>51725431
>>Javascript: The Good Parts
>>
>>51725442
this guy understands
>>
>>51725442
encapsulation doesn't really do anything. if you really want to access something private you can.
If I see a variable or function name prefaces with an underscore I leave it alone because I know it won't do what I want it to
>>
>>51725442
That's actually a non-issue because no one ever misuses existing public fields.
>>
The best mechanism of encapsulation is the module. Prove me wrong.
>>
>>51723973
Examples?
>>
Working on a network packet dissector in Python.
I had a look at both the source of Wireshark and Scapy, and I think I'm getting an idea of how to implement it.
Getting closer to processing inbound traffic.
>>
>>51725527
why python
>>
>>51725556
it's what the 1337 hackers use
>>
>>51725506
the most erotic part of the woman is the booby. Prove me wrong.
>>
>>51725506
C is your favorite language

>>51725500
good one m8

>>51725490
>I know
Thank god everyone knows these conventions.

My real issues with prototypal is the extra cost of a table lookup and that people can fuck with parent classes and fuck up all the objects that inherit it. Class definitions are not something that should be dynamic, classes are an extension of types. How thinks a language runtime should be able to make new types or modify existing ones?
>>
>>51725593
fag
>>
File: 4155731-6947784534-friez[1].gif (224 KB, 320x190) Image search: [Google]
4155731-6947784534-friez[1].gif
224 KB, 320x190
javafags = krillin
everyone else = frieza
itt
>>
>>51725464
>
>>
>>51725640
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>
>>51725490
>encapsulation doesn't really do anything. if you really want to access something private you can.
Only because the language is shit.

JS does let you do real encapsulation with closures at least. It's its only saving grace. The language would be utter shit without that. I mean... more so.
>>
>>51725630
>javafags
>plural
There's never more than one. It's always just the odd retard.
>>
>>51725649
>the
>good
>parts
>of
>javascript
>>
Anyone know OpenGL really good?

How do AAA games render do many objects with 60+ fps?


I've been trying to render via VBOs of each objects but with a lot of them i'm struggling to hit 30fps.
>>
>>51725690
He's been doing it for a while. I remember watching him throw a tantrum a couple times in the last fews months.
But I posted under the assumption there was some javafags who know their place silently lurking
>>
>>51725717
what exactly are you doing now, are you uploading them every frame?
>>
>>51725732
For objects that don't move within the world I upload as static VBOs once. Objects that have animations or may move i upload as needed.
>>
>>51725699
>good
>java
>script
>>
>>51725699
HAHA!! You're right anon, it was funny.
>>
>>51725522
As far as I can tell, basically anything that doesn't involve constructing a proof.

Like the identity:
id x = x
// x isn't constrained => polymorphic
id : a -> a
// elaborate normally
id : {a : Set} -> a -> a

or addition of naturals:
m + Zero = m
m + Succ n = Succ (m + n)
// second parameter is destructed as Nat
// result is constructed as Nat
// m is used as result => m is also Nat
_+_ : Nat -> Nat -> Nat


This is a proof that addition has a left identity of zero.
leftID Zero = Refl Zero
leftID (Succ m) = cong Succ (leftID m)
// parameter is destructed as Nat
// result type is some sort of equality, but equalities are dependent
// following annotation must be supplied
leftID : (m : Nat) -> Zero + m == m
>>
>>51725755
try uploading everything no more than once or as rarely as possible (not every frame). use skeletal animations so the GPU will take care of animations
>>
>>51725452
I skimmed through that book and all it said is to write JS in C style.
And most of the diagrams seemed to have been designed for idiots.
Hardly worth reading.
>>
>>51725556
Because it's quite a large project, and performance doesn't really matter.
The dissector is only a small part of the network stack.
Writing in C or C++ would cost a lot more time, though for decoding protocols structs are much easier.
I would have used either Elixir or Scala, if either had support for raw sockets, without having to write a FFI myself.
>>
>>51725755
>Objects that have animations or may move i upload as needed.
Christ. Learn what a transformation matrix is.
>>
File: 1430529951791.jpg (38 KB, 400x388) Image search: [Google]
1430529951791.jpg
38 KB, 400x388
>>51725814
forgive me senpai
>>
I'm trying to think of a personal project that will help me become a less shitty programmer. I discovered that even though I've been working as a dev for 4 years, and I'm as good as the senior devs at my job, I'm still a very, VERY bad programmer :(
>>
>>51725801
Next time use F#
>>
>>51725798
He said 'just JS'. No libs, no frameworks. At most what else do you want? Objects and closures? Most of what you can do with them is outside the scope of a 150 page book.
>>
>>51725871
What are your qualifications?
And were you hired on the merits of your qualifications or nepotism?
>>
>>51725871
Mathy, graphical, complex and large, network communication, etc. etc.. What flavor you looking for?
>>
>>51725522
>>51725795
But to be honest, the only time where inference is really useful is anonymous functions. Otherwise, you're best off writing a type signature anyways, for documentation and to make sure your implementation makes sense.
>>
>>51725909
It's nice to have for interpreters (e.g. GHCi) and short/simple programs, but you're definitely right in actual projects.
>>
>>51725378
Eloquent Javascript (free online, the first js book you should read)
Javascript: The Good Parts (overrated but good)
Javascript: The Definitive Guide (the js bible)
Javascript Enlightenment
Speaking Javascript
Functional Javascript
Secrets of the Javascript Ninja
A Smarter Way to Learn Javascript (authors site has interactive lessons)
You Dont Know JS Scope and Closures
>>
>>51725874
No thanks
>>
>>51725797
What if as one of my thinks I have a line that gets shorter as time goes on. What's the proper way of updating the length of that line when drawn?
>>
>>51725832
dumb frogposter
>>
>>51725955
>Eloquent Javascript
When I said K&R-like book I meant a book that doesn't go into what a variable is, or how to use a loop.
>>
>>51725899
>What are your qualifications?
not being a retard, being able to learn by myself
>And were you hired on the merits of your qualifications or nepotism?
my father wanted me to work with mainframes like him, tried it for a few months and didn't like it. Other than that, I was hired on the merits of my 'qualifications'.
Also, I live in Brazil and I'm asian, makes it super easy to get a job

>>51725905
Something small that I could acomplish in a month if I worked on it 2h per day, I don't have much time to spend
>>
>>51725985
if the entire thing gets shorter you can use a transformation matrix. if the line is only a part of a model you can use a skeletal animation.

https://www.youtube.com/watch?v=IrggOvOSZr4
>>
>>51725960
you're loss m8.

It's basically like python, except fast, statically type with type inference and shit loads of other awesome features.

There's no reason to use python in the F# world
>>
for the huffman compression, it describes the huffman tree and then has the text with no break in between right? how do i tell the huffman tree function when to stop?
this is my function that reads the tree from binary
 // Function treeFromBinary returns the tree read in from the binary file at the second spot in the command line.
Node* treeFromBinary(BFILE* filename)
{
int x = readBit(filename);
if(x==1)
{
Node* leaf = new Node(readByte(filename));
return leaf;
}
else if(x==0)
{
Node *left = treeFromBinary(filename);
Node *right = treeFromBinary(filename);
Node *nonleaf = new Node(left, right);
return nonleaf;
}
else
{
return NULL;
}
}


and these are my functions that read the actual text
 
// Function readCharCode reads a character code and writes the character to the output file.
// It returns false if it reached the end of the file and true otherwise.
bool readCharCode(Node* huffmanTree, BFILE* binaryFile, FILE* outputFile)
{
if(huffmanTree->kind == leaf)
{
fprintf(outputFile, "%c", huffmanTree->ch);
return true;
}
else if(readBit(binaryFile)==1)
{
readCharCode(huffmanTree->left, binaryFile, outputFile);
return false;
}
else
{
readCharCode(huffmanTree->right, binaryFile, outputFile);
return false;
}
}

// Function uncompress uncompresses binaryFile into outputFile.
void uncompress(Node* huffmanTree, BFILE* binaryFile, FILE* outputFile)
{
bool x = readCharCode;
while(x)
{
x = readCharCode;
}
}


it doesn't give me any errors, my PC just starts whirring really loud and fast and i have to ctrl c
>>
>>51726032
Does it do raw sockets? On Linux?
>>
>>51725757
>java
>good

>script
>good

>javascript
>good
>>
>>51726029
That music is great
>>
>>51723700
cheaters never truly win
>>
>>51723530
Learn code the hard way and then Python tips
>>
>>51725798
>>51725452
Are you fucking stupid? That's a great book and Douglas Crockford highlights the functional and prototypical aspects of js which is great.
>>
>>51726162
worst advice desu
zed shaw is a moron
>>
>>51726086
It will work with any .net library, including those available in mono.
In fact in a lot of ways f# is monos first class language. It's by far the most foss oriented of the microsoft products. So yes, it should do sockets on linux
>>
>>51726086
yes
>>
>>51726032
>It's basically like python
F# is a subset of Ocaml, its NOT 'basically like python' at all
Thread replies: 255
Thread images: 26

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.