[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: 355
Thread images: 41

File: K&R himegoto.jpg (159KB, 500x700px) Image search: [Google]
K&R himegoto.jpg
159KB, 500x700px
old thread: >>52890835

What are you working on, /g/?
>>
first for C
>>
2nd for java best language
>>
3rd for memes
>>
File: jlqXtAA.jpg (168KB, 1920x1080px) Image search: [Google]
jlqXtAA.jpg
168KB, 1920x1080px
As I said before right after this was posted:

>tfw babby finally set up his first dev environment.

Wish I'd have done CS instead of IS now probably. When I picked IS, I didn't care for programming, because the only thing I tried was HTML and CSS on Codecademy and got bored in like five minutes.

Then I got interested in Information Security, Networks, Servers, pentesting, etc. So I picked IS of course. Then I did Python on Codecademy and was like this is sweet, so I started learning JavaScript and C and C#. Now I don't even read about Information Security or sysadmin stuff anymore.

I'm sure I'll get back into it when we learn that stuff in uni, but for now I guess I'll just learn C. Only problem is their is no project or goal I have in mind, literally only learning to learn.

Thanks for reading my blog.
>>
Dynamic typing lets you shit in the streets.
Garbage collection lets you shit in someone else's streets.
>>
File: 1454469292606.png (378KB, 1450x1080px) Image search: [Google]
1454469292606.png
378KB, 1450x1080px
>>52897542
You might wanna try one of those, although they're not that interesting either.
>>
>>52897581
I could do the unit converter in Python or JavaScript. Don't know how to in C or C# yet.
>>
200 lines of C, all to draw a triangle in opengl

I want to rotate the triangle and do fun things with it, but every tutorial requires glm, which is C++ only.
Maybe in a few days I can learn enough openGL to make a spinning cube.
>>
>>52897618
oh well too bad cus you're doing the minesweeper in C
>>
>>52897636
Aight senpai
>>
>>52897633
You can just use a rotation matrix I think. Dunno how you've set it up of course.
>>
File: hb.jpg (95KB, 600x600px) Image search: [Google]
hb.jpg
95KB, 600x600px
>>52897652
How new are you senpai?
>>
>>52897652
wow baka desu senpai
>>
>>52897652
>frog
>writes senpai instead of fa
>>
>>52897652
>being this much of a senpai
embarrassing desu senpai
>>
>>52897652
The 4chan admin, Hiroyuki, is a racist, he doesn't like people talking using black slang.
>>
>>52897652
wow you're new desu senpai cuck
>>
>>52897633
just make the bottom two points move closer and further away from each other you dummy

tada, you have a rotating triangle. now go and learn algebra (for real this time) to do cool things with stuff like this.
>>
>>52897652
dumb frogposter
>>
>>52897786
dang, get your shit together f͏am
>>
>>52897786
step up senpai
>>
>>52897812
...how'd you do that.
>>
Dear /dpt/,

I have this integer in C#
And I want to change its individual bytes without affecting the whole integer
What is the best way of doing this?

To be more clear:
My integer is 0x4488AAFF and I want to change the 88 to another byte
>>
>>52897887
f͏ != f
>>
>>52897925
0x4488AAFF-0x00880000+0x00XX0000
>>
File: 02-10-11-52-16.png (13KB, 420x327px) Image search: [Google]
02-10-11-52-16.png
13KB, 420x327px
>>52897925
I think this is the only way to do it man, definitely no other way around it.
>>
>>52897978
this
the compiler will be able to optimise this the best
>>
>>52897215
kill yourself
>>
>>52897925
you could also do:
(0x4488AAFF & 0xFF00FFFF) | 0x00XX0000
>>
>>52897987
not sure if serious
>>
File: 1388583148347.jpg (62KB, 572x800px) Image search: [Google]
1388583148347.jpg
62KB, 572x800px
>>52898034
Well, the compiler certainly can optimize constant values the best :^)
>>
i'm so fucking bored
>>
File: 1438895468905.png (14KB, 640x480px) Image search: [Google]
1438895468905.png
14KB, 640x480px
rate my super cool(not) c++ skills
https://github.com/7Y3RPXK3ETDCNRDD/dungeon_generator
>>
>>52897925
You're using the wrong language nigger.
>>
>listened to mastered for iTunes music
>then try to listen to pleb mastered music
>it sounds like utter shite
people are bad and they should feel bad
>>
>>52897979
That's how I do it but setting the individual bytes that way surprisingly is very slow

>>52898018
0x00XX0000 isn't a byte though
>>
File: 02-10-12-11-28.webm (3MB, 1024x700px) Image search: [Google]
02-10-12-11-28.webm
3MB, 1024x700px
Quadtrees are for suckers
>>
>>52897668
test
Hiroshima
Nagasaki
baka
desu
senpai
thot
nigga
>>
>>52898118
>That's how I do it
what the fuck nigger the guy must've been joking

look into boolean algebra, bitwise operations work on the same principle but with multiple bits at a time

you do it like

i = 0x4488AAFF;
i &= 0xFF00FFFF; // i = 0x4400AAFF
i |= 0x00XX0000; // i = 0x44XXAAFF


or

i = 0x4488AAFF;
i ^= 0x00880000; // i = 0x4400AAFF
i ^= 0x00XX0000; // i = 0x44XXAAFF


or

i = 0x4488AAFF;
i ^= 0x00880000 ^ 0x00XX0000;


use your imagination
>>
>>52898165
>you do it like
*you can do it like
>>
>>52898165
or

i = 0x4488AAFF;
i |= 0x00FF0000; // i = 0x44FFAAFF
i &= 0xFFXXFFFF; // i = 0x44XXAAFF
>>
Im going to ask again sorry, but what do i use to compile .as files into a .swf file?
>>
>>52898165
>>52898186
I don't get it
How am I supposed to use 0x00XX0000 when I only have XX
>>
>>52898202
XX << 4
>>
>>52898201
Better question is why are you still using flash?
>>
>>52898118
0xXX<<16?
>>
>>52898209
XX << 16
>>
>>52898202
use a shift
A=(int)XX << (8*n) where n is the byte

also, you really should know how this stuff works
>>
>>52898210
>f͏
requirement for a project. I dont like it but the closest ive got is flashdevelop and the website seems to be down
>>
File: 1426955668069.jpg (9KB, 300x250px) Image search: [Google]
1426955668069.jpg
9KB, 300x250px
doing a c++ program wich is going to use a postgres database, can't find enough info about libpqxx and libpq++, what should i use? at the moment i am using libpq++ and compiling tells me there is no library, shouldn't the library have installed while installing postgres (i am on ubuntu)
>>
File: output3.webm (271KB, 800x608px) Image search: [Google]
output3.webm
271KB, 800x608px
>>52897649
>>52897684
I feel like there should be a better way of doing this, but I don't know linear algebra, like at all.
>>
>>52898288
apt-get install libpq-dev
>>
>>52898313
Looks good to me, mane.
>>
>>52898313
It's cool because it looks like it's rotating at first but then you notice that it's just closing in and then reopening but then you think it's rotating again etc.
>>
>>52898236
>>52898224
>>52898218
That worked, thanks

