[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Extra juicy! | Home]

Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 353
Thread images: 31

Old /dpt/ at >>51557857

What are you working on?
>>
memifying memelangs.
>>
>>51562843
D
>>
File: 1445563002664.jpg (7KB, 94x94px) Image search: [iqdb] [SauceNao] [Google]
1445563002664.jpg
7KB, 94x94px
>OO "Programming"
>>
Probably going to start memeing on my image shit again. That said, I just got back from shooting some clay pigeons and that was entertaining.
>>
>>51562046
>In Java Swing, what's the best way to lay out a GUI like this?
>Like I want some components on one side, and another on the other side.
>I had originally done a GridLayout to split the panel then a LEFT FlowLayout and a RIGHT FlowLayout, but if one side has more components then the other it starts to look weird really fast.
>>
>>51562896
I thought americans only did school shootings.
>>
Nice image OP.
>>
OO paradigm is just closures
>>
>>51562893
Who are you quoting?
>>
>>51562935
Jesus
>>
>>51562915

Well, we have probably 400 million guns, so we have to do something with them in-between the high profile shootings.
>>
>>51562965
Jesus would program in a functional language
Prove me wrong
protip: you can't
>>
>>51562843
Benchmarking DMA transfer between two GPUs across a NTB link.
>>
File: Valutron.png (17KB, 750x216px) Image search: [iqdb] [SauceNao] [Google]
Valutron.png
17KB, 750x216px
>>51562843
I'm building a Lisp, called Valutron. I am implementing its compiler-interpreter in Objective-C.

It has some unique features: first, it offers what are called V-expressions, an alternative notation for writing code. Second, it offers a comprehensive object system inspired mainly by that of SmallTalk-80, one of the earliest Object-Oriented languages, and by Common Lisp's CLOS, Common Lisp being the first object-oriented language to be standardised.

This object model is implemented atop the Objective-C runtime, which I have extended with support for Double Dispatch to enable the availability of CLOS' characteristics multimethods.
>>
>>51562914
The best way to use Java Swing is by not using Java Swing.
>>
>>51562914

Use JavaFX family
>>
>>51563194
The best way to use Java.Swing is by not using Java
>>
>>51562893

NEET detected
>>
>>51562914
Without you illustrating your desired result I can't really tell you anything. You currently (in the picture) have three button like things which could be placed using absolute coordinates. If you want to place them relative to the window size use a GridLayout.

But I suggest you play around with the different layouts and get a feel for what they actually are, or read about them more. Then you can make the decision.

But if you want someone else to tell you offer a better description. Like throw out 4 different examples of desired situations.
>>
>>51563016
jesus was pragmatic, not a time waster
>>
which is more programming related, CS or SE?
>>
>>51563016
>a functional language
In other words not an FP language because FP languages don't function
>>
>>51563428
SE
>>
>>51563327
which is exactly why he'd use FP
>>
>there is one part of program that is full of bugs
>impossible to debug unless you know the runes it is written in
>the person working on it is lazy

well, I hate my job. also boost sucks
>>
>>51563469
Nigga probably wrote it that way on purpose.
>>
File: Untitled.png (7KB, 399x211px) Image search: [iqdb] [SauceNao] [Google]
Untitled.png
7KB, 399x211px
>>51563265
I want the behavior of FlowLayout, but want one set of components to left-justified and the other set to be right-justified.
Basically, the components on the left will be "glued" to the left and their position will be relative to the left border (just like a FlowLayout(LEFT)); the components on the right will be "glued" the right and their position will be relative to the right border (like FlowLayout(RIGHT)).
Resizing the panel will increase/decrease the spacing between the two sets of components.
>>
>>51563469
It's called job security, do you want to be an unemployed poorfag?
>>
>>51563450
>not an FP language because FP languages don't function
#FUCKNREKTM8
>>
>>51563428
Both are not just programming. They both contain it, but one is more a science and the other is more product development
>>
File: Untitled.png (7KB, 399x211px) Image search: [iqdb] [SauceNao] [Google]
Untitled.png
7KB, 399x211px
>>51563501
woops. mixed up left and right.
>>
>>51562843
That's probably the most appropriate pic to start dpt ever.
>>
Let me explain something to the retards that say lisp us bad because parentheses :

print(x)
(print x)

Any difference in the number of parentheses?

Ok, now imagine instead of curly braces there's parentheses.

void foo()
{
print(2);
}

(define (foo)
(print 2))

Still same number.
>>
>>51563562
>webm
>pic
>>
>>51563783
>( . Y . )
>>
>>51563537
JFrame frame = new JFrame();
JPanel pane1 = new JPanel();
JPanel pane2 = new JPanel();
frame.add(pane1, BorderLayout.WEST);
frame.add(pane2, BorderLayout.EAST);
>>
>>51563783
{void foo()
{print 2}}


Because this makes sense?
>>
>>51563832
I completely forgot about BorderLayout, which is embarrassing since I'm using it for north and center.
>>
>>51563787
It's a moving picture.
>>
File: 1448151711319.jpg (156KB, 800x800px) Image search: [iqdb] [SauceNao] [Google]
1448151711319.jpg
156KB, 800x800px
>>51563878
technically it's many pictures, just one after another
>>
Trying to create a string array that holds 5 names.

#include <iostream> 
#include <string>
using namespace std;

int main()
{
const int names = 5;
string theNames[names] = {"", "", "", "", ""};

cout << "names";
cin >> theNames[names];

return 0;
}



The console command just crashes.
>>
>>51563454
>>51563520
is it possible to learn programming or any elements from CS/SE on my own and not have to shell out tens of thousands of dollars to go to some fancy smancy university?
>>
I've been trying to get this president's quiz to work. It takes the answer without giving an exception finally but the "correct" variable doesn't get anything added onto when the answer is correct. On Line 61 it always says that the person got 0 correct!

http://pastebin.com/5CgSS90v
>>
>>51563996
>array has positions 0, 1, 2, 3, 4
>let me put something at position 5
>>
>>51564040
It's Line 46 in the pastebin.
>>
File: Imgoingtohell.webm (1MB, 1280x720px) Image search: [iqdb] [SauceNao] [Google]
Imgoingtohell.webm
1MB, 1280x720px
>>51563062
would you just fuck off? Nobody wants your "lisp" that isn't even a real lisp
>>
>>51564067
script-fags actually think that's proper program behavior
>>
>>51563062
do you have any code examples
>>
>>51563897
That's a creepy lil girl
>>
>>51564097
>girl
>>
so has the light gone out inside for any other programmers
>>
5 cpus ?
>>
>>51564121
that looks like a girl to me
>>
>>51564134
Whatever makes you happy, man.
>>
File: homer-jury-duty.jpg (17KB, 639x475px) Image search: [iqdb] [SauceNao] [Google]
homer-jury-duty.jpg
17KB, 639x475px
>>51564067
>>
What's the best x86 asm IDE?
>>
File: 1438386392621.jpg (36KB, 599x432px) Image search: [iqdb] [SauceNao] [Google]
1438386392621.jpg
36KB, 599x432px
>>51564196
>ASM IDE
>>
For my programming class I have to create a program of my choice at a beginner level that requires significant effort. What can I make that is both fun and has a good final product. Thanks.
>>
>>51563062
>first, it offers <useless addition to language>
Ok?

>Second it offers <an old concept> inspired mainly by <an old language>, one of the <oldest> Object-Oriented languages, and by <an old language>, being the first object-oriented language to be standardised.
Am I supposed to be impressed? Why don't you invent a time machine instead?
There's a reason that nobody writes in Smalltalk or Common Lisp; because they're old languages and modern languages have improved since then.

