[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: 28
File: 1334682645405.jpg (475 KB, 1024x1076) Image search: [Google]
1334682645405.jpg
475 KB, 1024x1076
Previous /dpt/ at >>51258434

What are you working on?
>>
>>51264585
Thank you for not having a cancerous OP
>>
1st for python
>>
>>51264601
>python was too slow
>>
5th for Go
>>
>>51264635
Go is useless. Check em'
>>
>>51264599
this

This fucking Umaru WebM with quality animation is right out annoying when browsing the catalog.
>>
File: 1430933959150.png (24 KB, 684x737) Image search: [Google]
1430933959150.png
24 KB, 684x737
>>51264656
plus the reddit/code of conduct spam is totally ok
>>
>>51264599
>>51264656
this

>>51264652
no u, kek
>>
Working on my 2D fighting/card game. I think I should work on it a bit more before I talk about the details.

Was working on just a card game, but decided to mix it up. Good code design allowed me to switch the project up with little pain. I just need to put more time into it.
>>
https://gist.github.com/anonymous/01d43a417b5796197768

Made stupid CLI tool that measures how long you can go without using mouse
sudo ./pymousetracker.py /dev/input/event4


Don't really know why...
>>
writing a term paper on any language i choose. must have data types and able to implement stacks

can't be java, ruby, any iterative of c, or lisp
>>
Hello friends
Theoretically how hard is it to build a program to make threads on 4chan? Particularly to force recaptcha v1in the making of new programs
>>
>>51264891
>Theoretically how hard is it to build a program to make threads on 4chan?

easy.

>Particularly to force recaptcha v1in the making of new programs

incredibly hard, probably impossible for most of us.
>>
I'm really just starting out, so I've been working on a simple calculator program.

I've got a question: what kind of IDEs or text editors do you use? If you work with multiple languages, do you use different IDEs or text editors or the same ones?
>>
I've been learning some Qt, is it best to do things programmatically or via the designer?
>>
>>51264933
I use whatever does the job. I primarily work in Visual Studio, but I've worked in a variety of IDE's for different languages.
>>
>>51264852
Take python:

from collections import deque
q = deque()
q.appendleft("e")
q.appendleft("n")
q.appendleft("o")
q.appendleft("D")
print("".join(q))
>>
>>51264891
you could buy a pass for your program and have it shitpost endlessly
>>
>>51265013
We need to reinstate the RMS bot.
>>
>>51265013
or pay $0.7 to solve 1k captchas
>>
>>51264933
I primarily use VIM, as it does the job quite well for most languages. But whenever possible I use IntelliJ (pyCharm, rubyMine, webStorm, etc) with ideaVim plugin
>>
I hate applying for jobs. I feel like I know nothing compared to what they ask for.
>>
>>51264971
make sure you separate the program logic and the user interface. Make it so that you can "plug" any interface to it, be it QT, GTK, CLI, whatever
>>
>>51264933
IDE's are generally tied to specific languages as they rely on specific built in compilers. Text-editors (such as sublime text, VIM, etc) show syntax which helps people program but they themselves can't compile or run programs, they rely on external compilers.
>>
>>51265058
This is how my friends described engineering jobs as;
You go to school and learn all this fucking math, then you get your degree. Once you land a job they teach you the tools you need to do the job.
This is probably similar to programming jobs as you have to learn their codebase
>>
C web server with concurrency
>>
why this doesn't work?
>>
>>51264612
ayy
>>
>>51265149
Can you be a bit more vague please
>>
>>51265164
the enemy just stay there and doesn't move.
>>
>>51265164
why?
is that ok?
>>
>>51265112

You're right, I learnt more about how to do Math then I did how to write programs or go through the entire life cycle of a project, dozens of frameworks and more languages. It's a bit nerve racking and overwhelming.
>>
>>51265180
Because you're a shit "programmer"

Back to >>>/vg/agdg
>>
>>51265180
Is anything actually /calling/ those functions?
>>
>>51265180
put your code in a pastebin
we can't see what's wrong with your code with only this information
>>
>>51265221
sure.

>>51265216
they told me to fuck off.

>>51265222
ok
>>
>>51265180
>>>/vg/agdg
>>>/trash/
>>
>>51265251

Dude, post the code using the code tags instead of screenshotting.
>>
>>51265251
we hereby tell you to fuck off as well
>>
>>51265275
this t᠎bh f᠎am s᠎mh
>>
>>51265291
>this t᠎bh f᠎am s᠎mh
dumb filters gone now?
>>
File: theme.png (241 KB, 1027x769) Image search: [Google]
theme.png
241 KB, 1027x769
>what are you working on

this :^)
gaymes are fun
>>
>>51265338
desu I think so senpai
>>
>>51265274
http://pastebin.com/eb8wdVBx
gamemanager
http://pastebin.com/4EbZRh2W
Enemy
>>
FUCKING FUCK GOD DAMN IT
>>
# -*- coding: utf-8 -*-

