/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: 410azMWkp3L._SX258_BO1,204,203,200_.jpg (260x320, 14K)

Other urls found in this thread:

domain.com
app.domain.com
orwelldevcpp.blogspot.com/
tutorialspoint.com/cprogramming/c_pointer_arithmetic.htm
tcl.[tk]/faq/tclwin.htm
twitter.com/SFWRedditVideos

working on this

NEW /DPT/ RULES

>(A)GPLv3 only
>no Windows
>no Nvidia
>no OO
>no webdev

Designing a language for systems/application development on heterogeneous and/or distributed computers. The idea is to, in the abstract, use a model that is based entirely around message passing and then allow optimizations based on shared memory where it is present.

For instance, a linearizable concurrent data structure behaves like its own process that queues up method calls and executes them sequentially and asynchronously from its clients. However, if all of a data structure's clients reside on the same shared memory system, it may not be implemented as such - it can just be a shared object that the clients manipulate directly with some synchronization protocol (e.g. a lock).

this thread was licensed with GPLv2. Feel free to remove your contributions to this thread at any time :^)

these questions are so dumb, I feel dumber for not being able to instantly answer them

Attached: hmmmmm.png (842x486, 47K)

>The quality of posts is extremely important to this community.

>The idea is to, in the abstract, use a model that is based entirely around message passing
I'm going to have to see your "Hello Fibonacci"

>big-Oh
what the fuck

yeah, book/prof are frenchies

anyone else just default to writing emulators when bored?

i of course get bored of that too

I default to thinking of ways to dismantle centralized systems into distributed or decentralized systems.
It doesn't get tiring but it does get frustrating.

pointless mental masturbation

>writing emulators isn't

a helpful learning exercise

Also, the language has futures to capture this asynchronous behaviour. The great thing about this is that even when clients are interacting with a shared object and not an actual process, there is some room for them to execute other code concurrently with the method call, e.g. doing a bit of work after each iteration of a busy wait loop or a failed CAS in a lock free scenario, which helps with contention.

type Stream(A) = A * Stream(A);

proc fibs(): Stream(Nat) {
proc go(x, y) {
yield x;
go(y, x + y)
}
go(0, 1)
}

Where can a brainlet like me get started with contributing to opensource? I want to get more comfortable with git and working with existing code bases but I have no clue where to start.

Attached: 1514694727315.png (645x729, 82K)

What do you mean? Java is all I know so I don't have anything to compare it to.

Look up an ongoing but languishing issue in your favorite open source project, tackle it, and then submit a patch.
How hard is that?
Don't worry about being wrong or doing it in a questionable and suboptimal way, they'll review your code.

Obviously don't pick a project with like 300 ongoing pull requests like Tensorflow.

putting together a pretty simple webserver, the thing that makes it interesting, I guess, is that I'm trying to make the whole thing async. So, one thread and using epoll to multiplex everything out. Mainly interested in getting a better idea about how to put an async thing together without higher-level abstractions.

Attached: Portrait-reimu.png (300x300, 80K)

>not big-eau notation

it just keeps shifting until it's zero, so f(y) = ceil(lg(y))

O(lg(n))

2*ceil(log_2(y))

thats not a simple expression

We frogs just say comparaison asymptotique.

Either that or Landau notation.

I see, makes sense, thanks

I'm reading about desuarchive's issues, and they're talking about wanting a distributed scraping mechanism, and how terrible it is that Jow Forums's API doesn't provide a method to verify the authenticity of its content (other than receiving it from the server directly, through SSL)

This got me to thinking: How do people donate time to distributed computation projects? How do these distributed computation projects verify the accuracy of the results from each node?
What about computing using smart contracts on distributed blockchains?
Surely it's the exact same issue.

I am trying to create a regular expression to capture domain names and sub domains but am running into issues. I am a brainlet when it comes to regex so I might not be able to do what I am trying to do.

I want my regex to capture domains like
domain.com
httpS://domain.com
app.domain.com
app.domain.com
domain.com
cool.app.domain.com

I want each section of the domain to be in its own group.
http:// group one
app. group two
domain. group three
com group fore

