/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

anjinhasunidas.comxa.com/ziz.html
nzx.com/markets/NZSX/securities/FNZ?icharts=true
iso-9899.info/wiki/Why_arrays_arent_pointers
strawpoll.me/12023125
forum.dlang.org/thread/[email protected]
twitter.com/SFWRedditGifs

First for D

Second for memes

Rewriting in Rust because communism.

rewriting c++ game engine in c

The Linux kernel?

Having fun with AudioContext

anjinhasunidas.comxa.com/ziz.html

GONAD warrior?

GOMAD -.-''

>Namefagging
>-.-''
Please leave.

Installing Gentoo

ok i wont post again

JavaScript is a mistake.

acceptance tests in codeception
it's nice

Sorry, I didn't know you were such a hardass.

JavaScript was a lot of mistakes

if for example I have
uint16_t buffer[255] = {0};

and I use buffer as an argument that expects an unsigned 16 bit integer, how come I get the compilation error:
invalid conversion from 'uint16_t* {aka short unsigned int*}' to '__u16 {aka short unsigned int}'

aren't they the same thing?

one's a pointer, one isn't

different types famalam

why pcsx2 is so shit?


static __fi void _vuMULA(VURegs * VU) {
if (_X){ VU->ACC.i.x = VU_MACx_UPDATE(VU, vuDouble(VU->VF[_Fs_].i.x) * vuDouble(VU->VF[_Ft_].i.x)); } else VU_MACx_CLEAR(VU);
if (_Y){ VU->ACC.i.y = VU_MACy_UPDATE(VU, vuDouble(VU->VF[_Fs_].i.y) * vuDouble(VU->VF[_Ft_].i.y)); } else VU_MACy_CLEAR(VU);
if (_Z){ VU->ACC.i.z = VU_MACz_UPDATE(VU, vuDouble(VU->VF[_Fs_].i.z) * vuDouble(VU->VF[_Ft_].i.z)); } else VU_MACz_CLEAR(VU);
if (_W){ VU->ACC.i.w = VU_MACw_UPDATE(VU, vuDouble(VU->VF[_Fs_].i.w) * vuDouble(VU->VF[_Ft_].i.w)); } else VU_MACw_CLEAR(VU);
VU_STAT_UPDATE(VU);
}

So... I don't quite get the context behind this section of code. Why is it shit, exactly?

JFC
That much branching and pointer indirection for a multiply/add.

I'm just trying to make DISLIN work in Code Block.

This:

mingw32-g++.exe -o "bin\Debug\Hello world.exe" obj\Debug\main.o -luser32 -lgdi32 -lopengl32 C:\dislin\discpp.a C:\dislin\dismg.a C:\dislin\dismg_d.a

doesn't work. I get an undefined reference to Dislin::Dislin(). It's presumably a problem of static library inclusion. Annoying.

minutes_to_midnight() takes in a datetime object d and returns how many minutes are left until midnight

import decimal
def minutes_to_midnight(d):


now = datetime.datetime.now()

oneday = datetime.timedelta(days=1)
tom = now + oneday
midnight = datetime.datetime(tom.year,tom.month,tom.day,0,0,0,)

delta = midnight - d
delta = (delta.total_seconds() / 60)
delta = int(round(delta,0))

returnstr = ""
returnstr = str(delta)+" minute"

if delta > 1: returnstr += "s"

return returnstr


pls tell me everything whats wrong with this code

I normally do not see .a files used as arguments like .o files like that. Typically it might be something like...

g++ -o "bin/Debug/Hello world.exe" obj/Debug/main.o -L C:/dislin -luser32 -lgdi32 -lopengl32 -ldiscpp -ldismg -ldismg_d

Try that, perhaps?

idk my man do you really need that many variables

def minutes_to_midnight(d):
tom = datetime.datetime.now() + datetime.timedelta(days=1)
mid = datetime.datetime(tom.year,tom.month,tom.day,0,0,0,)

