[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: 25
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>51880381

What are you working on, /g/?
>>
Don't shit this one up you fuckin' turboautists.
>>
>>51882890

C
AVERAGE
INT
>>
>>51882877
SeconD
>>
>>51882890
second for my wife's boyfriend
>>
>>51882877
Please do not use an anime image next time, thanks.
>>
File: F5EPoX5.jpg (11 KB, 160x160) Image search: [Google]
F5EPoX5.jpg
11 KB, 160x160
For a linux shell script, how do you do custom option parameters that have variables?

Like, if you KNOW what the parameter might be, then it's easy. You would do:
if [ "$2" = "meme" ] ; then
#your code


But if your parameter could be a number of different things, like "-1" or "-2" or "-6045", then how do set that up such that the parameter will see the "-[number]" pattern and then take that number and use it in the option's code.
>>
>>51882890
WEB
FAG
CSS
KEK
AVERAGE
INT
BURGER
FLIP

pack up this thread is ruined
>>
LEGIT THREAD

>>51882900
>>
How do I get a regex to match just the whole string?
I have this regex
[A-Za-z0-9.+!#$%&'*+-/=?^_`{|}~]+\@[A-Za-z.]+


[email protected]
[email protected]
[email protected]
should<<<,n\\[email protected]


It matches the first 3 completely, and then matches the valid half of the last email.
How do I get it to stop doing that?
>>
>>51882924
The only thing ruined is what you're doing with your life.
>>
File: why.png (3 KB, 334x100) Image search: [Google]
why.png
3 KB, 334x100
why wont my program run
>>
>>51882935
end your life
>>
>>51882952
Here, try this regex for matching email addresses:
http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
>>
>>51882975
haha holy shit
i'm not gonna escape all those characters in C
>>
>>51882954
y take my post serious
>>
>>51882994
...
replace \ with \\
:%s/\\/\\\\/g
>>
>>51882975

Lord have mercy. I'm so glad C# has verbatim string literals.
>>
>>51882909
I haven't made anything useful with sh in a while, but try to look into variables and cases. i thing something like
for i in $@
do
case $i in [0-9]):
# Do things
"dicks"):
# something else
esac
done

Could do the trick.
>>
>>51882994
here you go
http://termbin.com/quzc
>>
File: lmao.jpg (472 KB, 3360x2100) Image search: [Google]
lmao.jpg
472 KB, 3360x2100
r8 my Swift calculator
>>
>>51882994
here, put it on one line for you so you can easily copy/paste it into a nice little .c file.
http://termbin.com/igf9
>>
>>51882970
Because of a stop sign at the top, duh
>>
How do I average two longs in Java?
>>
Fizzbuzz in Forth
>>
>>51883060
homosex/10
>>
>>51882909
man getopt
>>
I need to calculate the total rate of return for a specified amount, but the rate varies for each level of money. For instance

First $500,000 you receive 0.7%
Second $500,000 you receive 0.35%
Third $500,000 you receive 0.175%
etc.

What's the best way to calculate this in code (using AngularJS but any language will help me see the formula)
>>
>>51882904
That GC sure slowed you down
>>
File: Untitled.png (67 KB, 1889x973) Image search: [Google]
Untitled.png
67 KB, 1889x973
>>51882664
This thing is totally still chimping out even though I'm just trying to declare a variable of my struct type. Did I screw up the IDE?
>>
>>51883139
Try "struct index blah".
>>
>>51883124
if (num < 500000) {
//give .7%
}
else if (num > 500000 && num < 1000000) {
//give .35%
}
else {
}
>>
>>51883139
Look at your C textbook and see if that's a valid way of declaring a struct. Hint: it isn't.
>>
>>51883139
typedef struct index {
/* whatever here */
} index;
index blah;
>>
>>51883124
BAHAHAHAHA WEBDEV RETARDS
>>
non-trap thread, posted after the bump limit: >>51882900
>>
>>51883186
You contribute nothing of value. Promptly off yourself.

