/dpt/ daily programming thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

facebook.github.io/reason/
demos.neocities.org/matrix.html
pastebin.com/eZ32720A
javacodex.com/Math-Examples/Floor-and-Ceiling-Example
twitter.com/NSFWRedditImage

Who is this fluid druid?

who is this testicle molester?

Who is this cock dock?

researching streaming using basic web languages (PhP, JS)

...

Is that a good book to learn how to use C in if i really know the syntax, have experience in c++, c# and coding in overall?

that's not the original ya dip, the original has no hand

just some camwhore
learning python

Is this cum dump a photoshopped dude or what ?

>Amateur game development general
That's an 8 board I haven't checked in a while. Thanks for reminding me.

>he prefers girls without a hand
jesus, autism levels are through the roof

New to programming here, how can I reverse a string without string.h?

nothing

It's a general in /vg/, you mong.

Pajeet learn to solution first.

That's a hard problem.

select a pivot and xor swap

How the fuck do I create a console application in C using this piece of shit Eclipse?.

>inb4 pajeet-tier retardery faggots.

In the year 2016, does it ever make sense to use float instead of double in C?

...

Yes, RAM is slow and float is smaller

Can't a 64-bit CPU deal with it natively?.

>joy

Okay, with the exception of saving RAM (which is basically never an issue these days)?

>which is basically never an issue these days
RAM is slow, no matter how much you have.

What is a good book for a total beginner to programming to learn C#?

In the year 2016, does it ever make sense to use int instead of long long in C?

Pajeet pls

store string in LIFO
create second LIFO
stack second LIFO with top of 1st LIFO
unstack first LIFO
repeat
add the ending character
done

So I have a vector of chars, like so:
std::vector data{};


It contains a few kB of data in total, now I have a few isntances of std::string and I'd like to search for these sequences in data, what function do I use?

For instance:
std::vector data{'a', 'b', 'c', 'd', 'e'};
std::string s{"bc"};
something_find(data, s); // returns iterator to second element or something

Are you fucking retarded?

You're assuming Pajeet knows how to stack.

#include
:^)

Go learn the C syntax and then learn how to program simple programs in C++ after that you are ready to learn C++ classes and such, then move to OOP Java and Java in general, after you are done with that look up for C# videos on youtube, by that time you will master C# in no time (at most one week)

Thats the right approach.

reverseString :: String -> String
reverseString = reverse

Jesus fuck, just try it:

tic ();

size_t N = 1000000000;
double p;
for ( size_t n = 0; n < N; ++n )
p = sin ( ( double ) n / ( double ) N );

toc ();


and

tic ();

size_t N = 1000000000;
float p;
for ( size_t n = 0; n < N; ++n )
p = sin ( ( float ) n / ( float ) N );

toc ();


At least on my machine the first one is faster than the second one. And not just a little bit, it's 12 seconds vs 18 seconds.

Half-assed, but that's the first thing that came to my mind:

auto chars = std::vector{'a', 'b', 'c', 'd'};
auto str = std::string(chars.begin(), chars.end());
auto found = str.find("bc");

std::cout

>mfw a physical copy of that book costs 67$ in my country
>mfw i have no face

if you are going to learn to program, you either gonna git gud or gonna fail, if you fail, you fail you suck etc. if you git gud $ 67 is your hour wage and you should care, so my conclusion is that you are retarded.

been screwing around with images still

Nevermind, this one-liner does a better job:

auto chars = std::vector{'a', 'b', 'c', 'd'};
auto str = std::string("bc");

auto it = std::search(chars.begin(), chars.end(), str.begin(), str.end());

What exactly are you trying to do?

original one

i tried doing RGB to HSV conversion - but i just put the values back as RGB
so H->R
S->G
V->B

im not sure the HSV stuff is correct though...

Who's talking about learning how to program? I was just pointing the price of that book
Besides i already have it in pdf but it's comfier to have a physical copy

Hey, uhm, sorry for interrupting, but I need to ask. I have read in your wiki that " the C programming language, second edition" is the best for learning C. However, I don't have any concepts nor experience in programming. So, is this book still good even for me as a beginner? I'm studing Mech Engineering, so you may have an idea. Thanks.

It's outdated. "C Programming: A Modern Approach" is a better choice, and great for a beginner as well.

C prog. By Kochan, helped me alot when i first started

K&R doesn't teach programming, it teaches the C language to people assumed to already have some programming experience

not saying you can't learn from it, but it is not the best book if you've absolutely never programmed before

Has anyone here tried using
facebook.github.io/reason/
yet?

Thank you guys. I'll check those.

definitely check out the book that other user mentioned, A Modern Approach, also 'Pointers on C' is a really good textbook

Dubs decide something trivial for me to program

pro-tip: it's never worth trying to use a non native IDE to use a different language unless you are super duper power user. Use Eclipse for Java.

Double is about 1 second slower for me compiling with MSVC (2015/14.0). The difference in size will matter if you're ever doing anything similar to this with SIMD intrinsics, since you'll be performing that instruction on twice as many floats at once.

Given a number x, print the biggest prime number that is less than x.

discrete fourier transform

rolling for data visualization of average cock length by race.

Interpreter for a dynamically typed lazily evaluated purely functional programming language.