public byte R
{
get { return (byte)((Value_Int32 >> 0) & 0xFF); }
set { Value_Int32 ^= (value << 0); }
}
public byte G
{
get { return (byte)((Value_Int32 >> 8) & 0xFF); }
set { Value_Int32 ^= (value << 8); }
}

public byte B
{
get { return(byte)((Value_Int32 >> 16) & 0xFF); }
set { Value_Int32 ^= (value << 16); }
}

public byte A
{
get { return (byte)((Value_Int32 >> 24) & 0xFF); }
set { Value_Int32 ^= (value << 24); }
}


About 66% faster than the FieldOffset way
I have no idea why
>>
>>52898346
God C# is fucking disgusting
>>
File: 1444284553053.gif (3MB, 400x225px) Image search: [Google]
1444284553053.gif
3MB, 400x225px
God bless stackoverflow
>>
>>52898354
Tell me what language you use, I need a good laugh.
>>
>>52898314
thanks but it still fuck ups with compilation, i've tried running ldconfig but it doesn't do muc, i am quite a retard about using non standard libraries, i am supposed to add something more to g++ test.cc?
>>
>>52898365
Javascript
>>
>>52898365
logo on rails
>>
Kile is totally fucked for Windows. What do you guys do to write LaTeX?
>>
>>52898365
visual PL/I
>>
>>52898385
post errors
>>
>>52898365
I speak poo in loo
I manage the Indian hordes to write my software bidding.
They say that if you get a monkey on a typewriter it'll eventually write Shakespeare.
So theoretically I should be able to get them to write excellent code by managing a lot of them in parallel.
>>
>>52898354
You haven't seen anything yet
dib_col32[idx_dib] = *((COLOR32*)&pm_col24[idx_pm]);
dib_col32[idx_dib].A = 255;

This is how I set an RGBA color array using an RGB color array in C#
...strangely the FieldOffset way gives me 10000+ fps here and the bit shifting only 8500
>>
>>52898415
it's the usual error due to library missing:
libpq++.h: No such file or directory
>>
Why are ANSI NULLs a thing? This seems like a horrible setting to have on.
Why the fuck would no value NOT equal no value?
>>
>>52898055
thank you for a star anon
>>
>>52897215
nice meme book
>>
>>52898428
find -type f -name libpq++.h

then compile as g++ -I/whateveritreturnedhere/ test.cpp -lpq
>>
File: you-dont-say.jpg (19KB, 500x280px) Image search: [Google]
you-dont-say.jpg
19KB, 500x280px
>>52898354
the claim that C# is clean, simple and elegant is one of the biggest memes on here
>>
>>52898505
i mean find -type f -name libpq++.h /
and test.cc
>>
>>52898514
No it isn't

it doesn't even come close to 'dynamic typing is convenient'
>>
File: 02-10-13-12-08.png (62KB, 625x848px) Image search: [Google]
02-10-13-12-08.png
62KB, 625x848px
>>52898514
Show me another language where you can write the same functionality and it'll look as clean.
>>
>>52898159
Are the word filters back?
>>
>>52898519
thanks for the help but while looking around i found out that libpq++ is becoming kinda obsolete due to libpxx so i just rolled in with that, everything works now, by the way find couldn't find shit and i think it might be because i am on ubuntu 15.xx or something, thanks for the help anyway
>>
>>52898612
OCaml
>>
File: wZEzZW0.png (44KB, 867x694px) Image search: [Google]
wZEzZW0.png
44KB, 867x694px
>>52898612
Even this hastily thrown together sack of shit I wrote to demonstrate something to someone is relatively clean and readable.

Nothin' beats good old C#.
>>
File: Capture.png (22KB, 669x379px) Image search: [Google]
Capture.png
22KB, 669x379px
>>52898612
My code tends to look like vomit sometimes
>>
Social App for Android. It's gaining a lot of interest. It's my first App and a solo project at that. I've been making steady progress, I'm learning a lot.
>>
>>52898764
>Social
>App
>>>/out/
>>
>>52898772
Get social, idiot.
>>
File: 1313969637486.jpg (31KB, 313x286px) Image search: [Google]
1313969637486.jpg
31KB, 313x286px
>>52898778
>Socialising
>>
>>52898778
Missed his chance.
>>
>>52898612
lmfao that looks fucking disgusting kill yourself
>>
How do trainee positions at startups hold up in your CV compared to bigger companies?
>>
File: welp.png (18KB, 513x328px) Image search: [Google]
welp.png
18KB, 513x328px
>>52898698
Let's not forget that you can also easily extend it.

Since I'm working on a game though, I don't use Linq (IEnumerable is dogshit for performance), I use custom data structures, even my own List<T>.
>>
>>52898866
>Linq
Yes, it's fucking useless.
>>
>>52898866
much of what you're doing is probably dogshit for performance

http://codeblog.jonskeet.uk/2014/07/16/micro-optimization-the-surprising-inefficiency-of-readonly-fields/
>>
>>52898899
>clean
>simple
>elegant
>all these fucking "features" that you aren't even supposed to use
>>
>>52898901
Yeah, no. Resharper sets those fields to readonly for me.
>>
>>52898921
ok? lol @ u
>>
>>52898899
>Linq
>Useless

How is it?

It has a use, and that use is in the name "query".

Maybe you should look up the definition of "useless"
>>
>>52898932
>query
>being a normie pleb CRUD codemonkey
>>
>>52898913
We're talking about the language itself, not the features of the framework. Linq is a library, not a feature.

>>52898930
You said that most of what I'm doing is dogshit for performance, by pointing out a completely redundant thing.
>>
>>52898935
Yeah I'm building my queries with string concatention and without mysql_real_escape_string. Feels good man.
>>
>>52898937
just because resharper does it for you doesn't mean it isn't inefficient. why are you even using a dictionary, hashset, schemelist? and top kek how you Csharts act all high and mighty about your type inference but you still have the shit in >>52898612
>>
>>52898932
You're confusing the famework under namespace System.Linq which is not a part of LINQ, and LINQ itself, which is the DSL only.

LINQ is just the possibility to write
SELECT ljkdkl j FROM djkdfjk
>>
>>52898935
>Being this much of an elitist
How's the view that far up your own arse?

I use Linq to quickly, easily and succinctly pull things from enumerable objects, what part of that is so egregious to your delicate sensibilities?
>>
>>52898949
>MySQL_real_escape_string
>not MySQL_srsthistime_escape_string
>>
>>52898969

>not MySQL_srsthistime_nokidding_escape_string
>>
>>52898952
What in the actual fuck are you talking about?
Why am I using things that do the job in a good way for what I'm trying to accomplish?
What are you actually saying here?
>>
>>52898968
Very thesaurus post my man. I'm impressed.
>>
>>52898987
Nice counter argument you fuck.

I was raised speaking another language entirely, I only started learning English later on. I'm sorry that the very words I use are so offensive to your fragile little psyche.
>>
File: 02-10-13-54-32.png (26KB, 653x368px) Image search: [Google]
02-10-13-54-32.png
26KB, 653x368px
>>52898754
I can kinda relate to this, I've been downloading and categorizing all the webm's from /gif/ for the past few months.