>>51883204
You too.
>>
>>51882877
Reading SICP just for fun (I'm that kind of person) and was wondering: while I try to solve the exercises (it takes a lot sometimes) what functional language should I learn for my projects? I'm interested in FP and I would like to use it on a daily basis but I find Scheme too strict sometimes... Maybe F#? Haskell?
>>
>>51883124
>using AngularJS
you will not get the rounding right
>>
>>51883169
>>51883186

That isn't it at all.

You have to break it down. For instance, if the amount is $1,000,000 the rate is .7 on the first $500,000 and .35 on the second $500,000 leading to a rate of 0.525

You can use a ton of if/elseif statements to do it but that would be time consuming.
>>
>>51883165
>>51883176
>>51883177

That explains why I got a C on my midterm :(
>>
>>51883124
Don't have the time to code, but a simple way would be:
rate = 0.7%
my_money = 0
deposit_amount = 0
deposit(money){
deposit_amount += money
rate = 1/ (deposit_amount mod money) * rate
my_money = money * rate
}


formula might be wrong, but it should be along those lines, hf
>>
>>51883242
webdevs everyone

seriously it's like kiddie school math
>>
>>51883224
I think bringing Haskell into the equation might make some exercises really differ in difficulty from the intentional ones (like way harder or easier than they are with Scheme), but that's really just my take on it
I don't think it's a particularly bad choice and I'm sure people have followed SICP with it before, I just don't think it's all that conventional
I encourage you to try a few exercises in a few languages or check out the solutions online to get a general feel for what working with them would be like.
>>
>>51883269
I meant
 deposit_amount mod 50000 
, mb
>>
Daily reminder that CSS is as powerful as C. Webdevs are going to replace Cfags soon.

http://my-codeworks.com/blog/2015/css3-proven-to-be-turing-complete
>>
>>51883266
Work harder man. You can do it.

>>51883124
Try to think about it. The tiers are ----> divided <------ 500 000 by 500 000. Which means that if you were to -----> divide <----- the amount of money you have by 500 000 you'd get a number that tells you how many times you have "500 000" in your number of money.
>>
>>51883414
Not when they can't into basic arithmetic. >>51883124
>>
>>51883434
>Try to think about it. The tiers are ----> divided <------ 500 000 by 500 000. Which means that if you were to -----> divide <----- the amount of money you have by 500 000 you'd get a number that tells you how many times you have "500 000" in your number of money.
>>
no traps
no webdevs
no hasklels
no big dick playas

>>51882900
>>
>>51883176
It is though, he just needs to add a "struct" before index blah.
>>
>>51883060
> no quick help
BTFO
T
F
O
>>
why is lisp so good for AI?
>>
File: oPXZ1r4dtqwo1_1280.jpg (120 KB, 640x634) Image search: [Google]
oPXZ1r4dtqwo1_1280.jpg
120 KB, 640x634
Should I learn Forth? Why?
>>
>>51883762
It's not, it's awful at AI.
At least it's not hasklel, though.
>>
>>51883437
>>51883434
>>51883561

If the number is $800,000 your theory ends up being flawed.

You guys are talking shit but seriously still don't know how to solve it.
>>
>>51883800
If rounding a number is too hard for you you can try 800 000 - (800 000 % 500 000), dumbass.
>>
first for average of 2 ints in whitespace
>>
>>51883800
you guys are all dumbasses
int main(void)
{
int times;
times = 800000/500000;
printf("%d * 500k", times);
return 0;
}

OUTPUT: 1 * 500k
>>
File: indian baby names.jpg (2 MB, 3296x1992) Image search: [Google]
indian baby names.jpg
2 MB, 3296x1992
>>51883124
while(money > 0) {
if(money > 500000) {
amount += 500000 * rateOfReturn[i++];
money -= 500000;
}
else {
amount += money * rateOfReturn[i];
money = 0;
}
}
>>
>>51883971
that was never the task you mongrel
>>
>>51884044
I thought you wanted to know how many times you should divide your percentage by 2 to get the final.
>>
>>51884063
oh i dunno lol lel

while(money > 0) {
if(money > 500000) {
amount += 500000 * rateOfReturn;
money -= 500000;
rateOfReturn /= 2;
}
else {
amount += money * rateOfReturn;
money = 0;
}
}


i guess

just some crap i threw together

web devs are the worst at at even writing a spec
>>
File: 1449316962879.gif (2 MB, 500x490) Image search: [Google]
1449316962879.gif
2 MB, 500x490
What does eta-conversion mean in Lambda calculus? I've read many definitions all over the web, but I still don't get it because I'm a retard.
>>
>>51883971
>>51883842

The point is that at 800,000 the rate is not just (.7+.35)/2 -- it is .7 on 500K and .35 on the remainder, which ends up being a total rate of .569 instead of .525
>>
>>51884135
see >>51884120
>>
>>51884135
Then just split it into tiers
tier1: first 500k
tier2: second 500k
tier3: all the rest
so total would be tier1*0.07 + tier2*0.035+tier3*0.175
>>
>>51884120
just divide the money for 500000 and store it in an int called times. then do a for loop that checks for i < times. every single time the loop runs, store temp as total / 2 and then total = total + temp. finally, print total. should be roughly that, I am not too concentrated now.
>>
I learned the basics of the Linux command line, what should i do next?
Im thinking in learn C then Phyton, but im not sure. Help-me, anons.
>>
>>51884135
ah, right.
>>
>>51884178
That is fucking obvious and what the guy said in the first post. Put it in code or shut up
>>
>>51884210
see >>51884120
>>
>>51884201
Learn Racket.
>>
>>51884135
Are you the poster? Is the task really that?
Isn't it just for every 500k you do something instead of calculating for incomplete ones too?
>>
>>51883124

The rate halves with each 500k increase. The total rate of return is the ratio of the total profits (money returned - money invested) to the total amount of money invested. For an example, say we invested 1 million dollars. We receive a 0.7% profit on the first 500k invested, or $3500 profit. On the next 500k invested, we receive 0.35% profit, or $1750. Adding these two together we get $5250, which from our $1000000 invested, makes a 0.525% profit.

I presume now that you have a greater understanding of the problem description, you should be able to write code around it yourself, yes?
>>
>>51883266

I assume you fixed your casting problem? I didn't see the new thread and answered here:

>>51884307

As for struct index vs index, you either have to use "struct index" -OR- use a typedef like:

typedef struct {
char name;
char street;
char cityST;
char zipchar;
long ziplong;
} index;

index record; // Compiler is happy
>>
>>51884201

Learn Python, then C.

Python will get you up and running, doing some fun, useful stuff.

C will teach you more of the fundamentals of how computers work.

Then learn C# or Java. They're interchangeable and great for employment opportunities.

Then whatever esoteric stuff you want to do. Functional, webby stuff, whatever.

Never, ever learn C++. It's not helpful enough to be useful for modern, large projects, and it's not clean enough to be advantageous for low-level work.

I'm primarily a C++ programmer, BTW.
>>
>>51884446
0/10
>>
>>51884500

0/10. If you disagree with my recommendation, feel free to explain why. But if you just want to post retarded /g/ meme bullshit in a passive-aggressive attempt to insult me, you can fuck right off.
>>
>>51884524
Looks like each tier is half the previous, while first one starts at 7%
>>
>>51884525
>being so mad on anonymous imageboard
>>
im working on a hell of a first project.
ok, here is what im working with and my end goal.
1. raspi with video camera and digitial IO expander.
2. able to recognize a stain/tear on a hand towel traveling at 80 m/s
3. eject said towel

i have the hardware on order.

i am reading some guides on basic video processing.

any tips if anyone has done such a thing?

i just finished a UV blood detection stain sensor to work with an arduino but the thing is far too twitchy and ends up rejecting too much good things and not enough bad things.
>>
>>51884632

>gets called for shitposting out with direct language
>shitposts dumb assumptions

Please, just stop shitposting. If you want to have a conversation, fine. Don't shitpost with "0/10" and then make shit up about anger when you get called out on it. It's pathetic.
>>
>>51884651
//Hardware pin definitions
int UVOUT = A0; //Output from the sensor
int REF_3V3 = A1; //3.3V power on the board
int REJECT = 13; //Output to trigger the reject function and led status
void setup()
{
Serial.begin(9600);
pinMode(UVOUT, INPUT);
pinMode(REF_3V3, INPUT);
pinMode(REJECT, OUTPUT);
Serial.println("Reject linen: ");
}
void loop()
{
int uvLevel = averageAnalogRead(UVOUT);
int refLevel = averageAnalogRead(REF_3V3);
//Use the 3.3V power pin as a reference to get a very accurate output value from sensor
float outputVoltage = 3.3 / refLevel * uvLevel;
float uvIntensity = mapfloat(outputVoltage, 0.99, 2.9, 0.0, 15.0);
Serial.print("Reflection: ");
Serial.print(uvLevel);
Serial.print(" Voltage: ");
Serial.print(outputVoltage);
Serial.print(" UV Intensity (mW/cm^2): ");
Serial.print(uvIntensity);
Serial.println();
delay(100);
//This IF THEN statement controls the machine reject based on stain levels
// uvIntensity , uvLevel , outputVoltage acceptable variables for comparisons on stains/holes
// float in_min used for hole/dark spot detection, float in_max used for reflective hot spot detection
if (outputVoltage > 1.00)
{
digitalWrite(REJECT, HIGH); // sets the LED on and rejects
delay(500); // waits in high state for a ½ second
digitalWrite(REJECT, LOW); // sets the LED off and continues
delay(100); // waits in low state for a 1/10th
}
}
//Takes an average of readings on a given pin
//Returns the average
int averageAnalogRead(int pinToRead)
{
byte numberOfReadings = 3; //frequency of reading, speed vs accuracy
unsigned int runningValue = 0;
for(int x = 0 ; x < numberOfReadings ; x++)
runningValue += analogRead(pinToRead);
runningValue /= numberOfReadings;
return(runningValue);
}
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
>>
File: patrick_bateman.jpg (38 KB, 529x350) Image search: [Google]
patrick_bateman.jpg
38 KB, 529x350
>>51884651
>stain/tear on a hand towel

>blood detection stain sensor

Bro, what are you doing with your towels?
>>
File: hacking_2E_big.png (110 KB, 474x625) Image search: [Google]
hacking_2E_big.png
110 KB, 474x625
Did I do good? I figured it might be a good book to have since I'm actually going into IT Security
>>
Is this book any good, wanted some extra reading about algorithms and data structures seeing as I just finished my module in it?
>>
Okay, it's an OOD question for you, I know you guys LOVE object oriented design.

I am developing routines for this program that tracks shipments and inventory. Lots of parts of this program need to look up items in the inventory database by their UPC code or their description or whatever, so I have a class that houses those functions. Send it a search string, it figures out if you are looking up the UPC or searching the title, etc. I just call the class something like "ItemSearchEngine" and make everything in it static, so that you don't need instances of the class to look for items.

Is this OOD? I feel like it really is just functional programming using the class name as a "heirarchy" to house related functions. The "Engine" doesn't really represent an object. Or does it? I don't get it.
>>
>>51884660
You should fetch some buttcream before it's too late senpai.
>>
>>51884210
http://ideone.com/Ws3sez
apart from float → int shit, you get how it works
>>
>>51884740

If you have something of value to say, do so. If not, stop shitposting.

/g/ can be a very useful resource. And then there are people like you who pollute it.
>>
>>51884774
Please refer to >>51884774
>>
>>51884731
You can't get much better if you want a very in-depth understanding of how various algorightms works.

I use it mostly as a reference though, shit's too long to read cover to cover.
>>
>>51884400
I was implementing this. For $1.500.000 do you get $7875 in return?
>>
>>51884774
I bet you don't even sage every post you make you fucking faggot.
>>
>>51884814
s/works/work
>>
>>51884825
>>51884803

See
>>51884774
>>
>>51883139
It's standard C but the answer is yes.
>>
>>51884860
Observe >>51884774
>>
>>51883124
newamount =: 3 : 0
y+0.007*0.5^1-~<.y%500000
)
>>
>>51883124
Try this:
/* Shitty implementation of the problem */

#include <stdio.h>

int main(void)
{
int times, money, i;
float temp, total;
money = 1500000;
times = money/500000;
total = 0.007;
for (i = 1; i < times; ++i) {
temp = total / 2;
total = total + temp;
}
printf("Return: $%.f", total * 500000);
return 0;
}
>>
>>51884761
Oh and rate starts at 7% instead of 0.7%, some display errors and shit, but generally the tier-stuff is okay.
>>
>>51883124
>etc.
If you actually mean "etc."
#!/usr/bin/env ruby
sum = Integer(ARGV[0])
step = 500000
ror = 0.7
n = sum / step
if n > 0
result = step * ror * 0.01 * (2**n - 1)/2**(n-1) + (sum % step) * 0.01 * ror / 2**n
puts result
else
puts sum * 0.01 * ror
end
>>
>>51882877

this
>>51884318
>>51884372
>>51884474
>>
File: Untitled.png (23 KB, 1190x612) Image search: [Google]
Untitled.png
23 KB, 1190x612
>>51884405
I did fix the issue and I pretty much finished my program, but I'm having an issue with passing the array of pointers to structures to the function correctly.

Here's my main:
#include <stdio.h>
#include <stdlib.h>
#include "Header.h"
#define MAX_RECORD 50
int main(){
struct index{
char name;
char street;
char cityST;
char zip;
};
struct index *record = (struct index*)malloc(MAX_RECORD*sizeof(struct index));
ARRAYfill(&record);
BUBBLEsort(&record);
for (int i = 0; i <= 49; i++){
puts((record[i]).name);
puts((record[i]).street);
puts((record[i]).cityST);
puts((record[i]).zip);
}
return 0;
}


Here are my functions

#include "Source.c"

void ARRAYfill (struct index *p){
for (int i = 0; i <= 49; i++){
p.name = gets(stdin);
p.street = gets(stdin);
p.cityST = gets(stdin);
p.zip = gets(stdin);
}
}

void BUBBLEsort(struct index *p){
int temp;
int iteration;
int index;
for (iteration = 1; iteration < MAX_RECORD - 1; iteration++){
for (index = 0; index < MAX_RECORD - iteration; index++){
if (atol(p[index].zip) > atol(p[index + 1].zip)){
temp = p[index];
p[index] = p[index + 1];
p[index + 1] = temp;
}
}
}
}


Basically what the program should do is take a bunch of records, store them using an array of pointers to structures and sort them by zip, but I'm getting hung up on properly using the passed pointers to my functions.
>>
>>51885195
why are your functions so angry
>>
>>51885195
1) put struct definitions outside of main
2) what's with ARRAYfill and BUBBLEsort
do either arrayFill or array_fill
>>
>>51885195
>#include "Source.c"

