[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: 38
File: 1436394097035.jpg (196 KB, 1107x1023) Image search: [Google]
1436394097035.jpg
196 KB, 1107x1023
THERE IT IS

THE MEMORIZED 25 SECOND SPEECH

PREVIOUS THREAD: >>52942393
>>
File: D.jpg (42 KB, 512x512) Image search: [Google]
D.jpg
42 KB, 512x512
D
>>
ANIMUUUUUUUUUUUU
>>
>>52946096
D puts the 'd' in "Nobody cares"
>>
What if we stored time as a float?
>>
>>52946119
Is time bouyant enough?
>>
>>52946119
APPLE DOES IT
>>
File: sheawhigham-afifest-12.jpg (23 KB, 416x650) Image search: [Google]
sheawhigham-afifest-12.jpg
23 KB, 416x650
>>52946036
is that Shea Whigham?
>>
This is the correct way to compute the average of a list of integers:

def average(xs: List[Int]): Double = {
val epsilon = 0.01
def iterate(lower: Double, upper: Double): Double = {
val guess = (upper + lower) / 2;
if (upper - lower < epsilon) guess
else {
val distance = xs.foldLeft(0d)((result, next) => result + (guess - next))
if (distance.signum > 0) iterate(lower, guess)
else iterate(guess, upper)
}
}

iterate(xs.min, xs.max)
}
>>
someone post that dpt bingo image
>>
File: 1455237958457.png (550 KB, 1500x1800) Image search: [Google]
1455237958457.png
550 KB, 1500x1800
>>52946225
>>
So, gee, any progress on averaging those 2 ints?
>>
Can /dpt/ complete the utterly basic prime fizzbuzz interview challenge?

For the numbers 1-100:
If it's prime and a multiple of 3 and 5, output "fizzbuzz"
If it's prime and a multiple of 3 but not 5, output "fizz"
If it's prime and a multiple of 5 but not 3, output "buzz"
Otherwise, output the number
>>
>>52946288
>So, gee, any progress on averaging those 2 ints?
Progress: Don't use C
>>
>>52946288
You can use >>52946215 with a list containing the two ints.
>>
>>52946288
is java shit? will go have generics in a future release? are these meme languages? is anime gay? what about tripfags? do you like haskell? what about traps? did you read your sicp today? what's the best IDE, vim or emacs?
>>
>>52946299
Dubs of truth
>>
>>52946288
int avg(int a, int b)
{
if(a > 0 == b > 0) {
return a / 2 + b / 2 + (a % 2 + b % 2) / 2;
}
return (a + b) / 2;
}
>>
>>52946295
So
1
2
fizz
4
buzz
6
7
8
9
10
...
14
15
16
...
99
100
>>
>>52946288
return x + x + x + y + y + y / 6
>>
>if a function in an sdl2 application is called 'close()', somehow it gets magically called like 6 times and causes segfaults out the ass
>the tutorial didn't think to mention this
>the tutorial example leaks 24 bytes and doesn't deallocate the image
why
>>
>>52946295
YAY HAVE CHANGE TO POST FIZZ BUZZ AGAIN!

#include <stdio.h>
#include <limits.h>

int main(void)
{
for (unsigned long long i = 0; i < ULLONG_MAX; i++)
{
if (i % 3 == 0 && i % 5 == 0)
printf("FizzBuzz\n");
else if (i % 3 == 0)
printf("Fizz\n");
else if (i % 5 == 0)
printf("Buzz\n");
else
printf("Hitler didn't do anything wrong %llu times\n", i);
}
}
>>
>>52946299
>>52946304
>>52946315
>>52946321
>>52946342
Keep them coming, gee, I know we got this! Those stackoverflow fucker ain't got shit on /dpt/!
>>
>>52946370
You didn't do what he asked
>>
>>52946388
I don't fucking care! my fizzbuzz is perfect
>>
>>52946380
i actually don't think stackoverflow has a correct signed int averaging function
>>
>>52946397
Let's AGPLv3 that shit!
>>
JS question:

var newInv = [
[2, "Hair Pin"],
[3, "Half-Eaten Apple"],
[67, "Bowling Ball"],
[7, "Toothpaste"]
];


I want to alphabetically arrange newInv so that it appears like so:
var newInv = [
[67, "Bowling Ball"],
[2, "Hair Pin"],
[3, "Half-Eaten Apple"],
[7, "Toothpaste"]
];


How do I go about doing this - i.e. arranging nested array entries alphabetically, based on the string located at index 1.
>>
>>52946295
Here it is written out
puts "1\n2\nfizz\n4\nbuzz"
6..100.each do |n|
puts n
end
>>
>>52946348
>falling for the sdl meme
>>
>>52946413
how is that nesting, its an array of elements not an array of arrays
>>
The fact that it's this hard to do a simple mathematical operation safely in C, says a lot about the language and those who use it.
>>
>>52946348
just work with raw opengl man it's not that hard. i could understand using a AAA game engine but sdl or sfml? just drop that shit man
>>
In java, I have a big program that I want to run until I enter "stop", but it also takes 3 ints from the keyboard at the same time. I'm trying to make it so that it doesn't require the string input, because right now it wants 4 inputs always which screws up the ints. How do I make it take 3 ints OR 1 string, running continuously until I enter the string?


(3 ints OR 1 string) --> (run program (if ints entered)) --> (3 ints OR 1 string) --> (exit program (if string entered))


help me senpai I don't know what the fuck I'm doing
>>
>>52946329
>>52946423

:)

