/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: trees.jpg (948x776, 50K)

Other urls found in this thread:

pastebin.com/fLe2HtRG
businessinsider.com/bill-gates-loves-donald-knuth-the-art-of-computer-programming-2016-4?international=true&r=US&IR=T
discord.gg/4TuhPhr
twitter.com/NSFWRedditVideo

hey girls, wanna bang :)

First for Smalltalk.

holy fucking shit.
I tried to get i2c working to control a raspberry hat.
There exist libraries for python, but i wanted to implement it as kernel module in C, because i am a brainlet.
End of story: i2c control worked perfectly fine, i just sended the wrong data to the wrong registers. REEEEEEEEEEEEEE

But atleast it works now. Fuck, i am fucking happy.

Attached: winwin.webm (1920x1080, 294K)

which one of these is the easiest to make?

Attached: m0uKDne[1].png (917x790, 60K)

I have a coding challenge for you niggers.
no this isn't my homework.

the challenge: program, in your language of choice, the following functions:

1) a sine function: the function should have at least 2 parameters, the first parameter is the input value and the second parameter indicates if your input value is in either radians or degrees.
for example; sine(pi, rads) should output 1.

2) a cosine function: same as the sine function.
for example; cosine(0, rads) should output 1.

3) a tangent function: same as sine and cosine.
this function is to be implemented without using your already built sine and cosine function.
for example; tangent(0, rads) should output 0.

rules (this is where it gets interesting):
>no math libraries are to be used (eg, math.h) you get the idea.
>YOU CANT USE A TAYLOR OR MCCLAURIN SERIES APPROXIMATION.

>"what do I get for doing this user?"
nothing, this is just for the fun of it, best code may win some respect among fellow anons but I cant guarantee that.

good luck.

looks like some tough homework there, goodluck pal

mfw

Attached: lenses.png (628x1270, 809K)

Got my Othello program working. Just going testing some other shit and commenting my code.

Attached: othellov4.png (454x539, 31K)

second line in post says its not homework.
just thought it can be a fun challenge and it can be done with some creativity.

All of these are extremely easy. 200 loc max for any of them.

i just started a course at uni so they are supposed to be pretty easy

fourth might be the easiest

>says its not homework
Oh sorry! Didn't notice you said it is not homework.

5 is the easiest
ignore this guy

mandelbrot that takes some command line parameters can be done in like 10 lines

looking into memelangs like D, Go, Rust and C++

what makes you think its homework?

I don't think it is anymore because you said it isn't.

ffs mate

which anonymous do i trust??

Attached: nqi095R.png (477x282, 80K)

The correct solution is to use a small angle approximation

Uhhm I'm not sure but thanks and no l33t haxoring I want to write an anti virus because I feel the ones out today aren't very good and there's a hole in the market to be capitalised on.

>AVs are just file watchers that scan files against their virus database
I suspected this but what about signature, heuristic and emulation scanners? How do they actually work?

Ok to explain what I've done and what I'd like to do in detail: I heavily modified the Lilith RAT and added in some parts of the Enigma ransomware, I cloaked the process by injecting dll into notepad.exe hooking and overwriting the first few bytes of the ZwQuerySystemInformation function by adding a jump to my function, I uploaded it to TotalVirus and it came back as a threat so I used Dsplit until I found the number of bytes the threat signature was located on and used LordPE to find the exact spot then hexplorer to edit and remove the signature, uploaded the editted exe to TotalVirus and it came back clear, I started playing around with writing code that would allow me to send data through port 80 to a webpage but got sick of it when I realised I had to write shellcode and I'm not that invested in this it's just a little project.

So far it is undetected on TotalVirus, by TrendMicro, Norton and Malwarebytes although it isn't doing anything but keylogging right now. I want to write a scanner that is able to -specifically- find malicious software that does what this does, hides its process or hooks the ZqQuerySystemInformation and FindFirstFileExA functions, how do I do it?

Attached: 1520187738815.jpg (368x368, 48K)