WTF?

You need to move your index declaration into a header file and include it from your main .c file and your auxiliary .c file.

You declared index within main, so how could ARRAYfill and BUBBLEsort possibly know what index is?

And what's with the bizarre caps in your function names?
>>
>>51884814

Thanks, guess I'll get a copy then.
>>
Is this bad practice?
err = regexec(&regex, str, 0, NULL, 0);
char *override = strstr(str, ".@."); /* edge case */
if (err == REG_NOMATCH && !override)
printf("%s\n", "false");
else
printf("%s\n", "true");
>>
>>51885268
>>51885282
>>51885283

I did all of these things but I'm still having issues with the array fill function.

Header
#include <stdio.h>
#include <stdlib.h>
#define MAX_RECORD 50
struct index{
char name;
char street;
char cityST;
char zip;
};

main
#include "header.h"
int main(){
struct index *record = (struct index*)malloc(MAX_RECORD*sizeof(struct index));
array_fill(&record);
bubble_sort(&record);
for (int i = 0; i <= 49; i++){
puts((record[i]).name);
puts((record[i]).street);
puts((record[i]).cityST);
puts((record[i]).zip);
}
return 0;
}

functions
#include "header.h"
void array_fill (struct index *p){
for (int i = 0; i <= 49; i++){
p.name = gets(stdin);
p.street = gets(stdin);
p.cityST = gets(stdin);
p.zip = gets(stdin);
}
}

