/dpt/ - Daily Programming Thread

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

Attached: 1420870704644.jpg (787x830, 118K)

Other urls found in this thread:

gitlab.com/9898287/nixwriter
pinnacle.com/m/Mobile/en-GB/Enhanced/Regular/TestDrive/7/NoLicense/Leagues/Soccer-29/Market/1
functionalcs.github.io
functionalcs.github.io/curriculum/
docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/statements#the-continue-statement
dotnetfiddle.net/aVchJZ
omdbapi.com/
v3.void.cat/#HCyVi4XKyhaCQ0CwIp5l1LgAb9T:8b6a785cc2e36d0c7212fb67587d5927:ca52c999836d1a648b8039205ffd6f07
a.doko.moe/tpztna.pdf
stackoverflow.com/questions/14105650/how-does-stdflush-work
twitter.com/SFWRedditVideos

>Anime
Good job, OP.

Attached: 1458548144091.png (159x302, 42K)

My first GTK project.
gitlab.com/9898287/nixwriter

>sachiko
can she say niggy?

Attached: 1537198279816.png (663x801, 174K)

>it's a python 2.7 and 3 breaking eachothers settings and programs i need to run
h-haha wouldn't it be hilarious if we picked a language that still hasn't gotten over its user divide for most of our system's applications?

Is anyone able to get the html of this in python, so I can beautifulsoup it: pinnacle.com/m/Mobile/en-GB/Enhanced/Regular/TestDrive/7/NoLicense/Leagues/Soccer-29/Market/1
Normal requests gives this:
"There was a technical problem retrieving your customer data."
If you access the page you will see some JS that loads up the page some of the page, but the request just grabs it instantly.. this could also be an attempt by the site to prevent scraping but I can't really think of a way around it. Any ideas?

Decided I'm going to start learning how to program. Starting with Python. Redpill me on what I need and what I should use in terms of programs. I'm on Windows for now but will eventually move to ubuntu or w.e. later

>most of our system's applications
Most of my system's applications are in C, though.

As long as you have a python interpreter and a text editor you don't actually need shit. You'll pick up whatever other tools you need as you need them.

>// tool for expanding pretty file names into actual byes
// assert(7.5G == 7.5 * 1024^9);
private ulong inBytes(in string sz)
{
import std.conv : to;
import std.math : pow;

ulong factor = 1;
ulong quotient = 1024;
switch (sz[$ - 1])
{
case 'K':
factor *= pow(quotient, 1);
break;
case 'M':
factor *= pow(quotient, 2);
break;
case 'G':
factor *= pow(quotient, 3);
break;
case 'T':
factor *= pow(quotient, 4);
break;
case 'P':
factor *= pow(quotient, 5); //TODO: fix possible overflows
break;
case 'E':
factor *= pow(quotient, 6);
break;
case 'Z':
factor *= pow(quotient, 7);
break;
case 'Y':
factor *= pow(quotient, 8);
break;
default:
factor = 1;
}

Attached: Screenshot from 2018-11-21 23-49-43.png (810x972, 211K)

thoughts on functionalcs.github.io
?

functionalcs.github.io/curriculum/
**

nobody cares

nothing

How do I circumvent a program not allowing cheat engine to run while it's running

Attached: D8CRtMS[1].jpg (374x374, 39K)

use undetected cheat engine if that's still a thing
or make your own by editing the source and changing the names of everything

stop cheating you absolute retard.

Faggot

stop playing botnet games

What obscure language is best for vidya games and which is worst?

:0)

>loop variables don't get incremented if you use continue in C#
Holy shit how can people be retarded enough to use this language? Micro$shills are the worst I swear.

Attached: f_3aOvZe.png (482x482, 18K)

>Best
Lisp
>Worst
Lisp

based and redpilled

make a game with malboge
Hello World:
(=Z,XW)UTSL53\HGFjW

Yes I need to address that at some point.
Realistically speaking though I don't think anyone is going to buy a 1P hotpluggable SCHI storage

Please tell me it's not real
LMAO

I don't get why foldr in haskell works with infinite lists. While I'm perfectly understand why foldl doesn't, and I know "the answer" to my question is "muh lazy evaluation", but still. Let's say we have a:
foldr (+) 0 [1,2,3, ..]


it is equal to:
(+) 1 ((+) 2 ((+) 3 ..))


How are you gonna evaluate that if you need to evaluate
(+) 2 ((+) 3 ..)

first and so one.

I understand that exactly because this is lazy, you don't need to evaluate that. But even then you just get "lazy answer of": "1 + f(x)", not "1 + 2", there is no 2, there is "2 + f(x)"

it's not.

cringe