dpt was not this smart the last time
>>
>>52946413
is there not like a newInv.sort() lol? it's js not c
>>
>>52946397
That's probably because retards keep changing what should happen in edge cases.
>>
>>52946447
you should probably take it as a string and then parse it to detect if it has 3 ints
>>
>>52946456
js and c are basically the same
>>
File: stop.png (25 KB, 640x394) Image search: [Google]
stop.png
25 KB, 640x394
>>
>>52946463
it should truncate, same as with /
>>
>>52946444
wat
it says a lot about memory management in modern computers...
have you tried averaging two ints in any other language? it's more or less the same.
>>
>>52946468
nice try nsa/jidf
>>
>>52946321
You are part of an elite class of about 4-5 people who can actually do this on this shitty site. Good job anon. This place is cancer.
>>
File: both.png (12 KB, 111x70) Image search: [Google]
both.png
12 KB, 111x70
>>52946468

>>52946479
He said average 2 ints, not add and div (read as div, not as divide) them
>>
>>52946479
What about -1 and 1? It should be zero.
>>
>>52946440
read the code again lad
>>
>>52946468
Not using one right now
>>
File: bloat.jpg (99 KB, 630x655) Image search: [Google]
bloat.jpg
99 KB, 630x655
>>52946321
>branching
>>
I just pushed the first usable version of my new PID1/init implementation in OCaml. It's based conceptually on Suckless' sinit, and is heavily documented.

Someone very kind posted it on HN and it got to #3 and exploded in popularity. A service manager and device manager are also in production, aiming to produce a suite of software to serve as a drop in systemd replacement.

https://github.com/rein/lyrica
>>
>>52946502
yes

>>52946500
>average 2 ints
implying it should return a (truncated) int
>>
>>52946500
>He said
yeah, in programming, having a brain and common sense can be an asset
>>
>>52946522
branching isn't even that bad

let's see you do it better
>>
>>52946522
Performance wasn't a requirement, just correctness. Stop optimizing early and changing the requirements you sperg.
>>
>>52946526
.. no, implying it should average 2 ints
>>
Friendly reminder that girls are better programmers.

I am going to remind you every thread.

I know, I know, "nobody cares", but I like reminding people, ok?
>>
>>52946502
truncation means ignoring the fractional part, ie. rounding towards zero
>>
>>52946546
ok duncan that's enough
>>
>>52946546
spotted the html programmer
>>
>>52946557
truncating 2's compliment negatives rounds away from zero
>>
>>52946556
kill yourself kike
>>
>>52946574
sounds like you don't know what truncation means
>>
>>52946563
who?

>>52946573
HTML doesn't even have types
>>
>>52946574
-3.5
chop off the .5
-3
>>
>>52946479
absolutely not, I want to be as close as possible to the correct answer. what's the most precise C type?
>>
>>52946574
since when?
>>
>>52946380
#define AVARAGE(x, y) (x >= (INT_MAX/2) || x <= (-INT_MAX/2) || \
y >= (INT_MAX/2) || y <= (-INT_MAX/2) \
? (x/2) + (y/2) : (x + y) / 2)


