[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: 32
File: hime on the front page!.jpg (94 KB, 500x701) Image search: [Google]
hime on the front page!.jpg
94 KB, 500x701
old thread: >>53733358

What are you working on, /g/?
>>
How do I stop being a weeaboo /g/?
>>
>>53736758
one of these.
https://en.wikipedia.org/wiki/Suicide_bag
>>
>>53736788
weebs make the best computer software
>>
>>53736758
Some CUDA shit to benchmark how well the on-board DMA-engines fare.
>>
File: 1458848422476.jpg (37 KB, 352x750) Image search: [Google]
1458848422476.jpg
37 KB, 352x750
Corgi's are cute, CUTE
>>
>>53736793
Shemales do
>>
File: superfappable!.png (1018 KB, 640x941) Image search: [Google]
superfappable!.png
1018 KB, 640x941
Working on my file server with torrent support.
I'm nearly done implementing an indicator for new downloads.
Should I add the indicator (a '*') before or after the file name?
>>
Lovely to see a proper /D/ Programming Thread
>>
>>53736758
Systematically tracking down and eliminating people who program in Rust.
>>
File: 1453328832517.jpg (124 KB, 896x1280) Image search: [Google]
1453328832517.jpg
124 KB, 896x1280
Can you finish this function, /g/?
bool is_odd(int n) {
// code goes here
}
>>
>>53736821
That's very kind of you. They must be grateful for you putting them out of their misery.
>>
>>53736862
>
bool is_odd(int n) {
return !is_even(n);
}
>>
>>53736862
return n&1
>>
>>53736862
bool is_odd(int n) {
return n % 2 != 0;
}
>>
File: 5222828710_494ba3a100_b.jpg (93 KB, 1024x565) Image search: [Google]
5222828710_494ba3a100_b.jpg
93 KB, 1024x565
>>53736862
int is_odd(int n)
{
return !(n % 2);
}
>>
>>53736862
bool is_odd(int n) {
return n == 2; // it' the oddest prime, can't get any more odd than that
}
>>
>>53736804
proof?
>>
>>53736862

public static boolean is_odd(int n)
{
return (n % 2 != 0) ? true : false;
}
>>
>>53736862
int an = std::abs(n);
bool result = false;
while (an) {
an--;
result = !result;
}
return result;
>>
>>53736873
>>53736878
You fail the test.
n % 2 is going to be zero if n is even and zero means False while any number other than zero means True.
Get fucking good, scrubs.
>>
>>53736804
You mean mentally ill men make the best software? You're probably right.
>>
>>53736871
no

>>53736873
yes

>>53736878
no

>>53736895
>>53736896
>>53736870
kek
>>
>>53736908
I am wearing a dress right now as we speak
>>
>>53736901
look closer shitlord. >>53736873
>>
>>53736810
I'd add it before the filenames, so the user doesn't have to scroll all the way to the end when the filename is very long.
>>
>>53736923
how l-lewd, hope your cock is comfortable.
>>
>>53736919
why are you laughing?
it works perfectly and is completely portable
>>
>>53736919
Why is `return n&1` incorrect?
>>
>>53736959
ones' compliment
>>
Is JS acceptable to code in?
I know that the HTML/CSS side of stuff is firmly not-dev and JS sucks as a language, but is it okay to talk about it here?
>>
>>53736959
Because <insert arbitrary reason based solely on preference here>
>>
>>53736931
Yes, I looked very close and it's very shit. You didn't need the != 0, chucklefuck. return n % 2 would've done the trick.
>>
>>53736938
I'll be your girlfriend tonight
>>
>>53736965
Stop it, you'll make me blush
>>
>>53736965
>what is bit ordering
>>
non-fag thread

>>53736903
>>53736903
>>
>>53736976
if your JS code doesn't run outside of a sandbox in your webbrowser, it's not programming
>>
>>53736862
if (n/2) = 2 return false;
else if (n/2) = 1 return true;
else return false;

how'd i do? i normally do webdevelopment but i'm teaching myself coding now (i'm a girl btw)
>>
File: pysoccer-1080p-2730k.webm (690 KB, 1920x1080) Image search: [Google]
pysoccer-1080p-2730k.webm
690 KB, 1920x1080
Still working on my python turn base soccer game.
>>
>>53736982
>>
>>53736923
picture please
>>
>>53736976
all webshit, especially frontend shit, is not programming

most websites shouldn't even use javascript, they should just use HTML/CSS, you are not good just because you use javascript, fucking retarded memer
>>
>>53736990
this has nothing to do with endianness. This has to do with representation of signed ints
>>
>>53736994
nice bait but you forgot to use ==

if ((n/2) = 2) == true return false;
else if ((n/2) = 1) == false return true;
else return (false == true);
>>
>>53737007
Mr Bond, if you didn't get the joke about "compliment" being the wrong word, then I wont feel bad about cutting you in half with this laser.
>>
File: jealous.jpg (372 KB, 1280x720) Image search: [Google]
jealous.jpg
372 KB, 1280x720
Write a function that takes an integer of any bit length and returns a pointer to a char array containing the binary data of that integer.

Only boys who dress up like schoolgirls can solve this.
>>
>>53737018
>this has nothing to do with endianness.
Of course it does.

n & 1 works with one's compliment.
>>
>>53736965
>>53737018
First bit (b0) will only be set if the number is odd though, for 1 or 2s complement.

Just because it's a hack doesn't mean it isn't perfectly functional.
>>
>>53737050
No, n&1 DOES NOT work with ones' complement.

example, -5 is odd, but the LSB is 0
>>
>>53737023
wow i'm a dumbie x( thaaanks lol
>>
>>53737061
>First bit (b0) will only be set if the number is odd though, for 1 or 2s complement.

Except YOU'RE FUCKING WRONG about 1s complement. And 1s complement is one of the 3 allowable representations of signed ints in C/C++
>>
>>53737037
Into the gas chamber you go.
>>
i & 1 works just fine
http://ideone.com/MPU40e
>>
Web programming master race here just check in you code monkeys to say that in node js "is_odd" is as easy as "npm i is-odd", it's webscale as well.

https://www.npmjs.com/package/is-odd
>>
File: ready.gif (2 MB, 390x277) Image search: [Google]
ready.gif
2 MB, 390x277
>>53737065
>>
if you have normalized 2d vectors (points on a unit circle), what's a good way to map them to a "dial". like on a clock if you have 12 numbers evenly distributed along the edge of circle, then (1,0) would map to 3 and (0,-1) would map to 6 and so on.

the obvious solution would be to use atan2(y,x) to get the angle and then multiply it by a constant factor, but then you run into problems when x or y are close to zero, so i'm looking for an alternative solution. any ideas?

this is for opengl shader code btw
>>
>>53737101
implementation-defined
>>
>>53736800
nothing explains why he prefers any of those features. why are macros or higher order modules bad? why are higher kinded types/type classes bad? he says they're not useful but these are literally the best tools I can think of for cutting down on boilerplate.
then some things (like pattern matching addition) are literally undecidable at runtime... the only way to do that would be if you defined + as a pure/total function operating on a simple data structure (like natural numbers) and that would make execution slow as fuck. half of these have nothing at all to even do with F#.
>>
File: 1448066729810.jpg (24 KB, 401x372) Image search: [Google]
1448066729810.jpg
24 KB, 401x372
>>53737065
>example, -5 is odd, but the LSB is 0
pls go and stay go
>>
>>53737109
hashmap
>>
>>53737109
the first solution is fine, just use an epsilon to deal with floating point inaccuracy
>>
>>53737043
No anon, I'm not doing your homework
>>
>>53737018
>"bit order doesn't matter"
>>53737065
>"bit order does matter"

Also, pic very much related. Thanks for playing.
>>
>>53737108
Pretending to be retarded?

>>53737101
See >>53737079

>>53737129
ONES' COMPLEMENT! See >>53737079

>>53737135
>confusing byte ordering with signed bit representation
>>
>>53737132
no it's not fine in glsl, the implementation is likely to fuck it up severely, like it can give -pi/2 instead of pi/2 for (0,1)
>>
>>53737159
>>confusing byte ordering with signed bit representation
I said bit ordering, I never said anything else. & 1 gives you the LSB.
>>
>>53737187
and the LSB for -5 is 0 for ones' complement, see >>53737079
>>
>>53737187
http://stackoverflow.com/questions/3952123/representation-of-negative-numbers-in-c
>>
>>53737185
Point of atan2 is to preserve the quadrant.
>>
>>53737122
It works with unsigned ints, one's complement and for two's complement.. What other ways of representing integers are defined by the standard?
>>
>>53737210
>works for ones' complement

Except it doesn't. See >>53737198
>>
>>53737204
when you have division by 0 anything goes

and glsl implementations are optimized for efficiency, not correctness
>>
>>53737197
It's not, it's 1. See >>53737135
>>
How does one embed GLSL in their C programs?
>>
File: xEby2QO.png (38 KB, 561x852) Image search: [Google]
xEby2QO.png
38 KB, 561x852
Meh.
>>
>>53737210
>i don't know one's complement
>>
>>53737219
That link clearly talks about MSB. See >>53737239 and >>53737135

It definitively works, as one's complement representation of -5 ends with 0xB.
>>
If you guys want good programming practice with programming challenges everyday and programming tournaments coding against other coders.

Check out codefights.com you guys will enjoy it
>>
>>53737244
char arrays
>>
>>53737244
a fat const string.
>>
>>53737252
See >>53737239

Now get lost.
>>
>>53737253
>>53737239
Jesus christ, you're beyond saving.

YOU ARE NOT USING ONES' COMPLEMENT, YOU ARE USING TWOS' COMPLEMENT, OF COURSE IT WORKS

READ THE STACK OVERFLOW ANSWER MORE CAREFULLY >>53737198
>>
>>53737268
>>53737270
is there any way to make these look nice, like they're really part of the C file itself, instead of putting parantheses everywhere?
>>
>>53737272
That only works because your c implementation uses two's complement, which is not guaranteed to be true for all systems.
>>
>>53737272
herp derp
>>
>>53737266
I hate that shit. It's kinda fun, but all the challenges are autistic dick waving contests. If you want to get good at programming, start making cool shit.
>>
>>53737291
wrap the source in a TOSTRING macro maybe
>>
>>53737291
put it in a separate file i guess, and embed the file or some shit.
>>
>>53737291
>>53737319

seperate file and load them in
>>
>>53737159
>Pretending to be retarded?
Actually I just got 1s complement mixed up with sign/magnitude representation.
1s complement is slightly less shit than sign/mag but only slightly, both of them make passing the positive/negative boundary fucking painful in hardware.

Pretty funny that plenty of others don't understand this though, they can't all be pretending.
>>
>>53737308
But it's too hard to make all the cool shit I tried and have failed
>>
>>53737106

>importing a library for one trivial function
Checking if a number is even or odd is so trivial that you can easily inline it in an if statement in about as many characters as it would to invoke the function in the first place. Consider the following two cases:

if (isOdd(n)) { ... }
if (!(n%2)) { ... }


>>53737135

This does not produce correct output on the Univac 1100/2200 series of computers, and their modern successors, the Unisys Clearpath machines, which use 9 bit bytes and one's complement signed integers.
>>
>>53737367
All is possible in programing. Just keep learning, reading and trying until you can do it. If you're not very naturally talented, then just be patient.
>>
>>53737368
>less characters is better
Haskelfags are not permitted in this thread.
>>
>>53737368
!(n % 2) is not webscale, this is though:

'use strict';

var isNumber = require('is-number');

module.exports = function isOdd(i) {
if (!isNumber(i)) {
throw new TypeError('is-odd expects a number.');
}
return !!(~~i >> 0 & 1);
};
>>
Thanks /dpt/, now I know how to find odd numbers on ancient and/or clown-architecture machines.

And I only had to wade through a few dozen sperged-out shitposts!
>>
>>53737368
>!(n%2)

Retard detected
>>
>>53737043

template <typename T>
char* serialiseBits(T n) {
char* x = new char(sizeof(n) * CHAR_BIT);
for (size_t b = 0; b < sizeof(n); b++)
for (size_t i = 0; i < CHAR_BIT; i++)
x[b*CHAR_BIT + i] = ((char*) (&n))[b] & (1 << i);
return x;
}
>>
>>53736758
How do I contribute to projects?
Nobody else's code makes any sense to me.
>>
>>53737000
How do you make soccer turn based?
>>
>>53737368
Why should I remember arcane operators such as % when I can just import a lib do it for me? Remember, Real Programmers Ship
>>
>>53737237
Unlikely to cause any problems in practice, glitches a user can hardly perceive are perfectly fine.
And if it does cause noticeable glitches just fudge the edge cases around 0.
>>
>>53737432
>arcane operators such as %

gurl programmer detected
>>
>>53737413

Wait, shit, it's n%2.

I just woke up. Brain doesn't work yet.
>>
>>53737441
>what is sarcasm
>>
>>53737429
I'm thinking about it. Next thing I have to do is implementing payers movement. I think it will be simultaneous.
>>
>>53737409
you're welcome ^_^

I hope you understand that C has standards now
>>
>>53737421
whoops!
new char[sizeof(n) * CHAR_BIT]
>>
>>53737451
readable code is best code. None of this n%2 shit pls.
>>
I am making a dating application that is based off of Interests. So you and a person both fill out a bunch of interests and you are matched with someone with a lot of similar interests. For 1 minute each you have to talk about the highlighted interest in a live chat you both share and at the end of all the same interests you are given an option to give out your contact info or on to the next person
>>
File: modulous.png (92 KB, 646x459) Image search: [Google]
modulous.png
92 KB, 646x459
>>53737441
check yourself before you rek yourself
>>
>>53737479
>readable code is best code
Only if it works. broken readable code are totally useless.
>>
>>53736871
Don't know why no one's accepting this. Oh wait.. No one on /g/ knows anything about computing, I remember.
>>
>>53737494
>are

get back to eclipse, pajeet
>>
>>53737492
lel, I remember that, if anyone want's a laugh

https://css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/
>>
>>53737494
>broken readable code are totally useless.
If it's readable, it's easy to tell when it's broken. That's one of the primary benefits.
>>
>>53737421
>>53737477
woah I definitely fucked up somewhere
>>
>>53737266
I don't understand it, why does it give me solutions that need a tiny adjustment? Why is my opponent not coding in real time but rather can do it anytime? What's the fucking point?
>>
>>53737490
What do you guys think?
>>
>>53737490
Sounds like any other dating app tbqh
>>
>>53737479

n%2 is plenty readable, and most programmers intrinsically know what it means.
>>
>>53737266
this fucking sucks, if the number of lines differ it won't accept it? SHIT
>>
>>53737544
There's a shitzillion sites that do that sort of thing anyways. What's the point?
>>
>>53737523
I know readable code that are pure garbage. Best code is maintainable code, not readable.
>>
>>53737423
Generally, I’ll just pipe find into less and try to understand
the directory structure. Then either something grabs my eye or I don’t
understand what something is. So I pick a random file and get a feel for it.
Then I bounce around and wander aimlessly until I’m bored and then pick a
new random spot to jump in.
A lot of times, I’ll work on building it in parallel with reading it because
they’re very parallelizable tasks, especially if it’s hard to build. By the time
it’s finally built, then I can start tweaking it if I want to.
>>
>>53737558
You just fucked it up yourself peice of shit.
>>
>>53737558
Oh the irony... >>53737451
>>
>>53737572
I didn't say all readable code is good you dumb cunt. Better to be readable garbage than unreadable garbage no?

Maintainability and readability are not remotely mutually exclusive, and do in fact largely go hand in hand.
>>
>>53737368
>not n & 1
>>
File: everything_you_just_posted.gif (2 MB, 320x228) Image search: [Google]
everything_you_just_posted.gif
2 MB, 320x228
>>53737646
>>
>>53737585

My capacity for programming is at its worst within the first hour or so of having woken up, and at its best right around when I should be heading to sleep.
>>
>>53737646
it is platform dependent
>>
>>53737666
Great, so no one, including yourself, can reliably work on your code base if they are a little sleepy.

Maybe you could just make it more readable, and not have to hope and pray no one who works on the code fucks up as much as you just did.
>>
>>53737714

Generally speaking, one should be awake enough to program by the time they've managed to drive to work without killing anyone.
>>
What the fucks wrong with this code tbqh
typedef enum {false, true} bool;
int main()
{
bool fizz;
bool buzz;


while (int i = 1; i <=100; i++)

{
if (i % 3 == 0)
fizz = true;
if (i % 5 == 0)
buzz = true;
if (fizz || buzz) { // || == "or"
if(fizz)
puts("fizz");
if(buzz)
puts("buzz");
} else {
printf("%d\n", i);
}
}
}
>>
>>53737770
Generally speaking, one should be awake enough to program by the time they've decided it was a good idea to start shitposting on 4chan about it.

In any case, make your code more readable and it there will be less fuck ups. The end user doesn't give a fuck about how many characters your codebase had.
>>
File: moot.jpg (85 KB, 1024x512) Image search: [Google]
moot.jpg
85 KB, 1024x512
>>53737802
>while(stmt;stmt;stmt)
>>
>>53737829

Anon, there is never a wrong time to post on 4chan, even if you're braindead.
>>
>>53737319
>tostring macro

Is this portable?
because it seems to work great.
It ignores newline breaks, but it's not like GLSL cares about those anyway.

#define GLSL_embed(str) #str

int main(int argc, char **argv)
{
char *vertex_shader = GLSL_embed
(
int main(void)
{
// Transforming The Vertex
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

// Passing The Texture Coordinate Of Texture Unit 0 To The Fragment Shader
texture_coordinate = vec2(gl_MultiTexCoord0);
}
);
printf("%s\n", vertex_shader);
}
>>
>>53737872
spoken like a true shitposter. The latter still stands.
>>
>>53737669
>implying anyone cares about endian-ness
>>
>Javascript
Should I just give in and use jQuery, or is pure JS good enough nowadays.
I'm only caring about up-to-date firefox/chrome/edge, fuck legacy browsers.
>>
>>53737507
Stop being a fucking baby. Kids learn about bitwise operations in MIS 101. It's a boring answer to a boring question and we aren't obligated to suck your dick.
>>
>>53737905

http://blissfuljs.com/
>>
>>53737880

Fair enough. I suppose in a larger corporate codebase, making a function out of everything would probably be more logical. That said, using a library for it is retarded. As I recall, NPM had some issues with dependencies after some dude pulled a large number of libraries from the repo.
>>
>>53737973
eat shit ruby fag
>>
>>53737973
>I suppose in a larger corporate codebase
I've never heard an argument that made sense about why something that is good for large codebases is not good for small codebases.
>>
File: 1459110157704.png (308 KB, 622x466) Image search: [Google]
1459110157704.png
308 KB, 622x466
I'm done with this shit python is too difficult for me fuck programming seriously how the fuck i can learn programming? Not the language for languages are plenty of books out here but for learn programming zero
>>
>>53737878
double wrap it and it's fine

#define GLSL_embed1(str) #str
#define GLSL_embed(str) GLSL_embed1(str)


http://stackoverflow.com/questions/240353/convert-a-preprocessor-token-to-a-string
>>
>>53738162
Try learning Javascript first it is the easiest language
>>
File: maxresdefault[1].jpg (46 KB, 1277x720) Image search: [Google]
maxresdefault[1].jpg
46 KB, 1277x720
FUCK. ME.

I HAVE JUST SPENT LITERALLY 4 HOURS WRITING JAVA CLASS FOR UPLOADING FILES VIA SFTP TO WEBSERVER AND I DIDN'T REALIZE THE SCRIPT AND WEBSERVER WILL RUN ON THE SAME VPS, THEREFORE SIMPLE COPY COMMAND WOULD DO THE JOB
>>
>>53738191
var isPositiveInteger = require('is-positive-integer')
>>
>>53738162
learn java

https://docs.oracle.com/javase/tutorial/

python and javascript are SHIT
>>
>>53738163
Why do I need to doublewrap it?
>>
>>53738144

One word: Java.

>>53738128

Love you too, Anon.
>>
>>53738218
because otherwise if you put MUH_MACRO in your source then the source will have MUH_MACRO instead of what MUH_MACRO expands to
>>
>>53738218
so you don't catch std exceptions
>>
>>53738237
>catching stds
it's not 1997 anymore bjarne
>>
>>53738214
If he is struggling with Python he isn't going to get Java. Java is a much harder language to understand and learn
>>
>>53738251
it depends on what kind of person you are. java is much better structured. python is for minecraft playing ADHD shitkids who don't care about learning things properly
>>
>>53738236
What's the problem with MUH_MACRO being in your code?

Is this a C++ problem or something?
>>
>>53738233
>Java
Well.. sorta. Java is shit for small projects because it's horribly verbose. But this is shit for large projects too.
>>
>>53738297
you don't want your GLSL code to literally say MUH_MACRO, it means nothing in GLSL, you want it to say 1.23 or whatever
>>
>>53738320
But that's not what's happening.

the code in >>53737878 outputs
$ ./test 
int main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; texture_coordinate = vec2(gl_MultiTexCoord0); }
>>
A thief has a backpack that can carry exactly GMax kilograms. He can stuff it with the items he found in the house he is burglarizing. Only whole objects can be put into the backpack, so they cannot be divided into pieces. For each object you know its weight and price.

Your task is to find the maximum profit the thief can make.
Notice that the weight of all objects in the backpack must be equal to GMax.

Example

For n = 7, GMax = 100, weight = [80,10,20,10,100,30,55] and price = [8,20,5,1,10,30,20], the output should be
backpack(n, GMax, weight, price) = 29.

The thief can take the first, the second and the fourth items (1-based).

[input] integer n
The number of objects, 1 ≤ n ≤ 100.

[input] integer GMax
The maximum weight of the things the backpack can carry, 1 ≤ GMax ≤ 300.

[input] array.integer weigth
Array of length n, the items' weights. 1 ≤ weigth[i] ≤ 100.

[input] array.integer price
Array of length n, the price of each item. 1 ≤ price[i] ≤ 100.

[output] integer
The maximum price of the items the thief can carry, Return -1 if there's no solution.
>>
>>53738358
but then you might have additional macros in the GLSL source code just like you'd have macros in your C code
>>
>>53738377
Can't this be avoided by naming all the macros in CAPITALS?
>>
>>53738369
tldr
>>
>>53738388
no why would it

look

http://ideone.com/z4EUbd
>>
>>53738206
>what is rsync
>>
>>53737901
>what is ones' complement
>>
>>53738206
Just wait until you realise how shitty Java is.
>>
>>53736758

How can I test if a double (or float) is whole or not without converting it to an integer (c++)?

This is my solution but I'm converting it:
static inline bool isWhole(double n) {
return n == (int)n;
};
>>
>>53738644
modulo by the floor of the double and see if it's 0
>>
>>53738644
>double
>==
>>
>>53738692
or return n== floor(n) should work too now that i give i thought
>>
>>53738644
Is this an interview question?
>>
>>53738707
this
>>
>>53738717
this

you shouldn't be doing this, and if you should, you should probably have some tolerance for round off errors
>>
>>53738692
>>53738710
or
return n % 1 == 0
>>
>>53738772
gg replied to the wrong guy
>>
>>53738790
what

the only reasonable excuse for wanting to do it is if it's for an interview question
>>
>>53738813
my bad. I thought you were trying to reply to the double equals guy
>>
>>53738707
>>53738746
It works. Is it just bad for the performance or are you memeing?
>>
>>53738775
 error: invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’
>>
>>53738692
>>53738710
So how do I write a floor function without converting to an Integer
>>
>>53738832
I'm not so familiar with C. Would work in C#.
return n % 1.0 = 0.0;
>>
>>53738775
at least answer with working code...
>>
Someone please explain this. What the fuck is this magic?
>>
>>53738885
thats an invalid left-hand assignment ;)
>>
>>53738885
I mean '=='
>>
>>53738870
http://www.cplusplus.com/reference/cmath/floor/
>>
you should generally avoid if/else type stuff, at the very least for checking if a float is an integer, because your algorithm should work for any float or if it works on integers then you should use an integer type or the previous steps should ensure that the float ends up as an integer
>>
>>53738904
Watch a video about "floating point precision" and then you'll understand
>>
>>53738918
What languages support both integers and floats that aren't statically typed anyways?
>>
>>53738904
python starts rounding numbers at the 16. Int
(I never programmed in python but this is obvious i hope you are b8ing)
>>
>>53738829
>what is a lack of total ordering
>>
>>53738932
Lua?
>>
>>53738904
>python
and retards try to say python isn't shit for learning lmfao