Just been making little experiments with the Phaser game library:
demos.neocities.org/matrix.html

Eclipse is fine languages other than Java

a basic web server without gui...


...in assembly

TRIANGLE FILL

A simple function plotter

>Want to learn vulkan
>AMD drivers don't support my laptop's gpu
Well fuckballs.
Software implementation when?

[c#] why the fuck is this true?
inventory[i][j] = new Item(other.name, false, 1, false);
if (inventory[i][j]. == null)
Debug.Log("it's null");


It shouldn't ever write "it's null" but somehow it does,
why is this null?

#include
int _strlen(char *str)
{
int res = 0;
char *temp = str;
while(*temp)
{
res++;
temp++;
}
return res;
}
void reverse(char *str)
{
printf("Normal: %s\n", str);
char temp;
int len = _strlen(str);
int halfLen = len/2;
for(int x = 0,y = len-1;x

What's that extra dot for?

I that a dot in the second line after [j]?

accident, imagine it's not there

a program to help people queuedodge cheaters in the world of warcraft.

not the best investment to blow $67 on a stupid book if you're a poorfag

liberal news site rss feed in python that also aggregates certain buzzwords from headlines and stores the stats

precursor to buzzword bingo?

Pastebin, please. Enough so that the error actually happens.

Implementing a programming language. It's pretty complicated so I don't think I'll be self-hosted until Christmas.

Ideas for a summer project? 1st year CS student looking to start some projects to pad my resume.

fart mobile app

what backend?

GO BACK TO THE KITCHEN BITCH AND MAKE ME DINNER

>ace first two interviews
>completely bomb the third
>to my surprise I get told that I did well and they want another interview on wednesday, they just need to check the interviewer's schedule first
>that was an hour and a half ago, I still have no time

pastebin.com/eZ32720A

here you go.
btw inventoryCtrl.updateInventory(); checks inventory[][] and there that position is not null

Is there anything but LLVM?

>she

call them back on monday

I am trying to add my java mongo driver to the java class path from Eclipse. How do you do that?

>literally nothing is being done to contain Sup Forums anymore.
>literally every other post is pajeet this or poo-in-the-loo that

well, this board is done for.

Novice trying to understand the rounding methods in Java. rint() and round() are easy enough but from what I understand, ceil() will round up to the nearest integer no matter what, so 1.2 will round up to 2.0. floor() is just the opposite, with something like 1.6 rounding down to 1.0.

However, the book I'm using shows the following:
Math.ceil(2.1) returns 4.0
Math.ceil(2.0) returns 2.0
Math.ceil(-2.0) returns -2.0
Math.ceil(-2.1) returns -2.0
Math.floor(2.1) returns 2.0
Math.floor(2.0) returns 2.0
Math.floor(-2.0) returns –2.0
Math.floor(-2.1) returns -4.0


The negatives I kind of understand, but why does ceil(2.1) return 4.0 if ceil(2.0) returns 2.0? Shouldn't the former return 3.0? Shouldn't they look more like javacodex.com/Math-Examples/Floor-and-Ceiling-Example ?

Currently reading how to get a ray from OpenGL.

>neocities
Neat. I didn't know about this.

Try this test:
#define _GNU_SOURCE
#include
#include

double dubs[1000];
float floats[1000];
int main() {
struct timespec time;
clock_gettime(CLOCK_MONOTONIC,&time);
printf("%i.%li\n",time.tv_sec,time.tv_nsec);
for(int i = 0; i < 1000; i++)
dubs[i] = 1.0 / i;
clock_gettime(CLOCK_MONOTONIC,&time);
printf("%i.%li\n",time.tv_sec,time.tv_nsec);
for(int i = 0; i < 1000; i++)
floats[i] = 1.0 / i;
clock_gettime(CLOCK_MONOTONIC,&time);
printf("%i.%li\n",time.tv_sec,time.tv_nsec);
return 0;
}

Floats are 3 times faster on my machine.

Probably errors in the book

Why java is the best programming language?

It's not.

>Google book
>Homepage, Errata
>Page 122, line 2, Math.ceil(2.1) should return 3.0. Line 9, Math.floor(-2.1) should return -3.0. Line 7 in Section 4.2.4, Math.max(2.5, 3) should return 3.0.

Guess so, thought I was losing it. This book's really been letting me down in odd places the more I work through it.

I think that book might be doing binary floor and ceiling for doubles -> doubles. 2.0 is exactly representable in binary as are all powers of 2 times any magnitude.

Where is inventory defined? Is another thread fucking with it?

It's an absolutely shit programming language. It's got nice tooling, infrastructure, libs, well-tuned and fast-performing virtual machine and all that though.

def reverse_string(string): return string[::-1]

:^)

found the solution.
Class Item was inheriting from MonoBehaviour, I forgot to remove that

it's the best for large enterprise applications with many developers working on projects simultaneously because it has great support for OOP and is simple and easy to use so that all programmers can adhere to a consistent style with great ease. it's very safe while still being one of the highest performance languages.

I learned programming on edX with the CS50 course from HarvardX. The teaching language is C (at least for the most part) and it's way more motivating than a book, with videos, shorts, and weekly assignments, which are all really well done.
You should really check it out.