from urllib import request
from bs4 import BeautifulSoup

filenames = []

tags = "shiny"

for i in range(0,8*42,42):
response = request.urlopen("http://gelbooru.com/index.php?page=post&s=list&tags=" + tags + "&pid=" + str(i))
page = response.read().decode("utf-8")
filename = str(i) + ".html"
filenames.append(filename)
output = open(filename, "w", encoding="utf-8")
output.write(page)
output.close()

for filename in filenames:
f = open(filename, "r", encoding="utf-8")
infile = f.read()
soup = BeautifulSoup(infile, 'html.parser')

pics = []

for link in soup.find_all('img'):
src = link.get("src")
if src.startswith("http://gelbooru.com/thumbnails"):
pics.append(src.split("?")[0])

for link in pics:
link = link.replace("thumbnails", "/images")
link = link.replace("thumbnail_", "")
try:
resp = request.urlopen(link)
except request.HTTPError:
try:
link = link.replace("jpg", "jpeg")
resp = request.urlopen(link)
except request.HTTPError:
try:
link = link.replace("jpeg", "png")
resp = request.urlopen(link)
except request.HTTPError:
try:
link = link.replace("png", "gif")
resp = request.urlopen(link)
except request.HTTPError:
pass

pic = resp.read()

filename = link.split("/")[-1]
outfile = open(filename, "wb")
outfile.write(pic)
outfile.close()

let me have it
>>
>>51265444
Make those class variables private.
>>
>>51265551
I know about that, but I'm not sharing my code nor making a library.
>>
>>51265568
Doesn't matter, you should follow Java style and conventions when writing Java code.
>>
>>51265568
It's good practice either way. You become a better programmer by applying good code conventions even when they're not required.
>>
>>51265599
>cargo cult programming
C++ and Java are the worst offenders but it's pervasive in the community desu.
>>
>>51265180
I wrote a program like this a few days ago
Good luck, that sin/cos shit is a major pain in the ass
>>
>>51265444
everytime you call drawCircle is just adds a number to x_origin. x_origin is always the same and the number you add to it is always the same. That's why it doesn't move.
>>
>>51265568
Then when you go to fix problems it will be spaghetti code you have to dig through.

But oh well, you won't learn till you make these mistakes.
>>
Riddle me this. I have a data structure that I fill with data, then I push the object into an std::vector, then I repeat the step a bunch of times. Then another function receives that vector (it's actually passed by a reference to the first function to store it), then I iterate over the structure in the second function and all of the members suddenly become empty (as if they weren't initialized), what the fuck is going on?
>>
>you will never have a programming buddy to hang out with
Nobody I know is interested in programming
>>
>>51265678
UpdateCircle* not DrawCircle
>>
>>51265677
>Good luck, that sin/cos shit is a major pain in the ass
high school precalculus is troublesome when you're 15 I know
>>
>>51265682
Have you checked the value each time after adding to the vector. Have you tried stepping through your code with your debugger.
>>
>>51265698
probably you wouldn't agree on what to write anyway, the coolest shit begins with one man
>>
>>51265703
Fuck off its far more complex than that
For example calculating position on an xy plane, storing your desired position in an array and running collision detection from particles on that dynamic object isn't the easiest thing I've ever done

And fyi sin and cos are just functions, without your radian conversions and some way to manipulate them every frame it's meaningless
>>
>>51265678
oh well, it seems using += just give me 20k values.
>>
>>51265751
So difficult!
>>
File: 1443282649703.jpg (696 KB, 1920x1200) Image search: [Google]
1443282649703.jpg
696 KB, 1920x1200
>>51265763
... :)
>>
>>51265444
I don't really know java and I'm tired as heck right now, but I'm pretty sure in your UpdateCircle method, it just sets the enemy to a fixed position. The value of sin(45)*100 is the same no matter how many times you evaluate it. Multiply 45 by some value that's changing, i.e. the timer float. Also don't you want to call the enemy update method in addition to the UpdateCircle method in your gamemanager's update method?
>>
>>51265755
also, changing x_origin to x gives me a linear movement.

what do guys?
>>
>>51265480
Just set utf-8 encoding in your init file senpai.
>>
>>51265798
just use linear movement for now
focus on the bigger picture
>>
>>51265796
shit thanks bro.

>>51265838
nah, the other anon was right.
I just needed a counter that adds itself on each loop.
>>
>>51264585
>no anime image

this is trash. someone make a new thread please
>>
>>51265568
>spics in charge of making gaymes
>>
File: got it working.gif (241 KB, 436x427) Image search: [Google]
got it working.gif
241 KB, 436x427
welp, It took me like 3 days to implement this.
I guess I'm retarded.
>>
>>51265910
Grow up.