void bubble_sort(struct index *p){
char temp[5];
int iteration;
int index;
for (iteration = 1; iteration < MAX_RECORD - 1; iteration++){
for (index = 0; index < MAX_RECORD - iteration; index++){
if (atol(p[index].zip) > atol(p[index + 1].zip)){
strcpy(p[index], temp);
strcpy(p[index], p[index + 1]);
strcpy(p[index + 1], temp);
}
}
}
}
>>
File: foobar.jpg (47 KB, 727x338) Image search: [Google]
foobar.jpg
47 KB, 727x338
Whew.
>>
>>51885615
>gets
Never program again.
>>
>>51885668
is that the Botnet's secret 1337 challenge?
>>
>>51885701
yeah. The problems are hella-fun
>>
File: Untitled.png (20 KB, 650x507) Image search: [Google]
Untitled.png
20 KB, 650x507
>>51885680
It seems the issue is with the way I'm using the pointer, not the gets. Unless you're just trying to meme me
>>
File: fullretard.jpg (47 KB, 720x203) Image search: [Google]
fullretard.jpg
47 KB, 720x203
>>51885760
jesus just what the fuck are you doing?
you really need to understand the very basics of this language before jumping to pointers. that is a complete mess.
>>
>>51885760
gets is a function so shitty, they literally removed it from the language.
Every compiler that isn't shit will throw warnings if you use that function.
It should not be used under ANY circumstances, including as a learning exercise.

Even then, you're using it wrong.
>>
>>51885615
>I did all of these things

Ugh. Not really.

Here's a hint: why the fuck does header.h (what a terrible name) include stdio and stdlib?

What, exactly, do you think index is storing?

Do you understand that you're storing ONE LETTER for name, ONE LETTER for street, ONE LETTER for "cityST" (huh?), and ONE LETTER for zip?

What do you think gets does?

Why are you passing stdin to gets?

Why are you programming? I mean, holy shit, this is like day one stuff. You seem to just be doing completely random changes hoping that it will suddenly compile without taking a moment to think about WHAT you're doing.
>>
How do I get started with embedded programming?
Do I need an AVR programmer, or is an arduino ok?
>>
>>51885846
never arduino, unless you're <15
>>
>>51885846
>arduino
No
Programming an Arduino had to be the worst experience of my life
>>
>>51885846

Arduino is fine for getting started.

Moving past Arduino is ridiculously difficult, though.

>>51885878

Useless shitposting.
>>
>>51882877
Hime is such a fuck cutie. I want to massage and suck his balls and weiner.

Also, he's cutest with short hair.
>>
>>51885760

More:

* where do you think gets is storing the data it reads?

* what is wrong with this code?

struct whatever
{
int something;
};

struct whatever *w = (struct whatever *)malloc(sizeof(whatever));

w.something = 5;


* what is wrong with this code?

char name;
name = "Hello";


* what is wrong with this code?

char name;
strcpy(name, "Hello");


* what is wrong with this code?

char name;
strcpy(&name, "Hello");
>>
If python can assign a module/file a name __name__, and assigns the file being ran the name of __main__, doesn't it fucking know which file is main, so why the fuck can't we just do def main(): in each file?
I'm used to compiled languages so I imagine it's just the scripting nature of the language, but it's fucking stupid
>>
>>51885615
You pretty much have mistakes in everything.
Idk what'd be good for you to read before attempting to write this program again, check out this maybe http://www.tutorialspoint.com/cprogramming/c_structures.htm and see if you have problems understanding that.
Also learn how loops work? You do realize that even if the code in array_fill's loop body did what you wanted it to do (assign data from standard input to a structure, which it doesn't) it doesn't depend on i at all and just overrides (supposedly) p over and over again?
>>
>>51885820
Yeah, actually for the top part I do know that I didn't include an index number for the pointer, but that's because I was looking to see if I had made a syntax error and was adding parenthesis on the right, the dereference operator on the left, and that's how I ended up leaving it.
>>
>>51885701
>>51885750
any links to that challenge?
>>
>>51885971
>actually for the top part I do know that I didn't include an index number for the pointer

WTF are you even talking about? I don't see how that has anything to do with any of the questions I asked.
>>
>>51886008
http://www.google.com/foobar/

apparently google or someone already doing the challenges has to invite you

I got invited while googling something about python list comprehensions
Honest advice if you want in: pick up python or js, google all of your problems
>>
>>51885936
I take it that for all of them you're trying to store a set of characters into a space for one character.
>>
>>51885936
Well never mind. For the first one you didn't dereference the pointer, but for the next 3 you're trying to store more than one characters into the space of one.
>>
>>51885891
>>51885878
but you can program arduino with normal .hex for atmega328p. And you can compile .c files with avr-gcc and then upload it to arduino. I don't understand why you're against it.
It's a bit more expensive that assembling it from your own parts, but hey, at least you've got a board in one piece.
>>
>>51886056
I'm probably gonna get invited soon
>>
>>51886088

That's just one facet of the problems.

You fail to understand:

* The difference between a single character and a pointer to a string of characters.

* Who is responsible for allocating memory pointed to by a pointer.

* The difference between assigning the address of a pointer versus copying what it points to.
>>
avg() { echo $(( ($1 + $2) / 2)); }
>>
>>51885820
>What, exactly, do you think index is storing?
I suppose I'm mistaking it as a string type in c++.
>What do you think gets does?
Takes a line from whichever input stream you specify as a parameter up till it sees a new line char.
Why are you passing stdin to gets?
Okay, I read the use of it wrong. I thought you needed to specify what your input was as a parameter.
>Why are you programming? I mean, holy shit, this is like day one stuff. You seem to just be doing completely random changes hoping that it will suddenly compile without taking a moment to think about WHAT you're doing.

To be fair, this is the second C class I've taken and we didn't go over gets or puts until we did dynamic memory allocation. It was all getchar() and putchar() shit.
>>
>>51882586
char zipchar;
long ziplong;

There's no way this guy isn't trolling us right?
>>
>>51886198
That's me and nope. But I changed it already. The way I first thought about doing it was way complicated.
>>
>>51886193
>Takes a line from whichever input stream you specify as a parameter up till it sees a new line char

That's not what gets does.

You appear to be confusing gets and fgets. Either way, WHERE DO YOU THINK GETS/FGETS IS WRITING THE DATA THAT IT READS???