This code is a mess though.
>>
>>52899014
Sounds like you were raised on cocks too.
>>
File: 1336768215191.png (76KB, 441x411px) Image search: [Google]
1336768215191.png
76KB, 441x411px
>>52899022
6/10 for effort.
>>
>>52899022
kek
>>
>>52899022
BTFO
>>
>>52898980
i'm just saying your game has dogshit performance compared to what it would have in a language like C++ or even in C# if a more competent programmer had made it
>>
>>52898901
>>52898921
You could have Name and Amount be properties with private setters to achieve the same effect without the overhead of readonly. Also, the problem with Linq is mostly Linq, not IEnumerable. Writing your own data structures is not a very good practice. Are you making a game? If so, if you're doing it right, iterating through lists is not going to be your bottleneck.
>>
>>52899049
And how did you come to that conclusion?
That code is being called between 1 to 5 times at most per frame.

That dictionary isn't a framework class either, so you couldn't possibly know how it actually works.
>>
>>52899085
kill yourself idiot

keep believing your C# shit is so efficient and the pinnacle of performance

>inb4 it's some 2d artsy fartsy pixel game
>>
>>52899100
When did I ever fucking say that, All I ever said is that IEnumerable is bad for performance, THAT'S LITERALLY THE ONLY TIME I MENTIONED PERFORMANCE.
>>
>>52899113
and all i ever said is that IEnumerable isn't the only thing that brings down the performance of your game
>>
>>52899125
What I've said is that since I am working on a game, I'd rather not use IEnumerable because it's not as efficient as raw arrays.

>IEnumerable isn't the only thing that brings down the performance of your game
How is that related in any way, obviously there are a lot of things that come into consideration, especially data locality. But how any of that is related to what I've said? Did I ask you for advice? Did I complain that I am getting bad performance?

There's no point arguing with you, you're trying to prove something when there's nothing to prove.
>>
>>52899085
>>52899113
He has a point. Being a cunt about it, but still. The fact that you're using your own data structures in itself evidences that you are not as experienced as you'd like to believe. Micro-optimization is a common antipattern. The standard containers are effective enough when used correctly. In a well-coded game, you should rarely have to fully iterate through a large container on a per-frame basis. Containers should never be your bottleneck. Your optimization efforts should be focused on your game code.
>>
File: lines.webm (3MB, 1221x835px) Image search: [Google]
lines.webm
3MB, 1221x835px
Was kinda bored so I made this oscillating line-image filter thingy in processing. Each line is added on a click. How does it look? Any advice?
>>
>>52899188
The .net List, has a lot of unnecessary checks, if the list is of structs, there is no way to fast clear it, where you can just set the max index of the list to 0 and ignore all the data contained in it. There are version checks in the .net List. There is also no way to iterate over all the objects and clear them at the same time.

>The fact that you're using your own data structures in itself evidences that you are not as experienced as you'd like to believe.
That's a redundant claim without actually knowing the thought process or reasoning for the things I'm doing.
>>
>>52899257
Kinda neat, I suppose.
>>
I want to start learning one of these code
C, C++, or C# which is best?
>>
>>52899257
post code
>>
Despite how much I hated OSX and hated working with it, I really liked the idea of .app containers, so I made something similar for Linux:
http://pastebin.com/a0aFcm1a

[user@arch ~]$ ls -R test.app       
test.app:
app.conf bin lib res

test.app/bin:
a.out main.c makefile

test.app/lib:
lib.c liblib.so makefile

test.app/res:
nigger.txt program.conf
[user@arch ~]$
[user@arch ~]$ cat test.app/app.conf
bin=bin
res=res
lib=lib
exec=a.out
[user@arch ~]$
[user@arch ~]$ cat test.app/bin/main.c
#define _XOPEN_SOURCE 600

#include <stdio.h>
#include <stdlib.h>
#include <linux/limits.h>

void foo();

FILE *res_fopen(char *path, char *mode)
{
char abs_path[PATH_MAX];
snprintf(abs_path, PATH_MAX, "%s/%s", getenv("APP_RES"), path);

return fopen(abs_path, mode);
}

int main(int argc, char **argv)
{
printf("APP_ROOT = %s\n", getenv("APP_ROOT"));
printf("APP_BIN = %s\n", getenv("APP_BIN"));
printf("APP_RES = %s\n", getenv("APP_RES"));
printf("APP_LIB = %s\n", getenv("APP_LIB"));

FILE *fp = res_fopen("program.conf", "r");

for (int c; c != EOF; c = getc(fp))
putchar(c);

fclose(fp);

fp = res_fopen("nigger.txt", "w");
fwrite("Hello world", 1, 11, fp);

fclose(fp);

foo();

return 0;
}
[user@arch ~]$
[user@arch ~]$ open test.app
APP_ROOT = /home/user/test.app
APP_BIN = /home/user/test.app/bin
APP_RES = /home/user/test.app/res
APP_LIB = /home/user/test.app/lib
blah=1
lol=2
faggot=45
This is from a shared library in a .app container
[user@arch ~]$


>inb4 >app
>>
>>52899287
Three different tools that are best used for many different reasons.

What do you want to do? Why do you want to learn one of these languages?
>>
>>52899290
call it something other than app
>>
>>52899316
Like?
I can't think of a short and simple name.
>>
>>52899302
I don't know the reason, i think it could be useful someday
>>
>>52899321
prg?
>>
Does anyone know of any neat API's to play with?

I'm looking for something to build around, I can't think of anything useful so I'd love it if someone knows of any interesting or useful API's.
>>
>>52899333
nah
>>
File: 1407942768495.jpg (475KB, 852x973px) Image search: [Google]
1407942768495.jpg
475KB, 852x973px
>>52899287
Learn C it's the base. It will make you understand how the other languages work on the inside.

Also learn Lisp and Haskell. The order is not important.
C will teach you procedural programming.
Haskell will teach pure functional programming.
Lisp can teach you all paradigms, including object orientation.
>>
>>52899287
C++
>>
>>52899335
.nah
>>
>>52899288
It's not as commented as I'd like because I just threw it together.

import java.util.ArrayList;

Vector linePositions = new Vector(0, 0);

PImage img;
ArrayList<Line> lines = new ArrayList<Line>();

void setup() {
img = loadImage("mingus.jpg");
size(1207, 800);
}

void draw() {
background(122, 122, 122);
for (int i = 0; i < lines.size(); i++) {
lines.get(i).update();
lines.get(i).display();
}
}

void mousePressed() {
int rand = int(random(0, 2));
if (rand == 1) {
linePositions.x += 15;
lines.add(new Line(15, linePositions.x, 1));
} else {
linePositions.y += 15;
lines.add(new Line(linePositions.y, 15, 0));
}
}