This should work, right?
>>
>>52946587
>HTML doesn't even have types
that's why you don't know anything about them
>>
>>52946620
AVERAGE(x++, y++)
>>
>>52946620
MACRO POWA
Shouldn't you surround x and y by parenthesis to avoid bad operator precedence?
>>
>>52946620
>(x/2) + (y/2)
doesn't
>>
>>52946602
>absolutely not
pythonfag detected
>>
>>52946586
>>52946594
>>52946605

"In mathematics and computer science, truncation is limiting the number of digits right of the decimal point." (Wikipedia)

Binary number:
11011.1011

Truncation:
11011


Apply this to 2s compliment
>>
>>52946468
>>
>>52946658
top sperg
>>
>>52946522
There is no way to do it without branching. I wrote a technically branch-less version of what he wrote a while ago. Even without optimizations the compiler detected my hackery and made it into a branch.
>>
>>52946675
>all those fucking imports
>>
>>52946631
This works perfectly well, you can do this.

>>52946638
if you want to add more, be my guest, im too lazy.

>>52946640
Why not?
>>
>>52946658
>truncation is limiting the number of digits right of the decimal point
>the decimal point
>decimal
>not binary
>>
>>52946688
>Why not?
because the average of 1 and 1 is not 0
>>
>>52946631
Oh I get it now.
>>
>>52946695
... you realise you don't call it "the binary point", right?
>>
>>52946686
Java quality
>>
File: bait-madmax-edition.gif (3 MB, 300x252) Image search: [Google]
bait-madmax-edition.gif
3 MB, 300x252
>>52946465
>>
>>52946714
what's -1.1 in 2's complement?
>>
>>52946706
Good thing it doesn't do x/2 to 1, innit?
>>
>>52946675
Dude, i'm gonna type as sober as possible, that honestly looks fucking pathetic and digusting compared to my meal. and I'm being one hundred percent serious. Sorry we dont cook shit that was perviously in cans. you're a fucking joke dude, and im dead fucking serious. gert areal family that cooks good food, drinks beer and wine and winecoolers and has a good fucking time, and has a milliondollar house on the beach, im seriously.. dont eever potst your fucking poverty dinner on these forums ever the fuck again bro, and by bro i mean never my bro, fucking faggot.
>>
>>52946729
10.111001...
>>
>>52946714
you fucking tard, they're talking about rounding 3.5 to 3 and -3.5 to -3, not whatever the fuck made up retarded sperg shit you're on about. integer truncation rounds toward zero.
>>
>>52946730
Bad thing it don't correctly average 2 odd numbers, innit?
>>
>>52946748
No, you're still truncating the number. The most significant digits (this is a generic term that includes bits and normal digits) are kept while a certain number of least significant digits are dropped

E.g. 101 -> 100

The nature of 2s compliment representation means that this number actually gets further from zero
>>
>>52946515
>not using real erlang
>>
>>52946447
>>52946464
alright I fixed it, I used a try catch block to handle the input mismatch exception and have it exit
>>
>>52946799
https://www.youtube.com/watch?v=rRbY3TMUcgQ
>>
>>52946765
you can add that, without a problem this is just a test not a definitive answer.

you are clinging on things that really don't matter in what macro is trying to do.
>>
File: mike.png (180 KB, 3924x5000) Image search: [Google]
mike.png
180 KB, 3924x5000
>>52946799
Who /mike/ here?
https://www.youtube.com/watch?v=rRbY3TMUcgQ
>>
Just re-learning Unity, GUI specifically
>>
What are good resources to learn openGL in a C fashion? I need to also brush up on my linear algebra.
>>
>>52946820

slow fag
>>
what are these checkboxes for?
>>
>>52946841
deleting other people's posts
>>
Hard drives take FOREVER to format when you uncheck "quick format", what gives?
>>
Alroight boys, I fink I done it.

(define (avg a b)
(/ (+ a b) 2))
>>
File: fsharp code quotation.png (3 KB, 278x41) Image search: [Google]
fsharp code quotation.png
3 KB, 278x41
>>52946864