>we didn't go over gets or puts until we did dynamic memory allocation. It was all getchar() and putchar() shit.

Your entire thought process is still revolving around simple characters and getchar/putchar.
>>
>>51886223
>WHERE DO YOU THINK GETS/FGETS IS WRITING THE DATA THAT IT READS???
The way I wrote it I thought it was writing to p.name or the other struct variables I specified.
>>
require 'gmail'

USERNAME = '[email protected]'
PASSWORD = 'imacuck'
WAIFU = 'Desu'
WAIFU_PHONE = '[email protected]'

def generate_sentence
love_word = ['love', 'adore', 'worship', 'fucking love']
cute_word = ['cute', 'hot', 'adorable']

love_sentence = WAIFU + ' I ' + love_word.sample + ' you. '
cute_sentence = 'Ur so ' + cute_word.sample + '. '
later_sentence = 'Call me later. '

sentences = [love_sentence, cute_sentence, later_sentence]

sentences.shuffle.each do |sentence|
puts sentence
end
end

def send_message(message)
Gmail.connect(USERNAME, PASSWORD) do |gmail|
if gmail.logged_in?
email = gmail.compose do
to WAIFU_PHONE
subject ""
body message
end

email.deliver!

puts 'Sent dude. Way to be a good guy.'

else
puts 'bad connection'
end

end
end

send_message generate_sentence


Working on a script to text my waifu for me. Gonna turn the generate sentence function into a class. Wrote this after I did a quick ruby tutorial. Such a faggy language.
>>
>>51885615
Start over, seriously. Not on this program, on programming.
Read a book.
C Primer Plus by Stephen Prata
C Programming: A Modern Approach
>>
>>51886269
>The way I wrote it I thought it was writing to p.name or the other struct variables I specified.

By what magic would that happen?

Again, what types did you use when declaring the members of index.

I'm starting to believe you are just a troll.

And forget about "how you wrote it". Answer the question:

>WHERE DO YOU THINK GETS/FGETS IS WRITING THE DATA THAT IT READS???

What assignments you do, or whatever, is irrelevant. Where do you thing gets stores the data that it reads?
>>
>>51886293

Your indentation on that do/end block is all fucked up. Also, did not know Ruby had a gem for gmail shit.
>>
>>51883786
best language for testing embedded systems, all the embedded CE guys use it
>>
>>51886293
>require gmail

please dont tell me this comes built in
>>
>>51886459

No. On the contrary, the Ruby standard library is being downsized, rather than expanded.
>>
>>51886453
Thank you based Ruby, you're my favorite tripfag. Yeah I know my indentation is fucked up. Will fix.
>>
>>51886506
Oh? They're not letting you write ruby scripts anymore?
>>
>>51882877
I know this is a pretty stupid question.
What can I do once I learned python. I know the basics and don't know what to do next.
>>
>>51886697
what the fuck type of question is this?
>>
File: 1449740692829.jpg (46 KB, 720x480) Image search: [Google]
1449740692829.jpg
46 KB, 720x480
Best IDE for java?

Looking for something that's preferrably minimalistic/simple


Thanks.
>>
>>51886775
vim
>>
>>51886775
NetBeans
>>
>>51886775
just use pen and paper
>>
>>51886506
>the Ruby standard library is being downsized

Is that so?
>>
>>51886775

IntelliJ is the bee's nipples.
>>
>>51886775
vim and javac
>>
>>51886744
I'm insinuating he's a fat tripfaggot.
Go to bed.
>>
File: vKCjFLN.jpg (46 KB, 580x342) Image search: [Google]
vKCjFLN.jpg
46 KB, 580x342
>>51886893
>>
Are bitfields useful for applications programming?
>>
How the FUCK do I calculate the normal of a line segment in MATLAB? I need to make a 2d ray tracer for a uni project.

It seems so retardedly simple but every fucking method I've tried doesn't work.
>>
File: qt.png (45 KB, 1065x534) Image search: [Google]
qt.png
45 KB, 1065x534
Heh.
>>
>>51887114
if your application is resource intensive than yes. Have fun with your fizzbuzz faggot.
>>
File: carrot.jpg (60 KB, 600x450) Image search: [Google]
carrot.jpg
60 KB, 600x450
>>51887169
>
    return true;
else
return false;

hehehe
>>
File: Screenshot_2015-12-15-19-35-16.png (297 KB, 1080x1920) Image search: [Google]
Screenshot_2015-12-15-19-35-16.png
297 KB, 1080x1920
Made a python script that downloads project source and video files from a paid tutorial website.
>>
>>51887140
the normal of a line segment will be any vector where the dot product is 0

x1*x2 + y1*y2 = 0
x1*x1 + y1*y1 = 1
x2*x2 + y2*y2 = 1

4 variable, 3 equations, 2 answers
>>
How come some projects consist of multiple languages, like C, C++, and Python?
How do you get them to work together in a way other than via files, and what is the purpose?
>>
>>51887169
>>51887215
i don't see the issue?
you don't play code golf with production code by doing "cute" unmaintainable shit like
return (QCameraInfo::availableCameras().count() > 0);
>>
>>51887217
im interested in this
>>
>>51887290
>unmaintainable
Are you retarded?
>>
>>51887290
> cute
> unmaintainable
> code golf

3/10
>>
>>51887169
>>51887215
I don't get it. Code documentation is supposed to be readable, not to show off your totally 1337 le haxxor skills by writing it in one line
>>
>>51887335
>>51887344

Are you unemployable?
It's ok to admit it.
>>
>>51887335
I think he means that potato-mind noobs won't understand the terse-ness of it, so a little redundancy actually reduces the comprehensive complexity to the user
>>
>>51883060
Oh god, you followed the Harvard tutorial didn't you.
>>
>>51887353
If you aren't trolling please say so, you seem to be doubling down but I just can't believe anyone is this retarded.
>>
>>51887169
>I just learned what a ternary operator is, look at these devs who aren't as good as me! XDD
>>
>>51887292
You need to have a paid subscription to the site obviously. But it is pretty handy. The site is for cg artwork if you want more info let me know
>>
>>51887361
Not everyone is from CS101 day-one. There is no point in pandering to complete retards.
>>
>>51887408
you don't even need a ternary operator for that you little shit
that would be even worse tbf

