/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

terralang.org/
wired.co.uk/gallery/machine-learning-graphcore-pictures-inside-ai
rust-lang.org/en-US/community.html
nytimes.com')
twitter.com/NSFWRedditVideo

you guys worry about everybody being replaced by robots and advanced AI?

FIRST FOR TRAPS!

No, because according to the 60s we should already have been replaced by robots and live a happy and stress-free life thanks to robots doing anything for us.
50 years later and it still hasn't happened.

Ban C programming.


C is the reason why we still have shitty backdoors.
C is the reason why we cannot utilize multiple cores efficiently.
C is the reason why our programs continue to reveal security exploits after decades.
C holds back technology advancement to the 80's .
C is the reasons why Linux has no concurrency

itt C and RUST merge into CRUST the ultimate language to power the WORLD

TemplateHaskell is ALMOST good

You can write C within Rust

i can also eat with a shovel

What does TemplateHaskell do?

But you were asking for a shovel

@59078349
>our programs
m8...

Quoting and splicing, for instance in I generate a list of 10 type declarations

data Test0
data Test1
..
data Test 9

and splice them in

i though we just exchange facts..

@59078349
Your fervent anti-C posting just makes me want to use it even more.

...

#include

So after that I can use e.g. Test8 as normal type? That neat, but what are the real use cases?

Yes

one example is several libraries provide a function like

(Lens library)
$(mkLenses ''MyType)
(''Type quotes the name of Type)

This passes the type to the mkLenses function, which then generates functions and intsances based on its components (more powerful than GHC.Generics).

Unfortunately there are a lot of limitations, and the AST itself is quite bloated.

Ever since I tried Terra* I feel like the world needs more levels of metaprogramming for their types (at the cost of probably needing to ship LLVM to run the damn programs by the end!!!)

* terralang.org/
skip the first bit go to generative programming and enjoy the ride

why tho?

A lot of the time metaprogramming isn't needed, it's just a way to surpass limitations of the language.

but it is happening now for real

web 3.0 and advanced AI are making most people pretty much useless

>But some stupid boulevard papers and sites who only care for clickbait headings say so!

>advanced AI
The state of AI is nowhere near even slightly advanced. It's the same weak shit as always, and in almost any serious context numerical and statistical methods will kick the shit out of your bespoke RNN which falls into a worthless local maxima if you so much as include one slightly less than stellar piece of training data I am SICK of CIA Niggers pushing these dirty memes into our children

i added a neat tracklist view today

great start to a thursday

Why wouldn't you?
Define true and false yourself is stupid, and nobody wants to type _Bool.

>Define
Defining*

>The state of AI is nowhere near even slightly advanced.
already advanced enough to take over logistics

> CIA Niggers
why would they be interested in causing existential panic in society? you hate them just to hate, you can't even logically articulate it anymore you brainwashed libshit

just use 0 and 1

Is it possible to become a Hacker without python?
Also, what's a good language for triple A games like Call of Duty and stuff?

yes
javascript

Yes
C++

What do I have to learn for my first question then? I don't like Python and other similar stuff, I've tried it.
>javascript
Isn't that for scripting on the web and stuff? Or can it also be used for cool games?
>C++
Are most books on it fine?

>already advanced enough to take over logistics
You're saying that calculating a shortest path is something new? Or were you referring to moving packages though shelves/lanes that are standardized in a few shapes and weights in order for the robots to not crash and burn?

The CoD servers are actually written in Erlang. You should learn that.

autonomously driving trucks and ships on that shortest path is new and will fuck a lot of people

but that's just the beginning

>What do I have to learn for my first question then?
C, then JavaScript, and a reasonable scripting language. Then learn you some network protocols, computer architecture, and basics into software security. All the while, you should be programming for the fun of it. You don't have to create anything interesting, but you should at least be a tinkerer. Fuck with things. If nothing else, hacking is just making something do something it wasn't designed to do, for better or worse, and that's pretty fun. Take shit apart, fuck around.

>Isn't that for scripting on the web and stuff? Or can it also be used for cool games?
It's a general purpose programming language. You can do whatever you want with it. It's primarily used for browser side scripting and some web servers, however. These days, it's like a second franca lingua of programming, so you should know it in addition to C, the original franca lingua.