class Line {
ArrayList<Vector> history = new ArrayList<Vector>();

Vector position;
Vector speed = new Vector(10, 10);
Vector direction = new Vector(1, 1);

int dir;

Line(int x, int y, int dir) {
this.dir = dir;
this.position = new Vector(x, y);
}

public void update() {
this.history.add(new Vector(this.position.x, this.position.y));


if (this.dir == 1) {
this.position.x = this.position.x + (this.speed.x * this.direction.x);
} else {
this.position.y = this.position.y + (this.speed.y * this.direction.y);
}

if (this.position.x > width - 15 || this.position.x < 15) {
this.direction.x *= -1;
}

if (this.position.y > height - 15 || this.position.y < 15) {
this.direction.y *= -1;
}

if (this.history.size() >= 100) {
this.history.remove(0);
}
}

public void display() {
noStroke();

for (int i = 0; i < this.history.size(); i++) {
fill(img.get(this.history.get(i).x, this.history.get(i).y));
rect(this.history.get(i).x, this.history.get(i).y, 10, 10);
}

}

}

class Vector {
int x, y;

Vector(int x, int y) {
this.x = x;
this.y = y;
}
}
>>
>>52899262
I know. I've worked with C# for a very long time. Those things are trivial in the scope of a well-coded game, and making your own data structures sacrifices interoperability that just ends up costing you elsewhere. The effort you would spend making them is better spent in your game code, which is bound to be where your actual bottlenecks lie. It's a matter of priority. And while I don't know your reasoning, I don't really need to because this tenet is essentially universal. Please don't misunderstand my tone; I'm not trying to be a dick, just trying to help you out.
>>
File: Untitled3084908.png (51KB, 1920x996px) Image search: [Google]
Untitled3084908.png
51KB, 1920x996px
I'm starting to love LDAP. Initially it was hard to set up, but now it's running great.
Just got dynamic VLANs with radiusprofile to work, so I'm integrating it in the interface.
One day I'll have it finished and have a full open source Active Directory-like system running on Linux, complete with decent management tools.
>>
>>52899322
C# is extremely useful in most business environments, as many offices are mostly using the full Microsoft stack(Active Directory, SQL Server, Exchange, etc.). Working with these things is a breeze in C#. Same goes for rapid scripting and app devving from a sysadmin/BI standpoint.

C++ is the gold standard for baseline app dev and video game programming. Lots of jobs and things to do with C++, an easily marketable skill.

C is very low level, and frankly won't be of much use to you unless you're planning on pursuing a career as a low-level dev. Think drivers, game engines, OS components, etc.

Take what I say with a grain of salt; I'm biased towards C# because it's my favorite to write in for many reasons, and I use it almost daily for my job.
>>
>>52899342
is this processing ? looks like java
>>
>>52899373
keep going
>>
File: complexity.webm (2MB, 1205x796px) Image search: [Google]
complexity.webm
2MB, 1205x796px
>>52899257
This guy here. I was fucking around a bit more and tried something that made an interestingly complex looking pattern from something simple. I really like how this looks for some reason.

>>52899427
It's processing, which builds upon Java. You can use java libraries etc, it's just that Processing has some "in-built" features that make it good for visual programming.
>>
>>52899342
It's Processing, right?
>>
>>52899334
Anyone? ;_;
>>
File: 1445133759360.jpg (144KB, 708x664px) Image search: [Google]
1445133759360.jpg
144KB, 708x664px
>>52899461
neat. do it with pepe pls
>>
Is it normal to not really understand code that I'm reading until I've ran it?
>>
>>52899482
- Twilio - send SMS super easy
- Slack.Pipe - Connect any API data to Slack
- Tumblr
- Flickr -> Search through user Flickr content, contacts, upload or replace photos.
- Facebook APIs -> For ads, games, payments, login, sharing stats, and user data.
- Dropbox API-> Allows your app to sync files and data with Dropbox, giving you access to the Dropboxes of over 300 million global users.

infinite possibilities
>>
>>52899410
This is based on what's requested on job listings. If you learn Programming with C++ you learn that despair and chaos is the natural state of being (spoiler: it's not).

C is much more useful for learning and understanding purposes than C++ and C# are.
If you want to understand programming follow this guide: >>52899336
>>
>>52899524
not at all.

what can't you understand? loops ? if-else?
>>
>>52899524
depends. if it's some gigantic C or python clusterfuck then it's normal to not bother even trying to read it
>>
File: virustotal.png (23KB, 1018x381px) Image search: [Google]
virustotal.png
23KB, 1018x381px
A file scanner.
Detects file changes in specified folders and then proceeds to send file hashes to virustotal.com for a quick report. The x/y on the status column tells how many anti-virus products think it's a malware.

VirusTotal does provide an API for this sort of thing, but it only accepts 4 queries per minute, so I just made it mimic a browser for unlimited queries. Cheapskates.
>>
>>52899542
C is not necessary to be a good programmer.

C is more likely to frustrate someone trying to self-learn, as they won't be able to do anything consequential for a very long time.
>>
>>52899545
I understand their functionality, I usually miss a few things in the loop that are happening until I've ran it.
I guess it's because I'm skimming the code and not actually reading it.
>>
>>52897215
A 4chan thread downloader written in D.
>>
How do you use an enum defined in a class (as public) in another class?

I introduced it in the other class header file with "enum Colors;" and then included the header in the source file.

Then I used it like a datatype. It didn't work.

Then I added Class::Colors in the class that uses it but it still doesn't work.
>>
>>52899578
>D
post source
I just like reading D
>>
Give me a project to do immediately. I will do it in C and report back.
>>
File: pepe.webm (920KB, 705x643px) Image search: [Google]
pepe.webm
920KB, 705x643px
>>52899511
Here you go. I found some other weird effects it can give, I'm playing around with it more.
>>
>>52899576
without running the code, what is the output? (No, the output is not 20).
#include <stdio.h>
int main()
{
int a = 1;
switch (a) {
int b = 20;
case 1:
printf("b is %d\n", b);
break;
default:
printf("b is %d\n", b);
break;
}

return 0;
}
>>
>>52899573
The same can be said of C++. You'll be spending most of your time figuring out how to compile third party libraries, their dependencies and their dependencies' dependencies, etc. rather than actually getting anything useful done. And when a new version comes out or you need to set up a new computer it's the same shit over again. This is true of both C and C++ though.
>>
>>52899604
A S-Expression parser
>>
>>52899628
That's why I'd recommend C#, Python, or Java to a new programmer.

They can start doing things within a month or two of learning, and they all have a good amount of jobs later on.
>>
>>52899619
>declaration after switch but before any case statements
Never seen that before. Is it legit or is this just going to return an error?
>>
>>52899619
why is that b declaration in the switch? Also, the output is 0, i guess.
>>
>>52899602
I intend to, but it's not up yet. When it's reasonably releasable I will put it on github. It's already pretty much fully functional though. Just needs a bit more polish and repository cleanup. I will probably upload it fairly soon.

It currently supports thread merging (to retain deleted posts) only for 4chan and Tinyboard-compatible boards but it should be easy to add support for others by adding new parsers.
>>
>>52899604
Use this API to pull in movies and randomly replace a word with 'penis'.