pytards don't even touch the OOP, it's just basic control flow which you learn literally in the first day of java, you hardly even learn what a float or an array is
>>
>>53738829
Why do you need to know whether a floating point value is an integer?
>>
>>53738904

IEEE 754
>>
>>53737490
1 min is too short
>>
>>53738951
click to what he replied omg I'm gonna ask /b/ they are more intelligent than this board...
>>
>>53738904
17 9's are the equivalent to 1 and 16 returns a false due to it not being rounded?
>>
>>53738369
http://lmgtfy.com/?q=maximum+subarray
>>
>>53739051
>>53738904
the double closest to .17 9's is 1.0
the double closest to .16 9's is not 1.0
>>
Is this portable?
/* embedding GLSL in a C program */
#define TO_STRING(str) #str
#define GLSL_INLINE(code) TO_STRING(code)
#define GLSL_MACRO(macro) macro\n

int main(int argc, char **argv)
{
const char *vertex_shader = GLSL_INLINE
(
GLSL_MACRO(#version 120)
GLSL_MACRO(#define SOME_CONSTANT 3.14159)
attribute vec2 position;
int main(void)
{
/* Transforming The Vertex */
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

/* Passing The Texture Coordinate Of Texture Unit 0 To The Fragment Shader */
texture_coordinate = vec2(gl_MultiTexCoord0);
}
);
printf("%s\n", vertex_shader);
}
>>
File: girl code.jpg (150 KB, 869x1776) Image search: [Google]
girl code.jpg
150 KB, 869x1776
>>
>>53736862
bool is_odd(int n)
{
return true;
}
>>
File: 1320873593065.jpg (21 KB, 251x205) Image search: [Google]
1320873593065.jpg
21 KB, 251x205
>>53739584
>>
>>53739584
Fake
>>
>>53739646
>>
File: i-bought-you-a-necklace.jpg (13 KB, 400x298) Image search: [Google]
i-bought-you-a-necklace.jpg
13 KB, 400x298
>>53739584
>>
>>53739679
holy shit
>>
>>53739679
Fake
>>
>>53739711
>>53739646
thank skeltal obvious
>>
>>53739679
how did she take that picture with no hands
>>
File: gamergate girl code dpt.png (55 KB, 534x344) Image search: [Google]
gamergate girl code dpt.png
55 KB, 534x344
>>53739711
>>
>>53739711
I'd honestly be shocked if it was fake. Pretty much 0 of these #girlscancode that I've seen have ever had anyone involved who seems to know what the fuck they're doing. If I was female I'd be so fuck embarrassed and ashamed by this shit, and I know two females who are.

These are dark times we live in. I look forward to the day when we can as a society look back at this shit and laugh, just like with the hippies.
>>
>>53739711
no. no it isn't
https://www.instagram.com/p/5c1WXeESvD/
>>
>>53739774
you were faster.
it's on archive.is too https://archive.is/IWRgs
>>
>>53739679
>crazy_strings.rb

wew
>>
>>53739584
This is true though barely any of you guys use comments in your code don't deny it
>>
>>53739766
selfie cam with her mouth
>>
>>53739766
marketing form which hired her for the product placement
>>
>>53739584
Btw that is the godly quake quick sqrt function on the left, one of the most brilliant functions to ever exist.
>>
>>53739870
Doxygen conform comments because guidelines enforce it.
>>
>>53739880
fast inverse sqrt function, get it right
>>
>>53739879
*firm
>>
>>53739768
stop.jpg
>>
>>53739870
>comments in your code
USELESS
>>
>>53739856
if you and RUBY got into a fistfight who would win?
>>
>>53739870
I don't comment often because I make my code readable. I comment whenever I have a block of code where I feel it will be difficult to understand the intention of.
>>
I've been thinking about writing a web-crawler, but then i realized that this is probably an easy way to get put on any government watch-list ever, unless i put severe restrictions on the web crawler.
>>
 
public LinkedList<City> getPath(City originCity, City destinationCity) {
Stack<City> stack = new Stack<City>();
markVisited(originCity);
stack.push(originCity);
City currentCity = originCity;
while(!(stack.peek().equals(destinationCity)) && !stack.isEmpty()){
currentCity = getNextCity(currentCity); //set currentCity to the next unvisited city adjacent to currentCity
if(currentCity == null){ //all cities adjacent to the previous currentCity were already visited
stack.pop(); //remove the dead-end city from the stack
}
markVisited(currentCity); //mark the current city as having been visited
currentCity = stack.peek(); //set the new current city to the new top of the stack
}

if(stack.isEmpty()){
return null; // the origin and destination cities do not connect
}
else{
LinkedList<City> result = new LinkedList<City>();
while(!stack.isEmpty()){
result.add(stack.pop());
}
return result;
}
}


this should work, right? i haven't implemented everything and i don't know how to unit test so i can't check it right now so i'm just requesting a 3rd party sanity check since i've been working on this project a while and i'm a little worn out
>>
Holy asslicking, ruby died pretty quickly didn't it? The whole buzz lasted for less than a year, it feels like.
>>
>>53739870
Autogen comments
>>
>>53740059
A trick post. However the reply you didn't want is this, "Government already has you on the watchlist." Therefore your work will not put you on any government watch-list, since by technicality you're already on one.
>>
>>53740118
Yeah I can't remember a piece of code in the past year written in ruby
>>
>>53740059
You're on a watch list for visiting 4chan
>>
>>53740059
What would you crawl for?
>>
>>53740118
welcome to modern programming. Hot retarded new programming memes every few months. It's tiring just trying to read about all this new shit and separating the 90% that's shit from the 10% that's actually useful.
>>
>>53739998

I would. I'd just shoot him.
>>
>>53740176
yep

just stick to C++/java/C# and you're golden
>>
>>53740221
>java
>golden
>not brown
alright pajeet
>>
>>53740185
> I would just fist him

ALL NIGHT LONGG
>>
>>53740221
embedded programming infinite job security master race
>>
Will you guys atleast admit Java is a great learning tool for learning programming?
>>
>>53740185
Shots fired, pun intended.
>>
>>53740221
Pretty much. I don't people using other languages, but you need to know these basic ones pretty well to start with. They do pretty much everything pretty well. If you do a lot of work in a certain domain were certain languages are worth learning just for that work.. then that's fine. It's frustrating hearing people saying shit like Ruby or PHP is great because it's less complicated or verbose than Java, which is their only other language.
>>
>>53740287
It's terrible for learning to program. Why on Gods green earth would you use it over C#?
>>
>>53740287
java is literally the best for learning programming
>>
>>53740287
java is ok for learning to program
>>
>>53740311
Because all the jobs are in Java. All the Colleges and Universities a ton of them use Java for learning programming. JUST ADMIT IT
Thread replies: 255
Thread images: 32

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.