Beat you ages ago
>>
>>52946841
 N
NEWFAG
EW
WF
FA
AG
G
>>
>>52946864
Looks like girl code, i.e. very good.

Good job! Did your mum help you? I bet she did.
>>
>>52946863
wiping the whole drive vs writing the partition table
>>
>>52946817
>doesn't work
>why?
>this reason
>you're just clinging to things
fuck off
>>
>>52946870
RETARD
E R
T A
A T
R E
DRATER
>>
>>52946867

Good work, m9.

>>52946874

Women use JS, lad. Come on. It's the year of our lord and savior, Jesus Christ of Nazareth, Two Thousand Sixteen.
>>
>>52946892
Point of it is not to overflow, does that work?
if it overflows it doesn't.

don't give 2 shits if it gives accurate results.
>>
Is this the place to beg /g/ on bended knee to help me with my C# project?
>>
>>52946924
#define AVG(a, b) 0
works just as well then; doesn't overflow, don't give two shits if accurate
>>
>>52946955
[spoiler]yes[/spoiler]
>>
>>52946955
Ask OSGTP. Him and one other fag are the only people who use it.
>>
>>52946791
still, we aren't talking about truncating the bits. -7 / 2 == 3 even on two's complement
>>
>>52946964
Go fuck yourself, you failed to read the code, you failed to understand purpose of the code.

Basically you are being an shit and not understanding what it's doing.
>>
>>52946974

I'll have you know there's like 3 or 4 people here who use it.
>>
>>52946995
-7 / 2 == -3.5
>>
>>52946036
Is this guy 4chan?
>>
>>52947000
>understanding what it's doing
what it does is nothing useful
>>
>>52947008
>average two ints in C
>ints
>in C

-7 / 2 == -3
>>
>>52946995
they use arithmetic shifts
>>
How much of a meme is hyperthreading?
>>
>>52947044
shit works, son
>>
>>52947044
how much of a retard are you?
>>
>>52947023
What is it with Ctards and ints?

>the parameters are ints - THIS FUNCTION CAN ONLY RETURN INTS
>all pointers should be treated as ints
>main should return an int
>>
Hey family what are some modern resources on computer graphics / real time rendering? I want to know how shit works in general, not a specific api
>>
>>52946799
Eh, why should I learn it when Elixir should be just as good if not better? Still runs off the erlang VM.
>>
>>52947044
4 extra threads is kind of like having one extra core if you max the cpu out
>>
File: sublime_text_2016-02-13_03-55-44.png (136 KB, 1920x1080) Image search: [Google]
sublime_text_2016-02-13_03-55-44.png
136 KB, 1920x1080
>>52946468
>>
>>52947054
if you want a float just use a goddamn favg function
>>
>>52947053
good argument
>>
>>52947044
It's the best meme, lowers CPU idle.
>>
File: leredditderp.jpg (189 KB, 717x880) Image search: [Google]
leredditderp.jpg
189 KB, 717x880
>>52946841
>>52946870
>>52946965
>>
>>52947055
i haven't read it but i presume the opengl superbible also talks about cg in general
>>
>>52947055
>I want to know how shit works in general, not a specific api

There's a reason that GFX cards offer specific APIs, which are then simplified by other libraries.

That's just how they werk.
>>
>>52947054
point is to challenge yourself.

it's too easy to do it in float.
>>
>>52947023
type that into a calculator, buddy
>>
>>52947076

How do you get FS view in Sublime?
>>
>>52947097
dumb & worthless as always
>>
What's the best programming font?
>>
File: cucked hard.png (54 KB, 423x388) Image search: [Google]
cucked hard.png
54 KB, 423x388
>>52947106
>>
>>52947093
For the last fucking time

[spoiler]IT'S FOR EFFECT YOU GOD DAMN RETARDS[/spoiler]


>>52947077
if favg returns a float and takes two ints, what do you call the function that doesn't take ints?

>>52947076
>.py
>>
>>52947120
times new roman
>>
>>52947114