>>51265955
Regardless, you did and and now you know more than you did 3 days ago. Congrats.
>>
>>51265952
I'm not a CS college guy.
I learned using youtube anon.
>>
>>51265955
gotta start somewhere
>>
>>51265965
It shows, your code is a mess.
>>
>>51265978
Forgive him, not all of us dream in code like you and I.
>tips
>>
>>51265965
>>51265955
mhmm no youtube looks like a much better education for you, congrats on the sprite moving in a circle
>>
>>51265965
>I learned using youtube anon.
Your first mistake
>>
>>51266009
>>51266001
>Mad because someone actually made progress while you're shitposting about language choices, i++ vs ++i, int* nigger vs int *nigger and weeaboo nonsense.
>>
>>51266001
please no bully

>>51265955
but please fuck off to >>>/vg/agdg
>>
>>51266034
I'm not using unity or GM for this anon.
>>
Can someone recommend a good resource for learning cmake?
I am used to writing my own makefiles and the concept is just strange.
I have to use cmake for a project because it is portable.
>>
>>51266031
with that progress maybe he'll finally be granted promotion to 7th grade, woah!
>>
>>51266082
I learned cmake by looking at this project https://github.com/OpenMW/openmw.
>>
>>51266136
>0.37 will never be released
>>
I hate OpenGL so much...
>>
>>51266134
Progress is progress, regardless of how small YOU think it is. As I said, he knows more than he did three days ago. This is how people get better at something.
>>
File: set.png (34 KB, 491x560) Image search: [Google]
set.png
34 KB, 491x560
>Do I look like I know how 2D blur works


Step one towards an mosaic creator done.
>>
Polybox anon, are you here? Did you finish it yet?
>>
>>51266159
what are you trying to do right now? it gets easier. not easy, but easier.
>>
>implement polynomials as a list of coefficients
>easy to read, write code for, etc
>time to post some shit to /sci/
>decide to write a poly->latex procedure
Let me just say, once and for all, that human conventions for expressing arithmetic is fucking garbage. I could fit three polynomial arithmetic functions doing actual useful shit in the space it takes to make a procedure which properly writes an equation for other people to read.

mind upload when, it's taking way to fucking long, these meatbags are fucking garbage
>>
>>51266001

Go troll somewhere else.
>>
Anyone have that /g/ recommended projects list? I promise I'll save it this time.
>>
>>51266291
https://better-dpt-roll.github.io/
>>
>>51266291
Just use https://better-dpt-roll.github.io/
>>
Let's say I want to do some web scraping with my program. How do I get my program to send the signal to login without physically having the web browser open and having it send keystrokes and then a virtual mouseclick?
>>
>>51266305
>>51266312

Thanks
>>
>>51266325
you send a post request to the form dst
>>
>>51266250
Lighting. GL_LIGHT0 works but when I try to use GL_LIGHT1-7 it fucks up.
That or I missed something about pointlights. But iirc I only need to define a position for that light and do something like:
GLfloat pos[4] = { position.getX(), position.getY(), position.getZ(), 1 };
glLightfv(num, GL_POSITION, pos);

yet all I see is black...
>>
>>51266246
Sir yes sir !
I did several days ago sir, and I posted here

http://github.com/lourkeur/polybox
>>
>>51266395
>yet all I see is black...
that's some deep shit right there
>>
>>51266395
I think it's time to drop all your OpenGL knowledge and learn modern OGL instead of that deprecated crap.
>>
>>51266463
I gave values to GL_AMBIENT, GL_DIFFUSE and GL_SPECULAR, yet... it's dark...
>>
>>51266479
>and learn modern OGL
I have to use this shit for a school project. Rest assured that after I passed the course I don't intend to work again with graphics
>>
>tfw at uni studying economy
>tfw all I do is programming and math
>>
File: 1430386274937.jpg (26 KB, 600x450) Image search: [Google]
1430386274937.jpg
26 KB, 600x450
>>51266514
>economy
nice pseudo-science. I'm sure one of you guys will solve the economic problems of the world
what do you guys use? Matlab?
>>
>>51266514
then why aren't you studying computing and math?
>>
>>51266440
This is all awesome, but
>GPL for less than 200 lines of code
That said, it looks great. Maybe do some benchmarking to see how fast iteration over std::vector<std::unique_ptr> versus std::vector<polybox> actually is in practice.
I also kind of stole your optional<T> wrapper for a project i'm working on.
>>
>>51266506
Are they forcing you to use the fixed pipeline?
Modern OpenGL is actually pretty great.
>>
>>51266582
>stole
then you have to license your project under GPL too, anon
>>
>>51266514
>tfw at work which involves no programming
>tfw all I do is program
>tfw boss knows and now gets me to write things for him and his clients (mostly for data mining)
>tfw coworker wants to use a scraper i wrote and split the money he makes from it
Gotta say, love this job.
>>
daily reminder that gcc is BROKEN

try compiling this with GCC:
int main()
{
int(*){} ayyyy lmao
}


