/dpt/ - daily programming thread

what are you writing?

previous

Other urls found in this thread:

github.com/enfiskutensykkel/cuda-rdma-bench-advanced
developer.apple.com/reference/healthkit/1627060-healthkit_constants/1665100-category_type_identifiers
superuser.com/questions/127863/manually-closing-a-port-from-commandline#127865
better-dpt-roll.github.io/
dispatch.databinder.net/Dispatch.html
developer.mozilla.org/en-US/docs/Web/API/OscillatorNode
isocpp.org/blog/2016/09/announcing-diversity-tickets-for-meeting-cpp-2016
ideone.com/LRaAB5
diversitytickets.org/events/46
youtube.com/watch?v=lIFE7h3m40U
stackoverflow.com/questions/1012573/getting-started-with-haskell
github.com/NICTA/course
seas.upenn.edu/~cis194/fall16/
pastebin.com/cBMFdTHy
cplusplus.com/reference/cstdio/scanf/
cplusplus.com/reference/cstdio/printf/
reddit.com/user/CompileBot
pastebin.com/amaqBTp4
tour.dlang.org/
rust-lang.org
quora.com/Which-language-has-the-brightest-future-in-replacement-of-C-between-D-Go-and-Rust-And-Why/answer/Andrei-Alexandrescu
hacklang.org/
github.com/rust-lang/rust-mode
github.com/racer-rust/emacs-racer
github.com/flycheck/flycheck-rust
twitter.com/NSFWRedditVideo

A reply to this thread

>javascript talk in my city has reached its limit of 160 signups
this has gotten out of control

I broke my avr project once again.
And I don't even have an oscilloscope to check where exactly it hangs.

Working on my image handling library for Rust, writing documentation and tightening the API, and improving performance where I find issues.

