/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

lmgtfy.com/?s=d&iie=1&q=fopen
github.com/tsudoko/anki-mpv
anki.tenderapp.com/discussions/add-ons
pastebin.com/C5eaZpb7
pastebin.com/ufZgdTDx
time.com/money/4779223/valedictorian-success-research-barking-up-wrong/
twitter.com/SFWRedditGifs

First for FORTRAN

>multiple threads a day
>/dpt/ still can't agree on which language is best lang

Second for OCaml.

Literally doesn't even support native threads

#include

int main(){

int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;

printf("%d\n", d);

return 0;

}


How much is d?

how bad is -Ofast?

There is quite clearly no best lang. Different languages have different design goals and are aimed at different workflows.

There is no objectively "best lang" for every task

at least 1 CVE

d > 5

fully understanding arrays so there are no doubts about how to use them for me and also getting a grasp of object-oriented programming.

I want to start a new career as a programmer after years of suffering as a teacher.

Noob question, but how do you handle file errors in C? Like if I do:
FILE *file_ptr;
file_ptr = fopen("i/dont/exist.meme", "r");
///what now

I am seriously unable to properly google for this for some reason

good luck user!

if (file_ptr == NULL) // can't open file
Or
if (!file_ptr)

Procrastinating about implementing forth. I'm a bit confused about what happens after I implement the forth interpreter in C. Do I have to bootstrap and implement forth in forth?

Oooh ok, thanks

man fopen

when you guys praise perl you're talking about 5 since there's no reason to learn 6, right?

Yes, we're talking about perl, not perl++.

lmgtfy.com/?s=d&iie=1&q=fopen

Would it be possible to remove a feature from a language while retaining compatibility with old programs?

Why don't C++ or Java do this?

You can deprecate features.
auto_ptr was removed from C++17 after being deprecated in C++11 because it was a piece of shit.

so what's #pragma for?

compiler specific behavior

compiler commands

Hi g

My team hired a literal Patel. He starts Monday. How fucked are we?

>c++ is a horrible language

Thanks. Arrays seem difficult but once you get the hang of them they're not so hard. Object-oriented programming seems simple at first but gets complicated very quickly.

Generally speaking, programming is wonderfully logical and after years of working in the humanities that's exactly what I need.

ah, alrighty then

It's the beginning of the end, my friend. Soon you'll be laid off and replaced with his brother Pakesh.

but linus hates c++

Excuse me, Sir?

That's very offensive, Sir..

Object Oriented Programming is mainly about structuring large programs in a way other people can understand. You'll pick it up once you see how it's really used.

start looking for a job. only a cuck you train their replacement.

Incorrect. Try again.

what's wrong with my answer?

How is it not greater than 5

Speaking from experience just don't let him commit directly to master and you will be fine.

iirc this is undefined behavior

undefined beehayvyor

/algo/

Hey I need some algo advice.
I have a file with few points.
Each point has x, y, z values, x and y is long and lat and z is int value of point.

Points are not creating any specific shape like square or grid.

Now with values of those points I have to generate grid with of nxm size.

Is there a better way than this:
I could use bi linear interpolation to create values in specific point (it would create square or rectangle), then two for loops with bilinear interpolation to count rest of the grid.

but this method seems like not accurate + it would not allow me to use algorithms for any random point in future.


Is there group of algos or methods that would help me? Atm I am aware of interpolation and kriging

1 1 1 GO!

You can't use bilinear interpolation for that. Bilinear interpolation only works for grids.

You're going to have to convert the mesh into triangles and interpolate along the triangles, which is easy enough when you construct a parametric coordinate equation for each triangle.

In some intro curse on assembly, I've learned about Carry flag and how it indicates overflows on arithmetical operations.
Yet C does not have checked addition or multiplication, some reason for that?

What's the surface (presumably) supposed to represent?

i.e. in what way the points in one grid cell affect its value

seems you should base your decision based on that

Not portable.

There's no good reason at all. Basically no languages except assembly let you see carry flags n shit.