all other compilers fail, but gcc successfully compiles it.
>>
>>51266599
>fixed pipeline
From what I read here https://www.opengl.org/wiki/Fixed_Function_Pipeline I think I am.
I'm using it with glut too
>>
>>51266687
That wasn't the question though. The question was, are they forcing you?
If not, then its your own damn fault for not looking shit up before using it.
If they are, then its their fault for being retarded.
>>
File: IMG_20151109_113921.png (180 KB, 768x1280) Image search: [Google]
IMG_20151109_113921.png
180 KB, 768x1280
Does this mean if I wish to create an app to post on 4chan I am not allowed to do so?

What if I do it without use of the api? Are there any rules for that?
>>
>>51266606
>you have to license your project
muh freedumbs
>>
>>51266325
learn how HTTP works
>>
>>51266654
What the fuck? Why does it work?
>>
>>51266440
that's some lovely code right there
congrats on your project man
>>
>>51266606
He posted the idea of using a union to store data on the stack instead of heap in a previous thread.
That's what i'm using. Its not like ideas can be patented.
>>
>>51266776
Ideas can be patented you dumb fuck
>>
>>51266654
>warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
>>
File: 9780132545235.jpg (25 KB, 400x430) Image search: [Google]
9780132545235.jpg
25 KB, 400x430
>>51266726
>The question was, are they forcing you?
yes they are. Basically we learn the theory behind the procedures and which matrices are being multiplied by what and then we apply those concepts using the respective opengl calls
>>
>>51266737
I assume you're talking about clause 5?
I would take that in the /literal/ sense. Do not clone 4chan exactly. e.g. 4chan archives aren't allowed.
Creating an app is fine.

>>51266795
a warning isn't an error, anon.
no other compiler but gcc compiles successfully. gcc is broken.
>>
>>51266737
>>51266654
stop spreading bullshit, faggots

tst.c:3:10: error: expected identifier or ‘(’ before ‘)’ token
int(*){} ayyyy lmao
^
tst.c:3:14: error: unknown type name ‘ayyyy’
int(*){} ayyyy lmao
^
tst.c:4:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘}’ token
}
^
tst.c:4:1: error: expected declaration or statement at end of input
tst.c:4:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

ok
>>
>>51266839
https://ideone.com/bFPKCS
>>
>>51266814
>still this butthurt about the ++a + ++a
GCC has useful extensions fgt
>>
>>51266795
#include <iostream>

int main()
{
int(*){}

What the heck is going on?
I have no idea!
This must be some silly g++ bug.
I can go on and on.
Where should I stop?

Maybe here? (lalalala)
Or here [2+sillyness]?
What about here?

return 0;
}

still compiles successfully.

>>51266839
what version of gcc are you using? what flags? for me it works with no flags at all.
>>
>>51266862
>using a random website as a proof

>>51266870
>what version of gcc are you using? what flags? for me it works with no flags at all.
tried 4.6, 4.7, 4.8 and 5.1
>>
>>51266802
Well how did you think graphics worked? Of course you need to know about linear algebra and transformations.
Also i don't believe you. I'm sure you can write your own shaders and use opengl 3.x in that class if you ask.
>>
this beginner C++ ebook makes me want to kill myself

void Seat::Reserve(string resfirstName, string resLastName, int resAmountPaid) {
firstName = resfirstName;
lastName = resLastName;
amountPaid = resAmountPaid;

return;
}
>>
>>51266894
>random website
nigga please
>>
>>51266894
This "random" website uses GCC to build C and C++ snippets and this snippet built successfully, that's a proof enough.
>>
>>51266907
Use the learn x in y minutes website
It's great
>>
>>51266894
oh, it works with g++...
well, that's c++ retardation for you
>>
File: Untitled.png (10 KB, 712x223) Image search: [Google]
Untitled.png
10 KB, 712x223
>>51266870
><iostream>
>C
>using no flags ever
>>
why do C++ projects crashes if I there's a compiler missmatch between the libraries and the compiler you use?
>>
new gcc feature!

#include <stdio.h>

int main()
{
printf("line 5\n");
int(*)
{}
New multiline comment syntax! Thanks gcc!
woop
{}
printf("line 11\n");
return 0;
}


http://ideone.com/wj5hxW
>>
>>51266954
stop shitposting, you fucking retard
this is C++14, not gcc
>>
>>51266934
it's a gcc bug for gods sake, the language has nothing to do with it

>>51266945
because the symbol names are different
>>
>>51266954
gcc fakeandgay.c -o fakeandgay
fakeandgay.c: In function 'main':
fakeandgay.c:6:10: error: expected identifier or '(' before ')' token
int(*)
^
fakeandgay.c:8:9: error: unknown type name 'New'
New multiline comment syntax! Thanks gcc!
^
fakeandgay.c:8:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'comment'
New multiline comment syntax! Thanks gcc!