>Are most books on it fine?
If it's written by Bjarne himself, it's probably fine. I can make no judgments about other books.

None of that is done by AI though, they can only offer assistance (keeping the lane you're in, but only if on a highway, etc.) but are completely useless for replacing humans.

>*mouth frothing*
FIRST FOR... RUST!

RUST RUST RUST RUST RUST RUST RUST URS RUST RUST RUST RUST URS T UR SUT RUST URS RUST URST RUST RUST RUST RUST RUST RUST RUST RUST RUT RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RUST RURS TUR STUR STUR STUR RUST RUST RUST RUST RUST

You okay, user?

it is all AI and it is replacing everything

You seem like one of those "business types" who always going on about "the cloud", "AI", and all of that sort of bullshit without actually understanding what any of it actually is.

no one knows what it is, it just works and getting more powerful

wired.co.uk/gallery/machine-learning-graphcore-pictures-inside-ai

>Reddit fomatting
>Goes on about AI without even knowing anything about it
You're an idiot, and need to go back.

>ignorant of recent progress made in AI field
>resorts to reddit-shaming on a blue board

they probably took your job already

What are you going to do about it?

fuck off back to your shitty "subreddit"

designing fault tolerant protocols is a fucking pain

>no one knows what it is, it just works and is getting more powerful
that's some mystic occultism right there

learn English before posting here, you fucking plebbitor

that's what advanced AI is like, you don't program it, it trains without your input

all the fast food workers like this fag are totally fucked

redpill me on rust

You can't let it get too good, or it will replace humans

Don't fall into the trap. Avoid it like the fucking plague.

C and C++ are NEVER going to fucking die. Anyone who says otherwise is a brianlet and/or a webdev

I don't really see much keeping C++ alive.

Why does Sup Forums hate rust?

>what are video games?

>C and C++ are NEVER going to fucking die

Are you living in the 90's? They have been replaced by other languages. The remaining stubborn 5% will soon die out.

If there's no demand for C++ why the hell would anyone use Rust? Because it forces you to use smart pointers?

If you could replace C++ by being "C++ but not quite so ugly and with some options removed" it would have happened decades ago because everyone and their mother have already tried.

>They have been replaced by other languages
C is nowhere near being replaced.
People have been trying to displace C from its niche for decades, and nobody has even gotten close.

Does your name happen to Pajeet or some derivative thereof?

>not quite so ugly
That goes a long way. Developing in C++ objectively costs too much.

C is one of the best languages to learn if you want to become more than a CRUD developer. It really helps your understanding of computing as a whole.

Granted, but again, it's the first thing anyone ever thinks of and it's been tried a thousand times already. If it was gonna happen surely it would have happened already.

>If it was gonna happen surely it would have happened already.

While you've been in a coma Java took over almost entirely.

Working on a BeautifulSoup website parser and I'm stuck.

Basically if I have a HTML DOM like this:

fizz
buzz


which repeats itself mulitple times and I want to print the content of each individual span, grouped by container, how would I do that?

Java isn't "C++, but..." Java won the industry over with its somewhat-exaggerated claim of "write once, run anywhere."

How do I make a 3d game? Ive got unity, I know c++ but I havent worked with any graphics libraries. Or is unity a bad idea?

It has. Still, the two languages have only been replaced in "mainstream" applications but are still going strong in their respective niches. And that *is* unlikely to change.

Doesn't Unity work with the graphics library for you? If it doesn't, what's the point?

I recommend starting with a Unity tutorial.

>someone figured out how to inject .so into other processes on linux
what a time to be alive, time to port some cheats

> rust-lang.org/en-US/community.html

How can I make this output 5 instead of Friday?
def day_num(d):
days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday',
'Thursday', 'Friday', 'Saturday']
return days[d]

print(day_num("Friday"))

What book is that

print(5)

len(days)

days.index("Friday")

>We are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, disability, ethnicity, religion, or similar personal characteristic.
What did they mean by this?
I mean, are they implying that you can't use some other languages if you're gay or something?
I'm confused.