return QCameraInfo::availableCameras() ? true : false;
>>
>>51887169
Could have dropped the else statement, otherwise looks fine
>>
>>51887442
not returning a variable in a non-void function is undefined behavior and will lead to the function returning garbage that may or may not be interpreted as true or false by the function that called it.
>>
>>51887454
I meant like this
if (QCameraInfo::availableCameras().count() > 0)
return true;
return false;
[/code[
>>
>>51887169
LGTM, although due to personal preferences I'd write it as:
bool checkCameraAvailability()
{
if(QCameraInfo::availableCameras().count > 0)
return true;

return false;
}
>>
C++ bros, i need help.

Im accustomed to Java/C# but im learning C++ and i wanted to know, how do i make a function and call it again in main() afterwards?

int main()
{
otherfunction();
return 0;
}

int otherfunction()
{
int x;
int y;
int table[10][10];

for (x = 1; x < 11; x = x +1)
{
for (y = 1; y < 11; y = y + 1)
{
table[x][y] = x * y;
printf("%d\n", table[x][y]);
}
}
return 0;
}
>>
>>51887470
I've seen it done like this in production code
bool status = false;
if (QCameraInfo::availableCameras().count() > 0)
status = true;
return status;
>>
>>51887114
Yes, they can be. For example, you can put an int into your class or function. This gives you 32 bits to use for whatever you want. Maybe someday in the future you'll need your class or function to perform some special functionality (which will be created in the future), then you can say that the new functionality is only triggered when the 7th bit of the int is turned on. Basically it can be a way to future-proof things. That's just one example, but it's all over one large project I worked with.
>>
>>51887413
ah darn, oh well. Great job all the same
>>
>>51887273
I'm shit at math, how am I supposed to work that out?
>>
>>51887498
prototype
int otherfunction();

int main() { otherfunction(); return 0; }

int otherfunction() { }
>>
>>51887498
you need a forward identifier, just put
int otherfunction();
at the top, before it is used
>>
>>51887498
Put otherfunction before main in your file.

Alternatively, add a declaration of otherfunction before main.

int otherfunction();

int main()
{
otherfunction();
return 0;
}

int otherfunction()
{
...
}
>>
>>51887534
>>51887542
>>51887560

Thanks.
>>
>>51887526
If you're shit at math how do expect write a ray tracer in matlab you whiny millennial bitch?
>>
>>51887508
This is the preferred standard. Most industry coding standards prohibit multiple returns.
>>
>>51887290
>unmaintainable shit like
What the fuck is wrong with you?
>>
>>51887387
>If you aren't trolling please say so, you seem to be doubling down but I just can't believe anyone is this retarded.

Not GP, but he's pretty much right.

Most of the time, your goal is readability. Writing code that requires you to pause for even a moment is worse than code that is entirely obvious to everyone.

The next step in optimization would be:

return (QCameraInfo::availableCameras().count());


Which works for general cases, but would break if, for example, the call returns negative numbers to indicate errors.

Also, the "dumb" style sets you up for adding logging later. I don't know about you, but most of my production work has involved logging, both error and informational. It's been tremendously valuable in debugging strange problems out in the field.
>>
>>51887883
 return (thing > 0); 

is one return
>>
>>51887883
>Most industry coding standards prohibit multiple returns.

I've never seen any such standard.

With any significantly complex resource initialization, it's way more readable to do

if (!someResourceInitialization())
return false;
if (!someOtherResourceInitialization())
return false;
if (!yetAnotherResourceInitialization())
return false;

DoSomethingWithTheResource();
return true;
>>
>>51887903
Okay. I meant as opposed to the examples with two returns.

But since you bring it up, some coding standards insist that you return a named variable to make MORE QUICKLY LEGIBLE the value of what you are returning. You will obviously recognize the utility this has with a sufficiently complicated compound boolean equation.
>>
>>51887902
how is
return (QCameraInfo::availableCameras().count() > 0);

not completely readable? This is the most readable version IMO.

How does adding a laughably redundant if else block around it make it more "readable"?

This is blowing my mind.
>>
>>51887941
I've been told I could be fired for multiple returns by every single professor I had who worked in industry.

Meanwhile all the professors who have done nothing with computer science but teach it are the ones who tend to use multiple returns.

Are you an exception?
>>
>>51887902
What's the point of the function to begin with? Why not just inline it when/where you need to check the availability of cameras? No matter how short you write it there would still be 2 function calls over 1, is that abstraction worth it? (I know a compiler should optimize this but it still seems pointless)
>>
File: calculator.jpg (412 KB, 2496x1560) Image search: [Google]
calculator.jpg
412 KB, 2496x1560
>>51887383
nope m8. I swear god I'm doing everything from scratch just like real men would.
>>
>>51888037
nice, good work
what lib for gui? or does swift has one standard
>>
>>51888037
BUILD WALL
>>
>>51888051
UIKit m8
>>
>>51888001

I would never believe anything any professor has to say about industry, ever.

I've been programming professionally for 15 years. Return-on-error is extremely common in my experience in C++ on Windows programming.

I don't doubt that it's uncommon in big Java shops where people have hard-ons for arbitrary "patterns" and "best practices".

But when your choice is basically either:

bool succeeded = false;
if (someResourceInitialization())
{
if (someOtherResourceInitialization())
{
if (yetAnotherResourceInitialization())
{
DoSomethingWithTheResource();
succeeded = true;
}
}
}

return succeeded;


or

bool succeded = false;
if (someResourceInitialization() &&
someOtherResourceInitialization() &&
yetAnotherResourceInitialization())
{
DoSomethingWithTheResource();
succeeded = true;
}
return succeeded


or

bool succeded = false;
try
{
if (!someResourceInitialization())
throw SomeException();
if (!someOtherResourceInitialization())
throw SomeOtherException();
if (!yetAnotherResourceInitialization())
throw YetAnotherException();

DoSomethingWithTheResource();
succeeded = true;
}
catch (Exception e)
{
succeeded = false;
}

return succeeded;


(the last one is really just a completely superficially "improved" version of simply returning as soon as there's an error)

In my opinion, the alternatives are absolutely horrendous. The only reason not to return on error is 1) you aren't using auto-releasing resources (RAII) or 2) you're writing a function that is longer than it should be.
>>
>>51887902
> Not GP, but he's pretty much right.

You are both idiots creating extra lines of actual code that could easily be explained with a comment if it hurts your fragile mind so much. Anyone with 4 months of experience in C or C++ would not be perplexed by something like this and it is a waste to spend time on it.

If you want debugging, use a debugger you fucking moron.
>>
>>51887289
bump
>>
>>51888001
Reality check spoiler alert. You're professors are imbeciles and fossils who can't do shit. Thinking they know anything is a giant mistake.

When people are using C and allocating on the heap or locking mutexes then they need to structure things so they don't forget to free memory at each return.

This structure is obsolete because C is obsolete due to the current state of C++.
>>
>>51888173
>You are both idiots

Nope.

>creating extra lines of actual code

Well, not really. Not in any meaningful way.

> that could easily be explained with a comment

1) Comments go out of sync, usually alarmingly quickly.

2) This isn't the sort of thing that should be commented.