Try using Selenium or some shit. Or if you just want that specific page, open it in your browser and just copy the source you get from inspect element-ing the outer html tags.

and bluepilled

It's real

Attached: 1541063019528.png (1320x44, 14K)

>foreach = for
Is this bait?

ahahahahahahaha
Imagine language as shit as C# doesn't even loop properly

>>> 'for' in 'foreach'
True

stop lying, retard.

docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/statements#the-continue-statement

"""The target of a continue statement is the end point of the embedded statement of the nearest enclosing while, do, for, or foreach statement. """

in other words,
for(...)
{
continue:
}


is same as

for(...)
{
goto end;

end:
}

At least they tried

Attached: 1539878987455.gif (287x344, 72K)

function unique(array) {
return array.sort().filter(function(cur,idx,col){
if(col[idx] !== col[idx+1]) return 1
})
}

could this code even shorter using an arrow function expression or a ternary operator? I don't get it.

Attached: 1_HP8l7LMMt7Sh5UoO1T-yLQ.png (1600x1600, 48K)

in c, you would simply do

return col[idx] !== col[idx+1];

god that's a great idea

so it can be
function unique(array) {
return array.sort().filter((cur,idx,col) => col[idx] !== col[idx+1]
)}

I love it

Bump

build a hashmap; that would be better complexity

[1,2,3,3].uniq.writeln;

any of you know some good image api
example: i need api for finding movies posters so i can set them up as application background when user is watching movie

Yep all true. Fucking dotnettards.

Lisp is the most powerful programming language.

I wish I was good at Rust.
It'd be really cool.

Attached: 1537832685858.jpg (1000x900, 450K)

I hope you will understand the difference between foreach and for in the future. Python, C++, goddamn Delphi all have them, all with the same semantics.

rust is shit

>loop variables don't get incremented if you use continue in C#

dotnetfiddle.net/aVchJZ

Attached: brainlet.jpg (1218x1015, 212K)

Jesus christ!

Is there better way to compare three numbers than this?
(n1>=n2) ? ((n1>=3) ? n1 : n2) : ((n2>=n3) ? n2 : n3))

Sauce?

omdbapi.com/

Attached: nesteros.png (3680x5520, 551K)

what are you even trying to do here

In C and in C++, can I trust that there exists a total order for arbitrary pointers?
If not, should I just cast them to void* and then uintptr_t?

comparing 3 numbers to find the biggest
obviously 3 should be n3

int n = 12, n2 = 2, n3 = 43;
[n,n2,n3].sort.back.writeln;

???????????

(max n1 n2 n3)

Yeah.
max(nums)l

return (((((a >= b) * a) + ((b > a) * b)) > c) * (((a >= b) * a) + ((b > a) * b))) + ((c > ((a >= b) * a) + ((b > a) * b)) * c);

lads how do you tell if a python test is actually progressing or just stuck?
Surely test_socket can't actually take over a fucking hour? Especially when the other 308 tests never took more than 2 minutes.
>the absolute fucking state of just trying to build python so i can get on with my day

Hello guys, just starting to learn C#.
You guys, could recommend me some projects to start with?

>Image not related

Attached: 41706129_1107091726107378_2235688433580244992_n.jpg (960x720, 24K)

Rewrite .NET in C#

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

im writing in C,I have no idea what you sayin
is this part of some library?


corrected code because i was in a hurry and typed shit
#define MAX(n1,n2,n3) (n1>=n2)?((n1>=n3)?n1:n2):((n2>=n3)?n2:n3)

function unique(array) {
return [...new Set(array)];
}

Working on trying to get back into a programming routine.
I got into it first as a kid learning BASIC, and didn't get into formal programming until I went to uni for engineering, and was exposed to MATLAB.
At first I was adverse to it, but now I find myself preferring C to higher level languages, because I feel the demand for things to be declared in a certain order lends better to guiding the style/format one must adhere to.

I want to learn C++ and Python for robotics applications but, life hasn't been very stable lately and it makes sitting down to code hard.
Not only that but, I get anxiety hangups whenever I sit down at the computer, some times I feel overwhelmed, or like I'm too old to be trying to learn new things.

I think part of what makes learning OOP difficult so far is that I haven't found a lot of examples that provide a condensed/fundamental/canonical demonstrations of how their programs should be structured. Like an infographic that would just show from top down, heading comments, includes, var initializations, main loops, sub routines, styles of subroutines and flow control, etc. illustration of concepts in their most fundamental formats.
Too much of the knowledge presented out there is fucking endless paragraphs of text, with a demonstration from the author that is from their own work, rather than a generalized format that can be applied to anything.

It would be nice to find some online communities for robotics stuff like this...but, inevitably I end up running into somebody who's elitist about it, and it completely kills my vision of communities being worthwhile.
I feel I just need to settle on a project something and exercise better self-discipline/self-control about it, and not care so much about what others think.

