/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous Thread:

Other urls found in this thread:

open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
twitter.com/SFWRedditGifs

What are some good books on computation theory and math behind programming?

>'And what name do you want inscribed?'
>I said, 'I'll write it for you.' I wrote the name down: COBOL.
>'What kind of name is that?'
>'Well it's a Polish name. We shortened it and got rid of a lot of unnecessary notation.'

Howard Bromberg on how he bought the COBOL tombstone

THE DOES IT FOR FREE

Fourth for D

I think I finally figured out how to average 2 numbers.

int add(int a, int b){
int temp2 = a | b;
int temp = a & b;
temp2 &= (temp^INT_MAX);
temp = 23;
--l;
l

Damn, this thread got real clean, real quick.

Azure Data Factory management integration in .NET.

I love data.

I love moving data.

I want to rub data on my chest slowly, but firmly.

Nope. overflow if input is INT_MAX and INT_MAX, even though the average is well within the codomain

So just check for that condition and return INT_MAX
is it good now?

If a subclass in Python has the same constructor as the parent class, how do you implement this?

Without typing the constructor all again?

What about INT_MAX and INT_max -1
The average is not INT_MAX

Fuck it, Computer Science is too hard for me.

super

> Dennis was a winfag

How will Sup Forums ever recover

just divide the numbers by 2 first, dummy

Quite easily, windows is the obvious choice

Dynamically loading libraries is the best thing ever.

>implying Sup Forums doesn't use gnu+linux ironically
>implying K&R and SICP aren't jokes we play on n00bz

char* foo(){
char stuff[16] = "stuff";
return stuff;
}

void bar(){
char *things = foo();
char container[16] = "";
sprintf(container, "asd+%s", things); // this shit
}

why does this not work? i can't inject the returned char * into the container

pls help

>I've already read K&R
>I'm halfway through SICP
>I use Linux as a daily driver

I think I've been memed.


Linux is a scourge on humanity BTW.

what is variable scope

BECAUSE THAT IS FUCKING WRONG

but no
something that is though
CMAKE AND QT

Currently working on a system integration project using IBM Integration Bus. Most coding done in ESQL.

thanks mate
WELL OBVIOUSLY

you dip, it returns the pointer to the old location on the stack, that isn't valid anymore once you return from foo
please learn how the stack works for the love of god

for such a situation to work you need to use malloc()

>I think I've been memed.
Yep.

Turns out, those are really inefficient ways to quickly be productive, create things, and be employable. On top of that (for better or worse), those things are typically dry and unenjoyable for any potential learner, thus discouraging otherwise potential developers.

Figures that Sup Forums would recommend them.

i see, thank you

SICP is a bit memey, but at least offers you a new perspective on programming (especially if you come from a C background).
Linux is poor's man Unix to be honest.
And Unix wasn't that great to begin with.

best we've got

kek
int average (const int x, const int y)
{
if ((x < 0) ^ (y < 0))
return (x + y) / 2;
const int xh = x / 2;
const int yh = y / 2;
const int xhr = x % 2;
const int yhr = y % 2;
return xh + yh + (xhr & yhr);
}

>not "Fourth for fourth"

just kys

>he thinks it's spelled "Fourth"

just kys too

does anyone actually use d

And it's shit. Linux and Windows will crumble under their own weight. OS can be much more simple and robust than the shit we have today.

What's the most sensible sorting algorithm to use when I have a huge number of elements, but there are few unique elements, and identical elements often repeat themselves multiple times in a row?

e.g. something like

54,54,54,54,54,54,1,1,1,1,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,44444,44444,44444,1123,23,23,23,54,54,54,54,1,1,1,1,1,1,1,1,1,1,54,54,54... and so on for billions of elements

I'm thinking of doing a sort of run-length encoding as a first pass, but any suggestions after that?

Yes

Bogosort. :^)

[spoiler]But seriously, use Bubble sort.[/spoiler]

HtDP is just the less memey version of SICP.
Protip: nobody who learns python in a week is employable with it

Bucket-Sort. O(m+n) complexity where m is your range of values and n is how many values you have.

it's working

ish

CLRS


Fair enough.


Your mom.
Quite often, if I may say so.

i mean at least once
i know that

introduction to theory of computation.

there's really only a little bit at the end of clrs that you'd call theory of computation, no?
but maybe he's using the term in a non-technical sense

remy is maximum qt

How losers do selection control:


switch(x){
case 0:
printf("Hello world!\n");
break;
case 1:
printf("C is neato!\n");
break;
case 2:
printf("Jesus sure is nice\n");
break;
case 3:
printf("Let's play a friendly game of hopscotch!\n");
break;
}


How real men do selection control:

[
function(){
console.log("Hail satan");
},
function(){
console.log("Let's go drink beer and perform sodomy");
},
function(){
console.log("Hey kid, you wanna do some JavaScript?");
},
function(){
console.log("That C shit is for goody two shoes!");
}
][x]();