Stop being an idiot.
>>
>>51266964
then compile it in a C++14 capable compiler (excluding gcc, of course)
>>
>>51266967
what do you mean?
why do they change between 0.9 and 1?
>>
>>51266954
I really hope that's a joke.
>>
>>51266989
of course not, it's a feature

>>51266964
ideone.com compiled with "C++ 5.1" (whatever that means), and it still works!
http://ideone.com/t2BBWq
>>
>>51266902
>Also i don't believe you. I'm sure you can write your own shaders and use opengl 3.x in that class if you ask.
Mate I honestly don't give a shit if you believe me or not and I don't think I have a reason to lie about it on an anonymous board. But no, I can't use modern opengl
>>
>>51266977
gcc -std=c++14 -o what what.cpp
$ ./what
line 5
line 11
$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
>>
>>51266977
why would I care?

>>51266967
patches are welcome
you could also try killing yourself for being a retard
>>
>>51267014
http://dictionary.reference.com/browse/excluding
>>
File: p1.png (9 KB, 399x172) Image search: [Google]
p1.png
9 KB, 399x172
Daily [Valid C++] Reminder
>>
>>51266987
the ABI isn't standard so compilers/compiler version can change how it does name mangling and also some functions maybe have change/disappeared

>>51267027
>you could also try killing yourself for being a retard
I'll get right on that
>>
>>51267043
kek
>>
>>51266926
Don't do this.
Zed Shaw is a massive faggot and his C tutorial turns to shit very quickly.
>here's a 200 line program with multiple files and considerable use of structs that we haven't used before
>now copy it and then tell me why it works
>>
File: 1.png (44 KB, 961x325) Image search: [Google]
1.png
44 KB, 961x325
> twf keked by googol
>>
>>51267076
what did you do
>>
>>51267076
4chan app?
Booru app?
>>
>>51267055
ok.
but why this doesn't happen in java or C#?
>>
>>51266902
>>51266902
>I'm sure you can write your own shaders and use opengl 3.x in that class if you ask.
normal schools probably won't allow that
>>
>>51266954
that is not working you shitposter, can we ban this fag
>>
>>51267096
I assume they have a standard defined ABI
but I'm not sure, I don't use those
>>
>>51267076
>not reading google ToS
I remember uploading a remake of Hong kong97 and I was scared as fuck they would ban my account.
>>
>>51267091

wish I knew, they don't disclose that (lel)
>>
>>51267097
I can and do in mine. In fact, there was a class in my uni where fixed pipeline wasn't allowed.
>>
>>51267096
java and C# have their official compilers
gcc isn't the only or the official C++ compiler...
>>
>>51267076
What did you do anon I want to hear too
>>
>>51267129
what is the nature of your app if you don't want to mention it outright?
>>
>>51266954
post it on HN and leddit
>>
>>51267121
>>51267139
the more I learn about C++ the more I see it's just a meme language.
>>
>>51267133
check your privilege
>>
>>51267162
this is a horrible place to be when learning any language
c++ is fine, you're just poisoned by a bunch of NEETs
>>
Writing ghc in prolog
>>
>>51267194
C++ is great if you treat it as C with objects.
Idiomatic C++ is horrible to look at.
>>
>>51267162
It's cool, with relatively small libraries you can do stuff like this
>>51267043
>>
>>51267144

news aggregator based on rss feeds. that wasn't the issue. i have permission from content owners for this.

the retarded thing with google is they auto-moderate and if you're unlucky they auto-ban as well. appeals lead to canned response in > 90% of cases.

i suspect the issue was with my mentioning the names of said content owners in my description, but now i will never know.
>>
>>51267234
Google is a terrible company that needs to be shut down.
>>
>>51266935
nice flags, approved 100%
>>
>>51267234
you know google play isn't the only android store, right?
>>
Reminder that if your language has anything more than a style guide associated with it, it's shit.

Reminder that if your language doesn't have syntactic extension you might as well be using BASIC.

Reminder that Argentina is white.

Reminder that
int a = 3, b;
b = a++ + a++;

is undefined behavior and there is no right answer to what is supposed to happen.

Reminder that Richard Stallman sacrificed his sex life for you.
>>
>>51267298
If it's not on the play store, it might as well not exist.
The only relevant non-google app store is f-droid, and it's only relevant app is adaway because you can't install 1 without the other.
>>
>>51266136
>828 lines for a make file.
You got my attention.
>>
>>51266764
Thanks m8
>>51266786
Might have been ironic, just sayin'.

I'm open to relicensing a bit if it is really too much of a burden. I tried adding a GPL exception for linking the file into a project (LGPL for templates) but it was late in the evening so perhaps I fucked that part up. Hereby granting you the permission to use the quick bool template from ~10 threads ago for WTFever purposes just in case. Lastly, only copyleft licenses protect your freedom
>>
>>51267076
>>51267234
http://pastebin.com/qh6Tta3h
>>
>look at a tutorial implementation of a Stack in Rust
>this god damn pop function
pub fn pop(&mut self) -> Option<i32> {
match mem::replace(&mut self.head, Link::Empty) {
Link::Empty => None,
Link::More(boxed_node) => {
let node = *boxed_node;
self.head = node.next;
Some(node.elem)
}
}
}

