/dpt/ - Daily Programming Thread

Old thread: >he fell for the kys meme

Other urls found in this thread:

vex.net/~trebla/haskell/prerequisite.xhtml
youtube.com/watch?v=pa14VNsdSYM
youtube.com/watch?v=agrXgrAgQ0U
thepiratebay.org/torrent/9394908/C_Primer_Plus_6th_Edition_Dec_2013
stackoverflow.com/questions/230062/whats-the-best-way-to-check-if-a-file-exists-in-c-cross-platform
twitter.com/SFWRedditImages

First for SML

Recursion was a mistake.

Around stacks, never relax!

requesting the "dat goy" meme

You have been visited by the crossdressing C programmer of Shimoshina Academy!

Good performance, triple indirection, and tail call optimization will come to you, but only if you post "Keep overflowing the stack, Hime!" in this thread.

fags are bad and should feel bad

Alright, let's continue this
>encapsulation
>not a meme

>inheritance over composition

>not waifu2x
nice false flag

kys

>kys
kys

I wish bunnyman would wordfilter kys to something more fun like kimochi

this

reminder that the main trap poster, the actual tranny, samefags

>
>

If most of these are beyond my comprehension of how to start them and create a working solution in any language, should I just kill myself now?

>how do i google

Fuck off, nobody gives a shit.

get on your knees, Hime

Yes, those are all easy. The title should be:
Sup Forums's Programming Projects if you want to be a codemonkey

No you start with the easy shit.
Try these. I've ordered them in my guess at difficulty:
>FizzBuzz
>Count Vowels in a String
>Reverse a String
>Password Generator
>Linked List
>Sorting Algorithm
>Triangle Number Algorithm
>N Queens

>he fell for the you need math for Haskell meme
This shit isn't even hard
vex.net/~trebla/haskell/prerequisite.xhtml

Learning any language isn't difficult

The difficulty is in using it to its full extent

Using only the math terminology described in that link you have provided, describe what a monad is.

How do I learn C, Sup Forums-chan?

Read a book and write a lot of code. And by a lot, I mean A LOT. Until you get comfortable with it. Then proceed to the next part of the book.

Don't give up or you won't accomplish shit, ever. Don't expect results immediately. Keep trying, keep googling, keep being hungry for knowledge.

What are you listening to while programming?
What are you programming?
>youtube.com/watch?v=pa14VNsdSYM
>youtube.com/watch?v=agrXgrAgQ0U
>implementing Braintree payment in my website