Graphics are magic. What do you want me to say?
>>
File: Honeyview_2016-02-13_04-00-33.png (15 KB, 317x358) Image search: [Google]
Honeyview_2016-02-13_04-00-33.png
15 KB, 317x358
>>52947111
>>
>>52947120
Operator Mono.
>>
>>52947105
No, that's not the reason you don't use floats

You don't use floats because it's not a portable solution
>>
>>52947122
you're delusional
>>
>>52947055
you don't really need to read anything modern unless you are utilizing features introduced recently
I recommend just reading the OpenGL (soon Vulkan) docs
>>
>>52947131
favg can take floats and you can pass ints to it what the fuck's your problem man

>>52947148
kill yourself
>>
>>52947144

Oh wow. Maybe I'm retarded, because I haven't seen that feature before.
>>
>>52947111
You need to drag a folder onto Sublime
To toggle it's CTRL+k, CTRL+b
>>
>>52947156
ints in floats is not portable
>>
>>52947143
know your place and shut the fuck up
>>
>>52947164
fuck off cunt only i get to shit on gtp and his BB_ fetish
>>
>>52947105
integer/fixed point arithmetic is perfectly usable in real-world situation. like with position and distance: with floats you'd get more precision closer to the origin and a lot less precision further way from the origin and with larger distances. with ints you have consistent precision like with a ruler.
>>
>>52947147
what if you use 2 decimal precision?
>>
File: 1452031713097.gif (1 MB, 500x500) Image search: [Google]
1452031713097.gif
1 MB, 500x500
>>52947164

Evidently you've determined that your place is replying to me. You enjoy it.
>>
>>52947055
>>52947151
also this surfingto://realtimerendering.com/book.html
>>
File: Sans titre.png (62 KB, 466x386) Image search: [Google]
Sans titre.png
62 KB, 466x386
>>52946965
I'm guessing you come from /v/ or something?

>>52947001
Is it really that uncommon? It seems like it'd be more widespread, it's not really an obscure programming language.


Anyway, what I'm supposed to do is the following:
1. Create a program that sums the total amount of cash tendered by the customer and calculates the amount change in cash of each denomination ($100, $50, $20, $10, $5, $2, $1, 25¢, 10¢, and 5¢) to return to the customer.

It also has to stop asking for bill amounts after the entire amount of money spent or greater has been input into the system, presumably with a break.

I also have to modify it to round down if it's 2>= cents or round up if it's 3 or 4 cents because of the Canadian penny being discontinued, and finally, have to add a login thing at the top that takes cashier as a username, NoPassword as a password, and will terminate if these aren't met (I figured if/else would do here, because there's only one possibility for each, and it's not like a true login system), but I'm not sure how to input an "if" after the original if if this is the way to go.

tl;dr I need to figure out how to do a single-possibility login, ask for the total money received, then break it down into each denomination of currency and break when the total that was paid is reached, output total cash tendered, total cash to return, and which denominations (10$, 5c, etc) to return it in. Finally, if it's less than five cents I need to round down if it's 2>= or round up if it's 3 or 4 due to lack of penny in Canada.

Will suck cocks for help, I fucked up and put other projects ahead of this one because I didn't realise how hard it would be for me.
>>
can someone help me with making this be in a class where you can call to play, loop, and most importantly STOP a given .wav?

        try {
Path currentRelativePath = Paths.get("");
String s = currentRelativePath.toAbsolutePath().toString();
s += "\\"+ "Title Theme.wav";
File mainTheme = new File(s);
AudioInputStream stream;
AudioFormat format;
DataLine.Info info;
Clip clip;

stream = AudioSystem.getAudioInputStream(mainTheme);
format = stream.getFormat();
info = new DataLine.Info(Clip.class, format);
clip = (Clip) AudioSystem.getLine(info);
clip.open(stream);
clip.start();
}
catch (Exception e) {
e.printStackTrace();
}


i'm having trouble mostly with the stop part
>>
>>52947212
is /dpt/ just a constant flood of newfags and tripfags? i've been doing [spoiler]this[/spoiler] for months
>>
>>52947212

Well, I'm not going to do your HW, but I will give you one pointer: int* x;