delta = int(round((midnight - d).to_seconds() / 60, 0))

return '{} minute{}'.format(delta, 's' if delta > 1 else '')

thank you

Yeah I've tried ldiscpp types arguments before. I get this in the console:

mingw32-g++.exe -o "bin\Debug\Hello world.exe" obj\Debug\main.o -LC:\dislin -luser32 -lgdi32 -lopengl32 -ldisccp -ldismg -ldismg_d

c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -ldisccp
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -ldismg
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -ldismg_d

Not much doc about it but I feel close to the solution. Need to understand compiler / linker command and args better I guess.

Would anyone know how to do this? Basically im trying to start my first project in which I gather stock market quotes + historical data from my countries market website namely: nzx.com/markets/NZSX/securities/FNZ?icharts=true

the problem is when I look around and see if they have an api that I can retrieve information from they actually redirect you and tell you to find "data vendors" in which I go to their website and get lost/stuck because they don't actually tell you what type of data they provide market wise.

This is a really interesting project for me because I'd like to incorporate some financial tools in my GUI but I'm not even sure about getting the most important thing: The data.

thanks

finding good learning material for C, (i have no prior expierience with programming at all, i'm an advanced Linux user and don't want to start with shit like Python)

Hrm... oh wait, -l flags look for fiies in the name format libnameoflib.a, libnameoflib.so, or libnameoflib.dll. I suppose you were right the first time, but I'm not sure why the symbols are not present in the library then...

K&R C
>i have no prior expierience with programming at all
oh wait
Variables are named cells in the memory where you put values in your program.
Now you must know everything you didn't know about programming.

Does it really have to be from your country? Python + Panda is not a bad starting point for analyzing stock market data.

K&R isn't geared towards beginners.

Yes it does, I want to at least make a project thats relevant and can show my interviewer or something.

Is panda just a graphing/graphic tool? Or does it haev something to do with retrieving stock market data

I dunno, everything in K&R C I see being written in plain English.
What novices must know before they get introduced to K&R C?

K&R is a reference book

If I recall, pandas was not originally made for finance but just so happen to be particularly well suited to it. You'd have to research it though but it's a good starting point to explore and build.

If you wanna show something to a potential employer and build a portfolio I fail to see how the specificity of your country's stock exchange would be very much important. The price mechanism and any algorithm you develop would be equally applicable to some other data feed.

I see, I'll take a look at pandas

>
If you wanna show something to a potential employer and build a portfolio I fail to see how the specificity of your country's stock exchange would be very much important. The price mechanism and any algorithm you develop would be equally applicable to some other data feed.
Well I'm still in school, and also that is true but obviously id like to have them see some data that they can actually relate to, it doesn't make sense to analyze something from another country like Brazil.

Also I'm not trying to make a trading algo or anything, I just retrieve and show/inspect data with a GUI, maybe some other useful tools.

But about the data, how would I go about retrieving that? Ive never done this before so I have no idea what to look at or how things work

Look for example with python and yahoo finance. You get the data, your format it a little, put it in panda and then maybe you have some graphic package that allows you to plot something.

I'm sure there's many example all over. There are, of course, examples in the book I've just shown. Pic related. It's from the book.

How to program. K&R will teach you how for loops work in C and its peculiarities. It won't teach you what a for loop is more fundamentally.

>minute_to_midnight returns a string

I write a program in C for ATmega128 in Eclipse.
Eclipse shows me error "Symbol 'UDR1' could not be resolved".
What do I do in order to make Eclipse resolve the symbol?

>You get the data
How though? Like I said im extremely new to this, I dont understand how im supposed to get the data properly. The other stuff like data sorting/presentation I could probably figure out on my own, but I'll use that book for reference

Lemme see.

Do you know what header file UDR1 comes from?

Well, conceptually, you get it sort of like you get this webpage. There's a server somewhere waiting for request from client and when they get request for some data -- say, google stock price in the lat two month -- they send that back to you, in exactly the same way you browser gets a bunch of shit sent to it if he request whatever is at "boards.Sup Forums.org".