tfw haskell's not powerful enough to work on my wavelength

wish i was still programming in cinnameg

I'm trying to get into databases. Does the size of the database increase read time at all? I'm wondering if I should split it up and by how much.

I'm assuming no, because all the library needs to do is seek and read. But writing (not adding to the end of the list) would be slowed down, because it needs to shift all of the variables down

use ViewPatterns

font and size?

Monoid, 14pt.

fira code retina, size 17
i'll look into it but i'll probably just figure a way to do it with prelude. for some reason i dont want to get used to QOL stuff that's outside of prelude even though i know that sounds stupid

Pssst kid....

>javascript
>optimizations

thanks pretty
IDE/color scheme?

ViewPatterns is a language extension

before end s = drop (length end) s


toMil(before "AM" -> x)

that wasn't even me
ree_pepe.jpg

...

Atom.io with the Tomorrow Eighties light scheme ;3

and the IDE is atom with the ide-haskell package installed

fucking stop you shitbag

though for what you want you would change it so before returns a Maybe (Just if it actually ended with that)
so then you get

toMil (before "AM" -> Just x)

I actually used something almost exactly like this a few minutes ago, except I'm grabbing the beginning of strings with bang patterns

nice, thanks bruh
someone's craving some attention it seems :3

class Rodent (Mammal):
def __init__(self):
super(Rodent, self).__init__()

This is how it should work, right?
Because it does not work. Rodent does not inherit the constructor.

What does your programming environment look like Sup Forums?

post a screenshot please

no :333

How do I get over the hump of learning basics and actually programming?

any better way of doing this?
my_str= fcontent.replace('\n', '.').replace('?','.').replace('!','.').decode('utf-8','ignore').encode("utf-8").split('.')

close Sup Forums and do something

you sure are thirsty to get in the spotlight :3

what inputs would this not work on? am i missing something?
import Control.Applicative
import Control.Monad
import System.IO


main :: IO ()
main = do
time String
toMil (x1:x2:':':y1:y2:':':z1:z2:"AM") = x1:x2:':':y1:y2:':':z1:z2:""
toMil (x1:x2:':':y1:y2:':':z1:z2:"PM") = nx++':':y1:y2:':':z1:z2:""
where nx = show $ read (x1:x2:"") + 12
toMil _ = "incorrect input format"

getMultipleLines :: Int -> IO [String]

getMultipleLines n
| n

I was just helping the guy there, is all :3

Personally, I would use list syntax for toMil, and replicateM for getMultipleLines.

Also note that it will accept erroneously any characters where digits should be (other than the first two characters in an AM time).

nm got it, didn't include special cases for 12:00

nah you want all the mens eyes on you i can tell, slut :3

...

>computation theory
Do you mean formal languages and complexity theory type stuff?

*undresses in a malloc() fashion*

Well, now you can scanf me all you want ;3

>he hides stuff on Sup Forums fearing the invisible hand of the hacker

But it's not optimal at all bro.

I started playing with some opengl. How the fuck am I supposed to do a good collision detection? The AABB algorithm seems nice to filter the data, but how do I check for the actual collision?

I fucking hate this place.

if it werks it werks nigga

how good programmer are you, compared to your peers?

Does/Doesn't it bother you that they are better than you?

Use something like seperating axis theorem
What's that got to do with opengl though

>what inputs would this not work on? am i missing something?

Pointed out some inputs it would respond inappropriately to and some things you had missed.

Embrace the gay

and he's right

>What's that got to do with opengl though
I'm drawing 3d stuff and I want to make them collide

My friend is an ultra plen when it comes to coding (basically just a whole lot of hacks and stuff), outside of school stuff he's the only rl guy whose code I've seen.

I just feel pedantic more than anything, especially since he gets way more enjoyment out of it than I can dream of

use GJK

Hi /dpt/. What would be the best language to program a savegame editor in? So far I've just been using really complicated regular expressions, but I want to be able to visualize it and configure it.

you have such a thick luscious buffer, I'd like to overflow it with dirty data :3

javascript

Any modern language will do.

I know C# really well, and it's really easy to scrap up a working GUI in WPF, so that would be my go-to.

If you're familiar with Java, C++, Python, etc., those would all work fine as well.

open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html

Confirmed, C++17 is completely removing the need for OOP

Made something for my final that finds the shortest path between any given airports using dijkstra's algorithm. It was kind of easier than expected, feelsgoodman

Alright, thanks.

I'm really new to programming, as in I only know the very basics of C and MATLAB (engfag). I want to code a right-click option for my Windows menu that allows me to create a folder containing the files I have selected in the path I have open.

Where the fuck would I even begin with this? Is it better accomplished in Linux?

I apologise if this isn't the correct place to ask for help, is /diy/ more appropriate?