Yeah, no
>>
>>51267496
btw, it's not know if this is true. of course google denied this.
>>
>>51264585
int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;


How much is d?
>>
Is there a guide to set up vim as an IDE?
By IDE I mean functions such as refactor (rename a variable or function name and it will change all places it is relevant.
Or functions such jumping to the implementation in from a function.
Or functions such as automatically open files belonging to the project but not the files in libraries.

Most vim tutorials are only covering the basics of how to open and write to a file.
>>
>>51267666
d is undefined.
>>
>>51267666
undefined behavior
>>
>>51267690
uninitialized rather*
>>
>>51267496
>expecting anyone to read all this shit

can someone summarize plz

it reads like some serious click bait
>>
>>51267618
Yuck.
>>
is the switch/case function in java like the if elif in python ?
>>
>>51267666
epic trole
>>
>>51267666
this shit, again...
stop "trolling", this shit gets boring fast

>>51267690
>>51267696
>>51267708
don't feed the troll
>>
>>51267731
it's implemented as an if-else internally, so yeah
>>
>>51267618
So Rust is basically SJW'd C++.
>>
>>51267731
no

if else if
>>
>>51267731
kind of, but not the same
>>
>>51267746
switch/case has many differences compared to if elif you maroon
>>
>>51267672
most of these are questionable behaviors and the fact that you don't think so leads me to believe you should just stick with whatever ``IDE'' you're already using
>>
Anyone know why am I losing UTF-8 support on one of these lines?
I'm still not used to Haskell types.

Using HDBC.Sqlite3

main = do
conn <- connectSqlite3 "test.db"
r <- quickQuery' conn "SELECT * FROM testTable" []
let stringRow = convRow $ head r
disconnect conn

convRow [_, _, sqlDesc] = fromMaybe "nothing" (fromSql sqlDesc)


It's either in the quickQuery' or in the convRow function (fromSql), but I'm not sure what to change. HDBC supposedly has unicode support, I wasn't expecting having to change anything.
>>
>>51267780
not really
switch case is just a very specialized version of an else-if structure
>>
>>51267812
only if breaks are implicit
>>
>>51267812
>very specialized
that's what makes it different

and you don't have fall-through in else-if
>>
File: Rplot04.png (6 KB, 521x350) Image search: [Google]
Rplot04.png
6 KB, 521x350
R coin flip simulator

# coin flip
#

res <- vector(mode = "integer")
z <- 5;

while ((z >= 3) && (z <= 10)) {
print(z);

coin <- rbinom(n = 1, size = 1, prob = 0.5);

if (coin == 1) { # random walk
z <- z + 1;
} else {
z <- z - 1;
}

res <- c(res, as.integer(z));
}

plot(x = seq_along(res), y = res,
type = "o",
xlab = "Trial #", ylab = "Value of z");
>>
>>51267796
what's the type of that "nothing"?

whenever you're manipulating text you should prefer Text over String (performance) or ByteString (those are for binary data, not text)
>>
>>51264585
Finished my first program which prints the current time to standard output.

main(_) {
_^448 && main(-~_);
putchar(--_%64
? 32 | -~7[__TIME__-_/8%8][">'txiZ^(~z?"-48] >> ";;;====~$::199"[_*2&8|_/64]/(_&2?1:8)%8&1
: 10);
}
>>
>>51267849
#!/usr/bin/env bash

date
>>
>>51267863
Top kek
>>
>>51267666
6+7+8+9+10+11+12+13+14+15+16+17 = 138
although I get 139 when I run it...
why?
++c should increment c and return it. right?
>>
>>51267908
Because the compiler puts the extra 1 for good luck.
>>
>>51267908
it's undefined behavior in C/C++ and the compiler may well tell you to go fuck yourself
>>
>>51267840
have to learn a little bit of R for my time series class, can you actually build usefull things with R beside short scribt that analyse economic funktions ?
>>
>>51267908
++c returns the value after it's incremented
c++ returns the value before it's incremeneted
(it's backwards)
>>
>>51267959
No, that's all that it was designed for.
>>
>>51267958
If it was undefined, then the program would abruptly stop with a run time error, just like when using integer division with 0 as the divisor. This doesn't cause a run time error, so it is defined. You're just stupid.
>>
>>51267847
Text.
I changed it a little to debug
convRow _ = "unexpected result öÖöë"

And it's displaying the umlauts correctly.

I think the problem is here

r <- quickQuery' conn "SELECT * FROM testTable" []

Doing :t quickQuery' it says

:: IConnection conn =>
conn -> String -> [SqlValue] -> IO [[SqlValue]]

So I think the query itself is returning the row as a string and putting that inside the SqlValue.
>>
>>51267908
The compiler used a 1-based array for your array of ++ operations, which is why there is one extra.
>>
>>51268012
HERPA DERP DERP
>>
>>51267791
>questionable behaviours
Why exactly?
Refactoring rather than search / replace makes it much safer and since I am bad at naming things.
Opening a lot of files in tabs is not bad behavior either unless you have no resources left on the system.
Jumping from a function call to where the function is implemented just saves time and makes it easy to see how the function is implemented / what the parameters is needed.
The reason you use an IDE is mainly to read code.
Vim seems to agree with that since most vim is not optimized for inserting text.
>>
>>51267908
foo():
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movl $5, -4(%rbp)
addl $1, -4(%rbp)
addl $1, -4(%rbp)
movl -4(%rbp), %eax
leal (%rax,%rax), %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %edx
addl $1, -4(%rbp)
movl -4(%rbp), %eax
addl %edx, %eax
movl %eax, -8(%rbp)
movl -8(%rbp), %eax
movl %eax, %esi
movl std::cout, %edi
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
nop
leave
ret
__static_initialization_and_destruction_0(int, int):
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
cmpl $1, -4(%rbp)
jne .L4
cmpl $65535, -8(%rbp)
jne .L4
movl std::__ioinit, %edi
call std::ios_base::Init::Init()
movl $__dso_handle, %edx
movl std::__ioinit, %esi
movl std::ios_base::Init::~Init(), %edi
call __cxa_atexit
.L4:
nop
leave
ret
pushq %rbp
movq %rsp, %rbp
movl $65535, %esi
movl $1, %edi
call __static_initialization_and_destruction_0(int, int)
popq %rbp
ret
>>
>>51268089
>AT&T
>>
>>51268024
You might be accidentally extracting from the
ByteString
constructor and
B8.unpack
-ing it. Try pattern-matching manually and using
Text.Encoding.decodeUtf8
instead
>>
>>51268105
foo():
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], 5
add DWORD PTR [rbp-4], 1
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
lea edx, [rax+rax]
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add edx, eax
add DWORD PTR [rbp-4], 1
mov eax, DWORD PTR [rbp-4]
add eax, edx
mov DWORD PTR [rbp-8], eax
mov eax, DWORD PTR [rbp-8]
mov esi, eax
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
nop
leave
ret
__static_initialization_and_destruction_0(int, int):
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], edi
mov DWORD PTR [rbp-8], esi
cmp DWORD PTR [rbp-4], 1
jne .L4
cmp DWORD PTR [rbp-8], 65535
jne .L4
mov edi, OFFSET FLAT:std::__ioinit
call std::ios_base::Init::Init()
mov edx, OFFSET FLAT:__dso_handle
mov esi, OFFSET FLAT:std::__ioinit
mov edi, OFFSET FLAT:std::ios_base::Init::~Init()
call __cxa_atexit
.L4:
nop
leave
ret
push rbp
mov rbp, rsp
mov esi, 65535
mov edi, 1
call __static_initialization_and_destruction_0(int, int)
pop rbp
ret
>>
File: test2.jpg (4 KB, 531x249) Image search: [Google]
test2.jpg
4 KB, 531x249
Anyone know matlab? I want to crop this black square and save it as a new pic. I pasted this code together from stuff I found online. I identified the black square, how can I save it as an image itself?

