[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 | Free Show | Home]

/dpt/ - 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: 336
Thread images: 29

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>57769930

What are you working on /g/?
>>
>>57775764
Please don't use an anime picture next time. This is a tech related discussion board
>>
>>57775791
on an anime-based image board
>>
>>57775791
Please don't post a non programming related post here. This is a programming discussion thread.
>>
>>57775764

Okay is the guy that knows torch here still, am I retarded or why I can't just assign values to random table indices in lua?? If i do table[i] = 1 then it complains about the index being nil
>>
>>57775791
It's not anime and she's holding K&R, which is tech-related... I don't get why people complain on /g/ about anime. 4chan has always had its roots in anime.
>>
>he uses int
Why are you using importable code anon?
>>
>>57775823
This is a Isle of Man basketwork board, faggot.
>>
>>57775842
'cause I want my code to be imported?
>>
File: 1468899863437.jpg (95KB, 394x404px) Image search: [Google]
1468899863437.jpg
95KB, 394x404px
post the last code you wrote

post a screen shot if you want
>>
>>57775862
Rajesh?
>>
>>57775830
> then it complains about the index being nil

it means that `i` isn't assigned. Make sure i has a value other than nil.
>>
File: 1480169888369.jpg (10KB, 506x606px) Image search: [Google]
1480169888369.jpg
10KB, 506x606px
>tfw to smart to learn haskell
>>
>>57775830
table[{1}] = 1

It's dumb, but there aren't true arrays in lua, only dicts, so you must use its syntax.
>>
File: SOS.png (44KB, 1257x506px) Image search: [Google]
SOS.png
44KB, 1257x506px
Anybody in here able to figure out this compile error. game is my struct games is my array of structs, time_of_day is a string in the struct.
>>
>>57775928
its a pointer to a struct, use ->
games->time_of_day[2]
>>
File: stop.png (10KB, 530x360px) Image search: [Google]
stop.png
10KB, 530x360px
>>57775928
christ dude
>>
>>57775889

Ah, never mind, I am retarded haha, I went from a for i blah,blah loop to repeat until
>>
>>57775918
>indexing a table with another table

I'm pretty sure that's not what he was asking...
>>
>>57775969
haha
>>
>>57775928
tfw i never have to ask these questions because intellisense makes it clear for me.
>>
>>57776068
tfw I never have to ask these questions because I'm not dumb
>>
>>57775928
Use a fucking struct pointer if you have that many state variables to keep track of.
>>
>>57776068
>tfw i never have to ask these questions because i write error free code
>>
>>57776120
tfw i never have to ask these questions because i don't program
>>
>>57776068
>>57776120
>>57776143
>>57776144
tfw i never have to ask these questions because i code in PHP
>>
>>57776168
>tfw i never have to ask these questions because i code on PCP
>>
>>57775863
I don' wanna
>>
File: 1449015339592.jpg (4KB, 225x224px) Image search: [Google]
1449015339592.jpg
4KB, 225x224px
>given a dll with no documentation
>has a parameter just called block_size.
>different values for block_size make it run at consistently different speeds for the same return value
is there a way to find the best block size without brute forcing the value for block_size? the method is taking roughly 300,000ms to run...
>>
File: 1476046509837.gif (2MB, 320x240px) Image search: [Google]
1476046509837.gif
2MB, 320x240px
Is 1.5 seconds for generating 1 mil random 6-digit unique(in a set) ticket strings good performance for java or should that be able to be done in nanoseconds?

I get ~ 3 - 4 seconds for 2 mil
>>
I'm supposed to do stack smashing for my homework in C, but this example code I found doesn't work.
This is supposed to skip the instruction x=1 but it won't.

File Edit Options Buffers Tools C Help                                          
void function(int a, int b, int c) {
char buffer1[5];
char buffer2[10];
int *ret;

ret = buffer1 + 12;
(*ret) += 8;
}

void main() {
int x;

x = 0;
function(1,2,3);
x = 1;
printf("%d\n",x);
}


and the assembly instructions
(gdb) disassemble main
Dump of assembler code for function main:
0x0000000000400561 <+0>: push %rbp
0x0000000000400562 <+1>: mov %rsp,%rbp
0x0000000000400565 <+4>: sub $0x10,%rsp
0x0000000000400569 <+8>: movl $0x0,-0x4(%rbp)
0x0000000000400570 <+15>: mov $0x3,%edx
0x0000000000400575 <+20>: mov $0x2,%esi
0x000000000040057a <+25>: mov $0x1,%edi
0x000000000040057f <+30>: callq 0x400536 <function>
0x0000000000400584 <+35>: movl $0x1,-0x4(%rbp)
0x000000000040058b <+42>: mov -0x4(%rbp),%eax
0x000000000040058e <+45>: mov %eax,%esi
0x0000000000400590 <+47>: mov $0x400640,%edi
0x0000000000400595 <+52>: mov $0x0,%eax
0x000000000040059a <+57>: callq 0x400410 <printf@plt>
0x000000000040059f <+62>: nop
0x00000000004005a0 <+63>: leaveq
0x00000000004005a1 <+64>: retq
End of assembler dump.
(gdb)
>>
>
>>57776236
Run the threads in different CPUs and it'll print more parallel.
>>
C++, long double
(1.18973e+4932 + 1.18973e+4932) / 2
gives inf instead of
1.18973e+4932

what do?
>>
>>57776270
I'm a dunce so I don't know if you're joking. If not how?
>>
>>57776306
Half joke. It's what you want, but I don't know if Java can do that.
>>
File: courtseys.jpg (634KB, 840x960px) Image search: [Google]
courtseys.jpg
634KB, 840x960px
http://www.strawpoll.me/11767105
Alright, last repost, it seems /g/ is pretty conclusively in favor of C as the language of choice for the up and coming debutante. Thank you very much for participating in this incredibly important survey
>>
>>57776242

Is function() using the right return type?
>>
>>57776345
Yes. This looks approximately like what its supposed to.
>>
How do I print out a description of a class or object in Java?
Can't seem to find the answer anywhere.
>>
So wait, what's considered a good error for StochasticGradient?
>>
>>57776301
lol nvm fixed it
>>
>>57776372
How do you expect main() to work with whatever function produces if the retrun type of function is void?
>>
>>57776391
Because im trying to manipulate the stack frame to overwrite the return address pasr x=1 and dont care about returning data.
>>
>>57776384
getClass().getName()

?
>>
>>57776385

Like, I just want to know where the number comes from and what it's supposed to represent
>>
>>57776328
I waited like a couple of minutes and now it's printing randomly. I don't understand threads at all. I'm just going to assume it's working properly.
>>
So the video bios is below the motherboard bios in memory right? if I boot my computer with only integrated graphics, the video bios will be mapped to the integrated graphics hardware. But if I put a dedicated graphics card in there and boot the video bios will be mapped to that dedicated card.
How does that work? aren't those mappings physically built into the motherboard? I know that PCI devices are assignment dynamically so I guess my real question is, how does the motherboard dynamically change mappings like that?
Does the mobo have an internal read-write table of mappings that it uses to lookup devices from addresses? if so, I'd like to know what techniques and algorithms a motherboard would use to achieve the lowest overhead for looking up a mapping so I can implement it in my virtual machine.
>>
>>57776448
Don't think of threads as running in parallel, but rather running independent of each other. The order and time they run is up to the operating system to do with as it wishes. You can control them better with semaphores and telling the scheduler a threads priority and it's dispatching domain.
>>
>>57775758
>How does that work? aren't those mappings physically built into the motherboard? I know that PCI devices are assignment dynamically so I guess my real question is, how does the motherboard dynamically change mappings like that?
>Does the mobo have an internal read-write table of mappings that it uses to lookup devices from addresses?
The system address map is setup by the chipset/memory controller which can be controlled by special registers.
>>
>>57776407
I really don't get what it's supposed to do. You're trying to access the 12th element of a 5byte charater array?
>>
>>57776409
I get the error "non-static method getClass() cannot be referenced from a static concept".

