/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1480458155491.png (452x355, 312K)

Other urls found in this thread:

winestockwebdesign.com/Essays/Lisp_Curse.html
shenlanguage.org/osmanual.htm#4. The Core Language
github.com/CObjectSystem/COS
arxiv.org/abs/1003.2547
pastebin.com/9VFg7bxR
docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getasynckeystate
twitter.com/NSFWRedditGif

Maki would read a book with homo in the title lol

holy shit i made that image

Rust is a stepping stone. C is coming to an end and anyone with half a brain cell knows to avoid the mess that is C++.

Sample interview problems. Been an enterprise code monkey and ops guy for several years, so a lot of problem solving, but little in the way of traditional CS and the kinds of questions you get in interviews.

But it's better to reject 1000 good candidates than get 1 bad one, so I understand that this is the way the game is played.

Wish I still had my college notes and textbooks though. They were quite useful in landing my last job.

C++'s power is undefeatable and undeniable.

C++ is shit.

JavaScript rocks!

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

That's great user, I'm proud of you.

Attached: 1543467217172.jpg (235x283, 13K)

there are 18 different ways to initialize variables in C++

default: int i;
value: int i{};
zero: static int i;
constant: static int i = some_constexpr_function();
static: zero- or constant-initialization
dynamic: not static initialization
unordered: dynamic initialization of class template static data members which are not explicitly specialized
ordered: dynamic initialization of other non-local variables with static storage duration
non-trivial: when a class or aggregate is initialized by a non-trivial constructor
direct: int i{42}; int j(42);
copy: int i = 42;
copy-list: int i = {42};
direct-list: int i{42};
list: either copy-list or direct-list
aggregate: int is[3] = {0,1,2};
reference: const int& i = 42; auto&& j = 42;
implicit: default or value
explicit: direct, copy, or list

my life is complete
time to die

Attached: 1548110097897.jpg (1920x3272, 2.01M)

Scrapped the OpenGL renderer in my Rust engine and now learning gfx-hal

Should I make a neural network?

Is it possible to FFI into a rust library or is it a nightmare like trying to FFI into C++ libraries?

Attached: .jpg (584x657, 231K)

Rust has extern "C" just like C++ for that.

Delusional.

Do most Rust libraries use it though or do they ignore the non-Rust community?

Lisp is the most powerful programming language.

What's the joke, besides some of these being wrong?

Either you are lucky and there are C bindings or you gotta write them yourself. Same situation as in C++.

The vast majority don't because it would mean crippling the type system.

If Lisp is so powerful why does no one use it?

winestockwebdesign.com/Essays/Lisp_Curse.html

Yeah well if no one uses Lisp then why is it so powerful?

power = force x distance / time
lisp is really far away

it's too powerful

I couldn't find any program/script that would let you make a search on danbooru with more than 2 tags, would this be hard to program for a noob? How would this kind of program work?

All I see is a bunch of limp lisplets failing to give a good answer.

if lisp is so powerful why can't lispers answer you

Hey lads, Java newfag here. I started a programming night course, and we've reached the Scanner command, and I have a question.

Is Scanner's sole function to turn the usual input-output format into an input-input-output format? For example, to prompt the console to ask you a question such as "What is your name?", to which you are expected to respond before the program continues?

Attached: Brooks.jpg (400x225, 17K)

you sound a bit peeved friendo

A scanner is for scanning things.

is lisp powerful enough to create a problem which it can't be used to solve

yes, and the problem is lisp itself

Could you imagine a strongly typed Lisp? God that would be a good language.

Typed Racket is useless.

literally nobody has ever thought about this

That's because Racket is shit
I have. Types are a good thing and reduce runtime bugs.

If I have a procedural map, consisting of either active or inactive tiles, what is the correct algorithm to use to determine the largest, consecutive inactive area?

Consecutive in this case means a block either N,E,S,W must be in the same inactive or active state.

Pic related, I managed to get the result I wanted using a recursive function but I don't think it is the most efficient.

danboorudownloader3

why types rather than contracts or some other form of proof

forgot to attach pic :/

Attached: Screenshot_20190129_123630.png (631x642, 9K)

typed can be inferred

contracts supplement a good type system, not replace.

and you think other things can't? plus some types can't be inferred
wrong

S H E N
H
E
N
Dependently typed lisp
shenlanguage.org/osmanual.htm#4. The Core Language

Have fun typing your type constraints every time in your contract because your language has a shit type system.

nv you forgot your tripcode