Sup pro/g/rammers,
so long story short I'm currently finishing my masters in civil engineering and got a job at a consultancy firm that's going all in on robotic process automation.
We are using UIPath and I was wondering if anyone here has any experience with it.
My background in programming is very limited, I learned Pascal when I was younger and during university I used Matlab extensively, I mostly coded shit related to physics and mathetmatics. I.e. kruskal minimum span tree, ford fergurson and dijkstra's algorithms, fixed point and newton's method for finding roots nothing special.
I'm currently 50% done on UIPath's online certificate which is a great resource but I just feel like I have no idea what I'm doing, converting variable types just seems like a mess to me, I feel like I have absolutely no control over the data flow and there's no fucking code, it's just drag and drop flowcharts and sequences...


Should I take some time to properly learn C# and VB syntax? Any books/resources I should go thru before I feel confortable with UIPath? Anyone having a similar experience to mine?

Attached: Yescjo_o_400x400.jpg (400x400, 8K)

The tasks are getting harder as you go down.
Use your brain.

trust the bigger number

Are you retarded? There is no way 4 is harder than 3 the order of difficulty from easiest to hardest 1,4,2,5,3,6

started reading SICP & clean code, god damn these books are good. i've been programming for 7 years and i think i'm going to make a habit of rereading these once a year.

I have a lot of product data to work on. Data includes image urls, vat rates, descriptions... Work is mass edition, save CSV, compare prices, send one by one via REST API.
Question: I am using Python + Pandas dataframes to do that. Is that stupid? Should I look into databases instead?

Are you retarded?

>clean code
Don't waste your time with that shit. Robert C. Martin is a complete idiot.

How so? 1 is obviously made for retards so they can get a pass, 4 is done in literally a few lines 2 is easy to google.

>no this isn't my homework.
yeah sure...

But he already said that it isn't his homework.
See >this isn't my homework

>Don't waste your time with that shit. Robert C. Martin is a complete idiot.
So far it's been nice for just dumb shit being reinforced like "use a verb at the beginning of a method".
It's not particularly long so I'm going to finish it.

Know anything else that's good for patterns and architecture? Been keen to find more on that stuff.

ohhh I see, sorry, well maybe people will have some fun with his non-homework challenge then

>UIPath
Please tell me the whole company isn't using UIPath for serious production.

Attached: KhSCFWI.jpg (425x748, 36K)

Yup, they are UIPath "partners" I guess, they are heavily investing in hiring engineering graduates with backgrounds in different fields and making us get the online certificate.
So far, from what i've seen, what they mostly do is write bots for banks to automate processes like extracting data from PDFs, processing the data, and moving it from server to server. They also told me I would be learning SQL later...

What other RPA alternatives do you know? Is UIPath shit?

>So far it's been nice for just dumb shit being reinforced like "use a verb at the beginning of a method".
Exactly, he's just stating the obvious. It's a complete waste of time.

I haven't read any of those books myself, but I've heard good stories about them:
Introduction to Algorithms by Thomas H Cormen
The Art of Computer Programming by Donald Knuth

Design patterns and architecture are a meme. Just follow the KISS principle.

>think of coding challenge thinking itll spark up interesting discussion on math and some creative solutions
>immediately turns to debate of wether or not its my homework

what kind of retarded unis do you fags go where they make you do programming homework instead of just taking a test anyways?

>wake up
>it's 2018
>python
>pip
>js
>npm
>rust
>cargo
>ruby
>gem
>perl
>cpan
>C++
>...
>./configure still checks for printf()
>literally rofl my ass off and close back me eyes

invite for discord, plz?

why would a cs professor forbid the use of series approximations

Attached: 1510011926993.png (288x242, 5K)

private int square(int n)
{
int k = 0;
while (true)
{
if (k == n * n)
{
return k;
}
k = rand();
}
}


better version

STOP

>learning programming
>taking """tests"""
what kind of silly uni do you go to my dude

pastebin.com/fLe2HtRG

>If you want to know why the tree is growing upside down
Because you start writing/drawing at the top of the page? What kind of retard works from the bottom up?

If i'm in /CS262/Lab12/Ex1/ and want to move ex.c to /CS262/Lab12/Ex2