The issue I am running into is that I cant expand the amount of groups I have if I ad a arbitrary number of sub-domains. My end goal is to strip the http:// portion and the sub-domains and just have the main domain but just can't get this to work.

This is my implementation I just don't know how to expand the groups. can anyone guide me?
/(https?:\/\/)?([a-z]+\.)([a-z]+\.)([a-z]+)
[code/]

We all rely on hashes and the assumption that P!=NP.

How should I advance in CS topics? Right now I'm just learning Python from a starters books.

but surely you wouldn't know the answer (and thus the hash) of a computation performed on a node or as a result of a smart contract

A shell and a kernel, separately

Hey I was in the last thread asking how to start C. Where do I find a compiler for it? Does Windows SDK do it?

Look into SNARKS.

keep going in python as long as it interests you

what do do after is mostly a question of what you find interesting or what you want to do with programming

Use this IDE and Compiler: orwelldevcpp.blogspot.com/ you can thank me later.

Cygwin or VS

install linux in a vm, windows is horrible for programming

Does WSL even work for most use cases?
I tried to use it as an OpenVPN server but it had some critical issues with the network stack.

>an IDE with bloodshed in the name unironically

I wouldn't recommend windows for C programming. Windows doesn't officially support C11.

Is 3 captchas per post a fucking bug. I refuse to participate in this anymore.

I wouldn't recommend this comment.

You're shitposting too much, goy
can't have you rattling off opinions that go against Google's beliefs.
Remember schmendrick, don't be evil.

but I don't really know what interests me.

then do stuff that doesn't interest you. eventually you will be left with what does.

you seem very angry at the idea windows is a horrible platform on which to program

It's fine to pursue programming as just a job (provided you choose to work anywhere but Silicon Valley), but it would probably be a great boon for you to find some domain of interest that you can apply programming to.

Most people seem to enjoy computer graphics. Look up SIGGRAPH on goytube.

Update your browser and clear your cookies, I swear to god google is doing this shit on purpose, on my old browser it keeps asking for more captchas to solve but after doing sometimes I don't even need to solve it.

I got this and have navigated it well enough to make a Hello World. If I just follow the K&R book with a basic understanding of programming, will I be set?

When it comes to C there are not many ways to do things wrong. If people can understand your code and it performs well, there's nothing wrong with it.

its a retarded concept. thats not the relationship. there isn't some concept out there called program which you reach through an OS.

C is horrible to program with everywhere except an OS that essentially acts as a C IDE by virtue of having the right folder structure plus package management. Oh wait, Windows has that now.

I'm a brainlet. Why does
a[i] = *(a + i)

yep! It's all you need. Everything else only exists for when your programming gets so fancy you need/want extra tools.

tutorialspoint.com/cprogramming/c_pointer_arithmetic.htm

I have a char array of a binary number arr = [1,0,0,1,1]. How would I go about converting this to an int? I would like to do something like

int ans = 0b10011;

but I can't exactly do

int ans = 0barr;

I'm using C

The question you should be asking is why a[i] == i[a]

you mean to say that a[i] is equivalent to *(a + I)?
The "array index" syntax is syntactic sugar for the expression on the right.
That's just how it's defined, don't think too hard about it.

Look up pointer arithmetic. Pointers are just numbers; addresses in memory.

Guess what this does
while (*x++ = *y++);

Arrays are stored contiguously in memory, so you can just add or subtract offsets to an address in the array to move around in the array. The value of an "array variable" is just the address of its first element.

Attached: array.png (1051x611, 23K)

A lot of my work in house programs are programmed in TCL. We have to run Win 7 in basic theme to have them run.

Think of it like "the ith house on the street" vs. the "house i addresses away from the first house on the street".

*(a + i) == *(i + a)

it's STILL fucking awful to program on and to target

bizarre hand-wringing

>We have to run Win 7 in basic theme to have them run.
stop making shit up

although it needs to be understood that i[a] will probably cause register thrashing

I tried everything including a different machine and it's been like this for months.

Attached: cap.webm (484x595, 1.53M)

I was thinking about working in either development or data science.