What do?
Sorry 'bout this.
>>
>>57776535
Do you happen to know any resources I can use to learn more about this system address map?
>>
>>57776228
Damn. I just realized how slow Python is.

I just tried the same thing and got 2.7 seconds for 100 thousand.

You'll never beat my one liner, though :)))))
n=["".join(random.choice(string.digits) for _ in range(6)) for __ in range(100000)]
>>
>>57776448
try splitting the source into chunks, so each thread can work on one chunk at a time and then print in order.
>>
>>57776560
Just use
 YourClassNameHere.class 
instead of
 getClass() 
>>
>>57776575
where are the imported modules random and string?

that's not one line
>>
>>57776542
http://insecure.org/stf/smashstack.html

I am attempting to use a bug in C to overwrite the memory address which stores where the CPU should jump to in the code after it finishes running function.
>>
>>57776561
You can take a look at the spec for some particular memory controller like:
http://www.intel.se/content/dam/doc/datasheet/5400-chipset-memory-controller-hub-datasheet.pdf

In particular Chapter 3 and 4 which describes the register configuration and how the address map is setup.
>>
>>57776695
n=["".join(__import__('random').choice(__import__('string').digits) for _ in range(6)) for __ in range(100000)]

I could have just made it easier by making my own choice function in that same line. But fuck you
>>
File: ineedtoreturnthese.png (13KB, 690x194px) Image search: [Google]
ineedtoreturnthese.png
13KB, 690x194px
I need to return these values / send these values into another class.

Is there an easy way to do this without doing it individually?
>>
>>57776761
move that stuff out of the code and into data files instead
it'll save you a lot of pain later on
>>
Trying to graph in MATLAB.

Let's say I need to graph several vectors that represent a trajectory. These trajectories are all the same, except the only difference is some constants, which are changed through a "for" loop. At the end of the loop, I graph the trajectories on the same graph.

My question is: How would I write it such that I can get a legend for each of the trajectory? Like "Trajectory 1", "Trajectory 2", "Trajectory 3" instead of "data1", "data2", and "data3"?

Here's my code so far:
%CONSTANTS
C_ARRAY = [3000, 2775, 2545];
N_ARRAY = [3.0, 2.8, 2.6];

g = 0:.05:1 %"g is a parmeter that ranges between 0 and 1"

%TRAJECTORIES

for index = 1:3

n = N_ARRAY(index);
C = C_ARRAY(index);

t = (.1*C) * ( (g.^(n-1) / n-1) + (g.^(n+1) / n+1));
x = (.2*C^2) * ( ((g.^(2*n-1)) / (2*n-1) ) + (g.^(2*n+1) / (2*n+1)) );
y = (.1*C^2) * ( ((g.^(2*n-2)) / (2*n-2) ) - (g.^(2*n+2) / (2*n+2) ) );

hold on;
plot(x, y);
ylabel('Vertical Displacement');
xlabel('Horizontal Displacement');
legend('' + index);
end
>>
>>57776751
one less char than you
n=["".join(__import__('random').choice(__import__('string').digits) for _ in range(6)) for a in range(100000)]
>>
>>57776808
Not a good habit though.

There could be an a defined out of scope that you're overwriting.
>>
>>57776846
one
less
char
than
you
>>
>>57776339
Huh, I thought I was the only lady of good upbringing on /dpt/
>>
I had posted:

http://collinoswalt.com/11

Another user asked me to create an RSS feed

I just finished it

Here you go, anons:

http://collinoswalt.com/feed/
>>
>>57776242
>>57776701
That's 32 bit code, you appear to be compiling for 64 bit which uses a different calling convention and typically different frame setup.
It also depends on what kind of compiler flags you use.
Don't expect examples with hardcoded numbers like that to just work on your system, you have to check the disassembly, calculate the correct offsets and use those.
You want buffer1 + X where X = (buffer1 - rsp_on_entry).
Then ret's gonna have to be a long (64 bits), and the amount you need to skip depends on how big the x = 1 compiled to (probably bigger than 8 bytes on 64 bit -O0 builds).
>>
>>57776912
how does one make a rss feed?
>>
>>57776799

Shouldn't it be something like