img = imread('test2.jpg');
bw = im2bw(img);
imshow(bw)
% find both black and white regions
%stats = [regionprops(bw); regionprops(not(bw))]
stats = [regionprops(not(bw))]
%stats = [regionprops(bw)]
% show the image and draw the detected rectangles on it
imshow(bw);
hold on;
for i = 1:numel(stats)
rectangle('Position', stats(i).BoundingBox, ...
'Linewidth', 3, 'EdgeColor', 'r', 'LineStyle', '-');
end
>>
>>51268140
Fuck that black square man, you can do better than that.
May I suggest a blue square?
>>
>>51268089
this is what I mean.
Line 6 and 7 both increments the value (I am assuming c)
Shouldn't it only be incremented once?
the rest still makes sense.
>>
>>51268140
Basically take the part you wish and put it in a new variable.
http://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html?nocookie=true
>>
>>51268194
Racist shitlord, do you even read the CoCs?
>>
>>51268140
last time I used it gave me cancer, sorry
>>
let fn = lambda () 3;
New top-level name: fn : (<none> -> <long>)
{
let fn = lambda () 3;

}
: (<none> -> <long>)
generating...
rettype: 0x24f2a10
types: 0
; ModuleID = 'main'

define void @sequence() {
main:
}

define i64 @lambda() {
main:
ret i64 3
ret i64 ()* @lambda
}


Why is llvm not closing the BasicBlock after the first ret? Is there a way to pop it off the builder?
>>
>>51268109
Thanks, it wasn't that. It was me being an absolute retard.
I had added all the values to the database from the Windows terminal. So I tried dumping the contents to a .txt and it was a mangled mess.