>tcl.[tk]/faq/tclwin.htm
>ctrl + f "theme"
>0 results
you should stay at that job so that you don't infect other workplaces with your stupidity

i blame recaptcha for the fact Jow Forums has become exceptionally negative and angry in tone over the last couple of years

Windows doesn't support C11. Explain yourself.

nigger.cpp

thanks

Attached: mameshiba.jpg (184x184, 4K)

>Jow Forums has become exceptionally negative and angry in tone over the last couple of years
Well no, it's because we've had a massive transplant of newfags who don't know what trolling is and are thus easily baited and can't handle the banter.

I am responding to you and then closing this thread for good (and any other further iterations) because I am sick of having to combat your stupid fucking inane commentary at every turn. Enjoy your community you have fostered. Sure going to be fun wallowing in the mud like you have done for past decade and will continue to do so. Posters like you are what is so horrible about Jow Forums and else where.

see you tomorrow

Dude, what if this is the new shadow banning?

Attached: autismcat.jpg (512x512, 50K)

Or maybe that's our outdated version of ArcGIS

This means you lost lol

hahaha windows is a shit environment for programming, go fuck yourself with a DWORD, cunt

It's driving me fucking bananas. Sometimes it takes me minutes to MAKE a post. Not think it up and type it. Just to submit it.

It's bad enough we can't just drag select the squares. But now they take multiple seconds to fade in, and ultimately result in an invalid green checkmark anyway.
It's so frustrating. I don't even want to report bad posts as a result either.

i consistently spend longer doing the captcha than writing the post

i can feel the stress boiling away, if only i could bring myself to leave

Since you can't renigger these captchas so easily, what I've taken to doing is completing the captcha exactly ONCE and then pressing post, which will replace the captcha with a new one that will probably work better.

If it's one of those slow-as-shit ones I press the Post button even faster.

Oh is there a console or something on this where I can see printf outputs and such? My early experimentation kinda needs me to be able to see.

you mean an interpreter?
There isn't anything like that for C.
Write a small main() function and execute it.

I mean where does this output to

Attached: Capture.png (794x319, 7K)

Execute it and find out

printf outputs to standard output

Can you guys recommend a basic environment setup for progamming with C under Linux? My understanding is that most people here are simplying using a text editor + gcc, but how are you configuring them to work together? I assume something more streamlined is happening than saving a file and then running gcc on it in another terminal.

Attached: 1341154919140.jpg (1280x1158, 366K)

>inb4 he puts system("pause"); at the end

seems like there's a lot of unintuitive mystery syntax and object creation
This looks a lot like goroutines and channels.
What's different?

gcc -Wall -xc -

>not even giving him a debugger
This is why Visual Studio dominates over everyone else.

Attached: 1503300936287.jpg (1079x1070, 562K)

>gdb -q ./a.out

>seems like there's a lot of unintuitive mystery syntax and object creation
>This looks a lot like goroutines and channels.
There's no objects there, nor any concurrency. Maybe the idea is similar to goroutines and channels but I've never used Go and the actor model has been around for a long time. The "novel" (at least I haven't seen it before) part is refining message passing (executable) specifications to shared memory implementations where possible.

Did you try noscript recaptcha? You can force enable it from 4chanX (or just disable js).

You wanna hear some retarded shit?

So there is only one way to totally check if an object has a particular attribute in Python because of __getattr__ and __getattribute__ and that is by trying getattr() and catching AttributeErrors. That is all that hasattr does under the hood. This as a horrible side effect triggers fucking getter properties and brakes shit. So as a part of my project, I've had to implement by own fucking version of hasattr to solve this glaring issue that the language committee sees as a normal function.

God I hate Python...

def safe_hasattr(obj, attr):
return attr in dir(obj) or hasattr(obj, attr)

class A():
@property
def wew(self):
print("wew lad")

a = A()

>>> hasattr(a, 'wew')
wew lad
True
>>> safe_hasattr(a, 'wew')
True

Seemingly nowhere. I think I might not have the stdio.h it describes in the book

How are you running the program? If you're clicking an .exe it will pop open a command line window that will immediately close, and that's only if it's compiled in console mode. Try running it from a command line if you're not already. If you are, I don't know what to say.