http://www.omdbapi.com/
>>
>>52899648
Agreed. With those you can actually get stuff done.
>>
>>52899648
starting with that stuff means people won't understand what's actually happening in their program and in the memory, good way to becomg code monkeys of the worst kind
>>
>>52899604
infix to lisp converter
bonus: pretty print it
>>
>>52899684
Starting with using a computer means you won't understand what actually happens. A good starting place is manually welding transistors on a circuit board so that you truly understand how a CPU works so that you can begin to learn the basics of x86 and eventually x64.
>>
>Try to really understand big O notation because that's the fundamentals and if you can't even do that, you're kinda screwed.

Is this true?
>>
>>52899587
ANYONE?
N
Y
O
N
E
?
>>
>>52899619
One says b is 0, the other says
 prog.cpp: In function 'int main()':
prog.cpp:7:14: error: jump to case label [-fpermissive]
case 1:
^
prog.cpp:6:13: error: crosses initialization of 'int b'
int b = 20;
^
prog.cpp:10:9: error: jump to case label [-fpermissive]
default:
^
prog.cpp:6:13: error: crosses initialization of 'int b'
int b = 20;
^
>>
>>52899684
Unless you're writing an OS, device drivers or some super low level ultra-performance critical library you shouldn't have to deal with memory directly anyway. You're better off with a language that manages that automatically unless you're working with one of those things.
>>
>>52899628
>some sort of library hell
LITERALLY on Windows and Linux you don't need to compile anything. If you do need to compile, I've never had an issues compiling. Do you even build-essential and cmake?
>>
>>52899684
Nice meme, faggot.

This is only spouted by the people who were forced to learn C in their CSCI101 class.

Yes, C has many uses. No, most people don't need or want to use C.

You can still learn good programming practices without learning C.
>>
File: 1407245925810.png (305KB, 640x974px) Image search: [Google]
1407245925810.png
305KB, 640x974px
>>52899648
>and they all have a good amount of jobs later on.
Where they write the most shit code that will ever come in existence without having a clue about anything, simply approaching all situations with trial and error and build big fuckups that I'll have to clean up for them later. No thanks.
>>
>>52899744
I'm not sure if you're trolling at this point.

You can write perfectly fine code in any high-level language without ever touching C.
>>
>>52899763
Perfectly fine code != a good program. You can write perfectly fine brainfuck.
>>
File: ree.webm (707KB, 705x643px) Image search: [Google]
ree.webm
707KB, 705x643px
Do not ask for whom the bell tolls,
it tolls for ree.
>>
>>52899776
Dumb frogposter.
>>
>>52899770
You can write a perfectly fine program without ever touching C.
>>
>>52899770
>it doesn't matter if the code is good, if it's not written in C it's shit
?
>>
>>52899654
in C is the declaration when you give it a type or when you give it a value?

my professor (who claimed he help design yacc) told me it was when you give it a type...
>>
>>52899786
You won't ever write a good program without having programmed in a strictly-typed, imperative-oriented, non-object-oriented language. Those are you Cs
>>
>>52899792
He's right. You can define a variable in almost all languages without giving it any value, mostly for making sure you don't try to declare/use a variable that you meant to use for something else. It's like saying, "Listen bud, we're gonna have a variable named B somewhere down the line; I don't know what we're gonna use it for, or what will it contain, but we're declaring, that there is already a variable called B."
>>
>>52899797
Forgot to add: and manually memory managed.

There's a good saying: "you can get java to run fast - until the first garbage colleciton"
>>
>>52899728
Except usually you do, unless you are using Visual C++ (and the same version as the library) since all the different compilers have different output formats.

On a *nix system you can probably get a long way using the built in package manager if it happens to have development packages for everything you need and they aren't horribly outdated... but that's still a lot of ifs. Overall it's just a pain in the ass no matter what and it will all result in a tangled mess of dependencies that will take hours to reproduce on any new system and more so if it's been a while since you did it, or aren't the original creator of the software.
>>
Say I have two variables. Both are arrays, one of strings and one of ints.
The contents of the int array is a product of the string array. They are both the same length, the int array is just a numerical representation of the string array.
Now the key here is that the int array is reliant on the string array. You can set the string array, but you can not set the int array.

What is the good way to do that? In this case I am using C# and currently using the string array setter to set the int arrays content. But no matter the language, or whether you use setters or SetVariable(), it feels like the wrong thing to do. Like, you expect setting one variable will not affect the contents of another variable.
Code wise this is fine, it compiles fine and it runs fine. There are no errors. My question is if it makes sense?
And if not, how else would you model a one way, two variable dependency?
>>
>>52899711
HELLO?
E
L
L
O
>>
>>52899815
so isn't "declaring" b in the code we're speaking of OK?
but giving it a value is bad?
>>
>>52899439
Thanks, anon. I will.
>>
>>52899842
Both are okay. You can declare a variable without giving it a value or you can give it a value right at the declaration.
>>
>>52898360
God bless Jeff! God bless Joel! The greatest faggot-gift to the computing since Alan himself!
>>
>>52898422
>theoretically
Kindly do the needful.
>>
>>52899859
how the hell do I access the 20 it was given then? printf seems to always print 0.
>>
>>52899797
This is patently false.
>>
>>52899890
End the function with "return b" instead of return 0.
>>
>>52899833
So your int array is basically cache for string parsing? It should be single variable with three methods Set(), GetAsString() and GetAsInt(). Make a new class and hide both arrays inside. Or even better, store only ints, parse them in setter and make a getter to convert them into strings. But that depends on your use case.
>>
>>52898698
import Control.Monad.State

testData = [("Wood", 69), ("Iron", 420), ("Steel", 666)]

main = evalStateT loop testData
where loop = forever $ do
liftIO $ putStr "Enter resource name: "
name <- liftIO getLine
currRes <- gets (lookup name)
liftIO $ putStrLn $ case currRes of
(Just amount) -> "Found " ++ show amount ++ " " ++ name
Nothing -> "No such resource."
>>
>>52898630
not sure what you mean
but ##4..6 were replaced
>>
>>52899730
i didn't start with c, but i think most people will just take what happens on higher level languages at a face value without thinking what's happening beneath it, not saying you should take 10 years of training in assembly while getting raped by monks
>>
>>52899901
Also, declare b outside the switch.
>>
File: 1453375103204.png (105KB, 250x252px) Image search: [Google]
1453375103204.png
105KB, 250x252px
Making a digital version of the card game "Super Fight" with my friend in Java.
>>
>>52899901
I know I'm new to C and have only been programming for a year or so but I feel so retarded. Or I'm being trolled.

I change return 0 to return b but b is declared in the switch statement. returning b within the switch does nothing either, and I still continue to get 0.
>>
>>52899890
Is this the code you're talking about? >>52899619
You can't declare b inside of switch like that. First case begins only after it.
>>
>>52899939
>most people will just take what happens on higher level languages at a face value without thinking what's happening beneath it
You're absolutely right, but there's nothing wrong with that.

I don't have to give a fuck about what all the little circuits mean on the motherboard to build a great desktop from parts.
>>
>>52899903
Yeah, that seems like a good solution.
>>
File: asd.png (22KB, 718x540px) Image search: [Google]
asd.png
22KB, 718x540px
>>52899833
Something similar to this? Whipped it up in a minute.
>>
>>52899955
> b is declared in the switch statement