Attached: robots making robots.jpg (634x331, 34K)

Or if you care about perf then
function unique(sortedArray) {
const { length } = sortedArray;
switch (length) {
case 0: return [];
case 1: return [sortedArray[0]];
}
const result = [];
let prev;
result[0] = prev = sortedArray[0];
for (let i = 1; i < length; ++i) {
if (prev !== (prev = sortedArray[i])) {
result.push(prev);
}
}
return result;
}

It depends, actually. sum = foldr (+) 0 doesn't work on infinite lists, but map f = foldr (\x -> (f x :)) [] does. It depends whether the recursive call ends up being guarded by a constructor, which makes the function productive.

I've been looking to get into robotics and it feels really overwhelming. There's hundreds of parts for some projects and I barely know what some of them do. They can also break if I touch them wrong and things get expensive fast. I tried buying a robotic arm kit but it ended up being shittier than I expected so now I don't know what to do with it.

I also like programming in C despite everything being in python or even worth that scratch programming block shit.

>want to apply for a job as junior data scientist
>many companies actually do pretty interesting work
>90% of those companies are weird startups which present themselves as autistically as possible
>WE SO PROUD TO BE STARTUP
>WE HACKATHON AND STUFF, SO KEWL!!!
>WE CONTREEBUTE TO OPEN SORES, UWU
>FREE SUPPLY OF ONIONS EVERY DAY

Attached: 1511482564885.png (351x364, 258K)

any game engine tutorial to share, Jow Forums ?

If you need a tutorial you shouldn't program a game engine

2D or 3D?

any one of them is fine.
both is also fine.

It's impossible for me to program a game engine all by myself without any resource.

why do you need to program a game engine if you don't know how they work
just use one that already exists

Then you shouldn't try to write an entire game engine? Try learning some of the essential components i.e OpenGL or DirectX, shaders, rendering techiniques, physics.
Also don't write an engine just for the sake of writing an engine. You will just end up with an unstable, most likely broken, piece of garbage with no clear use case.

I have an MS in mechanical engineering, and it still feels overwleming. Really the best thing you could do with robotics is learn some basics (isolating motor current from logic current, sensor feedback loops, avoiding loop singularities), but then once you have that down deliberately choose a small portion to focus on.

I wanted to learn more about the computing and electronics side, in regards to how they drive motors, and I can tell you right now robotics as a discipline is a rabbit-hole with no end. There's no way any one human mind could master every facet of its discipline, so at some point you have to make a clear outline for what part of the knowledge/discipline you want to know best, and then find others to work with.

What kind of attacks against the TLS protocol are more or less feasible if the certificate is not compromised?
I heard correlation attacks are rather easy to perform.

Attached: 1502049818561.jpg (480x640, 111K)

game engine architecture third edition pdf
v3.void.cat/#HCyVi4XKyhaCQ0CwIp5l1LgAb9T:8b6a785cc2e36d0c7212fb67587d5927:ca52c999836d1a648b8039205ffd6f07

Attached: yuru_yuri_render_pack_by_ganesa221-d79ijbr.png (800x716, 345K)

how do i get the file off this site once it's downloaded?

what do you mean? your web browser should ask you where to save the file once it has been downloaded

fuck, i'll try an different browser
thanks for the upload anyway

mirror: a.doko.moe/tpztna.pdf

Quick challenge: implement fmod() in any language of your choice.

seems like it's from Naughty Dog, alot of good shit in here on animation which I'm working on right now

function fmod(numerator, denominator) {
return numerator % denominator;
}

Maybe if they hadn't made 3 so prescriptive we wouldn't be in this situation.

fprem

I'm working in C++ and trying to understand the concept of flushing the output stream. I found a discussion of it on stack exchange
stackoverflow.com/questions/14105650/how-does-stdflush-work
but I'm not actually seeing a difference when I test out the example one of the answerers gave
#include
#include

using namespace std;

int main() {

cout

In lisp, this is just mod.

DEF FNfmod( a, b ): b=ABSb*SGNa: =a-b*INT(a/b)

Flushing means you just dump whatever is in your buffer in one go. Doesn't really matter in this day and age for console output in modern OSes

You guys scored any righteous hacks lately?

the gibson

>c++
> have pointer to an node object ( new struct) for a binary heap i am making
> delete node
> the parent of the deleted node is now pointing to -5555666 or some nonsense instead of pointing to NULL.

hmmm yikes

What's wrong with a simple function-based API?
>make complex abstracted API
>people who just want some of its functionality don't want to use it
>make simple API
>people complain they have to build lego to do anything
How are you supposed to address this?