[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
/dpt/ - 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: 41
File: K&R himegoto.jpg (159 KB, 500x700) Image search: [Google]
K&R himegoto.jpg
159 KB, 500x700
old thread: >>52890835

What are you working on, /g/?
>>
first for C
>>
2nd for java best language
>>
3rd for memes
>>
File: jlqXtAA.jpg (168 KB, 1920x1080) Image search: [Google]
jlqXtAA.jpg
168 KB, 1920x1080
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 (378 KB, 1450x1080) Image search: [Google]
1454469292606.png
378 KB, 1450x1080
>>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 (95 KB, 600x600) Image search: [Google]
hb.jpg
95 KB, 600x600
>>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 (13 KB, 420x327) Image search: [Google]
02-10-11-52-16.png
13 KB, 420x327
>>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 (62 KB, 572x800) Image search: [Google]
1388583148347.jpg
62 KB, 572x800
>>52898034
Well, the compiler certainly can optimize constant values the best :^)
>>
i'm so fucking bored
>>
File: 1438895468905.png (14 KB, 640x480) Image search: [Google]
1438895468905.png
14 KB, 640x480
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 (3 MB, 1024x700) Image search: [Google]
02-10-12-11-28.webm
3 MB, 1024x700
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 (9 KB, 300x250) Image search: [Google]
1426955668069.jpg
9 KB, 300x250
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 (271 KB, 800x608) Image search: [Google]
output3.webm
271 KB, 800x608
>>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 (3 MB, 400x225) Image search: [Google]
1444284553053.gif
3 MB, 400x225
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 (19 KB, 500x280) Image search: [Google]
you-dont-say.jpg
19 KB, 500x280
>>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 (62 KB, 625x848) Image search: [Google]
02-10-13-12-08.png
62 KB, 625x848
>>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 (44 KB, 867x694) Image search: [Google]
wZEzZW0.png
44 KB, 867x694
>>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 (22 KB, 669x379) Image search: [Google]
Capture.png
22 KB, 669x379
>>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 (31 KB, 313x286) Image search: [Google]
1313969637486.jpg
31 KB, 313x286
>>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 (18 KB, 513x328) Image search: [Google]
welp.png
18 KB, 513x328
>>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 (26 KB, 653x368) Image search: [Google]
02-10-13-54-32.png
26 KB, 653x368
>>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 (76 KB, 441x411) Image search: [Google]
1336768215191.png
76 KB, 441x411
>>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 (3 MB, 1221x835) Image search: [Google]
lines.webm
3 MB, 1221x835
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 (475 KB, 852x973) Image search: [Google]
1407942768495.jpg
475 KB, 852x973
>>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 (51 KB, 1920x996) Image search: [Google]
Untitled3084908.png
51 KB, 1920x996
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 (2 MB, 1205x796) Image search: [Google]
complexity.webm
2 MB, 1205x796
>>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 (144 KB, 708x664) Image search: [Google]
1445133759360.jpg
144 KB, 708x664
>>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 (23 KB, 1018x381) Image search: [Google]
virustotal.png
23 KB, 1018x381
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 (920 KB, 705x643) Image search: [Google]
pepe.webm
920 KB, 705x643
>>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 (305 KB, 640x974) Image search: [Google]
1407245925810.png
305 KB, 640x974
>>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 (707 KB, 705x643) Image search: [Google]
ree.webm
707 KB, 705x643
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 (105 KB, 250x252) Image search: [Google]
1453375103204.png
105 KB, 250x252
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 (22 KB, 718x540) Image search: [Google]
asd.png
22 KB, 718x540
>>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 (11 KB, 635x468) Image search: [Google]
question.png
11 KB, 635x468
>>
File: python.png (297 KB, 596x596) Image search: [Google]
python.png
297 KB, 596x596
>>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 (52 KB, 805x1265) Image search: [Google]
6m9H0fK.png
52 KB, 805x1265
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 (14 KB, 400x400) Image search: [Google]
pips.jpg
14 KB, 400x400
>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 (92 KB, 444x440) Image search: [Google]
1448304848051.png
92 KB, 444x440
>>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 (47 KB, 400x337) Image search: [Google]
1426535295607.jpg
47 KB, 400x337
>>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
Thread replies: 255
Thread images: 41

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.