/dpt/ - Daily Programming Thread

Previous thread: What are you working on, Sup Forums?

Other urls found in this thread:

docs.oracle.com/javase/tutorial/
cs.armstrong.edu/liang/intro10e/
github.com/jathu/sublet
en.wikibooks.org/wiki/Ada_Programming/Types/array
destroyallsoftware.com/talks/the-birth-and-death-of-javascript
destroyallsoftware.com/talks/useing-youre-types-good
destroyallsoftware.com/talks/wat
tech.slashdot.org/story/16/11/09/1510219/google-searches-for-president-impeachment-canada-immigration-nuclear-shelter-skyrocket-after-trumps-victory
twitter.com/SFWRedditGifs

>pic that has nothing to do with programming
You stupid fuck

>muh animu~
user...

So 100000000 get is coming up on Sup Forums. Are there any good extensions for gets or do I have to write my own?

what did she mean by this

anything that's publicly available wouldn't be good enough to get such a highly sought after get with any remotely decent probability

i think you'll need kek's blessing regardless of what you do

This thread is better than the other thread. This is the real thread now.

what's a java book
a good one preferably
i will have to study java and OOP next year and I'd like to get started now instead
i have *some* experience with C

docs.oracle.com/javase/tutorial/
cs.armstrong.edu/liang/intro10e/

many tanks

Working on my terminal emulator, managed to squeeze some more performance from insertion heavy situations.

If you consider cancer started out taking 25 seconds to do the same this is a huge improvement.

To day i added metadata printout to my audio file player learner project.
I think the next step will be to go back and try to port some parts of the project to Linux.

Hi, if anyone can help me this it would be much appreciated. Input is an array and an int. I have to return the [i] number of the array.
Why is this not working? It's F# btw

then and else has to be switched I know, still errors :)

Nothing really

Arrays start their index at 0?

because you don't actually call the function?

Yes, should print out:
3
"i is not good"

You have no idea how much that bothers me

You're right, now I feel kind of stupid lol. Still errors : /

"This value is not a function and cannot be applied"

Get used to it, unless you want to architect a new computer.

safeIndexIf [|1..5|] 2

>unless you want to architect a new computer.
Lua and Matlab start their arrays at 1. Both run on the same computers as everything else. What now, faggot?

/sqt/ wont help me so I'm trying here.
I'm retarded and never used Python so excuse me.
I'm trying to move my leddit account settings to another one, and found this github.com/jathu/sublet which does it for you, but I have no idea how to use it.
I installed Python and Praw, but I'm not sure what to do from here, help me out lads.

>Lua and Matlab start their arrays at 1
They're not programming language. They're scripting language.

>making every access operation require an extra instruction just because you can't get to grips with what everybody knows and loves

There's no reason this couldn't be done compile time, in compiled languages.

"The type int is not compatible with the type 'Printf.TextWriterFormat'

Why is my function even that type to begin with? I have that "arr: 'a []" which is an array. Just dont get it

Ada allows you to specify array ranges. They must be using arcane magic, like subtraction.

That must be really confusing for readability.

>reddit

How so?

fugg u got me :DDD

Where its used is not specifying arbitrary ranges like (2 .. 97) for an array for no reason, but specifying ranges with arbitrary ordinal values instead of only integers, and remaining type safe.

Just harder to write idiomatic code. Increased risk for off by one errors, and harder to spot them, especially when working with someone else's code.

Ada has the 'first and 'last attributes, so indexing errors are pretty rare.

I mean, i would probably use 1 indexing half the time, because 1 indexing makes sense, and 0 indexing half the time because that's what i'm used to.

Please learn the language first

>1 indexing makes sense
It's not an index, it's an offset from the head.
That's why it's the same for pointers and relative addressing in asm.

see You could represent a Schedule as an "array (Day) of Task" (where Day would be an enumeration like (Mon, Tue, ...)) so MySchedule(Mon) := Work, instead of MySchedule(0) := Work. Of course exploiting a language like's C weak typing you can have Mon basically be an alias for 0, but there's no way to enforce only allowing Mon and not 0.

The example from en.wikibooks.org/wiki/Ada_Programming/Types/array has an array keeping track of character counts in a text, "array (Character) of Natural", so when you encounter an 'A' you can simply do "CharacterCount('A') := CharacterCount('A') + 1"

Like says, Ada documentation generally discourages accessing an element using just the index, they advise doing Array'First + Offset. So really, you will be using "0-indexing" since you're specifying the offset regardless of where the indices actually start/end.

dude dipropyltryptamine lmao

But everyone uses, thinks of, and calls it an index.

I know this is a web language, but I have a tech interview in an hour and I don't know what to review.

The place does javascript and I need to know what to review

>in an hour

What the fuck are you doing?

>in an hour
>just now asking for help
you're fucked

just make sure you understand these

Was weak typing a mistake?

It's more idiomatic. You can index arrays in ways that makes sense to people. For example, indexing for a grid from -X..X and -Y..Y.

review the history: destroyallsoftware.com/talks/the-birth-and-death-of-javascript

review the basics of types: destroyallsoftware.com/talks/useing-youre-types-good

review some unique features of Javascript: destroyallsoftware.com/talks/wat

and you should be good to go!

jeeeesus

Some of the examples I've seen before are pretty understandable but these are just criminal.

Haskell has something similar

...

cool

Ada of course adopted this from Pascal

Ada and Pascal are pretty good
Shame C got so popular

C is superior.

I like all of them

literally a trap language

What is the interest of your post? Delete it please.