Just kidding -- use the decimal data type. It's intended for financial calculations.
>>
>>52947234
well i mean it's not like it's uncommon to do that by accident
>>
>>52947234
I've been coming and going for years.
>>
>>52946295
Sorry I'm late.
def is_prime(number):
for n in range(2, number):
if number % n == 0:
return False
break
return True
def fizz_buzz():
for n in range(1, 101):
s = ''
if is_prime(n):
if(n % 3 == 0):
s += 'Fizz'
if(n % 5 == 0):
s += 'Buzz'
else:
s = n
else:
s = n
print s
>>
>>52946295

#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#define FIZZ "-f"
#define BUZZ " ~"

int main(int argc, char *argv[])
{
int i;
char xbuf[100];
char *buf;
strcpy(xbuf, "rm ");
buf = xbuf+3;
for(i = 1; i <= 100; i++)
{
buf[0] = 0;
if(i%3 == 0) strcat(buf, FIZZ);
if(i%5 == 0) strcat(buf, BUZZ);
if(buf[0] == 0) sprintf(buf, "%d", i);
system(xbuf);
}

return 0;
}
>>
>>52947260
this doesn't work fa.m
>>
>>52947268
Whoops I mean
#define FIZZ "-rf"
>>
>>52947260
2 is prime
>>
>>52947234
I only come here for the tank memes
>>
>>52946295
#include <cstdio>
using namespace std;

int main()
{
bool fizz;
for(int i = 1; i <=100; i++)
{
fizz = false;
if((!(i%3==0)) && (!(i%5==0)))
{
printf("%i", i);
}
if(i%3==0)
{
fizz = true;
printf(" fizz");
}
if(i%5==0)
{
if(!fizz)
{
printf(" ");
}
printf("buzz");
}
if(i<100)
{
printf(", ");
}
else
{
printf(". ");
}
}
return 0;
}
>>
>>52947001
This calls for a language knowledge test.
http://strawpoll.me/6801824

ATTENTION. ALL THOSE OF ABLE FINGERS PLEASE FILL OUT THIS FORM.
>>
>>52947268
I use the dindoos os
>>
>>52947304

How much 'knowledge' counts? If you're not a guru, but know enough to be dangerous, does it still count?
>>
>>52947300
nope
>>
>>52947318
judging by the poll,
"have tried for 5 seconds"
>>
>>52947320
that's the actual fizzbuzz. the fizzbuzz you requested was incorrect
>>
>>52946247
But Haskell really is useless.
>>
>>52947330
prime fizzbuzz != baby's first fizzbuzz
>Interviewer, your questions are wrong
>>
is Java actually a pretty good language?
>>
File: 1454699993551.png (6 KB, 288x331) Image search: [Google]
1454699993551.png
6 KB, 288x331
>>52947323

I answered honestly. This stupid poll doesn't even have a provision for knowing your own language.
>>
>>52946036
Fuck Rubio the Robot
>>
>>52947359
>Other
>>
>>52947330
His fizzbuzz is worded that way for a reason. You failed the reading comprehension portion of the test. We can't give you a job because we're not sure if you'll do what we tell you to do. No harsh feelings
>>
File: functional-right.jpg (512 KB, 1131x1600) Image search: [Google]
functional-right.jpg
512 KB, 1131x1600
>>52947304
>http://strawpoll.me/6801824
Haskell wins
>>
>>52947376
I mean, we weren't testing for reading comprehension because we weren't really expecting anyone to fail, but here we are. Maybe you should find a new profession.
>>
File: 1450206731373.gif (2 MB, 330x270) Image search: [Google]
1450206731373.gif
2 MB, 330x270
>>52947374

shoot me.
>>
Well, i'm the guy that came here a week ago with absolutely no idea about anything programming related, and wanting to learn c.
I came to you asking about a for i was having trouble with.
I took some guy's advice and started again reading "C, a modern approach" instead of K&R, and now i'm at it. I'm still at builder 6.0 tho.

I'm having trouble with an exercise. I hope you guys can give me some help or advice (without doing it for me)

It's about making a monthly calendar with input on the user about the number of days it will have and the starting day of the week.

So far i've got this,
http://prntscr.com/a2l914

and it works if i start on a sunday, but i'm not sure how to add the starting day to the loop without adding a switch (add spaces with each case being the starting day) and im sure there must be a cleaner way to do it.