mv ex.c /CS262/Lab12/Ex2 would be the command correct?

is software engineering a meme?

You won't get the heuristic algorithm done by next week.

Because a cs proffesor didnt make the challenge.
The challenge aint hard if you know some complex analysis.
Otherwise you can get creative and do some freaky shit.

>Exactly, he's just stating the obvious. It's a complete waste of time.
Meh. It's a pretty light read man. I've just been skimming through a chapter a night before bed. I kind of like that it states the obvious, I want to be more consistent in my code style.

>Introduction to Algorithms by Thomas H Cormen
Looks p deece
>Introduction to Algorithms by Thomas H Cormen
Multi volume, looks dense in subject, definitely on my list for the summer.
>KISS principle
Agreed but there is still value in learning patterns & architecture.
Would rather read a meme book on architecture than waste another night aimlessly browsing Jow Forums or playing flavor of the year PC games.
I'd write more software but I already do that 12 hours a day.

Well done mate.

ehMrEnR

>not using the superior Peano formalism adored by all the functional programming gods
heh
public class Square {
private static int successor(final int x) {
return x + 1;
}

private static int predecessor(final int x) {
assert(x > 0);
return x - 1;
}

private static int sum(final int x, final int y) {
if (y == 0)
return x;
else {
return sum(successor(x), predecessor(y));
}
}

private static int product(final int x, final int y) {
if (y == 0)
return 0;
else
return sum(product(x, predecessor(y)), x);
}

private static int square(final int x) {
return product(x, x);
}

public static void main(String[] args) {
for (int x = 0; x < 10; ++x)
System.out.println(x + "2 = " + square(x));
}
}

rust is pretty and cute

>talks about functional programming gods
>unironically uses java
user

thanks for the homework done retard

Almost Perfect my dude but you anherod it...
x + "2..."

>"here is my homework prof"
>"the fuck kinda language is that, fuck off"

the thing is he can now simply rewrite it in his language of choice now that he has a proper solution

I think programming might be too hard for me..I'm going to try again today tho..I couldn't even get the programs running on my Ubuntu...

Attached: 1525112672597.png (657x527, 169K)

>proper solution
>halve the shit until it gets under 0.1 is a proper solution
>cosine is even less performant
Geez the problem space isn't so big that you need to resort to this kind of Crap is it?

Name a good use for Python in 2018.

ask whoever made it, that wasn't my point

Teaching new people how to code

Also in RUST(TM) the big CoC dictates that you must use τ not π

dumb frogposter

When will this meme die?
I have nothing against Python, but using it to teach novices is the worst possible thing you could do to them.

Not me, fuck off.

>Meh. It's a pretty light read man. I've just been skimming through a chapter a night before bed. I kind of like that it states the obvious, I want to be more consistent in my code style.
Same here. I always try to read before going to bed and right after I wake up. Although, not everything I read is programming related.
>Agreed but there is still value in learning patterns & architecture.
It never hurts to know design patterns. Some are actually helpful like the builder pattern.
My problem with architectures is that they're too restrictive. Look at the CLEAN architecture for example. Some cases simply don't fit within the chosen architecture so you just hack your way around it. My trick is to make everything composable and separate 'impure code' like I/O from the rest.

>Look at the CLEAN architecture for example
yeah i haven't heard great things about this one. Uncle Bob is definitely a zealot as well.

thanks again for the recommendations

its one of the easiest languages to code with zero experience

But it doesn't teach programming. It is a shortcut to avoid it for people who can't into it.

How is it not programming?

No problem, user. I share the same passion for TDD as he does, but I don't agree with his reasoning. Have a cute lady.
Also, to give you an impression on how important The Art of Computer programming is: businessinsider.com/bill-gates-loves-donald-knuth-the-art-of-computer-programming-2016-4?international=true&r=US&IR=T

Attached: 1524423511667.jpg (1024x768, 91K)

check'd

It definitely was at the top of my list from reading a few sample pages. Now I'll probably pick it up next paycheck. Got my eye on the hardcover box set (i prefer real books).

also pic related