>Double Dispatch
Is this just a more restrictive version of multiple dispatch?

I don't know why you're trying to spread hype but it isn't working.
>>
>>51564038
Sure, you can learn everything on your own. The problem is you need a lot discipline to educate yourself the way a university does. Besides that a university would offer group projects and train you to get into a proper development process for something like SE. A university will also introduce you to things you might not think of yourself. You'll also have to build a good portfolio instead of being able to just wave around a piece of paper. Don't underestimate the discipline part, it's easy to slack or get sidetracked if you're the one that sets the deadlines.
>>
>>51564204
Yeah I can't find a good one. SASM is neat but it keeps trying to save my binaries to "/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../lib/" instead of something sane and from what I can tell I can't change it.
>>
>>51564285
Why do you need an IDE to write assembly? Why are you writing large enough in assembly to need an IDE? What the hell are you doing?
>>
Racket is so much better than the other lisps it's not even fair
>>
File: Pepe (32).gif (1MB, 828x828px) Image search: [iqdb] [SauceNao] [Google]
Pepe (32).gif
1MB, 828x828px
>>51564083
It is a Lisp.

My primary references in building Valutron are ISO/IEC 13816:2007 (Programming Language ISO LISP), from which I mainly draw from its description of ILOS, the object system it uses, and also Revised [6] Report on the Algorithmic Language Scheme, from which I derive general inspiration as well as the semantics of continuations.

>>51564096
Here's a very simple example of VOM, the Valutron Object Model:

// 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 dollar $ is an alternative form of method dispatch syntax;
// it passes its (left-associative) pre-component as first argument
let aLambda = { () => integer | print(stdio, aHello$get-hello-world()); };
aLambda();
>>
>>51564244


In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:

1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).

It is possible to make £2 in the following way:

1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p

How many different ways can £2 be made using any number of coins?
>>
>>51564309
I was using emacs but the major modes for asm sucked balls so I'm looking for something with actually-helpful syntax highlighting.
>>
>>51564333
This is not a lisp
>>
>>51564337
do your own math homework, fagot
>>
>>51564333
mild meme
./lolisp lol.fagtron
()>()::::()>()(:)(::)()()>(())()
>>
>>51564337
Significant effort, not five minutes of effort
>>
>>51564196
vim for nasm
>>
>>51563996
re-read how arrays work my friend.
>>
>>51564368
() & & ==+%*":#;{} {<>;[] [{} <<>^;
>>
>>51564196
Depending on the assembler you're using sublime (text editor) should be enough, unless you're in win in which case I think you should use VS.
>>
>>51564354
I don't believe you know what a Lisp is. Please consult McCarthy's Recursive Functions of Symbolic Expressions and Their Computation by Machine and The Lisp Programmers' Manual 1.5. Next, consult the Common Lisp ANSI standard, then ISO/IEC standard 13816:2007 (Programming Language ISO LISP), and finally Revised [6] Report on the Algorithmic Language Scheme. Once you have read those, you can come back to me with arguments - if you have any left :-)
>>
>>51564244
reverse fizzbuzz
>>
>>51564383
Write a screen scraper that looks at gambling sites for arbitrage opportunities.
>>
>>51564395
 o   o
¿
\_____/
>>
>>51564402
hahaha great post
well meme'd, my lad
>>
>>51564406
Where are your s expressions?
>>
>>51564040
Can I get some help please?
>>
>>51564439
The mistake is on line 45: `if (name == pres)`
>>
>>51564466
They're both strings though.
>>
>>51564426
u wot m8
>>
>>51563746
How do you do that with arguments?

Because if I have
int fooTheStuff(int32 arg, real32 arg2, disgustinglyLongStructName* input, int (*fThe)(disgustinglyLongStructName)){
return fThe(input);
}

Or just many arguments I'd rather break it up like this.
int fooTheStuff(int32 arg, 
real32 arg2,
disgustinglyLongStructName* input,
int (*fThe)(disgustinglyLongStructName)){
return fThe(input);
}

Because this is easier to read for me. But there can be plenty of cases where the former example is there because they straddle my limit for how long I want args to be. I think I'd find this very hard with only parenthesis's. At the very least it doesn't make it as clear to me mentally. I see the braces begin in C and I seem them close. That makes it plenty clear what the function body is. But if I were to have this straddling case I don't feel nearly as sure anymore.

What's the case for not using braces? Why not make them optional? I haven't programmed in lisp obviously.
>>
>>51564482
I can't believe that somebody would nonmemetically recommend Sublime Text and Visual Studio.
>>
>>51563996
>>51564389

I fixed it from crashing by doing this


cin >> name[0] >> name[1] >> name[2] >> name[3] >> name[4];

cout << name[0] << name[1] << name[2] << name[3] << name[4];
>>
>>51564475
And == doesn't compare the strings by value, so you lose.
>>
>>51564491
Visual Studio is perfectly fine as an IDE.
>>
>>51564504
vimDE
>>
>>51564491
Why? Both are good
>>
>>51564437
Available for use. But I was asked for a code example, and so thought it better to use V-expressions, the algebraic syntax available in Valutron, that I could show where Valutron offers differences. This is all explained in my original post.
>>
>>51564488
The thing about Lisp is that its syntax is based around parenthesis so there is no concept of "braces".
Like, in JavaScript (I'm using it because its a dynamically typed language with curly braces) it might be:
function foo (x, y) {
...
}


In Lisp it's like this:
(define (foo x y)
...)


In Lisp you show nesting by indenting things correctly. And if a function takes a lot of long arguments, you indent the arguments to the same position
(some function
that
takes
(a lot of)
arguments)
>>
>>51564538
Please use [ code ] tags.
>>
>>51564538 (forgot code tags)
>>51564498
Do this instead
int main()
{
const int names = 5;
string theNames[names] = {"", "", "", "", ""};
cout << "names";
for(int i=0; i<names){ //i goes from 0 to 4
cin >> theNames[i];
}
return 0;
}
>>
>>51564543
Clojure noob here doing tutorials. Is this indentation/style OK? I'm never sure when to start a new line for arguments vs leaving them inline.

(defn point [x y]
[x y])

(defn rectangle [bottom-left top-right]
[bottom-left top-right])

(defn width [rectangle]
(let [[[x1 y1] [x2 y2]] rectangle]
(- x2 x1)))


(defn height [rectangle]
(let [[[x1 y1] [x2 y2]] rectangle]
(- y2 y1)))

(defn square? [rectangle]
(if (= (height rectangle) (width rectangle)) true false))

(defn area [rectangle]
(* (height rectangle) (width rectangle)))

(defn contains-point? [rectangle point]
(let [[[x1 y1] [x2 y2]] rectangle
[x3 y3] point]
(if (and (<= x1 x3 x2) (<= y1 y3 y2))
true
false)))

(defn contains-rectangle? [outer inner]
(let [[x1 x2] inner]
(if (and
(contains-point? outer x1)
(contains-point? outer x2))
true
false)))
>>
>>51564618
Just you do you, man.
>>
>>51564618
Well first off you indented 'if' in 3 different ways in your example. Consistency is key
>>
>>51564602

thanks
>>
>>51564637
Makes sense.

Is there something like pep8/jslint for Clojure?
>>
>>51564618
For function calls I (my personal style) indent every argument to the same column, but for syntactic things like 'if' or 'let', put everything 2 spaces in.
(defn square? [rectangle]
(if (= (height rectangle)
(width rectangle))
true
false))

(defn area [rectangle]
(* (height rectangle)
(width rectangle)))

(defn contains-point? [rectangle point]
(let [[[x1 y1] [x2 y2]] rectangle
[x3 y3] point]
(if (and (<= x1 x3 x2)
(<= y1 y3 y2))
true
false)))

(defn contains-rectangle? [outer inner]
(let [[x1 x2] inner]
(if (and (contains-point? outer x1)
(contains-point? outer x2))
true
false)))


Note that "(if X true false)" is redundant, just write "X"
>>
>>51564700
Seems like a 'good enough' style, and lacking any of my own, I'll adopt it. Thanks
>>
>>51564543
I'm not sure I follow. Exactly how does lisp not have a concept of braces? Looking at
(define (foo x y)
...)

It seems pretty clear to me that the opening paren (first character) is the brace equivalent here. It opens and closes the function.

Your second example seems very odd to me. Perhaps you could clarify it by labeling things more clearly. Because as is I can't really say if you're making the point I think you're making. I don't see any nesting going on except maybe
(a lot of)

Which I can't really understand. (you're allowed to group arguments? Arguments can have names containing spaces?)
>>
times 1000000000 db 0
resw 1000000000