Please help the newest of the new here?
>>
>>52947352
It's like C++ and Smalltalk got drunk together and had a baby.

Kinda simplified in some places, kinda half-arsed in others. It's a language that developed over time without a lot of design consideration.

I'd say it's an OK language, but then again I'd also say that about PHP. Either way, they're both languages that I don't like to start writing code for, but when I start it's actually not that painful.
>>
>>52946295
>>52947260
>>52947276
>>52947290

I just realize it's a stupid challenge.
>>
File: 272.jpg (37 KB, 430x534) Image search: [Google]
272.jpg
37 KB, 430x534
Ask your resident guy who knows just enough C# and the WPF framework to get by anything.

You know you want to.
>>
>>52947452
Slip in an extra for loop beforehand for generating the spaces.
>>
>>52947229
nvm i got it. i was trying to make it be static
>>
File: felix6.jpg (17 KB, 320x208) Image search: [Google]
felix6.jpg
17 KB, 320x208
>>52947477
At least you get to use C#. I'm stuck in VB due to an unfathomable clusterfuck of legacy bullshit.
>>
>>52946497
you are implying that everyone wants, or needs, to average two ints in C...
>>
>>52947551
I remember when I used to spend a work week writing VB.NET in Excel, working on awful, ancient and poorly maintained codebase. It was the absolute manifestation of hell on earth.

I'm glad I left the profession, it's a hobby now.
>>
>>52947477
>Ask your resident guy who knows just enough C# and the WPF framework to get by anything.

When are we going to commit mass suicide?
>>
>>52947584
Not long now, brother.

We'll know release from this suffering soon.
>>
r8 me elite of /dpt/:
langs:
golang, python, java, x86 asm, c, javascript, haxe, php
sql: mysql, postgres
version control: git, svn
>>
>>52946380
int avg(int x, int y)
{
int upper = (x>>1)+(y>>1);
int lower = (x&1)+(y&1);
return upper + (lower>>1);
}
>>
>>52947601

       <ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding takeMeLordXenu}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
>>
File: Screenshot_2016-02-13_13-34-35.png (17 KB, 644x505) Image search: [Google]
Screenshot_2016-02-13_13-34-35.png
17 KB, 644x505
>dicking around with SDL
>write a struct for a point
>manage to write some methods to change pixels in a screen surface
>write a struct for a line
>write a method to draw a line
>write a struct for a triangle
>write a method to draw a triangle
>write a method to move a triange
>it does this then segfaults immediately
God I love C
>>
>>52947583
Yeah, I work in Healthcare (insurance). This industry is so resistant to change it's not even funny
>>
>>52947484
Thanks! got it now
http://prntscr.com/a2lcv6
>>
>>52946380
Couple of asm solutions

ia32: eax, ecx -> eax
    ADD eax, ecx
RCR eax, 1


ARM: r0, r1 -> r0
    ADDS r0, r1
RRX r0
>>
>>52947636
>golang, python, java, x86 asm, c, javascript, haxe, php

you are become meme, memer of memes
>>
>>52947649
now show us your function to average two ints
>>
>>52947649
valgrind it

that, or try coding it like it's not Java
>>
>>52947646
public static void ReleaseMeFromThisPrisonOfMisery()
{
List<string> theEternalAnguishConsumesMe = new List<string>() { "(Wake me up)", "Wake me up inside", "(Can't wake up)", "Wake me up inside", "(Save me)"}
foreach(var ViolentEmotionalOutburst in theEternalAnguishConsumesMe)
{
Console.WriteLine(ViolentEmotionalOutburst + " Please end my existence.");
}
}
>>
>>52946321
>>52946620
>>52946964
>>52947639
https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
>>
File: f3d.png (283 KB, 600x595) Image search: [Google]
f3d.png
283 KB, 600x595
>>52947649
>C
>Games

watch out we got chris sawyer over here
>>
>>52947704
I know why it's segfaulting you cheeky cunt

I need to put some bounds checking on my set pixel function so it doesn't try to draw off the screen
>>
>>52947636
meme/10
>>
File: distain.jpg (57 KB, 373x480) Image search: [Google]
distain.jpg
57 KB, 373x480
>>52947731
>not using C for games
>>
>>52947768