In a trial by fire. If you succeed the trial by fire, you will know C, and be allowed to learn other programming languages, and eventually call yourself a programmer. If you do not succeed the trial by fire, you should immediately stop all programming (don't even learn JavaScript), and find another profession. Maybe Graphic Design or Law.

In all seriousness, read this:
thepiratebay.org/torrent/9394908/C_Primer_Plus_6th_Edition_Dec_2013

mhm mhm, do you have any book recommendations?

>What are you listening to while programming?
Super Mario RPG OST

>What are you programming?
This shit because I'm a fucking faggot.

Just pick whatever, really, the book is going to teach you how the language works and how you write it, but it's up to you to learn it.

You won't learn just by reading it, you learn by practicing.

Sounds good, thank you!~

Is there a quick way of checking if a file exist.
Trying to open it with ifstream then closing it is the only idea I have to try this but it seems like itd take forever.

You should post your language for questions like these

In what language and what operating system? I/O is usually operating system specific and varies in implementation between programming languages.

While programming, I typically listen to long 1-2 hour mixes on youtube of some sort of electronic music, such as electro-swing.

I'm not programming anything right now. I'm actually about to head to bed. Tomorrow, I will be programming an FFT in Java, and likely regretting not doing this earlier.

stackoverflow.com/questions/230062/whats-the-best-way-to-check-if-a-file-exists-in-c-cross-platform

Well, considering he said "ifstream", I'd say there's a very high chance he's talking about C++.

>Tomorrow, I will be programming an FFT in Java, and likely regretting not doing this earlier.
That sounds very interesting. Night pal

Scala's type system is inherently unsafe and is dynamic to a certain extent (i.e. downcasting is allowed because type information is stored at runtime, even though it may be unsafe to perform)
there's no distinction between classes of bugs in most cases. any bug can be offset to the type checker. for example, if my application needs to verify that URLs are properly formatted but dont have access to a dependent type checker (which would allow all classes of errors to be offset to typechecking), i can still get most of the safety by defining:
-- Doesn't expose the constructor for Url for added safety
module SafeUrls (Url, toUrl) where

-- The type that all URLs must be passed in
newtype Url = Url String

toUrl :: String -> Maybe Url
toUrl str = if checkUrl url then Just (Url str) else Nothing

then I can define functions in terms of this URL type:
httpGet :: Url -> IO String

so when I call httpGet (or another function that requires me to pass a URL), the only way to get the string into that form is to explicitly verify that the URL is correct. if i forget to do that, then I get a type error and there's no real way of cheating it here.
another example of this concept could be units of measure or keeping track of permissions for a file through the type

...

Nice blogpost, but none of this says anything about implementation bugs, which I've found to be the majority of bugs in personal and professional work projects. In any case, lack of type checker never felt constraining to me, even after using static typed languages for about a decade and a half more

#include

int main(int argc, char *argv[])
{
int a, e, i, o, u;
a = e = i = o = u = 0;

while(*argv[1]++)
{
if (*argv[1] == 'a' || *argv[1] == 'A') a++;
if (*argv[1] == 'e' || *argv[1] == 'E') e++;
if (*argv[1] == 'i' || *argv[1] == 'I') i++;
if (*argv[1] == 'o' || *argv[1] == 'O') o++;
if (*argv[1] == 'u' || *argv[1] == 'U') u++;
}

printf("a: %d\ne: %d\ni: %d\no: %d\nu: %d\n",
a, e, i, o, u);
return 0;
}


how do you reverse a string tho?
iterate backwards and put char in a buffer/print it?

>how do you reverse a string tho?
The easiest naive way to do it is to use a queue.
O(n) running time and space

user, that's very very ugly. you can do better.

what kind of implementation bug would not be reduced by using this kind of strategy?
the only really common cause for bugs other than type errors (or what could logically be made type errors) is bugs arising from mutable state or like array indexing

make me feel bad and post your 1 line haskell version~

Currently listening to some classic mgs themes.

I just finished converting my voxel renderer from opengl 1.0 style immediate mode to highly advanced bleeding edge opengl 1.5 style vertex buffer objects to get a speedup somewhere greater than 25x. So much fucking code. At least vim and its macros made it much less painful.

I need to unfuck the order I'm rendering vertices (some are clockwise some are counterclockwise) in though so I can use face culling. I also wanna add support for rendering multiple vbo's and using multiple spritesheets.

Eventually I need to make vbo recalculation occur on a separate thread so that mutation to the voxel grid during rendering doesn't cause massive fucking lagspikes

Yeah. Temporarily write to a buffer string, then copy it back on the original string. Be careful about the \0 character, that shouldn't be reversed. Look up malloc and memcpy.

'Pointers on C' if you want to learn it in depth. it's pretty long (~600 pages) but explores every nook and cranny of the language. I'm at the chapter about arrays and it just spend several sections on comparing the performance of pointers vs subscripts by analyzing the produced assembly code

Implementation bugs like
>does this page redirect here
>do I get the right json data through my response using this request
>is this data calculated correctly
etc

>code
You probably want to change those if statements in something more sexy.

Damn I wonder if there's some function that checks if a char is a vowel or not?

pic related
the data being calculated correctly is the only one that can't be easily encoded in a type (since it isn't a data structure). although if it's not simply pure arithmetic, having type safety narrows down the amount of ways you can use the data and verifies that you're not going to use the wrong one of two variables because of a typo. for json it could be verified to be in the right format whenever it is created (or received). for example I could have two separate types for the JSON received (one for success and one for failure) and then encode the result of the parser as Either JsonFailure JsonSuccess (or equivalent).

Thats a really good way. Thanks.

So basically type systems don't solve implementation errors, got it

hey fuckers i know nothing about programming, but I just want to ask, why the FUCK aren't you programming a sex robot?

Nice meme.

reversing a string is pretty hard
fuck me

what are you struggling on?

reversing the string

are you retarded
allocate memory
for loop
start at end character
go to 0
wooow

i dont know how to use malloc so i would like to do it withotu it

Doing it without malloc is much harder and malloc is mandatory for using C, so learn malloc.

k
for loop
start at beginning character
store index character
swap index with end character - index
wooow

you are not going to do it without it.
or maybe you could but it's going to be a pain lol

just listen to us, read up documentation for malloc. do you understand what it does?

how do you guys deal with the no gf situation? do you allocate time and energy toward finding/maintaining a relationship or do you go all out on the programming and animu?

i just went to get my mail. there were two female clerks, both fairly attractive. the one that didn't serve me was fucking adorable, cute as hell and had a nice upbeat demeanor and everything

i'm probably good looking enough to a girl like one of those. the super qt one was staring at my package (the mail) like she was reading my name off the address label...

but right now i don't need the instant gratification of sex or anything, i think i just want to be as productive as i can, get crazy rich and release some sweet games and reap the rewards later on

#include

int main(int argc, char *argv[])
{

printf("%s\n", argv[1]);

char *temp = &argv[1][0];
while(*temp != '\0') ++temp;
while(temp-- && *temp) printf("%c", *temp);
puts("");

return 0;
}


i did dun did it!!

programming and memes are all you need to live a happy life

>reposting forced memes from other websites as the OP image

Is /dpt/ truly the cuckiest general of them all?

Wise words

"programming and memes are all you need to live a happy life" -user

My nigga

Anyone here have an actual job?

We fell for the redux meme.
I'm done with JS frameworks.