>if it hurts your fragile mind so much

It's not about my mind, it's about assuring readability and maintainability. I don't know what caffeine-fueled intern retard will be perusing the code in five years.

>If you want debugging, use a debugger you fucking moron.

Yes, let me just fire up the debugger on a client machine on the other side of world that's behind three firewalls and a Nazi IT guy. Or I could just have them enable debugging and send us the log, which nine times out of ten pinpointed the error within minutes.

Don't make the amateur mistake of thinking that because I'm a proponent of logging that I don't understand debugging. They're different things for different purposes.
>>
>>51888315
> Yes, let me just fire up the debugger on a client machine on the other side of world that's behind three firewalls and a Nazi IT guy. Or I could just have them enable debugging and send us the log, which nine times out of ten pinpointed the error within minutes.

Or you could just copy the data and state that made your program crash in the first place.

I don't know why guys like you get some mid-level java code monkey job and actually think they know what they're doing.

You have shit rationalizations to deal with you're shit workflow and shit environment.
>>
I wonder how Qt documented their function that averages two integers.
>>
File: 1449149279808.jpg (204 KB, 900x900) Image search: [Google]
1449149279808.jpg
204 KB, 900x900
>>51882877
Smart people of /dpt/, I beseech you:

What's the best most practical way to go about writing a samefag/ shill detector? Hard mode: you don't have access to IP addresses and users can easily create new ID's.
>>
>>51888315
What exactly is the benefit of the extra lines? This makes no sense to me whatsoever.
>>
>>51887289
>How come some projects consist of multiple languages
Because different languages have different strengths, e.g. C++ might be better for back-end analytic code, but you wouldn't want to write a GUI in it. So the back end could be in C++, the front end could be in Java or C#, and maybe there could be a third layer between these written in something that's good for fast networking.

>How do you get them to work together
APIs, network communication
>>
>>51888387
There isn't any. Look at the source code that GOOD programmers write and they never do something like this. QT did it as an example not as a real function.

not everyone here is the sharpest light bulb in shed...
>>
>>51888385
Detect all posts that disagree with your opinion.
>>
>>51888385
>samefag/ shill detector
If you don't have access to the posters' IP addresses, how do you think this could even be done? Looking at timestamps? Natural language analysis?
>>
>>51888431
I'm serious. This actually for another non-4chan-related project, so maybe using that image in retrospect wasn't such a good idea,

>>51888445
I'm not sure, really. I'm still trying to come up with ideas myself. I was thinking something along the lines of sentiment analysis, but the idea needs more refinement...
>>
>>51888375
>Or you could just copy the data and state that made your program crash in the first place.

LOL you kids and your cute little programs.

Look, kiddo, I've written software that's communicated with multiple servers through all kinds of funky APIs. You don't get to just "copy the data and state that made your program crash in the first place".

And who said anything about crashing?

>I don't know why guys like you get some mid-level java code monkey job and actually think they know what they're doing.

I don't know why retards like you -- who have such childish notions of software that they think you can just magically duplicate the state of an end user's computer and servers -- think they have any business being condescending to others.

>You have shit rationalizations to deal with you're shit workflow and shit environment.

You're a snotty child with no meaningful real-world experience driving your decisions.
>>
>>51888431
This, it's a time-tested technique
>>
>>51888403
Neat, thanks.
I ask because I'm learning python after using C for so long, and wonder how I could use both for a project.
>>
>>51888387
>What exactly is the benefit of the extra lines?

*shrug*

It's more readable to, as I said, a caffeine-fueled intern working at 3am.

You quickly learn that the most painfully obvious, readable code is the best code, over the long term. The notion that "more lines of code equals more bugs" isn't really true. More like, "more logical branches equals more bugs".
>>
>>51888462
>I'm serious.
me too. This is how every other 4chan user does it.

There's certainly no other way.
>>
>>51888472
That's easy then. Can you imagine doing text processing (with regexps etc) in C? C would be a horrible language for that, but python is a great language for it.
>>
>>51888466
Or maybe I have plenty of experience and figured out a long time ago that refining architecture to allow for these sorts of things make the situations you describe no longer problematic.

I don't know if guys like you that think they are doing something impressive just because it pushes you to your limits will ever stop making me cringe.

Have fun inventing the wheel for the thousandth time with your rats nest of Java that you pretend is an accomplishment just because it's been made overly complex.
>>
>>51888510
I'd have to write output from the python script to files for use in C though, wouldn't I?
>>
simple shitpost generator. so far got some different text shapes going

T O P F U C K I N G K E K
K T O P F U C K I N G K E
E K T O P F U C K I N G K
K E K T O P F U C K I N G
K E K T O P F U C K I N G
G K E K T O P F U C K I N
N G K E K T O P F U C K I
I N G K E K T O P F U C K
K I N G K E K T O P F U C
C K I N G K E K T O P F U
U C K I N G K E K T O P F
F U C K I N G K E K T O P
F U C K I N G K E K T O P
P F U C K I N G K E K T O
O P F U C K I N G K E K T
T O P F U C K I N G K E K

A
YY
YYL
YLMA
LMAO
MAO
AO
O
>>
>>51888488
>a caffeine-fueled intern working at 3am.
How?

>You quickly learn that the most painfully obvious, readable code is the best code, over the long term.
That's obvious as fuck m8. But decorating a boolean statement in a retarded if else block does not make things any more readable. Certainly for me it would make it more confusing. I would do a double take and think "wait.. why is the if else block there?". I would assume it was a mistake, or if I was confident it wasn't, then *maaaybe* the programmer wrote it because he was confident that he would replace the return true; and return false; statements with more sophisticated logic later, and wrote the if else block to make it clearer he was planning to do that. But it most certainly shouldn't be done otherwise.

If you wrote code like that in my company and someone asked you why you think it's easier to read and you said
>*shrugs*, it's more readable to a dum intern
You probably wouldn't be employed much longer. What kind of answer is that?
>>
>>51888563
>Or maybe I have plenty of experience and figured out a long time ago that refining architecture to allow for these sorts of things make the situations you describe no longer problematic.

Nope, you're definitely an inexperienced dumbfuck.

You clearly have absolutely no experience working with complex interactions between black boxes over a network. Shit happens that is entirely non-reproducible due to all sorts of causes (transient errors, configuration errors on some servers but not others, bad disks, all *kinds* of things). You simply DO NOT get to reproduce some arbitrarily complex state that induced an error.

>I don't know if guys like you that think they are doing something impressive just because it pushes you to your limits will ever stop making me cringe.

I have no idea what you're talking about. You seem to just be making dumb assumptions based on your complete lack of experience. Go back to writing your SQL queries for your web app.