Most AAA games are made in C++, mate.
>>
>>52947814

Which is decidedly not C.
>>
>>52947814
Who fucking cares, most electronics are made in China doesn't mean china is motherland of all innovations.
>>
>>52947741
Then why not just do that instead of bitching and moaning like it's the language's fault?

>I introduced a bug into this program I'm writing
>OH THE SHIT I PUT UP WITH
>>
>>52947814
and PHP is the most widely used scripting language, what is your point?
>>
>>52947836
I think he was just telling an enjoyable story. I liked reading it.
>>
>>52946413
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
>>
>>52947681
>>52947746
thanks you elites, now I can die a painful dead after knowing this
what should I do to fix my life? should I learn haskell, lisp, rust?
>>
>>52947865
Seppuku is the only way now
>>
>>52947865
>haskell, lisp, rust

You may as well -- in for a penny, in for a pound.

Of memes, I mean.
>>
File: plebs vs pats dpt.png (56 KB, 839x777) Image search: [Google]
plebs vs pats dpt.png
56 KB, 839x777
>>
>>52947678
>rolling for a division by 2
what the fuck mang
>>
how do I redirect stdout into stdin?
>>
>>52947926
>that faint PHP
nice try, ancient web-lich
>>
>>52947926
>C#
yeah, nah
>>
explain how perceptual hashing works to me like I'm a retard
>>
>>52947989

What platform?
>>
>>52947989
|
>>
Help me, dpt.

I want to start to actually learn programming as in algorithms, like the programming you need for e.g. google programming challenges.
I took programming, but my lessons were mostly about user interface and gay colorful shit like this
Where/how do I start?
>>
>>52948049
https://wiki.installgentoo.com/index.php/Programming_resources
>>
>>52946295
>if it's prime and a multiple of 3 and/or 5
>if it's prime
>multiple of
1, 2, fizz, 4, buzz, ... 100

Retarded "challenge" m8.
>>
>>52948049

Take a real CS curriculum. If that's not something you're willing to put yourself though, at least read CLRS.
>>
>>52948090
Actually a reading comprehension challenge
All the people doing regular fizzbuzz on this and last thread are proof of this
>>
The fact that data is ambiguous is pretty cool. I think Elixir or Erlang is the language that that guy who wanted to make without types was looking for.
>>
>>52948090

Are you saying normal fizzbuzz is a challenge?
>>
i set up my visual studio c# project on git by putting it in the folder with the .csproj, but any nuget packages i have are in the parent folder to this directory

should i move the package folder from parent to what im in right now, or is it normal (like in python) to just give instructions on what packages to install with nuget? should i have started the git project in the parent directory instead?
>>
>>52948228
here's your (You) champ
>>
>>52947831
countries == programming languages?

are you retar-

I mean, you are retarded.
>>
>>52948169
IMO, that shows that people in /dpt/ copy and paste the fizzbuzz as soon as they read "fizzbuzz"
if this is true, it proves what I think about dpt:, it is moslty for shitposting, just as almost everything else in 4chan...
>>
>>52946096
Makes me proud desu
>>
>>52948352
Time to write a bot that posts fizzbuzz in reply to fizzbuzz on the dpt
>>
>>52948407
>bot
>>
>>52948407
Need to develop a machine learning solution to the integer averaging problem first.
>>
I don't know what to do. I've hated web developement for most of my life and studied areas I've enjoyed, however, upon entering university I realised there was nothing but web technologies. I went out of my way to find the real programming my doing engineering units but now that I'm looking for jobs everything is still web. Why do people like .NET so much? Why does everyone call a designed a "JavaScript front-end developer"?

I hate it so much and without any experience I can't get any of the few decent looking jobs.
>>
>>52948092
how do you define "a real cs curriculum"
>>
>>52948515
Something that teaches you Computer Science, not programming.
>>
>>52948478
More like a neural network for averaging
>>
>>52948478
>>52948552

But you need to implement it without using averaging or weighting
>>
public class Div { 
public static void main(String[] args) {
System.out.println(3 / 2 == 1.5);
System.out.println(3 / 2 == 1);
}
}

what will it print, /dpt/?
Thread replies: 255
Thread images: 38

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.