So basically there's gonna be a financial API, like the yahoo finance API, which you're gonna use in your code in order to fetch financial data and put it in your app.

I will leave the rest to google and tutorials.

Yes

Find the directory that it is in and add said directory as an include path for your project. You'll have to google how to add an include path in Eclipse because I have absolutely no idea

Header which contains UDR1 has the line
# error "Include instead of this file."

I suppose I had to define the target device, but I think I already did it in project properties.

buffer here is an array of 255 uint16_t values, all of which are initialised to 0. Upon passing an array to a function, it is converted to a pointer addressing the first element in the array. You cannot use a uint16_t *, which is a pointer, as a uint16_t. Did you want to access the first element in the array? Simply dereference the pointer, using either *buffer or buffer[0]. Example:
buffer[0] = 5; // set the first element of buffer to 5

Hey guys I'm learning Java by creating some Android applications. How useful do you guys think it would be if I went ahead and bought a book instead of just googling everything?

In case you didn't know, though they are converted to pointers when used as arguments: iso-9899.info/wiki/Why_arrays_arent_pointers

What's a good reason to learn C++ over other more in demand languages?

...

Building keyboard support for this kernel project I'm having. Already have the GDT and IDT, and wondering do I really need the PIC and PIT to make it work?

Python is not shit, you arbitrary nigger.

There is no reason to learn C++.
It's completely shit.

lot's of things use c++

t. poo in loo

Find good recommendations (maybe ask on freenode) then google for PDFs or try TPB.

Lol I'm not a fucking pajeet.

omg can't use python btw i suck @ cs & math but at least i use c
>segmentation fault
oops

It is by far the most complete language, allowing you to get very close to the hardware (inline. assembly.), and then goes all the way up to support OOP so you can make use of all kinds of abstractions you need to. There's nothing you can't write in C++. The only criticism it receives is being TOO complete which means the language can do so many things that it's hard to find a programmer that knows everything that it can do.

Still, if you're not going to work with C++ then there is no reason to learn it. I don't know what you mean by "more in demand languages" since C++ is very popular where I live, but if every job offering you see requires Java then by all means skip C++ and learn Java, or whatever language, instead.

Text editor poll continues
strawpoll.me/12023125

>There's nothing you can't write in C++

>not using java

There's nothing you can't write in any turing complete language

So C++ offers nothing more than asm?

It's over: vim won. And some faggots actually use Sublime.

I just pointed one sentence that doesn't really make sense, please don't imply things that I didn't said

Of course there is we just cant imagine

I think there are more than 300 people here

Embarassing, to think that C++ fags have to resort to such obvious backpedalling in order to defend their god awful language. No wonder Java is more popular.

>73 / 8 / 31 / 1

>>There's nothing you can't write in C++
What can you not write in C++?

...

Yeah. That's why I am specifically asking him.
He's the one baiting for shit replies

A C++ parser

bullshit, of course you can write that
why not?

Downgrading with no purpose..

a polymorphically recursive type

Lol. Why would you say that? /dpt/ is for people who know how to program

Getters and setters are cargo cult programming.

>tfw to intelligent to be a code monkey

>setDefinition()
>returns definition
wew

Where's that code snippet from?

it's been around so long i doubt anyone knows where is it from originally

Hadn't seen this one before now

It's only just occurred to me that the origin might be known. Anyone?

java in a nutshell

Getters and setters are the most retarded idea, probably of all time (excluding communism, liberalism, etc)

>implying communism was a bad 'idea'
read a book, cunt
just because it didn't work out as planned doesn't mean it's a bad idea

>100m dead
it worked out exactly as planned

capitalism is a better idea
just because it didn't work out as planned doesn't mean it's bad

was killing 100m people part of your plan

forum.dlang.org/thread/[email protected]
Holy moly

please, this a technology board... keep Sup Forums out of this place or fuck off...

You mean /his/

I bought a new macbook pro lol