>Have fun inventing the wheel for the thousandth time

I'm... not reinventing anything...? I have no idea what you're talking about.

> with your rats nest of Java

I don't work in Java.

> that you pretend is an accomplishment just because it's been made overly complex.

Um. It's of exactly the same complexity? I'm not even sure what you're criticizing at this point, since it doesn't really make any sense when applied to any of the things I've said.
>>
>>51888610

>How?

You're asking how an inexperienced person in a suboptimal state of mind might be maintaining my code years after I wrote it?

>That's obvious as fuck m8. But decorating a boolean statement in a retarded if else block does not make things any more readable.

Okay. That's your subjective opinion.

>Certainly for me it would make it more confusing. I would do a double take and think "wait.. why is the if else block there?"

I'm not concerned about your desire to remove lines of code without actually changing the program at all.

>But it most certainly shouldn't be done otherwise.

Nothing but opinion.

>You probably wouldn't be employed much longer.

Yeah... People don't get fired for making their program's logic too obvious.
>>
>>51888636
Interesting that you think there are black boxes in code you control.

Guys like you never admit that they don't know what they are doing even though deep down they know it's true. They just thrash about and insult other people and talk about how hard everything they do is without real justification. Every time without fail.

But you are mediocre. You know it and I know it. Insulting me won't change that.
>>
>>51888565
That's one possibility. They could also communicate via the network, e.g. the C program listens on a certain network port. When the python program finishes, it connects to that port and writes the result of its processing. Then the C program reads the result and does something with it. This way the C and python programs can be running on different machines.

Another possibility would be to use python for utility/admin scripts. Big applications (written in C, let's say) might come with a bunch of these scripts to perform random application-related tasks. Usually something like python is a better fit for this kind of thing.
>>
>>51888690
>Interesting that you think there are black boxes in code you control.

Hoooooly shit you're retarded.

That is kind of the fucking point: IT'S NOT FUCKING CODE I CONTROL. That's why I would refer to them as black boxes.

>But you are mediocre.

Says the guy who doesn't understand what "black boxes" means, so he just assumes the other guy is retarded and in control of what said "black boxes" are doing.

I get it, the world is easier to talk shit about when you just assume everything else is coming from a position of absolute stupidity. Your circular logic makes you feel good.
>>
x/2 + y/2
>>
>>51888743
You've confused debugging software with troubleshooting other people's binaries.

I think mediocre might have been a complement.
>>
>>51888681
>You're asking how an inexperienced person in a suboptimal state of mind might be maintaining my code years after I wrote it?
no, re read the question you dense fuck. I'm asking why would the code be more readable to an inexperienced person in a suboptimal state of mind might be maintaining my code years after you wrote it. You keep saying it would be more readable and readability is good. But why would it be more readable?

>That's your subjective opinion.
Everything is a subjective opinion m8. But making code meaninglessly extra complicated does not tend to make it more readable. Ever hear of KISS?

>I'm not concerned about your desire to remove lines of code without actually changing the program at all.
I'm concerned the benefit of this isn't obvious to you. Everything should be as simple as possible. You add stuff when you have a reason to. I often add stuff to make code easier to read. If else statements that do nothing do not add to that. You have certainly not provided any reasoning for why you think they do. Perhaps programming is not for you. Thank god I work in a company where people incapable of critical thought like yourself do not make it past the interview stage, or certainly not past the trial period.
>>
>>51888776
>You've confused debugging software with troubleshooting other people's binaries.

>>51888315
>Don't make the amateur mistake of thinking that because I'm a proponent of logging that I don't understand debugging. They're different things for different purposes.

Goddamn, you're stupid. Please use a trip so I can filter you.
>>
>>51884717
This book (well, I have the first edition irl) taught me a lot about how the stack works and some x86. I don't hack or even do security but I can't definitely say that it taught me to be a better C programmer.
Offers nice insight into the ethics of "hacking" too.
>>
>>51888802
Two different people think you are fucking tard champ.
>>
>>51888681
>Yeah... People don't get fired for making their program's logic too obvious.
No, they get fired for claiming they are making code "more obvious", but are unable to explain why they think their code should be considered more obvious, and simply respond to any criticism or questioning with "well, that's just like, your opinion maaan".

Programming in a (good) company involves a lot of getting smart people together and criticising each other work and together figuring out the best solution to given problems. People need to be able to come up with ideas and also defend them. Saying something that other people don't understand or are skeptical about and then not backing it up with anything besides "if you don't like it then that's just your opinion" does not help get better software written. People don't want to waste time dealing with people like that either.
>>
>>51888815
>Two different people think you are fucking tard champ.

Ah, so only one didn't bother to read the thread?

K.
>>
>>51888827
>No, they get fired for claiming they are making code "more obvious", but are unable to explain why they think their code should be considered more obvious

But anon, it's obvious why it's more obvious.

> then not backing it up with anything besides "if you don't like it then that's just your opinion"

Everything you have offered is *exactly* as strong an argument as everything I've offered.

What don't you get about the term "subjective opinion"? How is this confusing to you?

>People don't want to waste time dealing with people like that

Right back at ya.
>>
>>51883224
How are you finding this book? Its on my wish list...
>>
>>51888908
Go read the doom source code for an example of straight forward programming without a bunch of loopy judgement calls on meaningless style ideas.
>>
>>51888958
>a bunch of loopy judgement calls on meaningless style ideas.

Literally every style guide in history, and 3/4 of all comments I've ever heard raised in a code review. Also, one complete meltdown by a seemingly intelligent and socially capable engineer who was driven absolutely mad when someone dared check in a bug fix in "his" codebase using the wrong brace style.
>>
File: 1438997788527.gif (410 KB, 400x300) Image search: [Google]
1438997788527.gif
410 KB, 400x300
>>51888990
Every style guide in history says to make 1 line into 4 lines that do the exact same thing with more verbosity?

Fucking java programmers man
>>
>Java
POO
IN
LOO
>>
>>51888990
> one complete meltdown by a seemingly intelligent and socially capable engineer who was driven absolutely mad when someone dared check in a bug fix in "his" codebase using the wrong brace style.

Follow the style of the rest of the codebase, you dumb shit
>>
>>51889239
void fizz (int n) {
if (n % 15 == 0) { System.out.println("FizzBuzz"); } else
if (n % 3 == 0) { System.out.println("Fizz"); } else
if (n % 5 == 0) { System.out.println("Buzz"); } else
{ System.out.println(n); } }
public static void main (String[] args) {
for (int i = 1; i <= 100; i++) { fizz(i); } }


>superiorcodingstyleface.jpg
>>
>>51883127
Underrated.
Thread replies: 255
Thread images: 25

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.