legend(strcat('Trajectory ', num2str(index));
>>
>>57776925
How do I figure out (buffer1 - rsp_on_entry)?
>>
>>57776926
I made it with a php file

basic rss takes the xml form:


<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>My Rss channel title</title>
<description>Description of rss feed</description>
<category>Programming</category>

<item>
<title>Item 1</title>
<link>http://linkToYourSiteAnd/article</link>
<description>Description 1</description>
<pubDate>Mon, Sep 23 2016 14:37:01 EST</pubDate>
</item>
</channel>
</rss>


And just use php to generate that. Make sure to send the
Content-Type: text/xml; charset=utf-8
header with it so the browser knows it's XML
>>
>>57777015
cheers!
>>
>>57776242
Does this perversion work?
#include <stdio.h>
void stack_smash(void)
{
enum { ASSIGN_INSTR = 7 };
void *r;
r = &r + 2 ;
*(char **)r += ASSIGN_INSTR;
}

int main(void)
{
int x;
x = 1;
printf("%d\n", x);
stack_smash();
x = 2;
printf("%d\n", x);
}
>>
File: 2016-12-01-132406_644x388_scrot.png (13KB, 644x388px) Image search: [Google]
2016-12-01-132406_644x388_scrot.png
13KB, 644x388px
>>57775928
You really should use a newer version of GCC.
It gives much more helpful error messages, especially for beginners.
>>
>>57776575

nice man
>>
>>57775764

Replacing an old bundy clock lunch bell system at a warehouse with raspberry pi's, speaker systems, html5 Audio() and configurable times from a simple admin interface.
>>
>>57777181
no
use clang, gcc is utter shit, they only reason they added those in gcc is because clang did it first and they suddenly had to compete.
>>
>>57776846
No it couldn't. a is local to the list comprehension
>>
>>57777238
>they added those in gcc is because clang did it first and they suddenly had to compete
So? How is competition not good?
Clang used to have way better error messages, so GCC stepped up their game.
Now that is no longer an advantage that Clang has over GCC.

You're going to have to give a real reason as to why GCC is "utter shit".
>>
File: 12.png (6KB, 583x429px) Image search: [Google]
12.png
6KB, 583x429px
>>57777181
my gcc gives a different error lel
>>
>>57776968
void function(int a, int b, int c) {
char buffer1[5];
char buffer2[10];
long *ret;

ret = (long *)(buffer1 + 0x18);
(*ret) += 7;
}

void main() {
int x;

x = 0;
function(1,2,3);
x = 1;
printf("%d\n",x);
}

I got this to work with:
gcc -fno-stack-protector

(my gcc had -fstack-protector on by default which adds code to prevent this kind of exploit)
>>
Mind helping a C++ beginner?

I need to make an IF statement that checks 3600 equations (X[i][j - Y[i][j] < 0,001) are simultaneously true.

How the hell do i write it with FOR loops? Im mostly in doubt if i need to use a && condition in the middle of the for, or if the for checks for everything.
>>
>>57777278
>4.7.3
>Copyright (C) 2012
Jesus christ. They're made so many changes since then.
That's why I can't stand using distros on my main computer that has ancient packages.
>>
File: 1480535720478.png (41KB, 1280x1483px) Image search: [Google]
1480535720478.png
41KB, 1280x1483px
>tfw to smart to understand racket
>>
>>57777299
If they all need to be true just check for the first false condition and break there, otherwise if the loop finishes you can safely know all conditions held.
>>
How can I become proficient in Ruby on Rails in a week? I have exp. with a few other languages/frameworks already so this shouldn't be a huge issue but what are the best books/guides/tutorials for Ruby?
>>
Beat my autism, /g/.

I made a program that tells me which album to listen to by spacing them out perfectly so as to create the maximum gap between albums from the same artist.

Each artist has its own interval. The hard part is figuring out how to populate a list that takes into account each artist's interval and the fact that spots will be taken by other albums.

Here is a snippet of a final list (Xiu Xiu and Animal Collective are repeated; Xiu Xiu has more albums and, so, appears closer together than AC):

Animal Collective/Strawberry Jam
American Football/American Football
Neutral Milk Hotel/On Avery Island
Xiu Xiu/Always
The Tuss/Rushup Edge
Sufjan Stevens/Carrie & Lowell
Aphex Twin/Drukqs
Meshuggah/Catch Thirtythree
Death Grips/The Powers That B/Jenny Death
The Caretaker/An Empty Bliss Beyond this World
Gorillaz/Demon Days
Xiu Xiu/Covers
Animal Collective/Prospect Hummer
>>
>>57777299
Loop through the equations and keep a flag. If any of them aren't true all of them aren't simultaneously true so you can break.
>Im mostly in doubt if i need to use a && condition in the middle of the for, or if the for checks for everything.
Lost me. Write out what you're thinking.
>>
>>57777341
just be yourself!
>>
>>57776242
you just need to demo how to smash a stack?
also please use "set disassembly-flavor intel" in gdb, at&t style is fucking retarded
>>
>>57777341
If you want to become proficient at something you don't read a book, you do a project, make something, you dumb MIT nigger.
>>
>>57777341
Build something and Google what you don't know
>>
>>57777385
I don't understand.
Explain yourself.
>>
    url = 'http://tracker.archlinux.org:6969/announce'
values = {'hash_id': urlhash, 'peer_id': 'ABCDEFGHIJKLMNOPQRST',
'port': 6881, 'downloaded': 0,
'event': 'stopped'}
print(type(urlhash))
sendto = requests.get(url, params=values, timeout=None)


i can't get a response back from trackers. i can't figure out what i'm doing wrong?
>>
>>57777415
You want to listen to every album that you have, right? Well listening to every album by an artist and then moving to the next artist would get boring. So this spaces them out perfectly so that you never listen to the same artist too often (close together).
>>
>>57777143
Before it segfaults, which it does, it prints a 1 and a 2. So, no...
>>
>>57777454
I can post a whole generated list if you want.
>>
>>57777469
do it.
>>
>>57777398
Some of my favorite technical books are of the format that walk you through some real projects and gives you the skills to do the same on your own. Was just curious if there was anything similar for Ruby.
>>
>>57777317
Are you one of the CS freshman on the same floor as me?
>>
>>57777282
Wow that totally works, thanks.
>>
>>57777454
so, something like
>song1:artist1
>song1:artist2
>song1:artist3
>song2:artis1
>song2:artist2
..
?
>>
How do I write a program that teaches another program to write more complex original programs?
>>
>>57777469
post code if its written in C, python, haskell, or common lisp
>>
>>57777497

The scope is that albums are listened to in full before moving to the next.
>>
>>57777431
okay so the error it's giving me is whne it's tried to contact teh server too many times iwhtout establishing connect.

this is the announce address so why can't reqeusts find it?
>>
>>57777497
Exactly, but with whole albums instead of songs.
>>57777480
comment too long, had to cut a bit

Xiu Xiu/The Air Force
Macintosh Plus/Floral Shoppe
Aphex Twin/Selected Ambient Works 85-92
Sufjan Stevens/Carrie & Lowell
Animal Collective/People
Susumu Hirasawa/Berserk OST
Gorillaz/Demon Days
Xiu Xiu/Almost Xiu Xiu, Almost Deerhoof
William Bonney/Good Vibes
Radiohead/OK Computer
Death Grips/The Powers That B/Jenny Death
Pink Floyd/Animals
In Flames/The Jester Race ⁄ Black-Ash Inheritance
The Hotelier/Home, Like Noplace Is There
System of a Down/Toxicity
Xiu Xiu/Fabulous Muscles
Animal Collective/Merriweather Post Pavilion
Aphex Twin/Girl⁄Boy
Snowing/Fuck Your Emotional Bullshit
Sufjan Stevens/Seven Swans
The Brave Little Abacus/Split
The Microphones/The Glow Pt. 2
Death Grips/Fashion Week
Xiu Xiu/Chapel of the Chimes
IBOPA/Ballads for Benpadrone
Giles Corey/Giles Corey
Gojira/L'Enfant Sauvage
Animal Collective/Spirit They're Gone, Spirit They've Vanished
Radiohead/Hail to the Thief
Why?/Mumps, Etc.
Xiu Xiu/Covers
The Tuss/Rushup Edge
Aphex Twin/Come to Daddy
Sufjan Stevens/Illinois
Neutral Milk Hotel/In the Aeroplane Over the Sea
Death Grips/No Love Deep Web
American Football/American Football EP
Gorillaz/Gorillaz
Xiu Xiu/Knife Play
Animal Collective/Prospect Hummer
William Bonney/Unreleased
The Caretaker/An Empty Bliss Beyond this World
The Brave Little Abacus/Okumay
The Microphones/It was Hot, We Stayed in the Water
Radiohead/Kid A
Mastodon/Once More ’Round the Sun
Xiu Xiu/Xiu Xiu — Parenthetical Girls
Aphex Twin/Richard D. James Album
Sufjan Stevens/The Age of Adz
Death Grips/Bottomless Pit
Animal Collective/Sung Tongs
Meshuggah/Koloss
Have a Nice Life/Deathconsciousness
Xiu Xiu/Dear God, I Hate Myself
The Mars Volta/De-Loused in the Comatorium
Opeth/Blackwater Park
BADBADNOTGOOD/BBNG
Red Hot Chili Peppers/Stadium Arcadium
Amon Amarth/Twilight of the Thunder God
The Jim Yoshii Pile-Up/Insound Tour Support Series No 26
Swans/To Be Kind
>>
>>57776939
Found how to do it, actually!

    legendInfo{index} = ['Path #' num2str(index)]; % or whatever is appropriate
legend(legendInfo)
>>
>>57777456
That's strange, it worked here.
Does this work for you?
#include <stdio.h>
void stack_smash(void)
{
asm("mov %rbp, %rsp\n"
"pop %rbp\n"
"addq $7, (%rsp)\n"
"ret");
}

int main(void)
{
int x;
x = 1;
printf("%d\n", x);
stack_smash();
x = 2;
printf("%d\n", x);
}

Which is the proper way to do it.
>>
>>57777526
This is neat, I'll implement that in my favorite langauge.
>>
>>57775764
Is it just me or does her foot look broken?
>>
>>57777509

Be more specific. What sort of original programs?
>>
>>57777339
>>57777388

I changed the If into a while, seens better. The loop is supposed to stop when the absolute value of difference between XY[i][j] - T[i][j] is less than 0,0001 for all i and j.


while (
for ( int i = 1; i < 59; i++ ){
for ( int j = 1; j < 59; j++ ){
(abs(XY[i][j] - T[i][j]) < 0,0001) && }}
)

{
for ( int i = 1; i < 59; i++ )
for ( int j = 1; j < 59; j++ )
{
T[i][j] = (XY[i+1][j] + XY[i-1][j] + XY[i][j+1] + XY[i][j-1]) / 4;
}

for ( int i = 21; i <= 39; i++ )
{
T[19][i] = 10;
}

for ( int i = 32; i <= 48; i++ )
{
T[i][29] = -10;
}

for ( int i = 1; i < 59; i++ )
for ( int j = 1; j < 59; j++ )
{
XY[i][j] = T[i][j];
}

>>
>>57777431
info_hash not hash_id
needs left as well
>>
>>57777615
Spontaneous, functional programs
>>
File: ohshitmotherfucker.jpg (64KB, 960x540px) Image search: [Google]
ohshitmotherfucker.jpg
64KB, 960x540px
Check 'em
>>
>>57777565
Thanks.

>>57777518
I wrote it in Python. I don't want to just post the whole thing, though.

Hints: I used os.walk to turn the artist/album folders into a list of strings ex: "The Microphones/The Glow Pt. 2"

Data:
"Collection" holds all of the "discographies", which are all of the "albums" that an "artist" has.

The rest is the hard part, as I've said before.
>>
>>57777712
still wont return a response.
>>
>>57777652

In retrospect, i written too much shit. Let me remake my question:

The loop is supposed to stop when the absolute value of difference between XY[i][j] - T[i][j] is less than 0,0001 for all i and j.

while (
for ( int i = 1; i < 59; i++ ){
for ( int j = 1; j < 59; j++ ){
(abs(XY[i][j] - T[i][j]) < 0,0001) && }}
)
{*My Loop*}


Hope it is clearer.
>>
>>57777777
>>
>>57777712
okaythanks i fixedthem things seems to be working now no moreerrors.
>>
>>57777562
Yes :) Worked.
>>
>>57777562
>>57777933
that isn't really fair to do, it's legit just 'increase the value at the top of the stack by 7"
if you want a realistic answer, use something like strcopy on a string allocated to the stack and overflow that
>>
Can /g/ beat my tictactoe?
Your character is X.
012
0 ---
1 ---
2 ---
Enter where you wish to play:
row col
>>
>>57777992
-1 3
>>
>>57778004
haha
-1 3
ERROR: The row -1 is out of the bounds 0 to 2.
Enter where you wish to play:
row col
>>
>>57778013
1
>>
>>57778032
i think it's waiting for a second number
1
>>
File: last.png (55KB, 1499x627px) Image search: [Google]
last.png
55KB, 1499x627px
Working on my terminal emulator, trying to find and fix inputs that crash it.

Using american fuzzy lop to achieve that, so far it has found 3 really weird bugs, the bright side is both st and rxvt-unicode crash with them, so I'm not alone.

libvte based terminals do survive them, but I'd wonder how well they'd go against afl itself.
>>
File: H E L P.png (17KB, 466x377px) Image search: [Google]
H E L P.png
17KB, 466x377px
WHY
WONT YOU WORK

java btw
>>
>>57778238
My guess is those quotation marks.
>>
>>57778238
>left and right double quotes
What the fuck?
>>
>>57778238
>>57778255
fucking realized just as i posted, i copypasted from my homework and it fucked me

fuck you mr walsh
>>
>>57778238
My guess is that it expects a ";"
>>
>>57778013
1.5 2.5
>>
>>57778108
how do you use american fuzzy lop in your project?

what does it actually do?


i dont get it
>>
>>57778277
ERROR: The space of 0 0 has already been used.
Enter where you wish to play:
row col
ERROR: The space of 0 0 has already been used.
Enter where you wish to play:
row col

and so on
forever

congrats ;-;
>>
>>57778294
AFL is a fuzzer, so it's sending bad input to his terminal to find crashes
>>
>>57778308
Wait, I forgot the first part
1.5 2.5
012
0 O--
1 X--
2 ---
Enter where you wish to play:
row col
>>
>>57778294
You test a part of your program with it.

You make an executable that reads from stdin, feeds the stdin to the part you're testing, for example a library decoding images, or in my case the functionality that handles input coming from the spawned program (i.e. a shell).

Then you feed it some example data, in the case of an image library it would be a couple images, in my case it's the test cases used by the control-code parser.

Then afl just spawns your executable, and starts forking it, passing it variations of the given test cases using a genetic algorithm.

It also has instrumentation from LLVM to know about branches and the actual code running, when the program crashes it logs the input it gave it and keeps going.

What I do then is use those logs, feed them to my terminal with a debugger hooked on, and figure out what the fuck it managed to find.

It managed to find a very weird edge case with integer overflows, and now it managed to find a way to somehow fuck up with the reference cell logic for double width characters.
>>
I'm now officially using OCaml for work. Take that faggots
>>
>>57778381
>GIL
lol ocaml sucks
>>
>>57777537

Oh, well I was close.
>>
>>57778381
What kind of work are you doing?
>>
>>57778394
>implying I'm not using multicore :^)
>>57778408
backend web stuff, can't go too far into detail
>>
>>57778443
>can't go too far into detail
why do people do this?

>can't say much more xD

you think people care ?
>>
>>57778381
Shitposting on /g/ isn't "work"
>>
>>57778464

>why do people do this?

NDAs

>you think people care ?

Some do, some don't. Most are ignorant that the information ever existed.
>>
>>57777957
there is no realistic answer, because it's all highly implementation dependent and a bad thing in general.
Here is a more magical version:
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#define MAINNUM ((uintptr_t)main)
void stack_smash(void);
int main(void)
{
int x;
x = 1;
printf("%d\n", x);
stack_smash();
x = 2;
printf("%d\n", x);
printf("%d\n", x);
}

void stack_smash(void)
{
enum { MAX_SEARCH = 10, MAX_FUN = 10000, CALL_LEN = 5 };
uintptr_t x[1] = {(uintptr_t)&x};
char **ret_ptr, *ret, *call;
for (size_t i = 0; i < MAX_SEARCH; i++)
if (x[i] >= MAINNUM && x[i] <= MAINNUM + MAX_FUN) {
ret_ptr = (char **)(x+i);
break;
}
printf("return address on stack at %p\n", ret_ptr);
ret = *ret_ptr;
printf("return at %p\n", ret);
call = memchr(ret, 0xe8, MAX_FUN);
printf("function call at %p\n", call);
*ret_ptr = call + CALL_LEN;
}
>>
>>57777726

Yes, but programs to do what?
>>
>>57777726
Good luck specifying that constraint, lol.
>>
Any help here? >>57777833

Please.

PS: I already fixed the < to >, but the sintax still wrong
>>
>>57778807
dont you mean 0.0001?
>>
>>57776242
I guess, I'd say something like this is a more accurate display of it though
void nice()
{
printf("hehe lol");
getchar();
}

void hey(char* in) {
char buffer[4];
strcpy(buffer, in);
return;
}

int main(int argc, char* argv[])
{
void * nice_addr = nice;
char overflow[8 * 4] = {
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
};
memcpy((void *)&overflow[8 * 3], &nice_addr, sizeof(void *));
hey(overflow);
return 0;
}
>>
>>57776242
Are you allowed to use inline asm?
>>
>>57776242
(menu-bar-mode -1)

also use x and
(defun toggle-minimal-mode (fs)
(interactive "P")
(defun fullscreen-margins nil
(if (and (window-full-width-p) (not (minibufferp)))
(set-window-margins nil (/ (- (frame-width) 120) 2) (/ (- (frame-width) 120) 2))
(mapcar (lambda (window) (set-window-margins window nil nil)) (window-list))))

(cond (menu-bar-mode
(menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1)
(set-frame-height nil (+ (frame-height) 4))
(if fs (progn (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(1 "_NET_WM_STATE_FULLSCREEN" 0))
(add-hook 'window-configuration-change-hook 'fullscreen-margins))))
(t (menu-bar-mode 1) (tool-bar-mode 1) (scroll-bar-mode 1)
(when (frame-parameter nil 'fullscreen)
(remove-hook 'window-configuration-change-hook 'fullscreen-margins)
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(0 "_NET_WM_STATE_FULLSCREEN" 0))
(set-window-buffer (selected-window) (current-buffer)))
(set-frame-width nil (assoc-default 'width default-frame-alist)))))

(global-set-key [f11] 'toggle-minimal-mode)
(tool-bar-mode -1)
(scroll-bar-mode -1)
>>
>>57777299
Look up Nested For loops and 2D arrays.
Then decide how you want to report if they are/aren't equal; if you jam this in a function you just need an IF in the middle that checks if the condition you want ISN'T satisfied, then return 0 or -1 or whatever you want for a fail condition. Else do nothing and at the end of the whole thing return 1 for success.
>>
>>57776242
What class teaches this?
>>
HOW DO I CARE ABOUT MY LIFE.
>>
>>57777385
>Beat my autism, /g/.
the name of the xiu xiu album is (remixed and) covered, unless that's a directory of individual accumulated covers, which shouldn't be considered a single album
also I'm guessing those are folders because of the death grips/powers that b/jenny death, and thus I conclude you have a garbage folder naming convention
(and your taste is garbage and derivative)
>>
>>57778832
That is true, but that is not my question. I want to k ow how to out an for loop as the condition of a while loop
>>
>>57777833
>>57779120
You should learn basic syntax rules before you try to actually do things in a language
>>
>>57778841
Why nops? They are irrelevant for the task.
>>
>>57779168
it was just a value to fill the stack with until we hit the return address, it could be anything since the stack isn't executable by default
>>
>>57779064
If you just want to learn exploitation, the RPISEC MBE course is really good, you can find it on github if you search for that.
Also getting into CTFs is a good idea
>>
>>57779072
You leave /g/ and go to /fit/
>>
>>57779196
Yes, it's not like it falls through them: you need an exact match, but it isn't well defined how far buffer is from the top.
>>
>>57779150

Then why dont you tell me how to put an for into an while so i can start learning the basic?
>>
For one of my CS classes, we have to implement a recursive descent parser in C, C++, or Java. The professor went ahead and wrote one function for us, here it is:
void getoken()
{cin.get(token); cout<<token;
while (token ==' ' || token=='\r' || token=='\n')
{ cin.get(token); cout<<token; }
if (
token>='a' && token <= 'z' ||
token=='{'||token=='}' ||
token=='('||token==')' ||
token==','||token=='$' ) ; //okay
else //input is not a correct token
{ cout <<"\nERROR: unrecognizable symbol in input"<<endl;
exit(1);
} //end if
} //end getoken()


Is this not the most disgusting looking code you've ever seen? I hope he won't be offended that I refactored it into something readable.
>>
https://www.youtube.com/watch?v=LnX3B9oaKzw

Is Haskell useful now?
>>
>>57779537
no
>>
>>57779537
>language with no side-effects
>oops, I can't print to the screen! that's a side effect :(
>no worries i'll just misappropriate some obscure concept from category theory and handle all side-effects in a sandbox known as a.... MONAD!!!!!
>WE ARE READY FOR INDUSTRY :DDDDD
>>
File: bait.jpg (32KB, 400x400px) Image search: [Google]
bait.jpg
32KB, 400x400px
>>57779636
>>
>>57779532
>{ code
>
code; code

>
while()
{}

>
if( /*Blank*/
code)

> ) ;
>
else /*comment*/ 
{
}


Who the fuck learns this way?
>>
>>57779532
your professor is a retard and that is unreadable
>>
>>57779736
college students do

going to college for programming is a scam
>>
>>57779763
No one goes to college to learn how to "program"
>>
>>57779736
Not me, thankfully. I think I'm the only one in the class doing the assignment in C. I'm pretty sure the rest of the class is doing Java since that's the only thing we've used in our classes.

>>57779741
I am worried almost no one at this university can code, not even the professors.

>>57779763
Too bad I only found that out when I was already $25k in debt. I have literally learned nothing useful from my time there. All of my programming experience is from personal projects.
>>
>>57779537
No, but Idris is!
>>
>>57779800
as long as you're learning on your own and reading you'll do better than 99% of the people you are in college with
what you know is more important than your school's name, as long as you can show understanding of programming you're going to be fine
>>
>>57779532
Literally 3 more lines.

void getoken(){
cin.get(token);
cout << token;
while (token == ' ' || token == '\r' || token == '\n'){
cin.get(token);
cout<<token;
}
/* Input check. */
if ( token >= 'a' && token <= 'z' || token == '{' || token == '}' ||
token == '(' || token == ')' || token == ',' || token == '$' );
/* Valid input. */
}else{
/* Invalid input. */
cout << "\nERROR: unrecognizable symbol in input" << endl;
exit(1);
}
}
>>
Which license should I release application (not library) under?
>>
File: last.png (58KB, 1494x624px) Image search: [Google]
last.png
58KB, 1494x624px
Am I safe from crashes yet?
>>
>>57779971
Why didn't he at least use a do-while block?
>>
>>57779971
This is what I ended up with:
void getoken(){
std::cin.get(token);
std::cout << token;

while(token ==' ' || token=='\r' || token=='\n'){
std::cin.get(token);
std::cout << token;
}
if (
token>='a' && token <= 'z' ||
token=='{'||token=='}' ||
token=='('||token==')' ||
token==','||token=='$' );
else{
throw_error();
}
}


I have no idea why he thought it would be a good idea to write code like that, it's only going to confuse people.
>multiple lines on the same line
>"magic" using namespace std with no explanation when most students in our class have never used C
>godawful spacing
>brackets on a different line BUT PUTTING INSTRUCTIONS ON THAT SAME LINE ANYWAY
>>
>>57779971
I'd argue to change the if statement to
if( )
{

}

just to quickly realize what it does later on
>>
>>57780033
import Text.Parsec

token = do
many (oneOf " \r\n")
letter <|> oneOf "{}(),$"


haskell
>>
>>57780140
whoops, I mean "lower", not "letter"
letter would also grab A-Z

this also doesn't cout whitespace but the purpose of that is beyond me
>>
>>57778108
>>57779993
submit a patch to urxvt, or at least send something out on the mailing list
>>
>>57780158
No thanks, I don't care, it's one of the reasons I wrote my own terminal.
>>
>>57779993
no, as long as you're getting new paths don't stop
run it for a few days at minimum
>>
>>57780198
Yeah I heard, thanks for confirmation.

I updated the version since I realized I was using an old one and restarted it, will make it go for a few days on and off.
>>
>>57780175
you clearly tried your issue in their terminal or you wouldn't have known it worked on it
it takes five minutes to write a bug report up, and is for the net good, particularly within a segment of people you probably fit within (given the familiarity with urxvt and st), and especially if you aren't publishing your own terminal's source (yet)
>>
How do I link against a libc besides glibc, like ucLibc?
>>
>>57780225
Generally you want to get a few hundred cycles completed
AFL is really cool, it rips deserialziation implementations apart
>>
>>57780231
I'd rather spend time shitposting than go look for the mailing list and send a report.

I tested in urxvt and st because I was curious to see if they were buggy too, that's all, if they really cared they'd go through the trouble of setting up AFL as I did.

Comparing to other terminals is needed because of many things just being de facto standards.

Also my terminal's source is available.
>>
>>57775863
>last code you wrote
It's on my other computer. Last thing I did was wrote some code to help identify points on an image (of a known object shape, so I can compare aspect ratios and such for other purposes). I learned that lambda expressions are p. cool. I should probably read more into those.
>>
Why won't mainstream languages hurry up and add FP, rather than extremely slowly adding FP features and relabelling them?
>>
File: back_propogation.png (82KB, 824x612px) Image search: [Google]
back_propogation.png
82KB, 824x612px
BUH.
>>
>>57780284

http://www.tldp.org/HOWTO/Glibc2-HOWTO-6.html

>>57780448

Most languages get designed by a committee of some sort, and therefore will always take a while to get features added, functional or otherwise. C# is starting to get more functional features, because Microsoft is more willing to let changes to the standard go through more quickly. Though on that front, it's easier to just use F# and call it good.
>>
>>57780521
is this haskell code
>>
>>57780521
>neural networks
tip top meme my friend
>>
>>57780521
Backprop is just the chain rule + dynamic programming, nigga
>>
File: two_layers.png (138KB, 940x670px) Image search: [Google]
two_layers.png
138KB, 940x670px
>>57780573

No. It's a general description of the procedure for back propagation within an artificial neural network. Also, there's a typo in there somewhere, IIRC.

In theory, I understand all of this. In practice, it's mentally exhausting translating it all into Java.
>>
>>57780647
>Java
why
>>
>>57780665

Because democracy.
>>
>>57780647
>it's mentally exhausting translating it all into Java.
That's because you're using Java.
You got all these long.sequences.of.words.that.javaprogrammer.s.insist.on() to put you completely out of whatever mode of thinking you were in.

printf is far better for staying within your own mode of thinking than system.out.print
Especially when you consider that writing Java without autocompletion is just a pain so you're likely being exposed to a bunch of other words while writing.

Really you shouldn't underestimate how problematic it is.
>>
>>57780685

I don't get it.
>>
>>57780557
>use F#
>call it good
don't kid yourself Ruby
>>
trying to build a bit torrent client.

so far it can kinda get address of peers through httprequests but not dispalying ports.

, (b'92.221.146.192', b'port'), (b'193.77.221.105', b'port'), (b'185.21.217.78', b'port'), (b'187.159.32.144', b'port'), (b'195.154.222.46', b'port'), (b'62.210.251.38', b'port'), (b'109.218.47.171', b'port'), (b'194.177.34.115', b'port'), (b'81.174.168.37', b'port'), (b'213.80.116.240', b'port'), (b'199.241.27.237', b'port'), (b'109.197.193.160', b'port'), (b'195.154.220.14', b'port'), (b'86.246.189.69', b'port'), (b'176.10.194.197', b'port'), (b'2.230.32.72', b'port'), (b'185.21.216.156', b'port'), (b'73.155.120.10', b'port'), (b


hopefully work on it more tomorrow. kinda difficultproject for a noob though.
>>
>>57780859
He's probably going to a Java school and has to do this as one of his assignments.
>>
>>57780859

Class decided on choice of programming language by a vote. Java was decided upon despite Python, C, and C++ also being a choice, and a ranked voting system being used to discourage strategic voting. Java was apparently the most preferred language in the class.

>>57780878

What are your problems with F#, nv?

>>57780889

It's not actually a Java school. I've had assignments in a variety of languages including Python, Java, C, Racket, and even a few in Ada (for my first 2 or so years of university, the introductory language was still Ada. They have since switched to Python). Language choice really depends upon professor and class, and some classes allow us to use whatever language we want. I generally use Ruby in these cases.
>>
>>57781146
his name is invoke
>>
>>57781146
>Class decided on choice of programming language by a vote.

Guess the popular vote isn't all it's cracked up to be. :)
>>
>>57781190
or representative vote
>>
>>57781160

He goes by nv on Discord.

>>57781190

Just goes to show that people have shit taste.
>>
>>57781254
>nv
That's his alter ego.
>>
>>57781146
my main issue is the emphasis on run-time safety, because the language designers gave up a lot of the compile-time safety they could've kept from OCaml. for example, they dropped structural subtyping for objects in favor of C#'s object model, which required giving up most static guarantees for objects, introduced unnecessary casting and reflection, and made more type annotations mandatory. also, the C# APIs just feel awkward as hell to use most of the time
in general, it's not too bad a language, but it feels like it tries to mix too many contrasting ideas for me to like it
>>
>>57781277
how do you use a language without good ad hoc polymorphism
>>
>>57781240

The representative vote was right this time, though. The popular vote showed how little people care about this country. :)

>>57781254
>Just goes to show that people have shit taste.

They could have at least picked C#
>>
>>57781309
What country are you even talking about? India? I don't think his class is that big
>>
>>57781319
>What country are you even talking about?

Don't act like you don't know.
>>
>>57781342
>Java was apparently the most preferred language in the class.
>in the class
>the class
>>
>>57781374

Come on. When I say 'popular vote' I'm obviously alluding to some big election that just happened.

Use that big brain of yours.
>>
>>57781309

C# wasn't an option to vote for. Professor wanted us to all use the same language to make grading easier, but gave us a list of languages she was familiar with, rather than having us program in a language she is unfamiliar with.

Also, the university Linux machines neither have Mono nor .NET core installed, so it is rather uncommon for students to submit assignments in C#.
>>
>>57781418
The elections for UKIP leader?
Glad Paul won desu
>>
>>57781302
lots of memes and autism
>>57781427
I can't imagine having to deal with all those weird Java build systems though. why isn't there just one fucking standard tool for a language that's supposed to be "industry standard"
>>
>>57780448
What's so good in FP that main languages should need to implement FP features?
>>
>>57781484
What language are you using?
>>
File: ring.gif (868KB, 500x500px) Image search: [Google]
ring.gif
868KB, 500x500px
>tfw when wrote all the actual code weeks ago, but can't be fucked with the frontend

where do I meet nu males/homosexuals who can take care of the design side of things for me
>>
>>57781443

>all those weird Java build systems
I just use CMake for Java. It doesn't do uberjars though, sadly.
>>
>>57781438

Nigel Farage is my hero, 2bh
>>
>>57781523

San Francisco and Seattle.
>>
Is C++ OOP-only?
>>
>>57781581
No. In fact you have to go out of your way to use OOP at all in C++.
>>
https://www.youtube.com/watch?v=25u-pp-7PHE

>this is what ruby looks like IRL
>>
>>57781545
I bet she'll still get ant, maven, gradle, whatever {eclipse,netbeans,intellij} use, normal makefiles, etc.
>>
>>57781507
Does that matter?
>>
>>57781623
>>composition (vs javascript)
>choosing to compare to js for composition over haskell

>>57781643
Yes
>>
>>57781623
>fat trans nigger wearing cat ears
>not being laughed off stage

I hate this fucking industry.
>>
>>57781650
>Yes
How?
>>
>>57781699
It might make sense if you tell me your language
>>
>>57781623
My american friends
No more nigger presidents please.
>>
>>57781623
what the fuck is that guy wearing.
>>
>>57781740
don't blame that one on ubungo. That's entirely San Francisco. The only solution to san fran is the final one.

>>57781754
the emperor's new clothes.
>>
>>57781762
Yeah. It needs a final solution or forced secession from the union. Either way works for me.
>>
>>57781736
English
>>
>>57781782
programming language
>>
>>57781778
Personally, I'm hoping for biblical earthquake.
>>
>>57781623

>makes complaint about how Ruby is like Javascript because map is a method and pop mutates an array

Ruby is a purely object oriented language and should be treated as one. Message passing is the abstraction of choice, and method chaining is the native equivalent to function composition.

The pop method is mutable because programmers expect push and pop to mutate the array. Most methods that mutate their data structures have a ! appended to the name to indicate that they are mutable. Ruby has an alternative to pop that does not mutate the array it is called on. That method is :last.

>>57781754

Looks like one of those cat ear hoodies. I have a proper pair of cat ears that reads your brainwaves and twitches based on your emotional response. Bought 'em at Sakura Con on a whim.
>>
>>57781581
Nah. You can write almost pure C in C++. I don't know if there are any caveats, but it definitely requires little to no porting

>>57781594
class MyClass
{
private:
int _x;

public:
MyClass(int x) _x(x) {}

int getx() {return _x;}
void setx(int x) {_x=x;}

};

?????????
>>
>>57781845
method chaining is functional and always will be desu
>>
>>57781820
Fortran
>>
>>57781881
>>go out of your way
struct { int x; };
>>
>>57781897
That's not object oriented though. Objects have functions.

I just made the simplest object I could 2bh
>>
>>57781845
>Ruby is a purely object oriented language
https://ruby-doc.org/core-2.2.0/Continuation.html

I guess Haskell really is the best imperative language ever
>>
>>57775928
I think I know you, család
>>
>>57781881
>getter and setter

encapsulation was a mistake
>>
>>57781881
So I can just start learning things specific to C++ if I'm already familiar with C?
>>
>>57781896
Wouldn't 4tran be great if you could write your own control structures?
>>
Is this page good to get know the C++?
http://www.4p8.com/eric.brasseur/cppcen.html
>>
>>57781933
Pretty much. C++ was originally just a huge library of functions for C. And because of backwards compatibility, they can't remove features, and can only just add them. Meaning original C code can be compiled almost flawlessly. I say almost because I don't know C well enough to say that. But C style coding are considered unsafe in C++. C++ features make it harder to fuck up and easier to write out hundreds of lines of code.

Also I do admit that removing features would be amazing
>>
>>57781995
C is not a subset of C++


Do not think everything that works in C will in C++, especially C11
>>
File: 74355f1ce5.png (16KB, 525x350px) Image search: [Google]
74355f1ce5.png
16KB, 525x350px
>>57775764
Finished adding the favorite option for the player, now I just need to make the queries asynchronous to avoid glitches. IDK if I should use async or some feature of SQLite.
>>
How do you modify a Python list item within a for loop? I want to keep track of scores for the different categories here, but I don't know how to modify the scores list.

board = [yellow, blue, white, green, red]
wagers = [yellow_wagers, blue_wagers, white_wagers, green_wagers, red_wagers]
scores = [0, 0, 0, 0, 0]
total_score = 0

for line, wager in zip(board, wagers):
points = 0
if (wager > 0) or (len(line) > 0):
points = -20

for n in line:
points += n

if wager == 1:
points *= 2
elif wager == 2:
points *= 3
elif wager == 3:
points *= 4

if (wager + len(line)) >= 8:
points += 45

total_score += points
>>
Is K&R a meme or is it the best book?
>>
>>57782379
Best book for what? If you're a beginner and want learn C, C programming a Modern Approach is a better option.
>>
File: Read Website.png (27KB, 797x678px) Image search: [Google]
Read Website.png
27KB, 797x678px
>>57775863
I wrote something to download the sound files off Overwatch wikia. Some didn't download properly, don't know why.
>>
>>57782415
I'm not necessarily a complete beginner, C is my first language though. I "know" pointers, linked lists, basic memory management, etc.
>>
>>57781945
This explains why FP is good not.
>>
>>57782510
Using applicatives and monads you can create your own control structures
>>
>>57782484
what if the website had dynamic content that only loaded after jav script was executed or some other bullshit ?
>>
>>57782544
Then it's not a big deal?
>>
>>57781896

I don't believe you
>>
File: image.png (3MB, 9600x4870px) Image search: [Google]
image.png
3MB, 9600x4870px
I'm not sure how this could be useful but it's almost done
>>
>>57775764
I'm using Python to model chemotaxis, it's our Physics assignment, and it's cool but it's ultimately just using Python as a glorified calculator. I there more the Python than this?
>>
File: 1467570941060.jpg (517KB, 1521x1076px) Image search: [Google]
1467570941060.jpg
517KB, 1521x1076px
>>57782881
distinct lack of anime images desu

maybe the redditors here will like it
>>
>>57782919
Images will be implemented soon. Of course with neural network as non anime filter.
>>
>>57778491
>he doesn't fizzbuzz on /dpt/ for a living
>>
>>57781887

Method chaining is an OO means of performing a typically functional task.

>>57781917

Ruby has several functional features. Nonetheless, the entire type system is designed around OO. Everything in Ruby is an object, even basic integers. All function calls are method calls or method calls on "function objects", like Proc or Method.
>>
>>57783247
That sounds basically like JAVA.
>>
>>57783290
In pajeet-lang, primitives are not objects, which leads to weird inconsistencies in the language.
>>
How do I chose version of C GCC uses to compile my program with?
>>
>>57783412
use the newest version and compile with ansi flag
>>
>>57783412
-std=c11
-std=c99
etc
>>
>>57783430
>-ansi
There is no reason to use that in 2016.
>>
how do i delete an object in python?
>>
>>57783247
>a typically
*a
>>
>>57783469
Memesnek is garbage collected.
Just let it fall out of scope.
>>
File: julia.webm (2MB, 960x540px) Image search: [Google]
julia.webm
2MB, 960x540px
>>57775764
working on a julia morph animation generator at the moment, going to work on doing a mandelbrot zoom generator after
>>
>>57782688
Who knows. Most of the file download properly, 1 or two had no name and no content. (Basically: EMPTY.mp3)
And some just didn't download.. So.. eh
>>
     #define xstr(s) str(s)
#define str(s) #s
#define foo 4
str (foo)
==> "foo"
xstr (foo)
==> xstr (4)
==> str (4)
==> "4"


what if you have

#define foo (2 * 2)


or

constexpr int foo = 2 * 2;


is there anyway you can get "4" instead of "2 * 2"?
>>
>>57783449
does he really need to include both standards? shouldn't c11 be enough?
>>
>>57783576
they were examples. You would only include one or i'm sure it'll bark at you.
>>
>>57783570
so the answer is no

damnit

lol @ this though:

$ cvs -d:pserver:[email protected]:/cvsroot/chaos-pp login 
$ cvs -z3 -d:pserver:[email protected]:/cvsroot/chaos-pp co -P chaos-pp
$ cvs -z3 -d:pserver:[email protected]:/cvsroot/chaos-pp co -P order-pp
$ cd order-pp/example
$ grep -A 6 'int main' fibonacci.c
int main(void) {
printf
("The 500th Fibonacci number is "
ORDER_PP(8stringize(8to_lit(8fib(8nat(5,0,0)))))
".\n");
return 0;
}
$ cpp -I../inc fibonacci.c 2>/dev/null | grep -A 6 'int main'
int main(void) {
printf
("The 500th Fibonacci number is "
"139423224561697880139724382870407283950070256587697307264108962948325571622863290691557658876222521294125"
".\n");
return 0;
}
>>
>>57783570
No. The preprocessor doesn't evaluate anything.
It only works with tokens.
>>
>>57775764
if I open sourced some malware and put it on my github with a disclaimer i.e this is a proof of concept to only be tested on systems you have permission to use it on, legally will I get fucked? UK
>>
is there any good book about design patterns that uses c#?
I've found some but they are too cheap to be good.
>>
>>57783834
>mfw numale liberal arts cucks can't handle CS101

Why would the syntax of a language used for examples in a book about design patterns impact your understanding of them?

I hope you're ready to switch majors.
>>
>>57783904
a cute girl like that wouldn't be so rude.
>>
>>57783290

Java doesn't have shit on Ruby. Ruby's type system was based on Smalltalk. And for what it's worth, it's a hell of a lot less verbose than Java, and you don't technically have to write any classes if you don't want to... although technically every top level function is a method on a singleton object that can only be accessed through the self keyword at top level, which is more or less called main based on the result of calling inspect on the object.

>>57783570

With the constexpr, foo is the integer 4, not the tokens 2 * 2. You could use constexpr functions and some template magic to convert that integer into a string literal. Probably.
>>
>>57783834

Just use a Java design patterns book, and do the example problems in C# instead.
>>
>>57783925
While Smalltalk did indeed influence Ruby, the definition of "object" in Ruby is closer to a mathematical object. Like a monoid:

[2] (pry) main: 0> 1.method(:+)
=> #<Method: Fixnum#+>


Monoids are merely:

class Monoid a where
mempty :: a
mappend :: a -> a -> a

mconcat :: [a] -> a
mconcat = foldr mappend mempty


Which must follow:

(x <> y) <> z = x <> (y <> z) -- associativity
mempty <> x = x -- left identity
x <> mempty = x -- right identity


Ruby seems pretty functional to me. But who knows what Matz was thinking when he created it.
>>
>>57783834
>c#
>good
no
>>
>>57784052
>c#
>not good
>>
>>57783929
I guess I'll have to learn java then
>>
Python replaced BASIC, what will replace Python (2/3)?
>>
>>57784203
Javascript.
Or both of them will die and we all program C
>>
File: 1468457848886.jpg (48KB, 492x449px) Image search: [Google]
1468457848886.jpg
48KB, 492x449px
I hate game programming. Such a stupid list of shit you have to do just for the chance you'll maybe please the customer. I sometimes want to just go back into application development. At least there I get paid to actually make shit for people without something as vague as producing "fun."
>>
>>57784252
that's what someone boring would say
>>
>>57784264
I use to be a fun and loving guy. But then I became a game programmer.
>>
>>57784252
I think you might be getting cucked by your company, you arent supposed to develop the game ideas
>>
>>57784273
Nah, I'm a solo developer at the moment. I outsource music and such but code everything myself. But after several released games, I just sat down and realized how crazy game programming is. And remember that I made a lot more money and used my time far greater when I was just making business apps.
>>
>>57784252
What's so boring about game programming? What's the stupid shit?

Maybe you just don't make cool games?
>>
>>57784299
Menus, timing events, making sure the image pops up at the right time to make it "feel cool." Having sound effects play at the right moment to feel like it isn't artificial. Cutting off and on input while doing transitions, making sure input can only be done at certain moments, etc. The list goes on and on and on.
>>
>>57784291
Yeah I understand, especially when your clients are idiots who don't know what they want. You'd be better off giving em some generic shit with small mods to make it "special"
>>
>>57784325
Clients are retarded on a whole nother level, but at least they give you money continuously for their own mistakes. It's funny that they can reduce a lot of their expenditures if they knew how software development works, but I guess that's what keeps programmers in a job.


But video game programming is the complete opposite. You're making a product that someone may pay for. And if isn't good enough, instead of paying you to fix it, you're using your own time and money to make it "more fun."
>>
what is a good java book for beginners? a book that has an epub version would be appreciated.
>>
>>57784252
Do you use an engine line Unity or Unreal or do you make everything from scratch?
>>
>>57784312
Sounds like everything except the actual game?
But really I wouldn't imagine any of those to be particularly onerous.
>>
>>57784341
I use to do everything from scratch, but I decided to drop my pride and jump onto the Unity train. It's easy to use and C# isn't much different from C++. I would even admit, I like some of the easier syntax and not having to rely on pointers and such.
>>
>>57784350
All of that matters for a good game. Or at least a polished one, is the better way to say it. I might need to change my mindset about game programming and try not to think too much about making it fun, but instead what I know is fun. Maybe I'd find people with similar tastes as me who will want to play.
>>
>>57784351
I don't know what kinds of game you make, but for simple 2d indie stuff I would go with game maker. it's much faster to get things done with it.
>>
>>57784365
I avoid game maker because it can't be ported to multiple platforms. Or rather, it's not a widely supported engine. I just use Unity. I'll likely use Unreal at some point to code up a Heretic clone.
>>
>>57784339
then gtfo the game programming field my man, I personally am writing small RTOS for microcontrollers and I wouldn't have it any other way
>>
>>57784351
But anon, Unity is a shit.

I understand higher level languages are attractive due to being easier but abstraction actually makes them harder to debug.

Honestly try programming in C and keep your games simple.
>>
New thread:
>>57784398
>>57784398
>>57784398
>>
>>57784390
Not yet. It's a challenge I took up to at least study the industry on the development side. If I go back now, I'd bring shame on myself and would have to commit senpaku
>>
>>57784377
>I avoid game maker because it can't be ported to multiple platforms
It actually can, if you buy the export modules.
However, HTML5 games don't work very well, and I've never tried exporting to android, ios or linux.
>>
>>57784430
When it comes to exporting, I've heard nothing but complaints from colleagues who have tried porting to other platforms. And Game Maker also doesnt port to console, which I do like to do now and again. Unity is fine, anyway. It's not complicated to me, and I often consider it a better Game Maker anyway.
>>
>>57784406
lol, you got that issue with finishing things just to be thorough and to not be a quitter, not good tho, you have to be willing to dump and switch things quickly to survive this industry my man
>>
>>57784490
Yeah but a lot of people never make finished projects to begin with, so I like to think Im ahead of the curve. I also know I cant be doing this by myself for too long.
>>
>>57784498
you are, but make a few ones just to get grasp on the languages / tools / methods then switch back to application programming, dont torture yourself like that, good luck
>>
>>57776808
That's still wrong because they're supposed to be unique.
>>
>>57784252
>>57784291
make your own games or get a real job
Thread posts: 336
Thread images: 29


[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]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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 RandomArchive shows their content, archived.
If you need information for a Poster - contact them.