Well technically you can use inline assembly to read it but then you're using inline assembly.

then why does C have floating point types?

>want to finish the unix programming environment and assembly language step by step before the semester starts
>have to cram for the GRE and relearn a bunch of useless math and geometry instead

>useless math and geometry
It's not useless if you're working outside of webdev.

>You can't use bilinear interpolation for that. Bilinear interpolation only works for grids.

I was thinking about creating square like frame from point I know then just do bilinear inside, but that would be generate inaccurate values.

I have to to write program that will generate isolines on map.

From what I have read so far, I need to create grid first then use contour line to create isolines.

Can you interpolate in R3 with great circles or something, normalize the points to a unit sphere then map them to R2?

Bilinear interpolation is 100% accurate along with every other interpolation.

It's whether the interpolation has the properties you want.

I’m currently running Anki on my version of linux (lubuntu) and while I can get the program itself to run, I can’t for the life of me get the audio to work alongside the flashcards. I’ve been trying to get Anki to run audio by getting it to utilise MPV for the audio side of things, but I’m not having much luck. I’ve installed the following addon calling “Anki MPV” : github.com/tsudoko/anki-mpv

For this to work you also need to install “pympv”: github.com/tsudoko/anki-mpv

The implementation of pympv is where I run into problems, if you look at the code in question it relies on a piece of code called “import mpv”, however, this code does not work. Running “import mpv” in python returns the value:

“Traceback (most recent call last):
File "", line 1, in
ImportError: No module named mpv”

If I run Anki through the terminal, it launches but I receive the following error messages:

First error, shown in a popup window in the Anki program itself:
“An error occurred in an add-on.
Please post on the add-on forum:
anki.tenderapp.com/discussions/add-ons
Traceback (most recent call last):
File "aqt/addons.py", line 41, in loadAddons
File "/home/aholmes/.local/share/Anki2/addons/mpvaddon.py", line 6, in
import mpv
ImportError: No module named mpv”

Error two, shown in the terminal:

“aholmes@Harpsichor:~$ anki
Unable to load library icui18n "Cannot load library icui18n: (libicui18n.so.48: cannot open shared object file: No such file or directory)"
QGtkStyle was unable to detect the current GTK+ theme.
Traceback (most recent call last):
File "aqt/addons.py", line 41, in loadAddons
File "/home/aholmes/.local/share/Anki2/addons/mpvaddon.py", line 6, in
import mpv
ImportError: No module named mpv”

Anyone know why the script can't import mpv?

when i'm writing a compiler or a protocol i definitely need to know about finding arc lengths of circles. computer science = math is a meme and if you push that you're ill informed or a math double major

How can I improve the code coverage of this test?
Since parse_opt is called internally by argp, how can I test it?

Unit Under Test:
pastebin.com/C5eaZpb7

Test code:
pastebin.com/ufZgdTDx

Surely you don't think calculating arc lengths is difficult.

I'm taking that anime girl for myself

you were the one who was laughed at on stack overflow, right?

haha

did i say that? reading harry potter books isn't difficult either and i don't want to waste my time doing that either

Finding the arc lengths of circles or simple-to-integrate curves is trivial. If you're having trouble with that you're going to have trouble writing a good compiler or protocol.

I get that it's not directly useful, so maybe you're just finding it tedious as opposed to hard. But since you explicitly said "arc length of circle", there can't be any particularly complicated shit in there - surely it's just a refresher of your high school maths that should only take you a couple days, a week at the very most?

Not that guy, but since when did something being easy mean it's worthwhile? Please get your head out of your ass.

Math single major :^). And arc lengths of circles is your example? Honestly if you don't know about that your high school diploma should be revoked because that shit is taught in middle school.

I can agree that in general geometry and calculus are less useful for a good chunk of CS, but you definitely need a strong number theory and abstract algebra basis for any non-trivial CS.

And not knowing geometry is going to ensure you don't get a job in anything remotely touching computer graphics.

