[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
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: 31
File: Most JSPythonRuby apps.webm (2 MB, 320x180) Image search: [Google]
Most JSPythonRuby apps.webm
2 MB, 320x180
Old /dpt/ at >>51557857

What are you working on?
>>
memifying memelangs.
>>
>>51562843
D
>>
File: 1445563002664.jpg (7 KB, 94x94) Image search: [Google]
1445563002664.jpg
7 KB, 94x94
>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 (17 KB, 750x216) Image search: [Google]
Valutron.png
17 KB, 750x216
>>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 (7 KB, 399x211) Image search: [Google]
Untitled.png
7 KB, 399x211
>>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 (7 KB, 399x211) Image search: [Google]
Untitled.png
7 KB, 399x211
>>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 (156 KB, 800x800) Image search: [Google]
1448151711319.jpg
156 KB, 800x800
>>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 (1 MB, 1280x720) Image search: [Google]
Imgoingtohell.webm
1 MB, 1280x720
>>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 (17 KB, 639x475) Image search: [Google]
homer-jury-duty.jpg
17 KB, 639x475
>>51564067
>>
What's the best x86 asm IDE?
>>
File: 1438386392621.jpg (36 KB, 599x432) Image search: [Google]
1438386392621.jpg
36 KB, 599x432
>>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 (1 MB, 828x828) Image search: [Google]
Pepe (32).gif
1 MB, 828x828
>>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 (25 KB, 214x265) Image search: [Google]
disgusted hitler.jpg
25 KB, 214x265
>>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 (67 KB, 600x600) Image search: [Google]
serveimage-24.jpg
67 KB, 600x600
>>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 (91 KB, 1207x587) Image search: [Google]
1448557826263.png
91 KB, 1207x587
>>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 (111 KB, 428x428) Image search: [Google]
1338160083986.jpg
111 KB, 428x428
>>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 (3 MB, 568x480) Image search: [Google]
game.webm
3 MB, 568x480
Rewriting a game engine i started working on last year
Pretty clean atm
>>
Simple point of sale web app
>>
>>51566726
>Buttboi
>>
File: working.png (6 KB, 190x216) Image search: [Google]
working.png
6 KB, 190x216
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 (177 KB, 615x850) Image search: [Google]
345834.jpg
177 KB, 615x850
>>51561893
Still wondering about this.
>>
>>51566702
>two minutes
well?
>>
File: finished.png (331 KB, 320x386) Image search: [Google]
finished.png
331 KB, 320x386
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
Thread replies: 255
Thread images: 31

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.