I wrote a test db from an .sql file and the code works fine. Feel like an idiot.
>>
>>51268303
oh, the windows terminal

does that shit still exist?
>>
C# question

There is a 3rd party .Net assembly that has global functions. How do I access them from C# code?
>>
File: ass.png (177 KB, 1037x1211) Image search: [Google]
ass.png
177 KB, 1037x1211
>>51268203
there are 13x
add    DWORD PTR [rbp-4], 1
but only 12x ++c

it's still valid output because of the undefined behavior. might even be intentional because the GCC guys are such language lawyers
>>
>>51268012
>If it was undefined, then the program would abruptly stop with a run time error
lrn2compiler
>>
>>51268373
add the assembly as a reference, then use the library as you would normally use the inbuilt classes
>>
Simple question, interested in getting some other opinions. I am helping at a college open day to sell the computer science department and thought it would be nice show some simple programs to get people interested. What stuff do you think people would like to see? I have already done fizzbang, a higher lower game and something which reverses a string. Other ideas?
>>
>>51268443
pong
tornado text
fappy bird
>>
>>51268391
Well I'm already doing that. I simply can't access global functions. They are not located under the namespace while the documentation mentions them. I can access all other available classes and instantiate them.
>>
>>51268477
in the ferences list, right click the assembly, and click View Object (or something similar)
it takes you to a listing of the assemblies loaded
expand your assembly, and you see all the namespaces.
expand the namespaces, and you see the classes.
>>
>>51268443
mandelbrot explorer
>>
>>51268443
Porn organizer.

VR animu sex simulator.

An interactive degeneracy test that tells you how much of a trap loving faggot you are in cortana's voice.
>>
>>51268443
>fizzbang
>higher lower game
>something which reverses a string
You're not going to get anyone interested with that, unless you're trying to keep it super simple to explain the code?

Even then, get a cool complex program to show them what they can do in the future if they join. Hell, pull a bait and switch and show them something really difficult that not even you can understand, if they ask about it tell them they wouldn't get it yet.
>>
>>51268443
make a program that renders things like this in realtime:
https://www.youtube.com/watch?v=r54bdCeY3AE
https://www.youtube.com/watch?v=EGFRBa6946I
https://www.youtube.com/watch?v=5_Nt-qG3CWs
>>
File: 1426618990258.gif (2 MB, 211x213) Image search: [Google]
1426618990258.gif
2 MB, 211x213
>>51268443
>fizzbang
>>
>>51268071
>Refactoring rather than search / replace makes it much safer and since I am bad at naming things.
Refactoring support is not bad for refactoring code in a "project" (whatever that means). It doesn't refactor comments. Search and replace is good at updating comments while you refactor in a single file, but can't do anything across libraries where naming could be all over the place depending on the language.

>Opening a lot of files in tabs is not bad behavior either unless you have no resources left on the system.
It's a sign that you have a spaghetti design that was enabled by an IDE. This is one of the many reasons IDEs are considered harmful even though every single one of their features are actually good.

>Jumping from a function call to where the function is implemented just saves time
There is no way for a text editor to know this since in some languages a function can be declared multiple times but defined only once and the language offers no resources for locating a definition.

>Vim seems to agree with that since most vim is not optimized for inserting text.
We will disagree on this point, but it doesn't really matter. Either you agree with the philosophy behind writing code in such editors so you use them or you don't so you don't use them. I have nothing against IDEs for good code but there is no question that they also are terrible enablers for shit code to still be maintainable due to their enhanced feature set over otherwise robust text editors.
>>
>>51268374
Wow, people are actually discussing the trollcode!
>>
>>51268374
It also happens when I just increment twice.
I don't see how this is undefined behavior though.

if you call a function twice in the same line, each call is executed as they were called one by one.

#include <iostream>

int inc(int &c){
return ++c;
}

int main(){
int c = 5, d;
//d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;
std::cout << d << '\n';
c = 5;
d = inc(c) + inc(c) + inc(c) +inc(c) +inc(c) +inc(c) +inc(c) +inc(c) +inc(c)+inc(c) +inc(c) +inc(c);
std::cout << d << '\n';
}


The second returns 138 as expected.
But adding the last bit also made the first bit print 138...
I don't see why.
>>
>>51268616
>It doesn't refactor comments.
uh, visual studio can refactor classes and comments
>>
Why the fuck are we still discussing this
>>
>>51268626
>I don't see how this is undefined behavior though.
try reading the standard sometime
>>
>>51268459
Solid stuff

>>51268568
Kek'd

>>51268587
I wanted simple stuff, the course is aimed at complete beginners, I wanted to ask people how they thought you could solve the problem then explain it to them after, anyone that can solve something harder is already in a different course.
>>
>>51268603
this t᠎bh f᠎am

if you're able to
Thread replies: 255
Thread images: 28

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.