There's your problem, you don't really get how a switch works. Switch statements only care things that are in their cases, that's what they're for. Do as I said in >>52899941
>>
>>52899964
nothing wrong if you want to be a code monkey wich writes 0(2^n) shit
>>
>>52899833
What's the end goal?

I'm whipping up something similar, but maybe not exactly what you're asking for.
>>
>>52899963
well that settles it then. well at least it was a learning experience thank you

>>52899977
k
>>
>>52899334
I don't have a thermometer
but knowing the temperature /outside/ is relevant_to_my_interests.jpg
so I'm polling Weather Underground site and displaying it on the page

you might wanna try, too
>>
>>52899987
>it's impossible to not write O(2^n) in any language but C
>>
>>52899987
Yeah, because you need C to understand algorithmic complexity you absolute mongoloid.
>>
>>52899373
as a general advice, posting your name (or any identifying information) on this here wretched hive of scum and villainy that we all learned to love is generally considered A Bad Idea

unless it's the Dutch version of John Q. Public

in which case, goed gedaan
>>
>>52900009
>>52900022
i said that you need to understand what's happening beneath higher level languages to be a better dev, not that you need to learn C, if being a dev wich has absolutely no idea of what's happening because "shit just works in my java class" it's ok to you i am fine
>>
>>52899971
I want to avoid using structs because the usage areas only ever need one or the other, not both bundled together.

>>52899993
Storing excel columns in the format that excel uses for the user of the program, and in a 0 based index for the program to be able to use in loops. GUI logic is completely separated from function, so you only ever need either the label or the index. Never both. And for performance reasons this can't be evaluated every time it's called.
>>
>>52900047
Your implication was that developers who write solely in C# or Java literally cannot understand basic algorithm complexity and good programming-performance practices.

Fuck off.

C is not necessary to write good code and good programs.
>>
>>52899482
>>52899535
also, take a look at Zapier/IFTTT for more examples
>>
>>52900069
i said that most peole that started and solely use higher lev languages will tend to learn less and produce lower quality stuff, if you keep having a tantrum about this C meme i'll let you
>>
>>52900087
>>52899987
>nothing wrong if you want to be a code monkey wich writes 0(2^n) shit
>>
>>52900060
Is there a reason you can't just call .Length() on the index of the entry you want?
>>
>>52900060
Are you sure you don't want to use the struct solution?
In the end the memory usage will be exactly the same, if not a little bit less because you don't need 2 separate arrays.

Also the performance will be exactly the same or slower by such a small margin that you literally won't care. Since the struct size is only 8bytes if you compile it for 32, or 12bytes (which is aligned to 16 I think) if you compile it under 64.

You won't really experience more cache misses when iterating for the int values, and iterating over the strings wouldn't matter either way.
>>
>>52899684
>good way to becomg code monkeys of the worst kind
Hey, just curious - where do you work, what do you do, what's the working conditions (including salary)?
>>
File: question.png (11KB, 635x468px) Image search: [Google]
question.png
11KB, 635x468px
>>
File: python.png (297KB, 596x596px) Image search: [Google]
python.png
297KB, 596x596px
>>52899648
>python
>>
>>52899935
Why the state monad? It would be much simpler without.

import Control.Monad

testData = [("Wood", 69), ("Iron", 420), ("Steel", 666)]

main = forever $ do
putStr "Enter resource name: "
name <- getLine
putStrLn $ case lookup name testData of
(Just amount) -> "Found " ++ show amount ++ " " ++ name
Nothing -> "No such resource."
>>
>>52899841
class myclass {
public:
enum foo {
value
};
};

int main () {
myclass::foo foo (myclass::value);
return (int) foo;
}
>>
>>52900161
>c style type casting
Absolutely disgusting.
>>
>>52900153
OneClass::EnumType enumInstance = OneClass::enumvalue;
>>
>>52900153
>>52900161
JFYI, you can declare properly namespaced enums outside classes:
class enum Foo { foo, bar };

int main () {
return static_cast<int>(Foo::bar);
}


I don't think there is a reason to declare one inside class, if you gonna use it outside.
>>
File: 6m9H0fK.png (52KB, 805x1265px) Image search: [Google]
6m9H0fK.png
52KB, 805x1265px
Post semen operator fizzbuzz
>>
>>52900155
>hurr durr i am confusing implementation details with the actual programming language.

>no multiline lambda in python
http://ideone.com/XB2hEM
>>
>>52899670
I decided to do this one. I got up to replacing the word and decided to give up. Was fun though.
>>
File: pips.jpg (14KB, 400x400px) Image search: [Google]
pips.jpg
14KB, 400x400px
>learning node.js
>decide to go on github to take a look at some node.js projects
>barely able to comprehend what the fuck is happening
>barely able to understand what the fuck im looking at
>so many this
>yfw you know your fucked
It wasn't like this when I was learning python/c
what the fuck is this
>>
>>52900490
                });
});
});
});
});
>>
>>52898313
>I don't know linear algebra, like at all
you won't get far
>>
File: 1448304848051.png (92KB, 444x440px) Image search: [Google]
1448304848051.png
92KB, 444x440px
>>52900490
>>
>>52900507
that bothers me the least desu senpai
>>
>>52899573
>C is not necessary to be a good programmer
csscucks actually believe this
stay pleb
>>
>>52900526
I'm learning this currently because somehow I made it this far without ever realising it was important.
>>
is Javascript code compiled/interpreted by the browser as needed or does it compile all the code as soon as the webpage loads?
>>
>>52900602
https://stackoverflow.com/questions/7501520/how-do-browsers-parse-and-interpret-javascript-code
>>
>>52900602
yes
>>
>>52900490
Did you learn Javascript and then try to jump straight into node? because Node at this point is effectively a DSL that encourages you to further fuck its shit up.
>>
>>52900821
>Did you learn Javascript and then try to jump straight into node?
got to the middle of eleqjs and started learning them simultaneously
>because Node at this point is effectively a DSL that encourages you to further fuck its shit up
what do you mean by this?
>>
>Ansible/Salt
>YAML
Holy shit who thought this was a good idea? Why is deploying shit so much hassle on Linux?
>>
>>52900120
Yes, "AB" has the same length as "CX" but the columns are very far apart. Also, it requires evaluation every time it's called, which I want to avoid.

>>52900129
I already have something that works, it's not the solution I'm looking for. I'm just wondering about the optimal way to go about implementing a weird variable relationship like this and have it be in a sane way. Where it's reasonable to the user of the class that one variable is dependent on the other. Best answer so far is to simply only have one Set function and two Get functions, an implied internal state of sorts without exposing the variables.
>>
>>52900925
>deploying shit so much hassle on Linux
as opposed to? isn't deployment a hassle everywhere?
>>
>tfw you will never be as great of a programmer as Mark Zuckerberg
>>
what's the easiest way to learn linked lists in c?
>>
File: 1426535295607.jpg (47KB, 400x337px) Image search: [Google]
1426535295607.jpg
47KB, 400x337px
>>52901115
No?

