/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 74362390_p42.jpg (640x916, 355K)

Other urls found in this thread:

wolframalpha.com/input/?i=sum from i = 1 to n sum from j = 1 to i sum from k = 1 to j of 1
learn.adacore.com
learn.adacore.com/books/Ada_For_The_CPP_Java_Developer/index.html
github.com/ohenley/awesome-ada
en.wikipedia.org/wiki/Big_O_notation
dev.maxmind.com/geoip/geoip2/geolite2/
github.com/28beanz/sdl-pong
github.com/rootcoma/kxm/blob/master/src/windows/gui.c#L108
pyoxidizer.readthedocs.io/en/latest/
twitter.com/SFWRedditVideos

Lisp is the most powerful programming language.

Nothing.

I need more math.

Nothing, programming as a job has killed my desire to program outside of work.

Oh man, I'd fuck Misaka even though her series is garbage.

small stuff in Ada to get used to it.

How detailed does your knowledge of algorithms and data structures have to be to work at these big tech companies? I'm in electrical engineering so all my programming knowledge is low level stuff. I had one course where we learned about queue, stack, and linked lists. Thinking of taking an actual algorithms and data structures course to learn this stuff in depth. Do you think it's worthwhile?

spending your free time on leetcode will do more for you to get a job at a company like that than taking a class

pretty good to get past the technical interviews
after that, the knowledge can help every once in awhile

Learning C and haskell

Attached: 4FF18711-A0CC-4577-8C7D-79EF59263106.jpg (768x1024, 95K)

data EitherOr a b = Hello a | Goodbye b deriving Show