I'm implementing the file detection part of a thumbnailing library and am having troubles distinguishing WebM and MKV. So WebM is basically a subset of MKV, any WebM is also an MKV and some MKV can be interpreted as WebM?

Working on some c++ black magic...

>2d game using some framework
>black magic
You sure you posted a right screenshot?

Just got through fixing 3000 lines of SQL procedures.

Now I have to use an internal software development tool that runs on Silverlight, and only works on Internet Explorer, to create an application using drag and drop.

...

Such is life on the Microsoft Stack.

WebM uses the exact same container format as MKV. WebM is essentially a subset of MKV that only allows certain video/audio codecs (intended for Web Streaming). I think it might impose other limitations, but either way it's a subset. So if you have and MKV file that contains a video encoded in the correct format (VP8/VP9), then it is a WebM.

That's way too many conditional branches to be honest famalam. I thought C++ was invented to prevent this.

holy fucking shit why are strings so hard in C?

I have been trying to extract links from html files and downloading them holy fuck the amount of shit I'm struggling with

strings are fucking painful

On that topic, what languages are good for this kind of stuff

Getting links from HTML files?

Easiest path would be to just use Python for this, since it has a library that does what you want to do already:

import httplib2
from BeautifulSoup import BeautifulSoup, SoupStrainer

http = httplib2.Http()
status, response = http.request('nytimes.com')

for link in BeautifulSoup(response, parseOnlyThese=SoupStrainer('a')):
if link.has_attr('href'):
print link['href']


Obviously, you can swap the hardcoded url with args[0] instead if you want.

These types of quick small scripts are where Python shines too bro.

You are absolutly right :)... But i got 3 more hours to fix shitty code that has been 'taped with duck tape' for 5 years :| . The whole fucking engine is a piece of black magic. Here is one more masterpiece form same engine :D

Any language made after 1990. Or abandon the built-in strings and google a good string library for C.

Perl shines at parsing strings, but damn is it ugly as sin.

Second question:

Why do people mix languages for example c and python for software?

Aren't you throttling yourself by the slowest language?
Why not just use (for example) python for the whole thing

Edit source in C to make program utilize CPU (Windows, and Linux) resources up to a specific threshold, which is determined by total CPU load (like I want to use a quarter of free resources).

Help, what to read? Like, fundamental/essential reads besides K&R.

rtfm

Sup Sup Forums, I want to read a stream of JSON from a socket in C#, encoded as utf8. How would you go about this? currently it's just a text stream, and I can insert delimiters between them on the sending side.

The JSON data will be on the form
{
"electrodes": [1, 3, 5, 6],
"stimFreq": [100.4, 145.6, 330.8, 54.6]
}
//whatever delimiter I want
{
"electrodes": [1, 3, 5, 6],
"stimFreq": [104.3, 135.6, 333.8, 78.5]
}

C[++] DLLs are often used for heavy-duty complicated tasks because it'll run them fast even if the GUI wrapper that you made in Python is inefficient. The Python code is "bottle-necking" only insomuch as the code is running in Python. Being wrapped in Python won't make the C code run any slower, it'll just take slower to get there.

faster development time
easier to find python programmers

1% of the code does 99% of the work, so it makes sense to only use C when you really need it.

Because the 0.1 seconds slower that small Python script is going to run doesn't matter.

What's going to take time is to get the site downloaded. The somewhat slower speed of the task isn't that relevant.

I mean, consider some inane task:
> FIND ALL THE LINKS ON OUR DOMAIN!
Yeah, you could write that software from scratch, or you could just use wget to grab all the pages, and feed them to a python script (like the one I linked) to get all the links, stuff them in a text file, do the sort | uniq -count trick, and you'd have a text file with all the links on our domain reachable from the root, with the number of times they popped up too.

Time to write that: 5 minutes.
Time to run it: 1-15 minutes depending on how big the site is, how fast the network is, etc.

Now, imagine sitting down and writing all that shit from scratch so that it ran slightly faster.

Would anyone really care that it runs twice as fast when you spent weeks building it? No.

Read the char-stream, tokenize until you have a complete JSON-object, and pass the whole object on down the pipeline?

It'll save the programming world... if anybody used it.