/dpt/ - Daily Programming Thread

Last thread: Whatcha workin' on, Sup Forums?

Other urls found in this thread:

youtube.com/durgasoftware
collinoswalt.com/post.php?pid=16
ideone.com/qwzbaO
fifa.com/mm/Document/FootballDevelopment/Refereeing/02/36/01/11/LawsofthegamewebEN_Neutral.pdf
twitter.com/NSFWRedditVideo

>C#

>he doesn't know

how should i go about finding a suitable textbook on the subject of how to play soccer that i can reference in a paper?

How is the street today?

What does that have to do with programming?

>youtube.com/durgasoftware
Golden.

...

I feel like I'm not even programming anymore.

90% of the time, I'm just using a library and wiring it to an existing codebase to get some other functionality out of it.

It's not like I don't like being able to do it, but at the end of the day I feel like I'm just putting legos together with prebuilt engines and showing it to my boss saying "ta dah" and everyone claps even though it's easy as hell.

then do a side project

That's why we don't tolerate webdevs and game developers in these threads.
This is exactly what they're doing.

>we

this. You're pretty stupid if you expect a programming job to be fun in most cases

I go to do a side project and 90% of what I'll be doing is already done in libraries anyway.

so? i don't see how that's relevant.

I realised after I posted that I should not have said that.
Nice ifunny image though, you fucking faggot.

>implying that's not what you're doing in a backend role
>implying that that's not any job except a systems programmer

Are you saying I should redo work someone else has already done?

I'm really not used to closures. In Lua, how would I write a function that would do the same thing as the pairs() operator, like the deprecated table.foreach(table, function)?

I'm saying that's irrelevant.

what the fugg
import std.stdio;
void main(){
int n=99;
while (n!=2){
writeln("\n", n, " bottles of beer on the wall, ",
n, " bottles of beer.\n", "Take one down and pass it around, ",
--n, " bottles on the wall.");
writeln();
}
writeln("1 bottle of beer on the wall, 1 bottle of beer\n",
"Take one down and pass it around, no more bottles of bear on the wall\n\n",
"No more bottles of beer on the wall, no more bottles of beer\n",
"Go to the store and buy some more, 99 bottles of beer on the wall.");
}

is producing
..
4 bottles of beer on the wall, 4 bottles of beer.
Take one down and pass it around, 4 bottles on the wall.


3 bottles of beer on the wall, 3 bottles of beer.
Take one down and pass it around, 3 bottles on the wall.


2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 2 bottles on the wall.
..

--n is working like n--
why

Sure, why not?

Because that's a waste of time.

>using --n inside a method call

This is your own fault.

No it's not.

Not very busy. Found a good spot by the post office.

So?

but putting n-- in the earlier one works

Every library is someone's side project.

What am I doing wrong here?
days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']

def weekDay(x):
for x in days:
days[x]
return x

print(weekDay(input("Input day number: ")))

I want it to do the same as for example and pull out a string on by the number it's ordered in
print(days[x])

I don't know about Dead-lang's semantics, but is there even a sequence point between the arguments?
Even if there is, mixing side effects like that is just a fucking bad idea.

>What am I doing wrong here?
using a shitlang

Fuck off

It's the same as Cee

>x declared in function parameter
>declaring it again[?] in the for/in block

Why not just return days[x]? Drop the for/in statement.

Then it should be undefined behaviour.

Rust doesn't have this problem

In C, the order in which the arguments get evaluated is not specified, which is why that happens. Apparently it happens in D as well.

Solution is just use (n - 1) instead.

Drop the bullshit and tell me what's wrong

Sure, Rust doesn't have the arguably very useful increment operators.

Holy shit /dpt/ was right

>Cee
NEVER EVER

That's what I had at first but it wasn't working either
Here's the error I get
Traceback (most recent call last):
File "5.14.py", line 7, in
print(weekDay(input("Input day number: ")))
File "5.14.py", line 5, in weekDay
return days[x]
TypeError: list indices must be integers or slices, not str

wtf I hate both C and D now

I was going to say exactly this. You don't need a loop for this, just to access the element at index [x] in the list and return it to stdout.

agents

This doesn't happen in Haskell

>C getting BTFO by hasklel and Rust

Why does the new user's example run anyway?

I'm not familiar with python, but x is declared twice in the same scope in their's, isn't it?

any program you write will use something written in c, so c always forever

How are you not getting an error? I'm running the same code with an error. I'm using Python 3.6

There's tons of languages that have this feature.
Many of those don't define the order of expression evaluation for two reasons:
- it might be preferable on the target hardware to not start with the first one
- It gives more options to optimize
Of course meme languages have a strict definition which parameters are evaluated in which order, they don't care about practicality or performance.

>any program you write will use something written in c, so c always forever
HolyC doesn't depend on C and nothing in TempleOS was ever touched by C

call me when other poster has written holyc

I've met up with a scientist from my university. They're storing all of their data in Excel spreadsheets. I told him I'd help convert the data into RDBMS format (MySQL or otherwise). Here's a writeup I did on the challenge:

collinoswalt.com/post.php?pid=16

>cares about performance
>doesn't write assembly
shiggydiggy