Attached: 1525189101296.jpg (650x608, 89K)

It teaches you bad practices and doesn't make you understand the cost of things.
For instance, a friend once wanted to print a list in reverse. He just reversed the list, printed it, and reversed it again. Look at any beginner's Python code, you will see shit like this all over the place.
Also notice how not a single Python reference book tries to explain things like what goes on in the interpretor when it tries to evaluate something; it simply does not matter to the Python programmer.

discord.gg/4TuhPhr

my vertex buffer is basically a 100x100 2d boxes made up by 2 triangles. winding should be ok.

I create my buffers like this:
glUseProgram(gProgramID);//my shader

glGenBuffers(1, &vhandle);
glBindBuffer(GL_ARRAY_BUFFER, vhandle);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex) * sizeof(GLfloat), vertex, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);

glGenBuffers(1, &ihandle);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ihandle);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(index) * sizeof(GLuint), index, GL_STATIC_DRAW);

and render it like this:
glBindBuffer(GL_ARRAY_BUFFER, vhandle);
glVertexAttribPointer(
0, // attribute 0.
1, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
2 * sizeof(GLfloat), // stride
(void*)0 // array buffer offset
);


//Index buffer
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ihandle);

//Draw the triangles !
glDrawElements(
GL_TRIANGLES, // mode
100*100*6, // count
GL_SHORT, // type
(void*)0 // element array buffer offset
);

ultra simple shaders so I just can see something. so far I dont.
#version 330 core

out vec3 color;

void main(){
color = vec3(1,0,0);
}

#version 330 core

layout(location = 0) in vec3 vertexPosition_modelspace;

void main(){
gl_Position.xy = vertexPosition_modelspace;

gl_Position.zw = 1.0;
}

Attached: 1505644219688.png (1131x1080, 914K)

I never liked Haskell, but I do like the functional mindset. Will Racket or CL suit me? Most of the programs I write are around 1k of lines. I don't have many requirements, but I want a proper HTTP client, XML and JSON parser. I'm willing to trade the safety of a static type system for expressiveness.
Or are there any languages I should look out for? I already know Rust, but I don't find it really enjoyable to write.

maybe I should pick up python...all I want to do in my programming is read game code and and figure out speedrun hacks.. Maybe be a code monkey for money

Attached: 1525127912010.jpg (1000x800, 218K)

dumb frogposter

C++ommon Lisp is a procedural abomination, pick a well supported Scheme dialect like Racket or Chicken if you care about functional paradigm.

doesn't Haskell have literally all of those

Clojure. Persistent collections and lazy sequences are just like those in the Haxell standard lib.

Not that guy but I love Scheme, is it really viable as a daily driver?

Is there a use for the user/sys distinction when using the Unix "time" command to benchmark some programs?

e.g. if I have two programs achieving the same result in ~4000ms, but one spends 3000ms doing user stuff and 1000ms doing sys stuff, while the other does 1000ms of user stuff and 3000ms of sys stuff, what's the difference, which one would be better?

Isn't Common Lisp the most active one out there? quicklisp looks rather nice.
I read through the first chapters of HtDP, but I got bored. Racket itself is neat though.
It does, but it constantly trips me up. stack is shit. GHC error messages are even worse than those of GCC. My main problem is the amount of theoretical crap you have to weed through to find the answer you're looking for. I'm a programmer, not a computer scientist.
I used Clojure for a bunch of Hackerrank problems. Aside from it not being a Lisp, it's quite nice... Until you try to call Java code. It's a fucking nightmare.

If both programs run for 4000ms they're exactly as fast by definition. Although from a benchmarking standpoint you could argue "user stuff" might be easier to optimize since you have more control over it, "sys stuff" is system calls which will usually be fast, and as a corollary to the two above factors, more optimized programs will often have a somewhat higher proportion of sys time to user time.

Employed Haskell programmer reporting in

Attached: 1474325315193.jpg (636x616, 44K)

do you use a github ani

daily reminder that Java is MASTERRACE

what did you meant by this

Java is literally the best language ever created

i do not believing you

don't have to, it's like an unspoken truth