Deploying complex shit on linux properly you'll need to learn both Ansible and Puppet; both which require you to learn their DSL and the languages their written in because good luck writing modules in YAML.

>Thing you depend on isn't compiled with xmlrpc for some fucking reason, gotta compile that shit
>Down the rabbit hole we go because everything is so out of date but your vendor doesn't support Debian so your stuck with CentOS

Meanwhile on Windows:

>PowerShell and .exe's
>That's literally fucking it
>Even custom DSC resources are written in plain simple PowerShell
>>
>>52901136
more accurately
>you will never be programming at a time where simply knowing PHP and some html will land you a job
>>
>>52901316
>Tfw you have to be a really great programmer who has been programming for many years to make a really creative programming application these days
>>
>>52898313
you should learn how to use your world matrix.

if you are not into linear algebra, you should really stop learning low level graphics programming
>>
>>52901340
>notch
>great programmer
>>
>>52901340
>no degree and even if I take cs it will take me 4 years to complete
>4 years of who knows what will happen to the market
>tfw you missed the golden age of startups and making easy money
>>
File: 1455112021628.jpg (99KB, 600x744px) Image search: [Google]
1455112021628.jpg
99KB, 600x744px
Smelly dumb ratposting scum.
>>
Syncing repo for another day....
Fuck people commiting on github in the night...
>>
>>52901298
>windows
>deployment
hahahahahaha; no really, what "complex shit" do you deploy on windows with powershell and dsc? iis? anything else? hahaha, what a joke
>>
>>52901298
>Meanwhile on Windows:
>>PowerShell and .exe's

Meanwhile on Debian:
>bash and .deb's

Meanwhile on RH:
>bash and .rpm's
>>
>>52901379
>>tfw you missed the golden age of startups and making easy money
fuck off, it's always the same with shits like you
1990+:
>tfw you missed the golden age of DOS utilities and making easy money
2000+:
>twf you missed the golden age of crappy Win32 shareware and making easy money
2010+:
>tfw you missed the golden age of "web-apps" and making easy money
2020+:
>tfw you missed the golden age of VR and making easy money

a loser's always a loser
>>
>>52901603
>Stateful configuration management
aka
>I've never managed anything outside of localhost or a $5 vps
>>
>>52901682
>.exe's
aka
>it worked on my machine when I right clicked "run as admin"
>>
>>52901706
You realize .deb's are functionally identical to .msi's right?
>>
>>52900490
My friend, don't buy into a

MEME
E M
M E
EMEM


language
>>
>>52901340
>>52901379
Better late than never.
>>
>>52901718
You realize you can't run .deb's on windows right?
>>
File: 1429234426637.jpg (50KB, 570x473px) Image search: [Google]
1429234426637.jpg
50KB, 570x473px
>>52901537
PDM and CAM software m8

shit is DOS tier retarded.
>>
>>52901741
>meme
Node has a lot of jobs open for people who don't have degrees, don't really care how meme it might be labeled on /g/.
>>
Anons, I can't get motivated enough to work on anything. My 30 day vacation starts today and I feel like I'm gonna waste it on Netflix and 4chan. Help.
>>
>>52901790
>Job for a non-degree

there's another meme
>>
>>52898313
use a matrix in the shader you fucking fuck

use cpu transformations very sparingly
>>
>>52901790
>Node
>people who don't have degrees
that sums up its quality
>>
>>52901816
you're an idiot, m8
>>
>>52901831
YOU are an idiot fuck you fucking tard
>>
>>52901837
you're brain damaged? that would explain a lot
>>
>>52901820
>>52901813
If the pay is more than the average income for my age, cba not going in for it before pursuing higher education
>>
>>52901848
how am i an idiot? fucking retard
>>
File: tipping-intensifies.gif (141KB, 287x344px) Image search: [Google]
tipping-intensifies.gif
141KB, 287x344px
>>52901849
>>
The only money in programming now is Web applications but we all know programming in Javascript, Php, and all those scripting languages with HTML and CSS is no fun. I have made quite a lot of money using them but I am not having fun using them
>>
>>52901876
>memes are bad
>literally posting a meme
post some green frogs with the deformed bald paper-white man please
>>
>>52901849
the job won't be around in 10 years

you won't learn any useful skills

the job won't mean much on a resume
>>
JS question:

I have a series of if statement nested within a function that takes "amount" as a parameter. Each if statement checks the value of "amount", and calls a function, passing "amount" as an argument to this function. This function then changes the value of "amount".

function callLibrary(amount) {
if (amount > 3) {
amountChangerOne(amount);
}
if (amount > 2) {
amountChangerTwo(amount);
}
//etc.
}

// Example of an amountChanger
function amountChangerOne(amount) {
amount = amount - 1;
}


The issue I'm having is that it doesn't appear to be the same "amount" variable that is being passed through the callLibrary function. "Amount" could pass multiple if checks, but it seems that the functions within are working on their own versions of "amount".

So, it's not like amount passes the if statement for amountChangerOne, then is modified, then we check if it passes the if statement for amountChangerTwo, etc. Instead, it seems like the one type of "amount" value is run through callLibrary function, and then the functions that work on "amount" are called after that series of checks.

At least, that's how it appears to me. Anyone have any ideas?
>>
>>52901902
fuck off to >>>/g/wdg are you trying to raid us or something
>>
>>52901854
you don't know what you're talking about, that makes you an idiot
>>
>>52901902
>amountChangerOne
Top enterprise m8.
>>
>>52900490
kill yourself
>>
>>52901899
do you even mention jobs that you worked for less than a year 10 years ago? are you fucking serious you mongoloid?
>>
>>52901902
>>52901921
l2into AmountChanger.prototype.doItFeg = function...
>>
>>52901919
you're the one who doesn't know what you're talking about you fucking shitter

you're a fucking joke if you do any significant amount of vertex transformations on the cpu when you could be doing them in a shader you fucking turd
>>
>>52901902
Post full code and I will do your homework for you
>>
>>52901929
how will that benefit me?
>>
>>52901934
>flipped 2 burgers back in '03
>>
>>52901921
This is example code, not the actual source.
>>
>>52901949
kill yourself fag
>>
>>52901911
fite me m8
>>
>>52901934
10 years ago? He said around for ten years. You are retarded aren't you.
>>
>>52901970
no u
>>
>>52901961
Post full code and we can help to see where you are making wrong error
>>
>>52901961
See
>>52901911
You're a fucking moron if you can't figure it out by yourself Pajeet.
>>
>>52901975
kill yourself

>>52901981
kill yourself
>>
>>52901945
>homework
This is a personal exercise, school is not a place I have the luxury of attending

The full thing is overly long/utilises closure, etc. This example version is more easily digestible
>>
>>52901976
define around you retarded cunt? If you want to play the dumb card I might as well say he meant 12 years you disgusting dweeb
>>
>>52901944
>spewing drivel
easy, anon, you might trigger an aneurysm
you're an idiot and you should come to terms with that
>>
Anyone know why requests.get() finishes so slow on google?


In [2]: %timeit requests.get("https://google.com")
1 loops, best of 3: 4min 15s per loop