Learn a real language

Python/Django dev here

We fell for the angular meme, now we use knockout.js

Whatever I feel like.
My file manager.

i want to learn php because you can shell script with it

wat
#include
#include

using namespace std;

int main() {
string oString = "blah";
string rString = oString;
for (int i = oString.length() - 1; i >= 0; i--)
rString[oString.length() - 1 - i] = oString[i];

cout

I have a gf, but I'm, also into things other than programming and anime, and it helps that my gf is into anime too

Redoing the old dungeon editing system and am working in getting rooms being registerable again (does a floodfill form the doorway to figure it out). Now it shows coloured alpha tiles to show which belongs to which room when in this menu.

loli lord pls leave

So how long until I'm no longer so retarded to the point where I could have thought of this myself?

Idk, hopefully under 3 months.

It was angular vs backbone for us,

How is knockout working for you guys?

I've realized all JS frameworks sound amazing before your app starts to grow to the point that sequential programming wont cover all of your needs and you have to start doing asynch stuff.

python would be a better choice

PHP is trash. Started programming at 14 with C++, was introduced to PHP through web development. The language is, absolutely trash.

Where does one find a cute anime watching girl who codes?

samefag
C++ std strings dont have null termintaors

As soon as you can look at a problem as a sequence of solutions. In programming, sometimes a sequence is very simple. Sometimes it's very complex. But the key is to break it down..

Any complicated task can be broken up into a series of (relatively) simple subtasks.

in my specific case, tinder.

I also had to teach her to code, but it was pretty easy

So once I get the basics of the dungeon editor back in, what should I work on for my loli kidnapping sim?

-optimize pathing system by creating a priority system/other shit
-add cops back in and work on their AI
-add in gifts and make that impact lolis moods and opinion of you
-add in a childhood simulation that makes lolis associate concepts together to make use of that concept system I talked about before
-work on stealth stuff
-post-kidnapping loli AI in general
-pre-kidnapping loli AI in general

Why?

GOTY coming in!

>How is knockout working for you guys?
Fantastic. We only ever needed 2-way data binding since Django covered every JS need that wasn't Ajax. In that regards, Angular was very bloated and very difficult to maintain

Why backbone? Heard it was great, but wanted to know your company's personal motivations

#include

int main(int argc, char *argv[])
{

printf("%s\n", argv[1]);
unsigned long int i;
char *temp = &argv[1][0];
i = (unsigned long int) temp;
while(*temp != '\0') ++temp;
i = (unsigned long int) temp - i;
char buf[i+1];
char *bufp = &buf[0];
while((temp-- && *temp))
{
*bufp = *temp;
bufp++;
}
buf[i] = '\0';
printf("%s\n", buf);

return 0;
}


it now saves the characters to a buffer!

GOTY 2023

Omg you're the loli dev, I was looking for updates on /agdg/ but none ;_; glad to see you here. Your code is amazing haha

Why don't you upload your code to gitgud.io or neetco.de? They don't care about SJW.

I have a thread up on /agdg/ now, but I'm looking for a new place since Jim (site owner) is being a complete idiot right now and mass-banning mods/anyone he disagrees with, and is being especially negative towards lolis.

I'm fine with the private repo for now. I don't think many people would want to contribute, and if they do they're welcome to contact me on irc.

are your sprites censored?

On /vg/agdg/ ? Can't find you, I must be blind lol. And yeah the public repo would be a good idea, no need to accept contrib or pull req, just a readonly thing could be cool. Some people could learn a lot from your code structure and all

>I have a thread up on /agdg/ now, but I'm looking for a new place since Jim (site owner) is being a complete idiot right now and mass-banning mods/anyone he disagrees with, and is being especially negative towards lolis.
>being negative towards lolis
Are you really talking about cripplechan? Even Sup Forums, the North Korea of chans, accepts lolis.

No.

No, on the other chan's /agdg/ board.I do post on AGDG here on /vg/ but I haven't for a few days since I was banned until tonight for "loli/shota pornography" for posting pics/gifs here that didn't even s how any nudity...

I also post in the OC/drawthreads on /jp/ too
I am. Most of the pedo mods were banned or left. Copypaste(HW) isn't running things anymore, it's the guy who was running 2channel when hiroyuki was selling the users data.

Guys, I don't know what to program. hlep

neural network for memes

There's also lainchan, but I don't know if it's active anymore.

R8 my Collatz

#include

int Collatz(int);

int main()
{
int n;
std::cin >> n;
Collatz(n);
}

int Collatz(int n)
{
if (n == 1)
{
std::cout

uint64_t *ur_mom's_weight_in_tonnes_LMAO

There is no point in all those returns

There is no point outputting n instead of 1 when n == 1

Newline braces a shit

other than that, it's alright

>cout
Disgusting. Printf is all you need in life.

Also Egyptian braces for lyfe.
if (foo) {
}

master race

Are you retarded? It's a recursive algorithm with a tridirectional branch. 3 branches 3 returns.