>There's tons of languages that have this feature
which doesn't make it right.
>- it might be preferable on the target hardware to not start with the first one
>- It gives more options to optimize
Fair enough.
>that reddit usage of meme
stopped reading right there.

whats the point of using anything slower than assembly

Technically his block works because he's returning the value that was originally input by the user, so nothing outrageous is being caught. He's got that list index days[x] going on in there but it doesn't mean anything since he didn't assign it to x or another variable to be returned.

It shouldn't be specific to either version of Python since it's a pretty universal way to directly access items in a list. Check your whitespace/type it out again. Try assigning the results of weekDay() to a variable like:
result = weekday(input("Input day number: "))
print(result)

>Whatcha workin' on, Sup Forums?

Rate my FizzBuzz, Sup Forums

ideone.com/qwzbaO

What about this?

fifa.com/mm/Document/FootballDevelopment/Refereeing/02/36/01/11/LawsofthegamewebEN_Neutral.pdf

Why the fuck do you space your posts like that, redditor?

Are you autistic?

Anyone able to help with this?

Answer the fucking question and leave this thread. Your kind is not welcome here.

>>>/9gag/
>>>/anywherebuthere/

Right now I'm spacing it like this solely to annoy you.

>It's real

Holy shit. I thought it was too good to be true.

Few will pay you to do it. I started off doing C. Couldn't find a job. Moved to JavaScript and now I get paid $15/hr part time.

>shunting CSV files into MySQL and querying the data

Pretty babby-tier stuff. Some awkward wording in your writeup, too. The "growth rate" section doesn't really make sense, as you're literally just taking a single measurement from one year to the next. You'd typically want to sample more years and get the average growth-per-year for a more meaningful comparison.

At the end of the day, the whole thing is as simple as spinning up a database anywhere you want and running a few lines of code and it's done. Not sure why you've given a complete writeup of this.

>Why the fuck do you space your posts like that
It's the fucking code block element you dense motherfucker.

Leave. This site is not for you.
>being this tsundere
stop.
I don't see a single code block in those posts.

14 / 88

...

yesterday people bullied me on my pangram program, so i rewrote it
#include
#include
#include

#define LOWER(c) (c | 0x20)
#define TOBIT(c) (c ^ 0x60)
#define LANDB(c) (TOBIT(LOWER(c)))

int main(int argc, char *const argv[]) {
uint8_t *s = argv[1], c;
const uint32_t mask = 0x3FFFFFF;
uint32_t val = 0;

if(argc

>>>/global/rules/2

>I don't see a single code block in those posts.
Are you fucking blind?

The problem is that input returns a string, not a int, even if you input a number. Numbers can be interpreted as a string or int, so in this case you would have to cast the string to a int using int(). So you would either do print(weekDay(int(input("Input day number:")))) or just
return days[int(x)]

Anything written in python is by definition not a "code" "block"

a year-to-year comparison can give you indications about years with lower rainfall.

The issue is not converting from excel to MySQL, the issue is that the tables are horribly formatted. There are columns spanning multiple years which should be condensed into 1 column with 20 records associated. I need to transpose that data, but I also need to slice up the spreadsheet into smaller tables. Height data and foliage density data are in the same spreadsheet but should be in two separate tables joined by the tree ID as the primary key.

>stop.

Make me.


You have to be 18 to post here

>Make me.
Please?

Fine.

What if I'm over 18? I still can't post here?

That's what programming is, nerd. Did you really think you'd be writing mathematic algorithms as a gui developer?

>a year-to-year comparison can give you indications about years with lower rainfall.
Can it? I'm no dendrologist, but I suspect there are many more factors at play than rainful when it comes to tree growth.

I get the idea of the project, and you've done a good job of fluffing it, but it's literally less than an afternoon of work.

If you're over 18 and posting on Sup Forums, you're pretty pathetic desu senpai

ok

>2011+6
>not programming on punched cards

Fuck off, retards.

Don't respond to bait, and stop shitposting.

It doesn't print fizzbuzz??

did I ask for your opinion? if not, fuck off and/or answer my question
where the hell did you get this image of me?!

>but it's literally less than an afternoon of work.

The issue is not converting A spreadsheet to RDBMS: the issue is creating a tool so that retards can do it; I'm learning jframe/swing so I can make a tool so that future undergrads can be put to work updating databases and you don't need a programmer every time you need to do this. Transposing an array and cutting up a CSV file is easy, but I'm working on the UI shit too. I don't get why you seem to be so intent on shitting on other people's work? Does it make you feel better about yourself being a l337 h4x0r C/Assembly programmer?

After a mere 80 posts the autism stretching reached an unprecedented level.
It was at this moment that everyone realized that /dpt/ is just a bunch of unemployed retards writing shitty fizzbuzz.

at least we're not /wdg/

>tfw posting this from work

>writing shitty fizzbuzz
>shitty
Don't ever say that again.

>not /wdg/
They've got jobs at least. Native code jobs are dead; web dev is the only way to get paid nowadays

>an unprecedented level
how's your first day here going?

>/wdg/
What's that, a reddit board? Why are you mentioning it here?

despite being webfags /wdg/ is a lot less cancerous than this place

>/wdg/
What's that? How about you fuck off back to that place if you like it so much?