Democracy is not ok?
Or is it only democracy and freedom when the one you want is winning?

The posts of Hillary supporters have high resemblance to the religious "When good things happen God wills it, but when bad things happen God works in mysterious ways." shit.

Take that shit to Sup Forums

get rid of the explicit cast if you really want to demonstrate "weak typing"

This is Sup Forums. Just replace Java and C, or any text editor comparison, with Conservatives and Liberals, and you get the same thing.
Don't delude yourself into thinking it ain't so.

Also Python is the best programming language :)

I'd allocate her my girl pointer, if you know what i mean.

Stop deluding yourself, ameritard.

I think you forgot something

Wha tthe fuck are you going on about? And what is it with your chinese-ish rhetoric? I don't mind that you be either or but what the fuck does it have to do with what you're saying or with this thread?

Anyway, I went on a hunt and got a ton of c code snippets from way long ago so I'm going to be messing with those for a while looking for old tips we might not have access to these days. Or at least may not have had access to before today.

Btw, I forgot the election was yesterday and went on as if it was all normal. Well...about halfway through the day, the pressure in my eyes and ears just went away. My computer stopped hissing and there is nothing wrong with my soundcard. WTF?!

And if Hillary had won, we would be getting the same from Trump supporters. So what else is new?

i think you forgot to kill yourself

The new thing is that America is great again.

And the rest of the world is going to suffer for it.

literally how will any non-fag suffer from it?

That's a good thing.

y r u so rude

Here's some weak typing
int x;
unsigned y = 0;

for(x = -5; x < y; x++){
puts("Tick");
}
return 0;

When America is great, the world benefits.

We buy more cheap chink shit, russian vodka, and european luxuries than anyone else in the world.

Yes, the rest of the world will suffer from the fact that Trump will initiate a world war with Russia, Iran, the Middle East, even though the main criticisms against him are his wishes to have more favorable ties with Russia, Iran, to abandon war in the Middle East.
Yes, it makes absolute sense that people are now Google searching nuclear shelters after Trump's election turned up to calm down and shave off the edge from USA's biggest enemies.

>And the rest of the world is going to suffer for it.

America buys more crap from the rest of the world than they do from us.

Even Ignorant niggers in African mud huts making their "peace bracelets" are thanking their gods Trump won.

>Also Python is the best programming language :)
It is tho

>When America is great, the world benefits.
>We buy more cheap chink shit, russian vodka, and european luxuries than anyone else in the world.

Yup. Eurofags should be thanking Allah in the streets 'Merica will be able to afford to buy their useless luxuries again.

Who has enough money to buy nuclear shelters but is threatened by the economy Trump represents...?

What?

>We buy more cheap chink shit, russian vodka, and european luxuries than anyone else in the world.

This.

Why else do you think the stock markets went UP today?

Apparently lots of people have money for nuclear shelters, as shitdot seems to find:
tech.slashdot.org/story/16/11/09/1510219/google-searches-for-president-impeachment-canada-immigration-nuclear-shelter-skyrocket-after-trumps-victory

working on a custom packet parser for reversing protocols

>tfw and theres 15 chinese in the dorm kitchen out of nowhere

I didn't ask about impulsive behavior. I asked about actual purchases.

there were only 2 a few hours ago
they breed so fast

Ladies and gentlemen, bad science

>destroyallsoftware.com/talks/wat
This is gold, thanks user

idk about burgerland but sweden has nuclear shelters literally everywhere in ordinary buildings and such

>We buy more cheap chink shit, russian vodka, and european luxuries than anyone else in the world.
You also exploit more workers in third world countries and prop up the governments who allow this. Remember when Chiquita effectively owned several central and south American countries as a source for their bananas? Backed by US naval power.
During WWI when the British needed more aluninum they found the port for their Cryolite mines in Greenland blockaded by US destroyers, forcing them to buy from the US companies.
Wonderful friends to have.

Oh, i'ts the guy who didn't read.
Fuck off

Those are not nuclear shelters, those are burrows to escape the cold.
Swedes resolve their war issues by doing suicide instead of building shelters.

nice meme

I need to use gitlab for a project I don't want to do. I have never used it, but here is my problem.
I managed to push my Android Studio project into gitlab server with following default .gitignore file:
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuil

My problem is that when check this project out on a new computer, I get pic related. How do I fix it.
I want to do it so that I can check out the project on any computer and continue working on it wherever I am.

How many will there be in an hour?
My quick and dirty simulation approximates it to 63. Because i'm to stupid to solve it algebraically.

win+r, cmd, enter
navigate to the folder you put sublet in by using the cd command.
python sublet.py

Trump is against trading with other countries though.

f(x) = ae^kx
exponential growth

initial was 2
f(0) = ae^0 = a = 2


f(x) = 2e^kx

after a few hours it was 15
lets say after 3 hours

f(3) = 2e^3k = 15
3k = ln 15/2
k = [ln 15/2] / 3 ~=~ 0.6716

f(x) = 2e^0.6716x

after 6 hours
f(6) = 2e^(0.6716*6) = 112.4768

after 6 hours there will be approximately 112 chinks

Oh god I thought the interview was going to be all javascript questions so that's what I studied but it was a java interview so I royally fucked up the terminology. I mixed up a hash table with a hash map and mixed up polymorphism with inheritance

God, that was my last opportunity. I'm going to fucking kill myself

It's ok. Both languages are shit.. But on a serious note, There are always more opportunities.

>I'm going to fucking kill myself
there might be a queue today