instance (Eq a, Eq b) => Eq (EitherOr a b) where
(Hello a) == (Hello a') = a == a'
(Goodbye b) == (Goodbye b') = b == b'
_ == _ = False

How come I can do stuff like this.
Hello 1 == Goodbye "3"

even though 1 and "3" aren't the same types?

for i in 1..n
for j in 1..i
for k in 1..j
O(1)

What's the complexity of this bullshit?

what's that last line lol
O(n*i*j)

n log n my man

n * log(n * log(n))

Fuck I don't know. I feel retarded.

I knew /dpt/ was freshmen but damn

O(1)

>What are you working on
Becoming a Jow Forums programmer (ノω・`o)

Attached: 1557113742020.jpg (1024x768, 107K)

O(n^3)

Learn Lisp.

Nice, user

I know it's not this.
I don't think it's this
I don't know what this means since i changes throughout execution.
If it's this then the question is retarded, sir

its this
n i j
sigma sigma sigma 1
i = 1 j = 1 k = 1

which solves to
n i
sigma sigma j
i = 1 j = 1

=

n
sigma i(i+1) / 2
i = 1

=

1 n 1 n n
-- sigma i^2 + i = -- | sigma i^2 + sigma i |
2 i = 1 2 i = 1 i = 1

= 1 n
-- | sigma i^2 + n(n+1)/2 |
2 i=1

more in next post

How are you learning Ada?
I'm pretty dumb and I can't seem to wrap my head around enums and types with the resources I've found

C++

int a = 0;

order: 1) type------2) name------3) value

enum { server, client } ConnectionEnd;

order: 1) type------2) value------3) name

whyyyyyyyyyyyyy

go back to r/hacking plebbiter

>I know it's not this.
user...

wolframalpha.com/input/?i=sum from i = 1 to n sum from j = 1 to i sum from k = 1 to j of 1

Let me pull out my graph paper and straight edge to keep along.

Attached: 1551261291275.jpg (251x242, 13K)

I read most of the holy bible, and learn.adacore.com and learn.adacore.com/books/Ada_For_The_CPP_Java_Developer/index.html
Also good resources and libraries on github.com/ohenley/awesome-ada

The language definitely has some oddity with its public/private packages and strong typing. I'm still getting the hang of it and have to work with the compiler to get code compiled.

Attached: file.png (180x234, 79K)

1 1
-- | -- n(n+1)(2n+1) + n(n+1)/2 |
2 6

= kn^3 + cn^2 + jn
= O(n^3)

>wolframalpha.com/input/?i=sum from i = 1 to n sum from j = 1 to i sum from k = 1 to j of 1
OK so it's O(1/6n(n + 1)(n + 2)). Nice. Good to know.

Which is the same as O(n^3)

So how do you "know" it's not O(n^3) again?

I did.

Whoa, I just bought that book on sale today.
I guess I'll have to practice patience and read a paragraph more than four times

then I can make game :0)
Thanks!

>Which is the same as O(n^3)
uh, no

Attached: 1484267752115.png (601x508, 127K)

Yeah the book can be a bit dense.

Your last spoonfeed of the day.
Use it wisely.

en.wikipedia.org/wiki/Big_O_notation

I disagree that 1/6n(n + 1)(n + 2) = n*n*n.

>i failed calculus: the post

Attached: brainletract.png (581x525, 55K)

( •_•)
This is the ultimate crypto question
( •_•)>■-■
When generating RSA key
how does performace degrades as you double key size
When encrypting with RSA key
how does performace degrades as you double key size
(■_■)

good post

Attached: wat.jpg (604x404, 40K)

Why don't you Ada?

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_line; use Ada.Command_Line;

procedure Subset_Sum is
type Set is array(0..4) of Integer;
Arr : Set;

-- find if subset sum exists in a set
-- @param Arr - the set to check
-- @param S - the sum to check against Arr
-- @param N - for iteration; equals Arr.length
-- @returns - truth value on whether subset sum exists
function Find_Subset (Arr : in Set; S, N : in Integer) return Boolean is
begin
if S = 0 then
return True;
elsif N = 0 then
return False;
end if;
if (Arr(N-1)) > S then
return Find_Subset(Arr, S, N-1);
end if;
return Find_Subset(Arr, S, N-1)
or else Find_Subset(Arr, S-Arr(N-1), N-1);
end Find_Subset;

-- verifies arguments are correct before continuing
-- @returns - truth value on whether args valid
function Verify_Args return Boolean is
begin
if Argument_Count /= 6 then
Put("Invalid arguments."); New_Line;
Put("Use arguments ' '."); New_Line;
Put(" is the sum to find, is space delimited list of 5 numbers.");
return False;
end if;
return True;
end Verify_Args;

begin
if Verify_Args then
Put("{");
for i in 0..4 loop
Arr(i) := Integer'value(Argument(i+2));
Put(Integer'Image(Arr(i)));
if i /= 4 then
Put(", ");
end if;
end loop;
Put("} ");
if Find_Subset(Arr, Integer'Value(Argument(1)), Arr'Length) = False then
Put("does not contain subset sum " & Argument(1));
else
Put("contains subset sum " & Argument(1));
end if;
end if;
end Subset_Sum;

RealFrac vs Fractional?

Because I Lisp. I mean Lithp.

Too busy learning Haskell

If I save the IPs that visit my server
how can I convert them to country and city
right now I am using cloudflare but
I don't want to depend in them
whats the safest private way to do this?

because I'm not going to fall for some MIC shilling for a fake and gay language.

same reason I didn't fall for the erlang fag shit that people fell for lately.

trying to figure out what's going wrong in this code:
void
function(Type1 t1arr[static 7], struct points arr[10][10], char y, char x)
{
for ( char i = 0; i < 7; i++ )
{
// calculate min,max for x,y coords
char minx = t1arr[i].pos[0].x;
char maxx = minx + t1arr[i].size - 1;
char miny = t1arr[i].pos[0].y;
char maxy = miny + t1arr[i].size - 1;

if ( minx == 0 && miny == 0 && maxx == 0 && maxy == 0 )
continue;

if ( t1arr[i].done == true )
continue;

if ( check1 )
{
if ( check2 )
{
if ( t1arr[i].pos[y-miny].tick == true )
{
continue;
}
else
{
t1arr[i].pos[y-miny].tick = true;
arr[y][x].state = 1;
t1arr[i].points--;
if ( t1arr[i].points

For some reason I want to say there is a public database somewhere out there that you can find if you look hard enough, but the data will be old and will have a lot of holes in the data. Maybe this dev.maxmind.com/geoip/geoip2/geolite2/

I got input working!
Kind of hacky, and my git log is gonna be a mess but it works! Now to add in bouncing balls and collisions.

Attached: 2019-06-29_21-35-53.webm (1280x640, 1.44M)

Look what I made Jow Forums!

Attached: monochrome_ellipses121.png (640x320, 250K)

Neat, user! The paddle movement looks great.

Is that a HTML 2d context canvas? looks cool. Would be fun if it bounced and overwrote itself, like the bouncing cards after you beat solitaire on windows.

draw some venn diagrams and you will see why.

bro
this will save you a lot of time
a massive upgrade
develop your program for web consumption
make a server
you will be able to show off your program to
any person
any device
anywhere in the world

1..j,1..i,1..n
n^i^j = k

I can't tell you how many times I've been working on a project and I calculate the Big O for my function but then I come to find out later that I calculated Big Theta instead and now I have to scrap the entire function.

>Would be fun if it bounced and overwrote itself, like the bouncing cards after you beat solitaire on windows.
Two steps ahead of you gringo.

Attached: Solitaire_bounce3.jpg (1080x720, 446K)

Muy bueno, compadre. Me gusta lo mucho guey.

I'll open up the Github repo I've been pushing stuff to.
github.com/28beanz/sdl-pong

thanks.

Pong Royal

Attached: 1561803477459.jpg (1476x990, 402K)

>MIC
what is a MIC?

Va a removar el 'stroke' para el circlo? La negra 'stroke' no es bonito guey.

Gracias.
Es esto brueno?

Attached: Solitaire_bounce1.jpg (1080x720, 112K)

si, me gusta lo mucho. Necesita continua modificar los colores, y es una projecta muy buena.

So this is the power of Haskell huh, can't even do a printf/format like function lmao.

So if I want to get into emulation should I just start writing emulators for very old chips until I get good at it?

Yes.

Attached: 1510710821987.gif (300x424, 2.56M)

Is there a path I should take?

>fake and gay language.
I'm not that poster but what. I just like Ada because it's kinda fun, so far it's confusing though but I always have trouble with languages

>Is there a path I should take?
Just do what this guys suggests

Is it a good idea to learn graphic design alongside programming?

Is it a good idea to make an omelette on a Monday?

what chips tho?

I've heard chip8 is the easiest. I am not into that sort of thing which is why I am being cheeky. I think 6306 is the next suggested after that. Not too sure what there is after that.

Based and Jow Forumspilled

Attached: Ameriga bear.gif (640x360, 2.88M)

Since I work on all projects alone, working on anything that requires graphic design, or drawing skills is painful and does not feel satisfying. Take this abomination as an example.

Attached: spooktitles.png (812x768, 67K)

Stitching to emacs bc there is an f* module and I wanna get into verified programming. Anyone do this? How do I find a job in program verification? I've already got some experience with tla+ but that doesn't produce anything that does any work

Bc this is an image board and I forgot a pic

Attached: 1557961397407.jpg (750x907, 105K)

>working on anything

Attached: notfun.png (319x352, 48K)

this may deserve to be in the stupid questions general but is there any way to edit the frame of a window using tkinter? i couldnt find anything anywhere.

Attached: Capture.png (390x395, 81K)

based

Can somebody pls make an instance of Show for functions (->) where the show _ = ""?

Python isn’t very portable, is it?

Depends on what you mean by edit.

????

(->) is a type yes?
Show is a typeclass
instantiate (->) for Show
is it possible?

If I have no intention of ever being employed as a progammer, should I learn common lisp?

You mean this?

instance Show (a -> b) where
show _ = ""

I understand you can change the title and the bitmap icon but i really mean the look of the min/max/exit and border. essentially im trying to make it look like the window in pic related but im doubting its possibility

Attached: win95.png (620x461, 5K)

If you think it's fun.

I am able to use Win32 with the window type of "POPUP_WINDOW" which gives me a window without any menu or buttons at the top. Can you set a similar "window type" in tkinter? Or maybe you can use a Win32 call to change the window type. github.com/rootcoma/kxm/blob/master/src/windows/gui.c#L108

Attached: tiny_black_square_window_in_windows.png (168x176, 2K)

What language is this?

Nope, don't think you can do that with tk.

Thank you.

Haskell

It could eventually be pyoxidizer.readthedocs.io/en/latest/

Learn Scheme and Haskell instead.