who's null terminated NOW, huh C?
>>
>>51564700
>Note that "(if X true false)" is redundant, just write "X"
Oh, and I know this, but the tutorial that I'm following has Midje tests which check the output for 'true' and 'false', so I have to explicity return those (I think).

Actually, now I think about that, I just assumed that to be the case, but false and nil are equivalent, right? And anything not nil/false = true. So the tests should pass either way...?
>>
>>51564779
OK, just tested that, and they still pass when not explicity returning true/false.

Thanks!
>>
>>51564762
I'm sorry.
In Lisp, () denotes a "list".
To evaluate a Lisp expression that is a list, it looks at the first item of the list. This first item is usually the function name that you are calling, which is why "(f x)" is equivalent to "f(x)" in other languages ("f" is the function being called).
Constructs like "if" are also just represented as lists. (if x y z) is essentially the same as "x ? y : z" or "if (x) { y } else { z }".
When you define a function, that definition syntax is again just a list. The special symbol "define" means that we are defining something.
(define <function signature>
<body>)

The (a lot of) example I gave was just to demonstrate indentation. In that example, the "some" function would be called. "(a lot of)" would also call the "a" function.

>>51564779
Never used "Midje"
>>
>>51562843

Working on a HTML 5 chatroom. Well... mostly finished with it now. Will give it a proper URL over the weekend:

http://raskie.com:85

Still open to suggestions and bug reports, if you have them though.

Cheers.
>>
File: disgusted hitler.jpg (25KB, 214x265px) Image search: [iqdb] [SauceNao] [Google]
disgusted hitler.jpg
25KB, 214x265px
>>51564333
>>
>>51564826
I'm not entirely sure how I feel about that. It seems neat on surface to have a syntax to say many different things and just change a keyword (or "symbol" as you call it) but I'm not entirely sure how I feel about it in practice.

It's very compact for sure. Something many other languages fail at.
>>
I was playing codingame's Clash of Code and just got keked hard by some fag writing Python. I was writing in C and got the task to reverse every word in a sentence (but not the entire sentence itself) and by the time I had finished typing in strtok and setting up my loop the fag was already finished.

Fuck scripting langauges.
>>
>>51564896
The reason I say "symbol" is because 'define' is just like 'x' and 'f', they're all "symbols". The syntax has hardly any exceptions or inconsistencies.
The cool part about lists in Lisp is that in Lisp code you work with data that is of the same form that Lisp code is represented in.
Therefore it's very easy to implement a feature so that Lisp code may be generated by other Lisp code during compilation. Macros are what makes Lisp such a powerful language; because the language is so simple, and features may be added easily through macros, you end up with an infinitely powerful and expressive language.
>>
>>51564862
Encryption?
>>
>>51564955
>C fags BTFO
>>
It's Black Friday and I'm feeling the need to find a programming book that's on sale and get it.
Damn you capitalism
>>
>>51564955
Don't worry. Your code most likely ran faster.

And on some level he didn't even complete his goal since he left his users mad at him for making their computers run slow/hot/loud and potentially burning battery for no reason.
>>
>>51564618
:~$ ./lolisp meme.cj
([][])([][])([]([[[][]]]()))([]([[[][]]]()))([]((()())))([](*()()))([]([[[][]][
]](((<)(<)))))([]([[]]((()()))))
Meme: 111
Total: 749
Total meme percent: 118.55%

>>51564700
([]((()())))([](*()()))([]([[[][]][]](((<)(<)))))([]([[]]((()()))))
Meme: 67
Total: 529
Total meme percent: 101.32%

It is less memier, he is correct.
>>
>>51565026
>And on some level he didn't even complete his goal since he left his users mad at him for making their computers run slow/hot/loud and potentially burning battery for no reason.
Do C users actually think this way?
>>
>>51565030
His code didn't include all my functions. I think the meme quotient is the same.
>>
>>51565073
Hmm.
Will revise. Thank you for your patience and understanding.
>>
>>51565083
Is forth the least meme language?
>>
Well I've been working for a few hours on this and it's pointless.

I wrote a hello world program in C without any libraries, without any uses of #include, without any macros or anything. The source file is 46 bytes.
But the compiled binary is, after tinkering around with gcc to get the smallest one possible, 4.4KB.

4.4KB.
The equivalent handwritten assembly binary is less than 1KB, but the "optimizing" GCC can't get it under 4.4.


Absolutely disgusting. I no longer feel bad when coding C# or Haskell, because C isn't even efficient. It's all just bloat. Bloat on top of bloat on top of more bloat.
>>
>>51565102
Oh good lord that's some ugly stuff.

>>51565107
Hahaskell*
>>
>>51565107
If anyone wants to prove me wrong and figure out how to get GCC to pull it under 1KB, feel free to try. Here's my meme source code that theoretically offers the most possible optimization:

void main(){write(1,"Hello, world!"\n",14);}
>>
>>51565107
Did you strip it? Did you look at the obj dump? Are you on winblows?
>>
>>51565107
Did you at least not link to the standard library
>>
>>51565107
have you removed the symbol table?
>>
>>51565131
this is not valid C
>>
>>51562893
OOP is literally one of the best programming paradigms you just don't understand it
>>
>>51565131
(take out that stray " though)
>>51565132
Opening it in a hex editor reveals that gcc dumps gallons of null characters and debug data that can safely be deleted without any issue. I cut 60% of the stdlib version's binary's size just be removing the junk data. And this was with the highest level of "optimize for size" option selected.
I'm on linux.

>>51565151
see >>51565131
>>
>>51565167
You still have to not link to it
>>
>>51565159
Yeah I accidentally added an extra " in the string when copying into the reply box. Remove the " after the ! in the code and compile it yourself. It only works on x64 Linux, but it compiles and works just fine there.
>>
>>51565166
>one of the best
m8 pls
>>
>>51564145
so is it a female or not?? hips/legs look suspicious i guess? maybe arms too? but the face doesn't look male
>>
I know you're trolling, but there's not a single x86 computer out there that is even slightly impacted by the difference between a 4KB executable and a 1KB executable.
>>
>>51565175
Adding in the `-c` option results in a binary file that doesn't even execute. And that binary file is still well over 1KB. Unless I'm missing something here?
>>
>>51564333
>dylan with scala-like syntax
>""""""""""""""lisp""""""""""""""
>>
>>51563783
absolutely disgusting
>>
>>51565107
>Haskell
>Compiler is 809 MB installed
>Worried about an extra 3KB on a C binary
>>
>>51565208
This is /dpt/, bikeshedding is practically all we do.

I've always heard that compilers are faster and better coders then humans could possibly be so it isn't worth writing assembly. I tried my hand at assembly and found that to be unilaterally false. Sue me.
>>
>>51565211
You have to link the executable, but you can stop it from linking to the standard library
>>
>>51565208
what is the 8086?
>>
>>51565207
Does it matter to you? If you think it's a girl then that's fine.
>>
>>51565181
still not valid C. void main is undefined behaviour on hosted environment. not sure about main with no arguments but I am pretty sure it is not allowed too.

you are using a OS dependent function and not even incloding its headers. you could as well post python code and call it C at this point
>>
>>51565228
>my assembly for 'hello world' was smaller.

Okay, now try with something substantial.
>>
>>51565107
http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
>>
>>51562843
C program that prints "my ass is hairy"
>>
>>51565259
>compiles just fine
>executes just fine
>"still not valid C"
>>
Interesting articles here:
http://joeduffyblog.com/2015/11/19/asynchronous-everything/

One of the lead developers on Microsoft's 'Midori' research OS has started writing blogs about it. The thing was pretty secretive up until now. Super interesting shit.
>>
>>51565235
Compiling with `-nostdlib` results in this error:

world.c: In function ‘main’:
world.c:1:13: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
void main(){write(1, "Hello, world!\n", 14);}
^
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400144
/tmp/ccko4EUM.o: In function `main':
world.c:(.text+0x19): undefined reference to `write'
collect2: error: ld returned 1 exit status


*shrugs*
>>
>>51565330
Yep, you can't use main() anymore.
>>
>>51565228
the "can't beat the compiler" and "premature optimization is the root of all evil" memes are just an excuse for stupid and lazy normies to write bad code. of course you can beat the compiler, it's just a simple tool that has to do a "best effort" within a reasonable time frame and it can't read your mind to find out what optimizations it can do that are specific to the problem you're solving with the code.
>>
y/n
>>
>>51565228
>found that to be unilaterally false
Write an assembly function that averages two integers, in the fastcall convention.
Then try
__attribute__((fastcall)) int avg (int x, int y) {
return (x + y) / 2;
}

gcc -c avg.c -O2

and tell me all about how much more clever and efficient you are than the compiler.
>>
>>51562843
Doing OpenGL uni work in Haskek instead of C with the raw bindings
>>
>>51565314
here is a "C" program that compiles fine on my custom "C" compiler and executes fine on my system. binary size is 0 byte, I bet noone can beat that record

fuck you
>>
>>51565342
and we aren't even close to getting strong AI so even if the compiler had perfect information about the problem you couldn't make it write a non-trivial program for you in the most efficient way
>>
>>51565340
Okay, now I'm interested.
>>
>>51565314
This compiles (under gcc at least), is it valid C code?
int main()
{
int(*){} ayyyy lmao
}
>>
>>51565361
Is the compiler's name touch, by any chance?
>>
>>51565342
"Can't beat the compiler" is in terms of translating C to assembly. Doesn't help you one bit if your program is poorly written in the first place.
>>
>>51564985

What encryption?
>>
>>51565366
>implying strong ai can circumvent rice's theorem
>>
>>51565324
>Midori was built out of many ultra-lightweight, fine-grained processes, connected through strongly typed message passing interfaces
holy shit, that is disgusting
>>
>>51565404
End-to-End
>>
>>51565415
What's disgusting about it?
>>
>>51565425

Nope.

No encryption at all.
On either end. Though I do that in other projects.
>>
>>51565214
I don't believe you know what a Lisp is. Please consult McCarthy's Recursive Functions of Symbolic Expressions and Their Computation by Machine and The Lisp Programmers' Manual 1.5. Next, consult the Common Lisp ANSI standard, then ISO/IEC standard 13816:2007 (Programming Language ISO LISP), and finally Revised [6] Report on the Algorithmic Language Scheme. Once you have read those, you can come back to me with arguments - if you have any left :-)
>>
#FROB#
>>
>>51565275
that was a great read.
>>
>>51565425

What made you ask about encryption anyway?
>>
>>51565494
%%FROB^^
>>
>>51565500
>Still open to suggestions
>>
File: serveimage-24.jpg (67KB, 600x600px) Image search: [iqdb] [SauceNao] [Google]
serveimage-24.jpg
67KB, 600x600px
>>51565473
>copy-paste previous post
>arguments - if you have any left :-)
just tripfag so i can filter your faggot ass
>>
well fucking shit I did it
i created a C program that compiles properly that's under 1KB


Granted it segfaults as soon as you try to run it but it fucking works.

Here's the glorious source code that, when fed into `gcc -s -nostdlib`, produces an executable of 952 bytes in length:

write($1){}


Am I a magician yet?
>>
>>51565380
http://melpon.org/wandbox/permlink/o7tUDnLjGUetzXVi
>>
>>51565525

What kind of encryption are you talking about here? And wouldn't be easier to just post the suggestion on the board itself?
>>
>>51565574
>Click this for noscript browsers
The link does not work
>>
>>51565594
End-to-End using a password, CryptoJS?
>>
Alright, I need help /g/entlemen. Say I want to do something to a variable via multiprocess. In UNIX, I've read that I'd need to use either shm_get() or mmap() but I didn't quite get how these work. Here's what I have

#define N 4

int main () {
pid_t pids[N]
int i;
pid_t pid;

for(i = 0; i < N; i++) {
if((pids[i] = fork()) < 0) {
perror("Fork");
abort();
}
if(pids[i] == 0) {
//do something to a variable
//example: x++, but I want x to be visible/shared with all children processes
exit(1)
}
}

while(pid = waitpid(-1, NULL, 0)) {
if(errno == ECHILD) {
break;
}
}
return 0;
}


Something like that. How exactly can I "share" x with the processes?
>>
>>51565601
Just like your browser. Just the way you like it.
>>
>>51565617
with shmget or mmap
>>
>>51565054
>C users
No most certainly not. C programmers might, but it's not a requirement to be a C programmer (sadly).
>>
File: 1448557826263.png (91KB, 1207x587px) Image search: [iqdb] [SauceNao] [Google]
1448557826263.png
91KB, 1207x587px
>>51565601
>clicking random links you see on le 4chinz
enjoy your free as in freedom malware brah
>>
>>51565634
My browser works fine, I can post here just fine, but your link though...
>>
>>51565643

The only requirement to be a C programmer is desire to instill a serious sense of consternation is every single one of your clients.

When is the major password-leaking bug going to show up? Who knows, and that's half the fun!
>>
File: 1338160083986.jpg (111KB, 428x428px) Image search: [iqdb] [SauceNao] [Google]
1338160083986.jpg
111KB, 428x428px
>>51565655
>that image
>>
>>51565655
>ever getting malware through your browser
typing in a loonix command != clicking a random link
>>
>>51565607

Oh... User accounts you mean?
Absolutely not! Went out of my way to devise a scheme to allow (myself and other) users to casual identify each, without using sessions or cookies. I've need to be especially care around networked devices that share the same IP...

I've accounted for that, but not sure if that code works yet, because you'd need a fairly rare condition to test the edge case of conflicting machines.
>>
>>51565292
do you have a repo for this? I'm interested in following development.
>>
>>51565721
What? No. Encrypt messages on the client before sending them to the server and then decrypt them at the receiver using the same password.

Just enter it once you enter the room.
>>
>>51565726
Unfortunately it is currently proprietary software. Perhaps I can release the source code under a more permissive license in the future.
>>
>>51565683
Very funny. If you know how to program C and build your abstractions well this is a non issue. (assuming your platform isn't vulnerable)
>>
>>51565759
or just use https encryption.
>>
>>51565778
Say no more, I understand.
My lolisp and hahaskell are also proprietary as of now.
>>
>>51565617
You can use named pipes. man -s2 mkfifo
>>
>>51565784
>if you don't make any bugs in your code it's a not issue
>>
>>51565784
>If you know how to program C and build your abstractions well this is a non issue.

Mostly, but there have been very few big projects that never see severe vulnerabilities.

>Very funny.

I know, I enjoy a bit of light trolling.
>>
>>51565810
I dream that your race mixing is an elaborate troll, but then I remember you use a trip as well, so clearly you are a niggerlover. What shame.
>>
>get challenge to grab hex number from stdin and convert to decimal then print
>OK, sounds easy to me
>write a three liner, seven if you count includes + main
>best winning entry is 15 characters, written in Ruby

why the fuck is the number of characters at all relevant

i guess if your code can't fit in a fucking tweet then it's shit, right
>tfw "#include <stdio.h>" by itself already makes you lose to keked languages
>>
I CAN'T WAKE UP
>>
>>51565840
http://codegolf.stackexchange.com/

Git gud
>>
>>51565888
why bother when one of your language's all but mandatory includes already precludes you from winning anything
>>
>>51565888
>best entry for getting the current time.
>>
>>51565540
Er, is there actually a way to get this to not segfault?

It seems like there should be but I'm stumped.
>>
>>51565793
>lolisp and hahaskell
You got my attention at "loli"
>>
>>51565827
>I dream that your race mixing is an elaborate troll, but then I remember you use a trip as well, so clearly you are a niggerlover.

If there are two things I am direly serious about, they are liberty and nigger-loving.
>>
>>51565759
>>51565785

The only real way to do it, is https. But for this, I don't want any encryption at all.

But I do want cogent machine id's without using cookies or database backed sessions.

Not sure if that's possible over http though. :/
>>
>>51565936
There's a lot of really good stuff on there though
https://codegolf.stackexchange.com/questions/33172/american-gothic-in-the-palette-of-mona-lisa-rearrange-the-pixels
https://codegolf.stackexchange.com/questions/35827/implement-the-game-of-life-on-anything-but-a-regular-grid
>>
>>51565997
just have a little bit of client side code that generates a unique ID for the machine, and tells the server.
>>
>>51562843
trying to rewrite the fucking datastax cassandra driver so it works on net.core and not just net.framework

FUCK THIS
>>
>>51566042
Those are really cool. Thanks for sharing.
>>
What's something fun to do?

Write imageboard/textboard software in JSP?
>>
>>51565984
What're you up to on this fine friday, GTP
>>
>>51566187
being a tripcode
>>
>>51566243
and what're YOU doing this fine friday
>>
r8 my function

/* TODO: Determine empirically vertices.size() as a function of Num_Divisions
* so that std::vector size is set with constructor
*/
GraphicArray_VCN make_parametric_surface(ParametricFunction f, ParametricFunction f_normal,
const UV_Bounds& uv_bounds, std::size_t Num_Divisions)
{
std::vector<Vertex> vertices;
std::vector<Vertex> normals;

for (int i = 1; i < Num_Divisions; i++)
{
double u0, u1 = /* range mapping cut for post length limit */

for (int j = 1; j < Num_Divisions; j++)
{
// v changes while u kept constant
double v0, v1 = /* range mapping cut for post length limit */

Vertex corner1 = f(u0, v0);
Vertex corner2 = f(u1, v0);
Vertex corner3 = f(u0, v1);
Vertex corner4 = f(u1, v1);

vertices.push_back(corner1);
vertices.push_back(corner3);
vertices.push_back(corner2);

vertices.push_back(corner2);
vertices.push_back(corner3);
vertices.push_back(corner4);

// http://mathworld.wolfram.com/NormalVector.html
// N = cross( dF/du, dF/dv );
Vertex corner1_normal = f_normal(u0, v0);
Vertex corner2_normal = f_normal(u1, v0);
Vertex corner3_normal = f_normal(u0, v1);
Vertex corner4_normal = f_normal(u1, v1);

normals.push_back(corner1_normal);
normals.push_back(corner3_normal);
normals.push_back(corner2_normal);

normals.push_back(corner2_normal);
normals.push_back(corner3_normal);
normals.push_back(corner4_normal);
}
}
std::vector<Vertex> colors(vertices.size());
for (auto& vertex : colors)
{
vertex.x = color.x;
vertex.y = color.y;
vertex.z = color.z;
}

return GraphicArray_VCN(vertices, colors, normals);
}
>>
>>51566432
function/10
now, you help me out
should i score blow or not
i kinda need to save but i would quite enjoy some white.
>>
Code this for me, monkeys

>the program takes 4 float numbers
>multiply 3 of them by 0,23
>multiply one of the by 0,3
>add the numbers after multiplied
>if >= 7 = yay
>else = bah
>>
>>51566187

Not much, kinda dicking around right now.
>>
>>51566432
seems hard
great job
>>
>>51566490
no going out? no drinking? no drugs?
>>
>>51566472
If you can't do this, drop out. You're just wasting your money.
>>
http://pastebin.com/vb3d8NkN


why does this give me a error when naming the enemies?
>>
>>51566529
How are you naming them?
>>
>>51566472
public class Nigger {
public static final synchronized strictfp String foo(float a, float b, float c, float d) {
a *= 0.23f;
b *= 0.23f;
c *= 0.23f;
d *= 0.3f;
return (a + b) + (c + d) >= 7.0f ? "yay" : "bah";
}
}
>>
>>51566499

No, no, and no. I'm actually trying to do that codegolf challenge where you use the palette of one image to generate another.

I have a slow going solution, but we'll see if it works.
>>
>>51565166
>one of
h-how many different paradigms are there? I didn't think there was a particularly large count.
>>
>>51566568
>h-how many different paradigms are there?

Millions.
>>
>>51566564
Gotcha.
Gay, gay and gay.
Nah just kidding. I'm off to get some blow, have a couple drinks with my buddy then I'll be back to shitpost some more if I can stand. Good luck.
>>
>>51566561
That's a class not a complete program. You're not handling arguments.
(Though he wouldn't know the difference.)
>>
>>51566568
6 googolplex quadrillion
>>
>>51566515
i'm not in CS or anything like it, just way to lazy to this in excel

>>51566561
i'm not a coder but 100% sure that won't compile
>>
>>51566564
if your're calculating the distance, don't use a square root. It's unnecessary and actually impacts computation time heavily.
>>
>>51565166
I wish someone who understood OOP who's of the opinion that it's good could explain to me why it's good in a sane way. Because it's not a paradigm made for human computers and I'm interested in alien technology
>>
>>51566583
Enjoy your drug dependence, brain damage, and life of regret.
>>
>>51566601
>just way to lazy to this in excel
That's a shitton of lazy right there.
>>
>>51566630
i didn't even typed the "to DO this"
top kek
>>
>>51566626
It's the weekend.
I have a monday to friday job which I work 43 hours a week, quite well. But I appreciate your concern, you have a wonderful night mr no self control judgmental kuk
>>
>>51566586
>>51566601
sure it would, try this:

public class Nigger {

public static final synchronized strictfp String foo(float a, float b, float c, float d) {
a *= 0.23f;
b *= 0.23f;
c *= 0.23f;
d *= 0.3f;
return (a + b) + (c + d) >= 7.0f ? "yay" : "bah";
}

public static void main(final String[] args) {
final Scanner in = new Scanner(System.in);
final String[] numberStrings = { "FIRST", "SECOND", "THIRD", "FOURTH" };
final float[] input = new float[numberStrings.length];
for(int i = 0; i < numberStrings.length; ++i) {
System.out.print("ENTER THE ");
System.out.print(numberStrings[i]);
System.out.print(" NUMBER");
System.out.println();
input[i] = in.nextFloat();
}
System.out.println(foo(input[0], input[1], input[2], input[3]));
in.close();
}

}
>>
>>51566683
dear god, how do you even code in that shitty language?
give me two minutes and i code that in python
>>
>>51566702
it's how you build scalable Enterprise™ solutions fgt
>>
>>51564040
>>51564439
I don't think that's how you use oop m8.
>>
File: game.webm (3MB, 568x480px) Image search: [iqdb] [SauceNao] [Google]
game.webm
3MB, 568x480px
Rewriting a game engine i started working on last year
Pretty clean atm
>>
Simple point of sale web app
>>
>>51566726
>Buttboi
>>
File: working.png (6KB, 190x216px) Image search: [iqdb] [SauceNao] [Google]
working.png
6KB, 190x216px
Well, it's plugging away right now. Rather naive solution, but I'm actually interested to see how shit the results are.
>>
>>51566741
Keep on working at it, Buttboisenpai
>>
>>51566614
in real life you use objects. like someone built a car for you (if you own a car), you probably didn't build yours from scratch. and it has a relatively simple interface for you to use it, with the gas pedal and steering wheel and such. when you want to start the engine, you just turn the key and it does all sorts of things automatically so you don't have to worry about the spark plug and whatnot. now take this concept of objects that you can use with a relatively simple interface into the programming world. that's Object Oriented Programming™.
>>
File: 345834.jpg (177KB, 615x850px) Image search: [iqdb] [SauceNao] [Google]
345834.jpg
177KB, 615x850px
>>51561893
Still wondering about this.
>>
>>51566702
>two minutes
well?
>>
File: finished.png (331KB, 320x386px) Image search: [iqdb] [SauceNao] [Google]
finished.png
331KB, 320x386px
Well shit up my ass and call me charlie, it worked!

This is American Gothic using the Mona Lisa palette.

However, since it works in strips, you can see how it was getting to the dregs of the mona lisa palette in the second half of the image.
>>
>>51566779
already did it, used it and deleted
just a simple function, even a mechanical computer can do it
>>
>>51566547
i have it in a string under the main code
>>
>>51566838
i would still like to see it for curiosity's sake
>>
File: surface.png (15KB, 514x229px) Image search: [iqdb] [SauceNao] [Google]
surface.png
15KB, 514x229px
>>51566432
with sample surface that didn't render completely correct. Gonna test with a sphere next, I don't think my function is meant to handle 360-revolutions.
>>
>>51566779
Guess he didn't show.
Here's something I did in 30 sec.
import sys

a=float(sys.argv[1])*0.23
b=float(sys.argv[2])*0.23
c=float(sys.argv[3])*0.23
d=float(sys.argv[4])*0.3
sum=a+b+c+d
if sum>=7:
print("yay")
else:
print("bah")

>>
>>51566683
>return (a + b) + (c + d) >= 7.0f ? "yay" : "bah";

dog shit tier code

nice readability nerd lmao!!!
>>
>>51566885
It's actually very good readability.
He even placed parens around the additions to make it super clear.

I wish everyone I worked with made things this clear.
>>
>>51566885
>public static final synchronized strictfp String
i was being facetious in case he would actually copy it for homework or something
>>
File: 194445352.jpg (250KB, 816x816px) Image search: [iqdb] [SauceNao] [Google]
194445352.jpg
250KB, 816x816px
>>51566875
jesus christ, that is a beautiful piece of code
>>
>>51566894
the parens were to keep better accuracy of the float additions so you get (a + b) + (c + d) instead of ((a + b) + c) + d
>>
>>51566934
Ah that's also an excellent reason to write it that way. Though I think that due to the way processors work the compiler would make the same thing because it doesn't want order dependencies.
>>
>>51566875
fixed
a = float(input("1: "))
b = float(input("2: "))
c = float(input("3: "))
d = float(input("4: "))

sum1 = a * 0.23
sum2 = b * 0.23
sum3 = c * 0.23
sum4 = d * 0.3

sum_final = sum1 + sum2 + sum3 + sum4

if sum_final >= 7:
print "yay"
print sum_final
else:
print "bah"
print sum_final
>>
>>51566833
I think better color matching is a recursive problem
>average the colors on each half of the farmer's wife
>average the colors on each half of the mona lisa
>find out which half is closer to which
>do the same for each quarter
I'm pretty sure this has some side effects, but I'm not sure what. Also, it becomes a bit more difficult for images with sizes that aren't perfect powers of two.
Also for fast averaging of colors, you'll need to take different sample rates for different pixel sizes. Obviously when you're comparing the two full halves, you don't want to take EVERY pixel when you're determining average color. Take, say, every 10th pixel.
>>
>>51566547
http://pastebin.com/809TuZgi

this is the main
>>
>>51566963
>>51566472
>the program takes 4 float numbers
Takes, not asks for input.
>>
>>51566561
>public static final synchronized strictfp String foo
lol
>>
What's with all these "programmers" that don't follow established design patterns?
>>
>>51566983
if a programmer types a input line of code thats because hes taking data from you
you have a moral duty to give that data to him, so the program can continue on his task
>>
File: finishedb.png (337KB, 320x386px) Image search: [iqdb] [SauceNao] [Google]
finishedb.png
337KB, 320x386px
>>51566972
>I think better color matching is a recursive problem

Probably. Many people also worked center-out, which pushes all the left-over shit-colors off the center of focus.

That said, I managed to come up with a similar result to that first run in about 1/8th the time, because this solution doesn't check the entire palette, but now just takes a random sampling off the full palette (say 5k colors) and picks the best.

Still has the problem of leaving the shit colors, but much faster and nearly the same quality.
>>
>>51566976
Still don't see where you're trying to set the name.
>>
>>51566754
But you're ignoring everything that makes it bad and saying it's good.

Your program has one goal. Take data and turn it into other data. There's no other way to do things right now. You can't give your program an object. You can't cram a car into your computer. What you give it is data in some form. You take that information and do something with it and place it (in memory) to another form which is a desired result.

Nowhere along this process is an "object" as object orientation describes it appropriate representation. Even such a thing as function association is inappropriate and superfluous.
>>
File: forth.png (3KB, 195x73px) Image search: [iqdb] [SauceNao] [Google]
forth.png
3KB, 195x73px
got most of my Forth interpreter working
still need to add error checking and symbol definition (lol) but after that it's just adding more standard functions
>>
>>51567042
there as a string,

//Game variables
String[] enemy = { "Skeleton", "Zombie", "Archer", "Viking", "Wolf", "Villager" };
int maxEnemyHealth = 100;
int enemyAttackDamage = 25;
>>
>>51562843
https://youtu.be/02_H3LjqMr8
>>
>>51567074
That has nothing to do with the Enemy class, though, I'm drunk as hell and don't even know what language you're in but {} looks wrong to me for a string array.

Might help if you posted the error message as well.
>>
>>51566529
If you really want help copy and fill out this form please:
Error message:
Line number:
Pastebin with associated file:
Desired result:
>>
>>51566951
i don't think it would. it has to be the equivalent computation, even without strictfp. maybe in some JVMs it would be allowed to have something like -ffast-math, not sure if it's mandated in the standard.

>
foo(0.1f, 0.1f, 0.1f, 0.1f)

>
return (a + b) + (c + d);

>0.09900001
>
return a + b + c + d;

>0.099
>>
File: sweating.gif (2MB, 1920x1076px) Image search: [iqdb] [SauceNao] [Google]
sweating.gif
2MB, 1920x1076px
Somebody explain this Spring for Java bullshit to me. I'm a professional developer and only have the vaguest idea of what problem it solves.
>>
>>51567133
        a *= 0.23f;
b *= 0.23f;
c *= 0.23f;
d *= 0.3f;

before the return statement
>>
>>51567064
murrican detected

you can have an "imaginary" object that only exists in cyber-space and it'll work perfectly fine. i'm not talking about putting an actual, physical car inside your computer.
>>
>>51567141
>People realize issues with what they're doing
>People aim to fix these issues
>Don't attack underlying problems
>Users end up confused as to what the point of it all is
>Doesn't matter for marketing people.
>>
>>51567172
>I meant an idea in my head not a physical car
>I interface to my computer like Neo and the matrix
Anon do you really think that was a relevant point to bring up. How about you respond to the data oriented argument I've made which invalidated Object oriented programming just fine on its own.
>>
>>51566472
def thing(a, b, c, d):
result=.23*(a+b+c)+.3*d
return 'yay' if result>=7 else "bah"

Of course I could smash this all into one line or use some lower-level pleb-tier language, but then I'd lose muh readability.
>>
>>51567133
Fair enough. Didn't consider that. Your results are computed with optimizations on right?
>>
So, I don't exactly understand the link between the XML and Java activities for Android Studio.

I have some EditText fields for Activity 1 with id entername and enteremail.
I want to pass something in those field to Activity 2, I'm using this code right now.
 Intent success = new Intent(this, RegisterSuccess.class);
success.putExtra("email","enteremail");
success.putExtra("name","entername");
startActivity(success);

After passing the Strings from the EditText in Activity 1 to Activity 2, how would I display those Strings on screen in a TextView?
>>
>>51567214
you can categorize your data, group them together and put them in an object. if you want a hamburger you don't start up a farm and raise cows, grow wheat etc and micro-manage the flow of the ingredients/data until you've made the finished burger, no you just buy a ready-made burger or at least ingredients that have been pre-processed to some degree. the same concept can be applied to any "object", real or virtual.

data-oriented programming is good for performance and catering to the hardware. but from a human's perspective it's not as elegant as OOP.
>>
>>51567104
those are what the enemies are supposed to be, it comes up as a java lang error. it is java.
>>
>>51567260
with strictfp in the method declaration the result will be the same on any computer and the results are like in >>51567133 even with strictfp
>>
>>51567214
also
>>I interface to my computer like Neo and the matrix
other parts of the program interface with the object of course
>>
hey guys, I'm on a mac and want to make my background the live stream from the ISS. I know it can be done with VLC, on windows, but It looks like I'm going to have to come up with something myself.

I know python and some applescript. Does anyone have any ideas/ know a direction to point me in? That's all I need to get started.
>>
Why doesn't this work?
my_processes = [x for x in psutil.process_iter() if os.path.split(x.cmdline()[0])[1] == 'firefox.exe']
>>
>>51567382
>>51567297
Post the error messages people, "it doesn't work" would make your ticket be closed with "invalid" in 2 seconds.
>>
>>51567412
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
my_processes = [x for x in psutil.process_iter() if os.path.split(x.cmdline()[0])[1] == 'cmd.exe']
File "<pyshell#6>", line 1, in <listcomp>
my_processes = [x for x in psutil.process_iter() if os.path.split(x.cmdline()[0])[1] == 'cmd.exe']
IndexError: list index out of range
>>
>>51567367
You can do the same with VLC on your Mac.
>>
>>51567382
>>51567432
Write it out in multiple lines and see where it goes wrong and why.
>>
>>51567412
# [Ljava.lang.String;@42a57993 appeared ! #
shows this instead of one of the random enemies
>>
File: 1293364813582.jpg (46KB, 600x591px) Image search: [iqdb] [SauceNao] [Google]
1293364813582.jpg
46KB, 600x591px
>>51567482
ok
;_;
>>
i am back. who would like a line.
>>
How can people stand using dynamic type checking? On top of making your program more prone to containing bugs, it also makes them infinitely harder to track down.
I've saved probably 20% of the normal amount of time I would have used writing code and spent 50% more time debugging.
>>
>>51567552
hey are you that guy that posted with his first name some months ago? i don't remember the name but i know he did coke i've been missing him t'bh
>>
>>51567574
I dunno my first name is Jeff, was it him?
>>
>>51567566
C++ is the least type safe language i can stand to use
>>
>>51567566
If it takes you that long to debug, your program is too complex or you aren't familiar enough with dynamic languages yet. Write unit tests to make up for the lack of typechecking. Also, having an interpreter at your disposal can make it really easy to find problems with your code.
>>
>>51567566
>On top of making your program more prone to containing bugs
[citation needed]
>it also makes them infinitely harder to track down.
[citation needed]
>>
>>51567611
it's very possible. i had a hunch that it was a single-syllable name starting with j. damn that's neat that you're still around and still interested in programming. good luck m8 and keep up the good work!
>>
File: 1448473404155.jpg (114KB, 720x960px) Image search: [iqdb] [SauceNao] [Google]
1448473404155.jpg
114KB, 720x960px
>>51567620
>relying on unit tests
>>
>>51567293
Data oriented programming is the straightest way through the program. It enables the program to be the theoretically best program on the machine. If you want the best program in OOP you really have to dig deep into complicated stuff that just isn't there in a data oriented design. I respect the OOP programmers who can do this immensely but since the argument for OOP tends to be convenience. And the few instances where it could potentially "simplify things" is in places where your program doesn't have many requirements on it (since where it matters OOP is going to be an issue because of performance) almost any programming style works fairly well for those problems. That's not where a programmer faces his issues. And when the programmer face these issues (as we do for one reason or another) the OOP will likely cost more than non-OOP in one way or another.

Either the solution isn't great, you have a "de-OOP" layer where you allow access in a non-OOP way or change the data around to fit the part of the program you'd rather not OOP because of the issues.

Or you will have to structure your OOP to fit the data oriented design. And at that point the OOP will clearly have been a hindrance.

Because really, you can't work with computers without understanding the memory in some form. Doesn't matter what abstraction layer is in front of it. You have to understand what it looks like to do the right things. At some point you did touch that data and change it the way you wanted it to. If not you then it was your library that did it. After that you deal with references in some form or another. You want this part of the code to know about the data which you touched before. The object abstraction doesn't remove any of the work. And without knowing what work has been done you can't make any judgement about the next step to take.

I'm too tired to be writing stuff like this. Hopefully it makes some sense.
tl;dr is that the cases I've seen OOP work (stringently) are few.
>>
File: finished.png (329KB, 320x386px) Image search: [iqdb] [SauceNao] [Google]
finished.png
329KB, 320x386px
Apparently a 2-pass method provides spooky output.
>>
>>51567022
A very good approach is to match one image's histogram to the other.
>>
>>51567661
What did this person you remember do?
Only recently (3 months) have I been able to afford this shit again, since I came into a quite comfortable job.

Do you recall this name from the /g/ Infect thing?
>>
>>51567617
I can handle using C, but that's about it. I mostly mean compile-time type checking as opposed to type safety, though.
>>51567620
>Write unit tests to make up for the lack of typechecking
Except if one thing goes wrong because of how a (standard library) function interacts with user input and I am not aware of that no unit test will properly cover that. Type checking limits the amount of possible states in a program, unit testing cannot do the same.
>>51567622
>[citation needed]
my current project :^)
>>
>>51567708
Unit tests are an industry-wide standard practice at this point. How else can you be certain that your code works? How do you know you introduced a significant change without breaking anything in a 2 million LOC project? I can't say I can take anything you say all that seriously if you think unit tests are anything besides a good thing.
>>
>>51567791
it was in /dpt/. i think he posted with Jeff or something like that in the name field instead of Anonymous. iirc he did some beginner programming stuff and talked about coke in an excited manner.
>>
>>51567839
>Except if one thing goes wrong because of how a (standard library) function interacts with user input and I am not aware of that no unit test will properly cover that. Type checking limits the amount of possible states in a program, unit testing cannot do the same.
ONLY unit tests can cover that.
Compile time checking doesn't help you at all with program logic especially not cases dependent on user input.
>>
>>51567869
Nope, wasn't me.
I was the dude who made Infect.
I do enjoy cocaine though, but I've been programming since my single-digit ages.
>>
drugs are overrated, 2bh.
>>
>>51567845
it's absolutely plebeian to put so much focus on the tests when you should just write the code properly in the first place. design your program well and step through the logic of each individual part. then you test the program as a whole or a major component of it, not each individual function. how do you even know that the unit test covers everything? if you're able to know that a unit test is good to go, then how can you not know if a function is good to go? or do you write a unit test for the unit test for the unit test etc? but i guess if you're the data-oriented fag you have no concept of encapsulation.
>>
>>51567923
use the drug, don't let it use you, tbqh.
>>
>>51567899
ah ok. might have been jake, jeffrey, joe or something like that
>>
>>51567899
Are you the feminist guy?
>>
>>51567939
jeffrey is short for jeff, but i appreciate you spelling it correctly. not of this tri-syllable bullshit "jeffery" or GOD forbid, geoffery.
you seem like a cool guy though, nice to meet you.

>>51567954
Fuck no. I have an ex wife who quite openly identifies as a cunt.
>>
>>51567923
what do you guys use to WAKEMEUPINSIDE? coffee kinda sucks. i've been trying alpha wave binaural beats and they do work, i get super productive but only for like a few hours and then i get super sleepy and sleep way too much.
>>
>>51567890
No I mean that a standard library function has multiple return types, for example (as is the case with some of the functions I'm using). Type checking would prevent that from happening (or verify that I am using the return type correctly if I'm explicitly casting the values). Instead, dynamically typed languages defer the bug to runtime. A unit test cannot simulate every single runtime variable so it will never have the kind of coverage that a type checker would.
>>
File: pua.jpg (116KB, 485x726px) Image search: [iqdb] [SauceNao] [Google]
pua.jpg
116KB, 485x726px
>>51567928
>how do I know my program is bug free?
>write unit tests
>but I never write code with bugs!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

none of you fuckers have never written anything bigger than your comp sci 102 term project
>>
>>51567966
may i suggest cocaine
kidding. adderall is good for programming, but honestly.. just drink a lot of water, get rest, relax, have neat ideas and be passionate. the feeling you get when you accomplish your goal is better than any line i've ever done.
>>
>>51567966
>coffee kinda sucks

I drink 100 cups a day. And I know, caffeine is a drug, but really?
>>
>>51567983
>if i write unit tests it will make my shitty python all fine and dandy!
>>
>>51567973
No, type checking wouldn't help with that.
>A unit test cannot simulate every single runtime variable
Of course it can, there aren't an infinite number of cases.
>>
>>51567928
>just write the code properly in the first place.
^)
>>
>>51568036
if it doesn't work, go back and debug it. put some print statements in the appropriate places to check what's going on. don't need a unit test for that.
>>
OOOH great example of a bug exclusive to dynamic type checking right here:
>using `let`
>switch functionality to something that should require `let*`
>identifier collision with 2 identifiers of completely different types
>program uses the wrong identifier, rather than warning me of a type error ahead of time (which would let me know that it is using the wrong variable)
>>51568021
a normal function has a^b combinations of inputs and outputs, where a is the number of values of the input type and b is the number of values of the output type. in a dynamically typed language, a and b become the number of possible values in the entire language, which is damn near infinite if you ask me.
>>
>>51568057
>if it doesn't work, go back and debug it. put some print statements in the appropriate places to check what's going on
Unit tests are just automating that process.
>>
>>51567995
if i drink more than 1-2 cups a day i quickly get burnt out and feel like shit and need a cup just to feel somewhat normal
>>
>>51568092
and the coffee barely helps in the first place. like now i've just been wasting time on the internet, mostly on 4chan
>>
>>51568014
Good code needs unit tests too.
>>
>>51568065
>in a dynamically typed language, a and b become the number of possible values in the entire language
No.
Dynamically typed languages still knows about all possible types (it obviously has to, since it dispatches to different code depending on the type tag), it's a finite and quite small number, definitely feasible to enumerate and test all cases.
>>
>>51568057
Yes, let's check the entire application manually by adding print statements in the whole code and going through it line by line with every change we make.

That'll save us time!
>>
>>51568141
no you just check the most recently changed part because you know that everything else works 100%.
>>
>>51568155
do you even write code
>>
>>51568155
But you don't know if there are any regression bugs due to your changes, running tests that take a few seconds vs going in and adding print statements every time should be a no-brainer.
>>
>>51568170
not everyone writes sloppy, retarded code that needs to have 80% of dev time allocated to doing unit tests, pedro
>>
File: cat.png (425KB, 496x442px) Image search: [iqdb] [SauceNao] [Google]
cat.png
425KB, 496x442px
>>51568114
>coffee barely helps in the first place

don't remind me.
>>
>>51568155
Kid, give it a few years before you chime in
>>
>>51568193
ok kid
>>
there is nothing wrong with python it's literally the best computer programming language
>>
>>51568186
>>51568274
CS101 script kiddies who can make simple loops and think know how to make real software detected
>>
>>51568342
normies that think it's a good thing to write a septillion unit tests, then spend close to zero effort on writing the actual program, and then testing and rewriting the code a septendecillion times until the code reaches the bare minimum to satisfy the possibly flawed unit tests detected
>>
pls make new thred
>>
New shitty thread: >>51568507
>>
so perl is neat, but i'm now learning that nobody uses it anymore.

what are the "hip" alternatives, and where do they shine. python and ruby come to mind, but i know little about them.

Basically, what scripting language should i really focus on learning?
Thread posts: 353
Thread images: 31


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]
Please support this website by donating Bitcoins to 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
If a post contains copyrighted or illegal content, please click on that post's [Report] button and fill out a post removal request
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.
This is a 4chan archive - all of the content originated from that site. This means that 4Archive shows an archive of their content. If you need information for a Poster - contact them.