Lisp doesn't play well with big teams, specially if the dev turnover rate is high.
Idiomatic lisp programs end up as DSL implemented at the top of lisp itself.
It can be made to worl (see Naughty Dog's games, AutoCad, Emacs, Yahoo Store, etc) but isn't as easy.
It's a tradeoff between having a handful hackers writting a very expressible language (often because extending the language so it can express what you need is very simple) or having a over a dozen guys hacking a language that isn't that bad (and that often has some sweet frameworks that do the lion's share of the work anyway)

no clue who nv is.

this dude

Floodfilling every unfilled cell will work. A smarter way might be to scan a row at a time, keeping track of consecutive horizontal lines of empty cells and then joining them together as you move down.

Shen is what Lisp looks like when its at peak performance.

think you're confused friend, im the only person who shills Shen, and I don't trip.

Start at a first upper left node and go horizontally left and right. Go past any boundaries left and right and repeat, you'll have at most 1/2 pixel paths to follow. Go down the next row, starting at each of the first paths from the previous row and go left and right. If you run under another node, join their back-intervals/horizontal line and add their existing area.

Literally all you can do is search the whole space, and if you want to retain their area knowledge, you need to abstract their edges, intervals, or keep individual blocks.

Compressing the data is another story, (T4 comes to mind).

ok nv

Sounds like a floodfill problem, so you might want to give that a search. Off the top of my head, I don't think you can get the algorithmic complexity much lower than the naïve solution unless you fuck with your datastructure. Recursive is fine bc you can transform it into an imperative loop if you're having problems with stack limits. Polite sage for shitty answer.

ignore schizo posters.

You'd have to add new areas at each row if you do this route (because the largest area can start anywhere after the first row).

guys i want to make an algorithm but idk how
lets say im selling a product, and due to the nature of it, it is in my interest to sell high quantities only, and not low. so when selling low quantities, I want the customer to get what he is paying for. but since I want him to buy large quantities instead, I encourage this by giving him extra product every time he buys a high sum.

e.g
customer buys 5$ worth => gets 0% extra, receives 5$ of product
customer buys 150$ worth => gets 2/3 extra, receives 250$ worth of product

am I just a math brainlet? if so what subject covers this?

If C is so great why did someone have to increment it twice with C++ and C++++ (C#)?

The law of supply and demand

Something free like microsoft azure but where I don't have to hand out my credit card and phone number? I need online sql server.

Azure Free Account

you could make the discount grow exponentially and cap it off at a certain % of profit loss

Here’s hoping C#xx isn’t such a pile of shit.

C#++ is probably going to be the C killer.

C# is Java++, and Java was the language Gosling made because he realized his employees weren't smart enough to use C++.
If you are going to write C these days, use COS (aka a port of CLOS for C)

>If you are going to write C these days, use COS (aka a port of CLOS for C)
>C
>OOP
Yikes

that sounds horrific

sepplesharp++ is going to be a bloated nightmare.

>COS (aka a port of CLOS for C)
Link?
Sounds like horrible macro mess that require too much effort to learn and really convoluted syntax to use.
Functions and data is just fine.

Download: github.com/CObjectSystem/COS

Paper: arxiv.org/abs/1003.2547

#include
#include

useclass(Counter, (Stdout)out);

int main(void) {
OBJ cnt = gnew(Counter);
gput(out,cnt);
gdelete(cnt);
}

defclass(Proxy);
OBJ obj; // delegate
endclass
#define gum1 gunrecognizedMessage1 // shortcut
#define gum2 gunrecognizedMessage2 // shortcut
defmethod(void, gum2, Proxy, Object)
forward_message(self1->obj, _2);
check_ret(_sel, _ret, self1);
endmethod
defmethod(void, gum2, Object, Proxy)
forward_message(_1, self2->obj);
check_ret(_sel, _ret, self2);
endmethod

Attached: 1544938358663.jpg (500x375, 92K)

this is terrifying

>sepplesharp++
would program in

Attached: DfnLCD4UYAAleAt.jpg (319x400, 29K)

C was a prototype for the constexpr true messiah of programming languages.

I'm reading this book right now and I'm struggling to stay focused.
I suck at reading I guess, I get way more engaged when just making my own stuff or using videos/short docs.

I feel like some of the info is going in, but like most of it feels like I'm just copy/pasting.

Any good MOOCs, online courses, or books on OCR?

Attached: Noss.png (880x803, 428K)

That's still less boilerplate than Java, impressive

#sepplesharp++

defclass(Proxy);
OBJ obj; // delegate
endclass

"Less boilerplate"
class Proxy {
OBJ obj; // delegate
}

Do you guys put you GitHub in your resume or are you personally against it?

Which language will earn me the most money?

Haskell is the most employable and will make you the most money out of any language. 8 out of 10 of the top richest coders use Haskell. Statistical analysis says the profitability of Haskell will only increase.

I am trying to figure out what this code does. Its one function in a keylogger written in golang but I don't really get the for loop.

var (
dll, _ = syscall.LoadDLL("user32.dll")
proc, _ = dll.FindProc("GetAsyncKeyState")
)

func GetKeyState(inputs []int) {
// get current input
for i := 1; i < 256; i++ {
a, _, _ := proc.Call(uintptr(i))
if a&0x8000 == 0 {
continue
}
// num lock
if i == 0xf4 || i == 0xf3 {
continue
}
// mouse
if i == 0x05 || i == 0x06 {
continue
}
// shift
if i == 0x10 {
continue
}
inputs[i] = 1
}
}


here is the full code for anyone interested.

I am an idiot and forgot to post the link

pastebin.com/9VFg7bxR

I don't help criminals.

it loops through all possible keycodes and checks if they're pushed down. If a key is pushed down, its corresponding index in the inputs array is set to 1.

what should I use to compile C on windows?

clang

WSL, mingw, cygwin, a linux VM, MSVC in that order

That is what I was thinking. I wanted to know if, say I only wanted to check for a mouse down, would I still have to loop through all 256?

No, you just need to check a single index for the left and right mouse buttons each. RTFM: docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getasynckeystate

Lol its for learning. I am new and want to learn about pentesting.

mouse and keys are not the same.
it loops through 256 keys because ASCII.

can I access my windows files with WSL?

Wrong, it's a windows API function that uses custom scancodes. There are two scancodes for each mouse button, VK_LBUTTON and VK_RBUTTON respectively.

Yes. Your windows drives are mounted at /mnt. So your C: is at /mnt/c.

Lol it isn't ascii, it's virtual key codes.