In [3]: %timeit requests.get("https://google.com", timeout=2)
1 loops, best of 3: 4.85 s per loop

>>
>>52902012
either you're doing some really epin shitposting/trolling or you're delusional and buttmad that you're going to have to refactor all your shit in your shitty little pixel art gaym
>>
>>52901986
can you demonstrate how to do that? not sure I follow
>>
>>52902017
>>>/wdg/
>>
>>52901985
not him, but every time I see someone talk mad shit about webdev language problems, they're never able to step forward and provide the solution

its all meme-tier tribal chest-beating

>ME OOKOOMLOOPUM OF C PLUS PLUS TRIBE
>YOU EVIL JS DEVIL
>>
>>52902017
KILL YOURSELF

>>>/g/wdg
>>
>>52902027
Thanks kind anon!
>>
>>52902023
>have to refactor
>shitty little pixel art
>gaym
what the fuck are you talking about, mentally challenged kid? did you forget to take your pills today? did mommy forget to leave them on the counter?
>>
>>52902031
EVERYONE PLEASE DON'T TELL THE WEB DEV FUCK THE ANSWER

>they're never able to step forward and provide the solution
the solution is easy as fuck you tard, you're just trying to trigger our autism so that we'll spoon feed you the answer
>>
>>52902052
>elitism over language syntax

once again we see assertions in action

walk the walk, etc.
>>
>>52902050
you still haven't explained why i'm supposedly an idiot

protip: you're the idiot
>>
>>52902031
Anon's problem is not webdev related. It's a basic pass-by-value/pass-by-reference problem. He's just a fucking MIT nigger who can't solve basic shit like this.
>>
anyone know how to print stuff in C, I tried this

import printscreen
print.screen() "hello, world"
>>
>>52902031
>talk mad shit about webdev language problems
>webdev language problems
>webdev problems
bwahahahahahaha; this cuck wants to be taken seriously; fuck off, pajeet, this is not programming no matter how hard you want to believe it
>>
>>52902067
even a day 1 beginner, a complete novice shouldn't be having the problem he's having. he's straight up retarded and he should fuck off to >>>/g/wdg where he belongs
>>
>>52902071
this isn't an issue in js, all variables are references
>>
>>52902068
>supposedly an idiot
no "supposedly", it's a fact, anon
>>
>>52902087
whatever you say, kid, you sure make a convincing case
>>
>>52902004
You have to make the amount variable a global variable it is most likely local scope error. You more importantly would have to either post entire code or run it through the Debugger to see for yourself where it's going wrong
>>
>>52902072
You need a semicolon or two inside the circular brackets.
>>
>>52902085
There you go, you partially solved the problem.
>>
>>52902096
>convincing case
no need for that, anyone with an ounce of reading comprehension can follow the thread and see it
>>
>tfw american authors are too dumb to explain algorithms
>indian guys on youtube don't know the language well enough to explain them properly
fuck this
>>
>>52901902
    function amountChangerOne(amount) {
amount = amount - 1;
}

This does nothing. It modifies the parameter "amount", which is a separate variable from the one you used as an argument when calling the function (assuming that you did actually use a variable; what do you think would happen if you used e.g. amountChangerOne(10)?).

You either have to return the modified value, e.g.
    function amountChangerOne(amount) {
return amount - 1;
}

then have the caller use it like
    amount = amountChangerOne(amount);

Or you have to write the function to take an object as a parameter and modify a property of that object, e.g.
    function amountChangerOne(obj) {
obj.amount = obj.amount - 1;
}
>>
>>52902113
all i said was >>52901816

you're the idiot if you disagree
>>
>>52897215

>>52899164 (OP)

In the bash command:

echo '#include<stdio.h>' | cpp -H -o /dev/null 2>&1 | head -n1

... what is the 'cpp' command? Does it mean C++? If so, why can't I replace it with 'c'? Do C and C++ share their libraries? Is it the same header file I'd use in a C program?

Thank you. Basically, I'm learning how to view header files in Ubuntu and I'm making sure that I'm viewing the right files as well as searching for them and opening them in the right way.
>>
>>52902097
It's not a scoping issue, the variable passed as an argument to the "amount" parameter is globally declared.
>>
>>52902137
cpp is a standalone C preprocessor.
>>
NEW THREAD: >>52902171
>>
File: 1454344197841.jpg (138KB, 650x650px) Image search: [Google]
1454344197841.jpg
138KB, 650x650px
>>52902011
keep littering your comments with explicit language as if it makes your argument any better
>>
next: >>52902177
>>
>>52902188
KILL YOURSELF
>>
>>52902146
Well in that case the variable that changes amount it is a separate new variable from the global one you are using and you would have to return the new variable in the method and then catch it whichever method you are calling it on. This is why you should always post full code so we can see exactly what is going on
>>
>>52902137
> what is the 'cpp' command?
The C pre-processor. It's the program which is responsible for processing directives beginning with "#" (#include, #define, #ifdef, etc) and performing macro substitutions. That stuff isn't done by the compiler proper; it's a separate program.

When run with the -H flag, it prints the name of each header file which is included. "-o /dev/null" causes it to discard the pre-processed output.

Another useful flag is "-dM", which prints the values of all macros which are defined at the end of the pre-processing step.
>>
>>52902130
and all I said was that you're an idiot; didn't say I disagree; reading comprehension? why do you insist with this display of retardation?
>>
>>52902188
Oh look, a retarded illiterate weebshit, big surprise.
>>
>>52902179
keep making comments that dont revolve around the point as if it makes your argument any better
>around can only mean it goes lower than the value
lmaoing@ur logic m8
>>
In parallel programming is it better to have a mutex on an object(iterator or whatever) and have each thread get the next thing to compute on or to have a central thread dispatch the work to all the threads?
>>
>>52902085
>this isn't an issue in js, all variables are references
webcucks actually believe this
>>
>>52902101
Your presentation of the problem as being simply value/reference in nature reveals a lack of understanding of the eccentric nuances of javascript. The language is neither - it works on call-by-sharing

In other words

step it up, scrub
>>
>>52902217
how am i an idiot?
>>
>>52902263
I am glorious Java master race programmer we don't have these silly problems in such a beautifully structured and well defined language
>>
>>52902127
I see now! Thanks for the help, it's much appreciated. I'm surprised I hadn't come across this until this point in time.

If I understand this correctly, the parameter is merely an identifier that I assign a value to - in this case, the value referenced by the argument passed to the function. So, if the parameter is modified in any way, only the parameter's refenced value is being changed. I need to return the value of the parameter back to an assignment targeted at the variable I was initially passing as an argument for it to have any real effect outside the function.

Is that correct?
>>
>>52902246
he's correct - note the "in js"
>>
>>52902216
Thanks for the in depth answer.

Am I actually viewing the header file source code when I open the file in gedit though?

e.g. 'gedit /usr/include/stdio.h'
>>
>>52902352
that's why he's wrong
>>
senpai
>>
>>52902607
lol, no. variables in js are references to values. this is basic shit, son
Thread posts: 355
Thread images: 41


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