i have a 3.92 GPA, so i'm probably more intelligent than you and am preparing more seriously than you would. thanks for your advice to just spend a week brushing up on some geometry as my preparation though i won't be taking it

Hopefully you can calculate some integrals faster than you can read a harry potter book.

If it's actually going to take you less than "a couple of days" why are you complaining so much then?

>And not knowing geometry is going to ensure you don't get a job in anything remotely touching computer graphics.
Or just about any area where CS meets actual engineering...

>needs to pull out numbers to demonstrate his superiority
pathetic

t. brainlet

People with sky high gpas tend to not succeed desu.
time.com/money/4779223/valedictorian-success-research-barking-up-wrong/

That too. I had compiler design on my mind and was thinking about the glsl compilers in graphics drivers.

Certainly no calculus means absolutely no computer engineering.

Learning C++. Someone might say i'm crazy, but pretty sure C++ could come in handy and teach me how to shoot in own foot and solve problems.

I currently work as C# programmer (web) and know C.

like what?
you sure are stupid aren't you?
i thought you loved numbers? guess only when you're memorizing a bunch of formulas

Learning C++ or C or Java is hard. Learn an easier language (like Python) and save your time.

> Someone might say i'm crazy
Nope, C++ is very useful. You should know it.

>Someone might say i'm crazy
Only unemployed people on Sup Forums would say that.
With C#, some web and C++ you got a lot of fronts covered

I'm a C++ dev (haven't worked with -anything- else language-wise) learning C# and trying to get into Microsoft's tech stack

I have to use R2

i'm in college, brainlet

>reading comprehension below noise floor

por que

maybe if you're speaking for yourself

>Learning C++ or C or Java is hard

C is not hard and i hate Pajeet-Java, will never fully learn it. C++ Is hard but i want to know it at least for some degree.

It busts my ego and dick size among fellow web monkeys and more importantly, i'm really interested

Programming is all I do now, sun-up to sundown.

Yeah and? You're still going to not succeed. Your GPA proves that you're obedient and have narrow-minded motivations, which means you'll only ever be mediocre.

>got em!

What programming projects, if any, are you currently working on?

>like what?

Anything that involves things moving around in the real world, or systems observing things moving around for starters.

Traffic, security cameras, scanners (material passing on conveyors/roller tables

Looks like you shitpost as well.

the article you posted as evidence referred to a study investigating high school valedictorians. pic is of you

>sour grapes
It's okay, sweetie. Brains aren't everything. :^( Now go earn me some bennies in the sheet metal factory while my grad school lover gives me the BBC (big-brained cock).

I'm trying to learn C++ for a weird platform I happen to have lying around but all the tutorials are shit and do things that you shouldn't be doing.

i like perl6

but user, all you need to do is throwing lots of hardware at an AI :^)

>Browse Sup Forums
>Go to /dpt/
>Read that JVM is faster than CLR
>Read that JVM is a good VM
>Not sure if irony or serious

ok thanc u guys

what would stop me from google searching a formula when i need it if i get a job doing that and not working as a programmer to meet requirements that have already been designed (which is the "real world")?
>inb4 'you can just google search about unix!'
yes, that's what i'd like to be doing

>Calcium Lime Rust, more commonly known as CLR, is a household cleaning product used for dissolving stains, such as calcium, lime, and iron oxide deposits.
blazing speeds my friend

>even checking a slab of concrete for defects involves tons of math, I work with this fun topic
>engineering concrete
That sounds brainlet as fuck, no wonder you're bitter. Well, I guess there's a chance you'll be smarter in your next life!

>What programming projects, if any, are you currently working on?
I'm trying to investigate the data flow in YOLO object detection framework. More specifically, I'm interested in disk IO patterns, as I have created a userspace NVME driver that allows individual CUDA kernel threads to initiate disk read/writes into GPU memory.

But extending YOLO with this functionality only makes sense if disk IO can be highly pipelined.

none. i'm studying for the gre.