#define/**/install/**/0[x]=045;p(j);p(k);for(;;){++l;m++;++q;r++;
#define gentoo if((l-44)){p(l);p(l);break;}}m|=3;q^=27;p(m); \
r+=6;t>>=2;t+=7;p(t);p(q);p(m);p(r);p(l) ;p(s); t++;p(t) ;p(10);}
#define/**/i/**Cred Forums*Cred Forums Cred Forums /c/ /d/ /e/ /f/ Cred Forums /gif/ /h/ /hr/*/
#define/**/c/* */char/*/k/ /m/ /o/ /p/ /r/ /s/ /t/ /u/ Cred Forums /vg/*/
#define/**/Anonymous/**/1[x] b-1;i Thu b;j+=4;k++;i a=// /vr/ /w/
#define/* *Cred Forums* */=0144/* /wg/ /i/ /ic/ /r9k/ /s4s/ /cm/ /hm/ */
c x[2];i j b,No b,k b,l b,m b,q b,r b,s b,t b;main(){ //lgbt/ /y/
#define p(o) printf(x, o) //3/ /aco/ /adv/ /an/ /asp/ /biz/ /cgl/


Anonymous 07/07/16*(Thu)*11;25;11*No*55458155;

install gentoo

Wrote hello world in C.

>what are you writing?
Time for pancakes

>/dpt/ frequenters will get this

github.com/enfiskutensykkel/cuda-rdma-bench-advanced

Some minor features left to implement and of course a README that makes sense, but would say around 95% done.

I want to learn Haskell because I found the name cute, where should I start?

I know C and a little bit of Phyton

>you will never have three programming languages named after you

Nice, what's its name?

Anyone know how to send raw HID stuff in windows like HIDraw on linux?

Fucking piece of shit windows validates the hid packets with the HID descriptor before sending them so I can't send anything that's not in the HID descriptor.

picto

Is this very unstable to add to repo?

#[testing]
#Include = /etc/pacman.d/mirrorlist

Did you try with hidapi?

a micro ethernet/ip stack

What is he doing?

Yes, it uses the normal windows HID api so there wasn't any difference.

I guess you're fucked then, you'd probably need a custom driver like the libusb one.

Doing the toot

toying around with algorithms in go to prepare for interviews
alternately boring and frustrating. fun every once and a while

>pick up algorithms book
>it's all math
>even the psuedocode is next to useless because it's so far removed from any programming language that they force you to learn THEIR syntax

Wikipedia is so much better for learning algos, they even keep their examples in C.

you need to be able to read math if you consider yourself a computer scientist and not just a koder

someone post kode with karlie pictures i'm on a new pc and i dont have any

It's not even math math, it's all weird symbols and they spend more time obsessing over the big O rating rather than the implementation

what is there to understand in big o?
Either your runtime grows with it's input size in a predictable way or it doesn't.

this is the kind of computer science book i like. i'm evangelizing kleinberg-tardos for this reason
but if you don't, you should look at sedgewick's algorithms in {c, c++, java}
still, it's going to be hard to analyze any of this if you don't like math somewhat

Memes aside, is python a good place to start with programming?

Since my city has a large video game Industry I plan on taking a job in that field, what would be the best languages to learn in order to better my chances?

In my opinion learn C and then C++
Interpreted languages are next to useless for game dev.

>muh gaymes
Python is an ok language to start with. It's easy and you can do small things quickly with it. However, you want to be one of the retard clique, so you'll want a strongly-typed language instead. Pick up C++ for gamedev.

>It's not even math math, it's all weird symbols
those weird symbols are math. everyone can read x = 2
>Either your runtime grows with it's input size in a predictable way or it doesn't.
if the size of your input is n and the time it takes for the answer to be computed is t, t = 2n grows with input size predictably just like t = 2^n. do you understand why those 2 orders of growth are different? plug in 500 for n on both of them in a calculator

I fixed it. Partially.
Cool.

MS-DOS Simulator for university
C++

I'm working on something in Python and Django. I'm thinking about using Angular 2 for my frontend. Has anyone whom has used Angular 1.x fucked with it? Typescript seems okay, and version 2 just came out, but it seems newfangled and tedious.

Yes.

C++, XML, at least some HTML. Possibly Lua. Do your research.

assuming you're a college csci student also go ahead and start learning greek letters, capital and lowercase. put all the symbols you see and you don't know on flashcards and memorize them

Yesterday user gave me a tip if you search 'metronome' google would give you a web app metronome. Pretty neat, but i want to learn how to build one myself so i tried to look at how it's done. This turned out to be more difficult than i'd hoped. Of course the code is near impenetrable, but i can't even save it offline and have it work, which makes revers engineering it almost impossible for me.

Can anyone offer any help or insight or tips into this problem?

This is a longshot, i know, but one can always ask. I'm also going to post this in the web dev general to see if anyone there might have any help to offer.

>Memes aside, is python a good place to start with programming?
The memes originated from truth. Python is a poor man's language.

>your api can't even get interMenstraulBleeding anaylitics.

What's your excuse android ""devs""?

developer.apple.com/reference/healthkit/1627060-healthkit_constants/1665100-category_type_identifiers

who is

>she

Is it reasonable to write a web API in C++, or should I just use Python? I don't need high performance, I just want something that just werks.

it's pyo hyemi

you really don't need flashcards to learn greek letters that's the most autistic thing I've ever heard

akariboobs user is doing it in c, iirc

go to google.com and click view page source

they obfuscate their code to the point where you just can't use it, you're better off starting from scratch

Do you mean the Akari avatarfag?

Learning Android

and

Learning how Perlin (Simplex) Noise works. Doing some experiences on Javascript+Canvas.

This weeks lesson is in debugging shit code
something im actually decent at.

>write a web API in C++
Why reinvent the wheel? Look up Wt, PoCo, ffead, Tntnet (might be outdated).

You sleep and play a sound on a loop. The only difficult part should be calculating how long to sleep, as you have to take into account the length of the soundbyte file. But honestly, it's just basic math, a slider, and playing audio. What aren't you getting?

He's the best user in this thread

Javascript. onTimeout function to implement a loop (update, like in games). Beep every X seconds. Voilá, a metronome.

Python is good to learn and good language because it's easy and fast to write programs in.
Execution speed doesn't matter because Moore's law and JIT. Type checking is for people who need hand held to write a safe program.

He is indeed, even though I dislike avatarfagging. He suggested composingprograms.com (no shilling intended) which I'm currently reading. It's a really good read.

>cant even remember ternary operators

is there any hope for me as a programmer

I didn't even know them by name, but I use them consistently. Don't worry, a year ago didn't remember them either.

I didn't plan on reinventing the wheel. Their implementations are light years ahead of what I can produce in a short period of time.
I'm just looking for something that allows me to easily write a web API.

Thanks for the hope user

suit yourself. you could spend 2 hours learning them and know them for life or not, up to you

>go to google.com and click view page source
Obviously, that's what i did. I was going to do it from scratch, but i thought i might learn some tricks by looking at how they have done it.

The thing i'm having trouble getting is how to play the sound, but mostly how to generate the sound to play.

im writing a basic tcp file transfer program but have ran into a bit of an issue

the program asks for a port to use, but if you ctrl+z/(exit out of terminal) without going through the programs "exit" function (which flushes/closes the socket), the port is unusable until i turn restart the internet/my computer. the port is still being used even if the program is long exited, assuming since it never flushes/closes

can anyone think of a way to not have that be so cumbersome

No, what I mean is go to google.com (click the link if that's too hard) and then when you're on the front page, look at the source code.

I need to develop a quick GUI in Python.
So, i tried but it took so effort in GTK.
Then I've discovered Glade, work well.
Is there some layout/container with fixed positions?
Can i have two or more container in the same window?

You can kill the process holding the socket: superuser.com/questions/127863/manually-closing-a-port-from-commandline#127865
What you described is normal behavior for any program killed that way.

Yes. That's what i did.

Can somebody please post some of those programming challenges pics? Just started programming and need more practice, but can't find those pics like at all. Thanks.

Not sure which language and library you're using, but in case you're dealing with BSD sockets you could try setsockopt with SO_REUSEADDR and/or SO_REUSEPORT. You could also try catching signals using signal.h, but I have no exact knowledge of how that works.

better-dpt-roll.github.io/

I thought you said you looked at the source code for the metronome, which is something else. My bad then, not sure what you're gonna reverse engineer on the front page though.

How much texture can I load in a 512mb or 1024mb video card?
I'm not talking about the max texture size, I'm talking about the total size of all the textures currently loaded in vram.

im using Throws Exception and Catch Exception, but its not catching NumberFormatExceptions

i was under the impression that "Exception" was the highest you could go so it would catch anything, is that wrong?

I tried to look at the source code for the metronome, but i couldn't even find that. I had to begin somewhere, so i looked at the web page source code.

Stop worrying about what other people do and just build it yourself.
Your solution will probably be much simpler than their JS-framework laden mess.

I started with C, 3 weeks later moved to C++ and had a glance for month or so with Java and C#, returned to C++ for good 6 or so months, started to develop stuff for uni with OpenCV and C++, heard about the Python meme stuff, tried it, actually wrote web spider for less than 20 minutes from scratch, and better it for no more than another 20 with some libraries.

Now doing OpenCV and CV in general with Python only.

>Point is, learn C and/or C++ for the general purpose language and OOP
>Learn them well, so you can appreciate higher abstract language later on
>Learn them well, so you can debug, improve, optimize your code down the line
>Once you do that, you can pick any higher language and actually start to build useful stuff x10+ times more faster and efficient than before

Also, you can use Python for C++ wrapper, which is really nice.

>tl;dr learn this:
>Fundamentals of C
>C++ and OOP + multi threading
>Python

In this particular order.

> just build it yourself.
Yeah, i'm in the process of figuring out the web audio API. But i'm kind of a noob, if that wasn't obvious, so it's been slow going.

NumberFormatException extends RuntimeException which extends Exception which implements Throwable.
You fucked up somewhere. Post code.

cute as heck phamalam

>websocket server
>200-400 MB RAM on moderate load
>refactor synchronisation algorithm to client-side
>25 MB
This is the best feeling.

Gonna make a personal blogsite and going to build the backend with a microservice architecture. Each microservice is going to do something different (for example ones going to serve up data using a service writtein inn C#, and another is going to be written in node). Like I'll have a cooking section, blog section, pictures section.

Mostly for practice and getting dank jobs in the future

As long as you remember that you've just pawned off the workload to someone else, not done some brilliant feat of optimization.

Then again, you could also say is what you've done is distributed computing, which makes it sound a lot nicer.

rip client

I always feel like a retard when trying to use new libraries.
>dispatch.databinder.net/Dispatch.html
>We’ll start with a very simple request.
>Can't get it to work
T-thanks

>Execution speed doesn't matter because Moore's law and JIT. Type checking is for people who need hand held to write a safe program.

It is not actually a high CPU or RAM usage operation, but a matter of state synchronization. I have a database with a guaranteed consistent state. On page load a client sends a request to the backend and receives a snapshot of this state. Then it opens a websocket connection to the server, which opens a change feed on the database (if one is not open already) and passes these state-altering messages to any listening clients. This is where the problem arises. What if any state change happened in the interval between the initial state fetch and connection to the change feed? Or what if a client disconnects and needs to catch up to the server's state?

My original solution was to keep the entire replication log buffered in the server's memory, so it can quickly resolve any of the connecting client's missing messages before subscribing the client and send the missing ones before any new messages are sent. Of course when you have a replication log of potentially several hundred thousand messages, it can lead to quite a lot of RAM.

So instead of blocking the change feed on the client, I refactored to have the server send out the current progress counter to the client on subscribtion. The client then compares this counter to the one it gained during the initial state fetch and checks, if any messages are missing. If there are any, it will block any new received messages from being handled by buffering them and request from the server a specific slice of the replication log, that it needs. When all the missed messages are handled, it can handle all the buffered messages and then just listen for new ones like normal.

So it's not at all an offload of a CPU or RAM bottleneck, but of the blocking elements of the synchronisation algorithm. Networking is fun.

developer.mozilla.org/en-US/docs/Web/API/OscillatorNode

What's an 'interface' in JavaScript.
JS doesn't have classes per se, so it's not like Javas interfaces or sepples pure virtuals, is it?

sounds elegant

Does it really matter what it's called?

"interface" here refers to the statically typed API the browser implements.

>statically typed API
I don't know what this means.

The browser isn't written in JS. So it needs to define a static way for JS to communicate with the relevant parts of the browser aka interface.

I have a couple C projects I'm working on.

1. I'm writing a C program that requests the name of any cartoon character from the user, then does the following with that name (use printf for each):

a. Displays it enclosed in double quotes.

b. Displays it in a field 24 characters wide, with the whole field in quotes and name at the right end of the field.

2. I'm also writing a C program that requests from the user the number of miles traveled and the number of gallons of gasoline consumed. It should then calculate and display miles-per-gallon, showing one place to the right of the decimal.

Any help would be nice.

interface vs abstract classes

whats the difference???

>The browser isn't written in JS

Yet

An abstract class has some definitions.

I'm not doing your homework?

AudioContext.createOscillator(), for instance, returns and object that conforms to the interface OscilatorNode?

An 'interface' is the same as what i would call a 'class' in c++?

Do you literally fucking not know what an interface is in any fucking language?

what is your problem with games?
is it useful to make you feel like a srs person and stop thinking about your permavirgin status?

You have to be 18+ to post on Cred Forums

whats the point of oop when it just makes everything slower

I thought i did. Since you're asking so nicely, maybe i don't.

great argument mr srs man

>It makes code reusable.

ayy senpaitachi, any of you had a paid programming job while at uni? im bored as fuck with uni and i want to do some actual programming in an actual company

It's not homework.

so does copy and paste

makes things easier to make

nigga u dumb

There are rare cases where doing things with objects (in the conceptual sense - things that can send and receive messages) is clearest.

Standard implementations of OOP all suck and 99% of OOP code sucks. But it's not entirely useless.

There's a lot of things that make code reusable.

This boy needs to get himself a pair of real trousers, a pair of proper shoes, and grow a bear, and he'd look a proper distinguished gentleman instead of a 'tard.

nigga u dumb

it couldn't more obviously be homework, or some arbitrary task given to you at the very least.

nigga u dumb

it's obviously homework mate

see copy and paste works

Maybe it's self assigned?

Although the way it's specified, i kind of doubt it in this case.

I'm self-studying C and I read the chapter but I'm stuck on these exercises.

Please don't say something discouraging. I'm trying to learn the language.

>grow a bear
While impressive, I'm not so sure that'd make him "gentlemanly".

kek

I wrote a random image generator, but it segfaults when the height and width are less than 211.

It would certainly make him some kind of manly.

if (height < 211 && width < 211){
// TODO: add kludge
}

Oh I wasn't looking for help I was just posting what I was doing, thanks though

That was a joke.

You should be finding the root cause, not adding a kludge.

i don't care if it's homework, but i think you should consider how you would ask a friend (lol) in person about this
the first thing your friend is going to ask is what you've done so far. do you know how to read in a string from the user? can you then print it out?

I used gdb and when I use anything less than 211 it says that memcpy.s is missing.

Here you go mate, I went ahead and implemented number two for you. Let me know if you have any questions :)

#include
#include
#define _ float /* ____(______) #sprintf("%d", _______) */
#define __(____) atof(____) /* return (double)__________ */
_ ___(_ ____, _ _____){return ____/_____;}
____(char *p){int i;for(i=0;i

...

I'm using Box2D and LiquidFun.

I get a java.lang.NullPointException at the line
mParticleDebugRenderer.render(mParticleSystem, LibPractice.PPM, cameraCombined);

Does anyone know what's wrong?
Everything that's normally in a box2D render method is in another class.

No idea what the problem is.

If I remove the problem line, it compiles fine.

it's so fast how did you do this

Yes. Learn Python. Python is a great place to start with programming. It's more important that you learn how to program than it is to learn the ins and outs of C and C++, which have become very specialized languages (i.e. performance-critical applications). Python lets you learn how to do neat things with programming relatively easily, since it has a HUGE standard library. You can even write games in it. You can always learn C and C++ later.

Also, just so you know, I'm fluent in Python, C, C++, and Haskell, and have played around in a bunch of other languages too, so I know more-or-less what I'm talking about.

Another thing: if anyone on here tells you that Python is too easy, or babby's first programming language, understand that it's not the syntax or concepts of a language that should be hard, but the design of the application and the abstractions used. Only go for the harder-to-use tool if you really need that extra performance in exchange for spending 10 times as long building the application.

How did you learned Haskell? I'm looking for some tips

what does this actually do though? not the guy but I'm wondering cause I see people post these all the time but I'm too lazy to check it out in a VM

Sorry bro but I know you're shitting me. Most of that has not been brought up at this point.

Compile it, you mongs. The code works. You can see that the only library functions used are printf and atof. What do you think is going to happen, your computer is going to blow up?

pls no
isocpp.org/blog/2016/09/announcing-diversity-tickets-for-meeting-cpp-2016

nah im good mate

anyone?

lyah

so /dpt/, do you call it a bodge? a kludge? a "hack"?

how do i make an assert statement in javascript?

Nice. Finally I can get something worthwhile out of my trap attire.

>since it has a HUGE standard library.
I kind of feel this is the reason DOESN'T let you learn how program.
You don't really learn if it's all been done for you. At least i don't.

Protip: You can't.

> C programming

How do I modify a global variable from within a loop.
I want my loop to swapsmade++ but it says its undefined despite been declared outside the loop

Did you remember to initialize it?

Yes, it is initialized outside, int swapsmade=0

a kludge is a stupid ugly solution to a problem.
a hack is an ingenious elegant solution to a problem, utilizing a resource or construct in a manner it was not intended to be used, and is likely to come back and bite you in the ass later.
never heard of a bodge, but it sounds like botch, which is a failed attempt to solve a problem.

Those are different things.

A hack is a unique, but potentially elegant workaround.

A kludge is a workaround with few redeeming qualities, other than the fact that it fixes a very specific case (often by simply preventing the case from occuring).

post code
#include

int swapmade = 0;

int main(void)
{
int i;
for (i = 0; i < 100; i++) {
swapmade++;
}
printf("%d\n", swapmade);
return 0;
}
ideone.com/LRaAB5 works fine

Post code

>diversitytickets.org/events/46
i do enjoy seeing a code of conduct near the top of every programming site where once there might have been useful information

Hack:
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;

x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed

return y;
}

Kludge:
if (userid == 69) { //man I dunno DB is corrupted on this guy or something
return;
}

Bodge:
Fuck if I know. Made up bullshit.

WTF, are u trolling us? Read something about "scope".

youtube.com/watch?v=lIFE7h3m40U

excuse me? that code's exactly what the guy wanted to do

>the marker will recognize someone else wrote this, please re-do my assignment

he probably wrote it in another language that compiled to C in a very optimized way

how do you not feel embarrassed asking something like this when you can google it in 5 seconds, this is the most basic something can get

shine on you crazy diamond

Anyone?

#include
int main(void)
{
char ch;

printf("Please enter your favorite cartoon character. \n");
scanf(&ch);
printf("Your favorite cartoon character is &ch")

return 0 ;
}

Am I doing it right?

Holy fucking shit.

My code compiles, and I'm actually competent at OOP.

:')

Buster Baxter

>Am I doing it right?
Let me answer your question with a question: does it compile?

The answer to both questions is no.

stackoverflow.com/questions/1012573/getting-started-with-haskell

github.com/NICTA/course

seas.upenn.edu/~cis194/fall16/

Sure. Post proof.

>Am I doing it right?
Why don't you compile and round your code, and find out?

/dpt/ is not your personal compiler

Welp, looks like school is back in session.

I like this book

It's good for learning general program construction, not so much for learning algorithms, parsers, etc.

I've never met anyone who's competent at OOP. The moment you start to be competent make you start breaking out of objectthink.

hahahaha

>It's good for learning general program construction
So is C.

>just finished my entire weeks worth of course work in 5 hours

thank you guys

this
pastebin.com/cBMFdTHy
Started learning recently and its been really fun

Opinions and maybe some tips on Java from long time programmers?
Also if (you) could suggest any books that you found useful for it.

Kurwa

Sure, but it's way easier for newbies to not have to think about pointers, memory management, etc while learning about basic constructs like variables, loops, conditionals, etc. That extra knowledge can always be layered on top after a base is built. Especially for people that don't already have the "programming" mindset.

>char ch;
This is a single character, like 'A' or '2' (not "character" as in "cartoon character"). Your favourite's name is probably longer than one letter.

>scanf(&ch);
Read how scanf works:
cplusplus.com/reference/cstdio/scanf/

You also probably don't want to use scanf for this since a name could easily have whitespace characters in it ("Spongebob Squarepants") and scanf'ing a string will stop at the first whitespace character. But if that's all you've learned, they might just expect you to only use simple names for this assignment.

>printf("Your favorite cartoon character is &ch")
Also read how printf works:
cplusplus.com/reference/cstdio/printf/

You will never be employed as a programmer, unless you're a woman and claim sexual harassment against every manager who questions your competence. If you're looking for a role model in that regard, feel free to look up Zoe Quinn.

What's the best free (preferably open source) PHP server?

Can we just stop using the term "OOP"? Either it means using objects everywhere, in which case it's obviously stupid, or it just means using objects. Objects are a tool to be used when appropriate (which is to say rarely) so the existence of the term "OOP" is either redundant or simply wrong.

Intro to Databases course detected.
Oh wait, no, that would be the ENTIRE courses lab work in 5 hours.

I appreciate you correcting me where I went wrong. Thanks user.

any favorite books on operating systems or networking?

Just took down an entire chan

whoops

But you don't. You learn the basic constructs first, just like any other language, and then you learn pointers and memory management.

>That extra knowledge can always be layered on top after a base is built.
That's what i'm saying.

Why is almost everyone in this industry so fucking narcissistic?

E M T
M
T

The only language that I really like is C.
Am I fucked /dpt/? People say that you need to master at least 5 to become a "good" programmer.

...

autism

only when they are behind a computer screen

Not as long as you make an effort to actually branch out.

just be one of the pasty 40 year old white guys who gets put in a hidden shed at tech startups

>diversitytickets.org/events/46
>Proudly built by RubyMonstas

If you know C, you pretty much know C++
if you know C++, you pretty much know the syntax for java & c#
if you know java, you can pretty much figure out how javascript works in a few weeks maybe

are there any good, free php servers?

have you tried static global variable?
I'm not a C guru but I remember that a static global variable retains its changed value

otherwise you could use a pointer which is probably the best choice

>If you know C, you pretty much know C++
No.

>tfw you put subtle references of your waifu in your code

is there a better feeling than this /dpt/? especially when companies/people use your stuff

>If you know C, you pretty much know C++
You got it the wrong way round.

yes

>is there a better feeling than this /dpt/?
having friends

This gave me an idea.
What if I wrote an extension that executed code in a post with inputs being replies to that post. Anyone have any idea what the language should be?

Actually, after posting, I think I'll make it a Lisp. It would be a good opportunity to learn Lisp, and introduce others to functional languages.

already been done

reddit.com/user/CompileBot

It's extremely easy to get attention based on how much you shill your work. It's probably the easiest industry to see the Peter Principle hard at work. It's also an industry that for all its resources still doesn't have enough people who know how to effectively teach others, so it's also easy to become a "guru" which plays into everything mentioned previously.

To be fair, it's most apparent with languages that are heavily associated with the web (JS, Ruby, Python) and SO. It's not too prevalent in academia, moreso in the workplace and that's only because of how many people make up the workforce in comparison to academia.

Tiro finale!~

>redhead
>japanese
sure

but user how will it deal with users too retarded to put code blocks around their code

Wow, I guess I'll look for something that's never been done yet.

how did both of you take this bait when the last line of his post is literally
>if you know java, you can pretty much figure out how javascript works in a few weeks maybe

that's the idea

it's called reinventing the wheel for a reason

It only accepts code blocks obviously
Maybe it should be:
#!/bin/whatever-the-fuck
Code goes here

>used to see anti-OOP fanatics on /dpt/
>thought they were just stupid and dismissed them
>started using a non-OOP lang
>mfw

Compiler error. Didn't get past the first error.

In this moment, I am euphoric. Not because of any phony god’s blessing. But because, I am enlightened by my intelligence.

I'm not really anti-OOP. Most pro-OOP people will agree that "OOP is a tool to be used when appropriate and most people just use it inappropriately" when you point out that most OOP code is garbage. It's hard to be against that. That said, it takes some experience using a language with very little support for OOP to realize that, while OOP is usually not the right way to go, there are cases where it's nice.

Dream of one day being this guy

shit-tier compiler

yo quiero aprender c pero el syntax no esta en espanol
porfavor, como cambia el syntax a espanol

no quiero estar escribiendo "printf" o "for"
es mejor "ponerf" y "por"

...

Would this
pastebin.com/amaqBTp4
be an example of over-use of inheritance and a good use of polymorphism? Worth noting multiple things inherit from DataBaseValue, International, and Intellectual.
I've never really used Inheritance extensively before, because of all the hate surrounding it.

#define PRINTEARF(argumentos) printf(argumentos)
No estoy seguro si esta correcto.

This, really.

you doxxed yourself

Aprende ingles puta :DDDD

Cant get my head around bubble sort in C.

Why is a second for loop added with j ?
why isnt one enough ?
Also, after it reaches the last element in the array, how does it go back to the start and start sorting again for a second pass through ?

I don't really care if my name is posted on 4chin, it's not like I'm a trip
Also googling that name just pulls up some actor, so I think I'm good anyway

This

That said, I am very strongly anti-"picking one or two tools and only using them religiously". If your personal interpretation of OOP means "my only unit of abstraction is the object as defined by Java" (which is definitely the majority interpretation of OOP) then you can go fuck yourself.

tämä on Englanti puhuva board

Terveisin,
GTPq

oho

the first 2 entries are your facebook and your home address lol

I suggest you read more about bubble sort

Multiparadigm language or bust. A mix of imperative, OOP and functional-ish, where appropriate is best.

ebin hahaha :DDDDDD

What programming language should I learn if I want to hack the FBI?

Try duckduckgo

I have just the language
tour.dlang.org/

Haskell

Torilla tavataan :DDDDD

Yup, this is why I'm enjoying learning Swift.

In my course, when can use Microsoft Excel or R (programming language) to plot data.

which one should i use?

rust-lang.org

fixed it 4 u

fugg benis :DDDDD

Binary

This code compiles:
void kek() { return (void)"wat"; }

I want to learn Go. Give me some good reasons to learn the language.

Why don't you just give it a go

My first result is Michael Cudlitz's wikipedia page and there's a facebook page for the name farther down
's not like it matters, my facebook doesn't crop up until several pages later


At any rate, how does that code look? Is that a good structure for a DB entry? that DataBaseValue object exists on a DataBaseEntry object that contains the entry, a unique ID, and an identifier for the type.

Can you give an example of a language that actually does this?

Do you need some pre-programing learning?
I don't know what a compiler is. should I learn some basics first instead of pickin a book and going to the terminal?

it's literal trash

what functional programming language has good tooling?

True enough.

A compiler compiles itself.

>Can you give an example of a language that actually does this?
Also any ML or Lisp.

Haskell is close but it doesn't take the right approach to purity IMO (which is linear types).

Rust be all like "look, I'm different so I must be special right?"
D be all like "here's everything you're used to but better"

This was a good read:
quora.com/Which-language-has-the-brightest-future-in-replacement-of-C-between-D-Go-and-Rust-And-Why/answer/Andrei-Alexandrescu

hello Max-mason Cudlitz
Age: 20
Address: 4221 Allott Ave
91423-4303

CA, Sherman Oaks

Phone: (818) 398-7741

There have already been a few examples posted in replies.

I'm having a go at possible interfaces for my replacement of c++ standard library. I hate STL with passion and don't want to use it with any of my future projects.

Also fuck RTTI and exceptions, write C with classes!

>Rust be all like "look, I'm different so I must be special right?"
Rust isn't different for the sake of being different, it's different because it understands that the conventional way of doing things sucks in many areas.

>it doesn't print fizzbuzz
Confirmed, Cred Forums can't do fizzbuz.

LITERALLY
STOP
POSTING
THESE
QUESTIONS
IN
DPT

HOLY SHIT SOMEONE ASKS THIS IN LITERALLY EVERY THREAD AND EVERY TIME EVERYONE REPLIES AND STARTS A SHITSTORM
dpt is so shit

why even use c++ at that point?

Though it does take some direction from its influences -- for instance, its insane level of verbosity is clearly an homage to C++.

hacklang.org/
>NSA with LOVE

>insane level of verbosity
Like?

Have you tried Go? No exceptions there.

Have you ever seen a Rust program?

Is everyone here just stupid or have none of you actually tried Rust and formed objective opinions about it?
I don't really think Rust is going to be a successful language but it doesn't have verbosity even close to C++, and it certainly isn't doing things different just for the sake of being different.

Yes.

You don't need to know the basic-basics of how things work at a low level, to start, but general knowledge is good. Essentially a compiler is what takes your code and turns it into a runnable format (for an example, an executable binary on Windows, a program in Linux, a .jar file for Java, or any other number of formats that you can run)
Some languages don't need to compile, and can just be run using their interpreter (This is actually sort of what Java and several other languages do, even though they're compiled they're just compiled into different code that's able to be interpreted by their interpreter, which is why you need Java to run .jar files)

I'd recommend starting with C# if you're just starting programming, it's not too difficult to get into and it's relevant.

Why do you want to learn go?

#include

int main()
{
int x=0;
std::cout

> tries to be different in a good way
> still uses as type annotations containers

>bikeshedding

Alright, truthfully, I'm just memeing. I just think the safety requirements are excessive for most requirements. It requires a more thoughtful design process that I'm not a fan of.

thanks, I was thinking on C -> python

>It requires a more thoughtful design process that I'm not a fan of.
B-but type systems hold your hand! Only shitty programmers like strong static typing!

Is the Haskell meme past its peak or still rising ?

Do you want to write a server, daemon or CLI tool? Learn Go. That's the language's niche and it's pretty good at it.

it won't compile if your program would have done something you wouldn't want (memory leaks, dangling pointers, data races, the list goes on)

what's excessive about that?

Read the thread + Go, JavaScript, Rust.

binary size, speed and I like to have some oop features while writing for embedded

no templates either and that's a big thing for me

It also won't compile if you try to do something that works in every other language under the Sun. The borrow checker is giving me an ulcer.

What compiled the first compiler ?

go away datafag

You need to learn how to structure code so that the borrow checker doesn't end up being too conservative. It's not hard, it's just a completely new concept. The only people who complain about having to work against the borrow checker are people who can't be bothered to actually try to understand it.

Me

Someone wrote it in assembly.

this. once you get it into your brain-compiler, it's smooth sailing. it should take less than an hour or two for someone who isn't retarded

And how did guys who wrote google search for their problems if there was no google???

>The only people who complain about having to work against the borrow checker are people who can't be bothered to actually try to understand it.

It definitely requires a conscious effort, though. Unless you started on Rust, it's just not something that's ingrained in your programming psyche, so to speak.

If I made a better effort to understand, it probably wouldn't be as bad, but learning is for nerds.

What kind of projects are you guys working on in Rust?

>OscillatorNode method: start()
>Schedules a sound to playback at an exact time. start may only be called one time and must be called before stop is called or an InvalidStateError exception MUST be thrown.

So every time i want to start and stop playback i have to create a new oscillator object?
What the hell? Why?

you are shit for not knowing the standard

>I just think the safety requirements are excessive for most requirements.
I think that this is true, but more importantly because there are few applications of a fast systems programming language that doesn't routinely need to do questionable operations that Rust rejects.
If you want a high level language, a GC is actually *not that bad*!! If you know anything about generational GC you'd know that GC can actually speed up other aspects of a program's performance, of course at the cost of the collection phase.
Rust just isn't worth it and nobody wants to learn it because it's too complicated.

There are a fuckton of magic objects in the standard library (like Cells and Box's and Vec's) that have to be safely implemented in order make most programs even possible. And then the programmer has to learn all of their concepts. The borrow checker itself is pretty simple but the infrastructure that you need to learn to make things useful around it is cumbersome.
High level languages should ideally be able telling the compiler "what" to do rather than "how", and Rust's borrow checker takes a step backwards (albiet not as far as C)

Python is awesome.

i'm writing a game.

2k LoC right now. in C++ at this point i would be pulling my hair out. in Rust i have no such issues. it's still as great as day one

No.
No.

I know exactly why it's doing that, get out of here with your b8

>there are few applications of a fast systems programming language that doesn't routinely need to do questionable operations that Rust rejects.
Just because you need to dip into "unsafe" a few times doesn't mean you've completely undermined the reason for Rust to exist. If 90% of your code is "safe", only that remaining 10% (including the use of unsafe blocks themselves) can ever cause a memory error. That's a massive gain.

>There are a fuckton of magic objects in the standard library (like Cells and Box's and Vec's) that have to be safely implemented in order make most programs even possible.

You said it better than I did. That's what I was thinking about when I was formulating my original post.

Argument evaluation order in C and C++ is unspecified for some godawful reason.
Usually it's in reverse, which is counterintuitive on its own, but technically it could be in a fucking spiral pattern if C++ wanted to fuck you up.

Interfaces can approximate the functionality of C++'s function templates. This is how they implement sorting for arbitrary types. Any type that has these three methods can be sorted with the standard library's sorting function.

type Sorter interface {
Len() int
Less(i, j int) bool
Swap(i, j int)
}

Alright smarty pants. Why is it doing this
#include

int main()
{
int x=0;
std::cout

yes

Dude wtf I thought I was the only hyemi fanboy in the world

And yet the Rust devs have cautioned against people describing their projects as x% safe/unsafe, or 'only x SLoC unsafe!'

Nah.

Just published 0.2 of my image handling library on crates.io, now I can go back to do whatever I was doing before.

I think it was an X11 window manager or something.

I'll probably do a clean up pass on some of my old projects.

Because it doesn't matter to anybody but a contributor. Unsafe code is not an excuse to say that memory errors might happen, it's programmers taking responsibility to ensure that they don't rather than being able to simply assume that they won't.

what is so cumbersome about the borrow checker?

as many immutable borrows as you want at the same time

only one mutable borrow at a time, and no mutable + immutable at the same time.

sometimes you may need to specify a reference's lifetime in relation to something else (most of the time "this reference lives as long as that reference")

you just learned rust! good job

interfaces are significantly less powerful than parametric polymorphism

yah

here's lesson number 2 - ownership:

foo // moved
&foo // immutable borrow
&mut foo // mutable borrow

you're a rust grandmaster now

Nope.

Did you not read my post? I said that the borrow checker itself is simple
Try to implement a runtime GC for an interpreted language in Rust and then tell me if the borrow checker is cumbersome.

...which are technically a subset of dependent types

yep

But in Rust you don't tell the compiler the "how", it tells the compiler the "who".

...

Only Rust developers use Rust software, so I don't find that argument compelling.

Nein.

>It is often said that AudioBufferSourceNodes have to be used in a "fire and forget" fashion: once it has been started, all references to the node can be dropped, and it will be garbage-collected automatically.

This is wreaking havoc on my mental model of the audio routing graph. Graphs should not change shape several times a second.

Borrowing "too much" is probably the biggest cause for grief. It would be nice to be able to write foo.x and foo.y and have the borrow checker track the fields separately, but as it is you have to destructure before borrowing manually.

The user of a library, given a safe API, should be able to assume that the library has been implemented correctly. Whether it uses any unsafe code at all is only important to somebody who is trying to track down and fix a bug in that library, if it's implemented incorrectly.

Is there a good Rust IDE now?

yes, emacs - syntax highlighting, auto-completion, on the fly error checking with underlines, etc

or you can use atom and a plugin

or intellij plugin

or visual studio plugin

i thought atom was a bad meme

It's a decent Free editor imo.

It is. Lel type polymorphic CoffeeScript.

I tried the IntelliJ plugin a while ago and it was hot wet garbage.

you can always use vim + youcompleteme

New thread:

I prefer emacs.

github.com/rust-lang/rust-mode
github.com/racer-rust/emacs-racer
github.com/flycheck/flycheck-rust

or if you're using spacemacs just add the `rust` layer to the layer list