/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

youtube.com/watch?v=ZhuHCtR3xq8
docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html
soundcloud.com/hyqxyz/monad
en.wikipedia.org/wiki/Malbolge
chrissawyergames.com/faq3.htm
superuser.com/questions/1101134/fedora-24-no-build-include-try-to-generate-autoconf-h
stackoverflow.com/questions/38987/how-to-merge-two-python-dictionaries-in-a-single-expression
youtu.be/Qpoy9iIi5ok
rbt.asia/g/thread/S56718622
youtube.com/watch?v=KbNXnxwMOqU
rbt.asia/g/thread/S56718622#p56721877
youtube.com/watch?v=5mzsD2rfR94
reddit.com/r/unitedkingdom/comments/53y1wi/a_redditor_was_arrested_and_fined_for_an/
twitter.com/SFWRedditGifs

First for c++ digraphs and C trigraphs. Death to standard syntax!

Java is so fucking verbose. Jesus.

I'm making games in C# because every job listing wants C#/.NET skills instead of Java or C++ for some reason

haskell a shit

What framework do you use?

4th for akari-bbs!

The last 2 threads have been just awful, even for Cred Forums.

as if C# isn't verbose

Who said anything about C#, dumbass?

Akari will make everything better!

half the people in the last thread? it's well-known that /dpt/ has a boner for C# while they shit on java as if they're two completely different languages.

Darn you they are so different it takes years to switch, like from american to british english.

Shame on you

They're significantly different, and just because you know one, doesn't mean you'd be any good at the other without a few months or more.

you're right. C# has PascalCase instead of camelCase and the curly braces are positioned differently.

Kill yourself frogposter

Don't know about C# but everything in Java seems to be over engineered.

C# is getting pretty popular in the industry. and it's a comfy language for making games in. pls don't say you're using unity tho

he didn't even say anything about C#. but while we're at it, C#, while definitely verbose, is still less verbose than Java. properties, namespace aliasing, implicitly typed locals ("var"), and expression-bodied members all help cut down on syntax

the unity engine is pretty based tho

Rearranging deckchairs on the Titanic.

No typeclasses.
No higher-kinded types.
No tail call optimization.

That ship has sailed an sunk user

C# is probably the best language in existence

it works fine for some people's needs, but it's pretty rigid and it runs like absolute shit

jesus, you shift goalposts like a motherfucker. this is your argument now? who cares? Java doesn't have that shit either

>Java doesn't have that shit either
that's the point. they're basically the same language.

>9 posters
quality thread

Why is OpenGL so fucking hard? 1000 lines just to draw a fucking triangle.

Quality vs Quantity

hello, i am the 10th poster

I'm saying that C# is not much less verbose than Java at all. You simply cannot express certain patterns that reduce verbosity in either of them as a result of the limitations of their type systems.

>helicopters and faggots aren't really different
>I mean, I guess one can be used as transportation and the other sucks cocks, but other than that, they're the same!

so far, this thread's quality is pretty bad though

poo in loo

OpenGL is a low-level API (although there are more low level like Vulkan).

>any language that doesn't have these three things is basically the same language
haha holy shit. you're trying so fucking hard dude. i don't know what kind of autism it is you've got but damn

False analogy.

>argue that java and C# are different
>everyone argues against me except for like one user on my side

>argue that java and C# are similar
>everyone argues against me

Have you forgotten where you are?

(you can always switch to akaribbs[!!])

Everyone's just arguing with everyone at this point.

However, it's pretty hilarious that the "Similar" party is conveniently ignoring a massive amount of differences shown by the "Different" party.

Welcome to Cred Forums; we're full of contrarians.

We think that those differences are small and inconsequential. They simply don't matter when compared to more powerful languages.

Java does some things better than C#.

C# does some things better than Java.

They have some differences, enough to be significantly different.

They aren't more different than, say, Brainfuck and Javascript.

Is this really worth spending your afternoon on?

Yep like the fact java doesnt have # in name, or they have different tooling. And paradigms are completely different not to mention IDEs?

>responding to Java fags
>responding to C# fags

How is this conversation even still going?

Is everyone involved, or is it just like 3-4 spergs?

Those differences are small and inconsequential.

kek yeah i was about to say "you should try vulkan"

oh boy, more autistic hair-splitting. i listed multiple features of C# that reduce syntactic verbosity compared to Java. keep in mind i didn't even say it was "much less" verbose or something. i literally just said "less". that's just objectively correct

>or is it just like 3-4 spergs?
mostly this

is akari bbs online?

This is what happens when you have a stupid OP image. It attracts all the cancer.

Exactly we didnt have maki or akari...

python3, can't understand how to unpack a list that contains dicts into a string format and show as many items the list has stored


notice either one shows only the first item

I don't understand what extend does in java or how it helps me.

Go ahead and mock me cause I probably deserve it.

Now that people have gotten used to it, Hime is generally the best quality threads because it's not frog, and it's not "something else".

I'm working on my shitpost detector so that I can prove the shitpostiness of a thread based on OP image and plot the results.

loli = list([dict({'loli':'the best'}),dict({'lolicon':'saikou'})])
print('{}'.format(*loli))
forgot the code ORZ

Thats genious idea! I'd also like to see time of day graph.
I'd like to contribute haha

Det kan brukes for å skrive en funksjon bare én gang i stedet for å skrive den flere ganger.

>Now that people have gotten used to it, Hime is generally the best quality threads because it's not frog, and it's not "something else".
i think it's more that it deters people like me from entering the thread. sometimes i still do it but other times i'm like "why even" and close the tab.

I'm learning Java too but I think that extends inherits everything that in a in a class and you can add more things.

So you're admitting that Hime turns away chronic shitposters like yourself?

愚かな言語、ばか!

Hvis du vet det ikke må du lese læreboken din igjen.

yes it's no secret that i despise the trap posting

Would anyone have any use for an automated racial slur generator?

aah you again from 2 threads ago. Probably pol

CTR might be interested

Norsk er det beste språket for å diskutere programmeringsspråk.

Noverški je ruzniji njemacki! Kakvo programiranje
Pričajmo u razlicitim jezicima, tako da se bolje razumijemo jel

fuck off avatarfag

I don't speak Norsk.

Norks is best language for programming discussion...

Hvorfor?

Hodor?

For et stygt språk!

It's inheritance if you know anything about OOP

If not, think of a class Pet. A Pet has an "owner" variable and a method "feed()". class Cat extends Pet, meaning a Cat is a Pet, and inherits the properties of Pet (owner, feed()) but then may also have things unique to it (method changeLitterBox()). class Dog extends Pet too, and may have something unique like takeForWalk(). Cat and Dog are both Pets, or in Java terminology, they extend Pet.

Nei.

yes, why shoudn't it?

working on some stupid esolang ideas, because i'm too lazy to work on something meaningful.

>esolang
A Spanish programming language?

Why do we persist with such analogies when teaching OOP?

Just asking. Link?

Hablar Inglés puta
Im running out of languages i can mangle

Jeg liker ikke å skrive på engelsk.

its more fun

Why do you teach OOP?

akaribbs.mooo.com

We use analogies to get point across so you dont listen to shit like this (for haskell fags):

If F and G are adjoint functors where F is left adjoint to G than composition GoF is monad.

To make students employable, sadly.

Sure, we could teach them something else and they'd be able to pick up OOP with a couple of weeks of training, but companies don't want to train employees any more, they expect them to spring fully-formed from college. So either we teach them OOP (instead of something more useful, transferable, and reusable) or they lose out to the kids who went to a school that taught OOP instead of theory.

Strawman.

You can teach monads without going into category theory and also without using bad analogies.

he wasn't alone, though

I'm not really seeing what I did wrong and I don't really understand what the terminal is telling me. I tried to implement the define line in an earlier example instead of the one the book was giving me as sort of an extra practice.

Anybody wanna help me out?

Eh?

OOP belongs in the LOO. All that's necessary is POD inheritance and generic functions.
(defclass pet () (owner))
(defclass cat (pet) ())
(defclass dog (pet) ())

(defmethod feed ((p pet))
;; shit
)
(defmethod change-litter-box ((c cat))
;; shit
)
(defmethod take-for-walk ((d dog))
;; shit
)

It looks nice now, last time i checked it didnt have css. Going through your github now

They were trying to bind your state. The Masketta Monad.

>int 0, 300, 20
That's what the int LOWER, UPPER, STEP statement is converted to.
Learn to preprocessor directives and switch to C programming a modern approach.

What the fuck is that DE

>56749243
South american here...

I'm learning Haskell and I'd like to know if I understand Monads
English isn't my native language so...

Monads are just an abstraction. You want to do composition with impure functions so you have Mx
so the bind function takes:(a -> Ma) -> and (a -> Mb) and returns Mb
but you only use Ma -> (a -> Mb) -> Mb
in the end it's just a way to glue the two functions together and the explanation is hard because is very abstract. am I right?

He tries to force this meme every thread

>South american here...
Aprende un lenguaje que te pueda permitir obtener un empleo, en serio Haskell es un lenguaje meme. Incluso yo tuve dejar de utilizar C y Sepples para poder ser empleable en un futuro.

first message is just a warning

int LOWER, UPPER, STEP is declaring new variables, but you already assigned values to these names with the #define lines. What actually happens with #define is that LOWER, UPPER, and STEP are replaced by what you defined these as, so the statement is actually int 0, 300, 20;/code] which is of course invalid.

turn line number on in g edit. Or just get CodeBlocks.

Here is how i define my constants:
#define PORTNUM 2300
#define BUFSIZE 12000
#define KEYSIZE 16

and shit works.

#define is a macro. you're telling the preprocessor to replace every LOWER in your .c file with 0.
now int LOWER actually becomes int 0, which is not a valid identifier.
in your case you don't actually need line 16.

FUCK, OF COURSE! damn I feel like an idiot. Thanks a lot man. Also, I'd switch but man, all I've done since trying to start learning is switching books and things. I don't really want to switch again. I'll take a look at it though. Thanks again.

DE?

Go back to pol, we don't need your racism around here. Racism is bannable in this board and any board other than your containment board, stormtard.

>I don't really want to switch again. I'll take a look at it though
I really recommend it, K&R teachs you how to program in C. The other book teachs you how to program. When I read it things started to make sense.

Não acho que C seja o melhor exemplo se você quer falar sobre empregos.

Sorry, Meu espanhol é fraco. Entendi mal, achei que você estava fazendo propaganda do C.

shot in the dark here but probably because it's simple and expresses the concept

>all oop is enterprise-style oop
nice pic you meme loving fuck

huehuehue

>>all oop is enterprise-style oop
>nice pic you meme loving fuck
I guarantee you don't know what OOP is
All you know is enterprise "OOP"

System.out.fuckmyshitupfam

You know that is a big problem I had for a while. I didn't know what a compiler was or how to do it till I googled it. The book just glossed over that important part.

I'll definitely pick it up then, its not often an user is adamant about his recommendation.

What kind of sick fuck asks a man to hold up his deformed child and kiss it for a photo op.

You can tell he doesn't fucking want it.

Quit your racism poltard. Out with you now. Reported for off topic racism.

>Monads are just an abstraction.
Yes.

>You want to do composition with impure functions
Monads are not related to impurity in Haskell.

>so you have Mx
Okay - M is a type constructor.

>so the bind function takes:(a -> Ma) -> and (a -> Mb) and returns Mb
I think you might be confusing bind and return here.

return has type (a -> M a), i.e. for any type a, it will take a value of type a and return you a value of type M a.

bind has type (Ma -> (a -> Mb) -> Mb), i.e. for any types a and b, it will take a value of type Ma, a function of type (a -> Mb), and give you back something of type Mb.

>in the end it's just a way to glue the two functions together
Roughly, yes. It lets you do it without having to 'look inside' M. This is why monads are needed to sequence IO actions in Haskell, because you can't look inside IO.

It's not just useful for IO, though - there are lots of other type constructors that you can use as monads. An example is Option. If you have a series of functions of type (a -> Option b), (b -> Option c), etc. then you can use bind to compose them together. If any of them returns None, then the result will return None.

>and the explanation is hard because is very abstract.
I think you're right. It's a concept that's very alien to someone coming from a language like C or Java. You have to get your head around both typeclasses and higher-kinded types to be able to do something as simple as a program that asks your name and then says hello.

You might wonder why put these things in a typeclass. The real power comes from being able to write functions that work on *any* monad, and yet to extend them to a new type constructor you only need to implement bind and return.

what? that's my line

>>Cred Forums is the direction, retard.

DE = desktop environment

Thank you. My little understanding came from trying some haskell and watching this video.

youtube.com/watch?v=ZhuHCtR3xq8

did you misunderstand me or do you have it backwards? the people who unironically repost that pic never actually understand oop and think that the retarded clusterfuck enterprise kind of oop it parodies is the only kind of oop

need a nickname for a programming competition

GO!

public class BrendanFraser {
public static void main( String[] args) {
new BrendanFraser().getShit().fuckUp( Shit.Types.JUST);
}

private Shit shit;

public BrendanFraser() {
setShit( Shit.Types.ALIMONY);
}

public Shit getShit() {
return shit;
}

public void setShit( Shit shit) {
this.shit = shit;
}

class Shit {
enum Types {
JUST, ALIMONY
}

void fuckUp( Shit.Types type) {
if ( type == Types.JUST ) {
System.out.println( "JUST FUCK MY SHIT UP");
}
}
}
}

maki4life

I guarantee you don't know what real OOP is, you only know the modern "OOP" that's used in enterprise, and that's why you're in no position to say this picture is about people who don't know real OOP. Your entire complaint is that they're taking it more seriously then you do.

texasenfuego

>I guarantee you don't know what real OOP is, you only know the modern "OOP" that's used in enterprise, and that's why you're in no position to say this picture is about people who don't know real OOP.

why don't you enlighten me then?

Sorry Sir but no compile.

Actually Java has anonymous classes and lambda expressions, just have a look at their Java docs

Can you email me the solution, Sir?

my email is: [email protected]

Thank you, Sir

What most people call OOP is just C with Classes. Java, C#, C++ are examples of this.
Design patterns, for instance, exist to remedy issues with "OOP" (C with Classes).
Though there are some miscallaneous "design patterns" that are actually just principles and not really patterns.
C with Classes is the basis for "multi-paradigm" languages (again, not really multi-paradigm either).

In a way, monads are a way to avoid repeating yourself. Consider the following code:

newtype Error = Error String

f :: a0 -> Either Error a1
g :: a1 -> Either Error a2
h :: a2 -> Either Error a3

-- without monads
composed :: a0 -> Either Error a3
composed a0 =
a3
where a1 = f a0
where a2 = case a1 of {Left e -> Left e; Right a -> g a}
where a3 = case a2 of {Left e -> Left e; Right a -> h a} -- have to choose whether to short-circuit or proceed every time

-- with monads
composed :: a0 -> Either Error a3
composed a0 = (f a0) >>= g >>= h -- bind takes care of choosing whether to short-circuit or proceed

composed = f >=> g >=> h

All in good time. I wanted to stick with the fundamentals for now.

but >=> is LITERALLY the operator for chaining those together

Yes, post source

Yes, but in Haskell, monads are defined in terms of >>= and return. I think it's better to get comfortable with those before branching out into additional combinators.

>=> is far more natural for this situation

4.0.3 apparently

I'm just making 2D games. No 3rd party engine

Remembered i have github repo, went to check it. Of all shit i made over last year i comited only 2 simple command line tools in C. I always used git for local vcs but obviously i never actually pushed those...
Good thing i formatted my drive...

>C++
>just C with Classes
it's not 1998 anymore.

Yes, let's teach people Kleisli arrows before they're comfortable with bind and return.

What the fuck are you babbling about you stupid fucking frogposter? We're not talking about every single part of C++

Kleisli arrows are simpler than bind

Oh, and with Control.Category imported (and prelude (.) hidden)

composed f g h = runKleisli . Kleisli f . Kleisli g . Kleisli h

uh... are you sure we don't have the same sentiment? i'm saying that, if that image wasn't originally just a joke, as it may well have been given the level of exaggeration, a lot of people seem to take it seriously (as in they interpret the right side of the image as being an accurate depiction of *all* oop, as opposed to just an exaggerated depiction of specifically an enterprise style of shitty oop), despite really knowing little to nothing about oop

So use kleisli when you want to compose monad functions?

Im almost positive there is somthing wrong with my math order here. Its a program that is supposed
calculate square roots. The answer im supposed to get is rootOne :: 1.00 and rootTwo :: 0.60. This is java btw.

No, we don't.
Actual OOP is dumb as a programming paradigm
"OOP" is dumb and not really OOP

...

oh okay never mind you're just retarded

>-

so if
f >>= x = f x
what is

(f a0) >>= g = ??

Is that JCreator?

>I'm just making 2D games. No 3rd party engine
ah, cool. that's the way to go, you'll learn a lot more that way

they aren't the same f, and you should use different names

x >>= f is a better choice of variable names
x is a monadic value (m a), f is a function from a regular value to a monadic value (a -> m b)

(f a) >>= g is just

x >>= g
where x = f a

Its what the make us use..is there a problem?

Will he make a good game and get rich tough?

and f >>= x is not f x

At what point can I say to people "I'm a programmer," if they ask me what I do?

I can make crappy 2D games in java and android. I'm currently working on my first potentially non-crappy game.

I can't tell at which point I go from sounding like "i'm in anonimous and i'm a l33t hacker," to someone with a respectable understanding.

I don't want to appear jobless to anyone who asks. I want to look as if, despite not currently earning money, I am working on it.

Explain what monads are

so
m x >>= f = f x

?

No

yeah, i saw. you have no idea what you're talking about and your semantics are shitty at that. you clearly don't really know what oop, design patterns, or multi-paradigm mean, but you're obviously satisfied making confident assumptions about them based on cursory knowledge at best. keep it up champ

Despite googling it just now, I still have no idea.

I should just kill myself.

Sure, I don't agree with you, and I'm not talking fondly of your favourite bullshit, so I must be wrong.
Well done user.

argh attempt no 3.

bind takes monadic value, function from normal value to monadic, applies first monadic value to function and returns new monadic value?

I want to make a program that:
1) I open it with a shortcut.
2) It asks for a youtube link input.
3) I press enter.
4) It reformats it to:
youtube-dl --format "bestvideo+bestaudio/best" [LINK HERE]
5) Then enters that into cmd.

What's the easier programming language to do this in?... please respond

you could do that even in assambler. Any language

>What's the easier programming language to do this in?
Python and I fucking despise this language.

C

its literally this:
int main(){
string foo;
cin >>foo;
system("youtube-dl " + foo);
return 0;
}

import os
link = raw_input(': ')
#import subprocess
#subprocess.Popen(['youtube-dl', '-f', 'bestformat+bestaudio', link]).wait()

os.system('youtube-dl -f bestvideo+bestaudio/best %s"%link)

Just write a damn shell script.
#/bin/sh
youtube-dl --format "bestvideo+bestaudio/best" $1
chmod 744 script.sh
run it as ./script.sh [LINK HERE]

I'll begin now the analysis of the performance of reading input and string concatenation in various languages in different paradigms. I will start with the Lisp family and move on to Haskell and see how it goes. I will of course also consider the possibility of creating a domain specific language to tackle the issue.
Please expect my reply this weekend...

Regards,
an expert programmer

$ nano .bashrc
alias whatever='youtube-dl -f best+best'

Can a malicious program harm your computer if you only run make but not make install?

youtube-dl -F url then pick them you'reself.

Yeah, you don't understand how make works. RTFM.

okeilabidavaičau

only if you run $sudo make

Okay, because I want to download some libre programs and compile them in my home folder. I was just wondering what's the worst damage that can be done if it happened to be malicious.

still can't understand how to unpack a list that contains dicts into a string format and show as many items the list has stored, without doing some ugly function that joins '{ }' into a string for later in python3

If it's open source the likelihood that it's malicious is 0. And if you are that worried, read the source.

What. Explain it better.

mfw all jobs in the industry ask for java or C# skills... tfw I spent 3 years learning C++ by my own and it didn't worth shit...

anime

Okay i suck at programming and am learning java. How the fuck do I take user inputted numbers and add them to an array? Like what im looking for in Python would be
map (int,raw_input ().split ())

t. mad google

Scanner sc = new Scanner(System.in);
for(int i = 0; i

docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html
You can figure it out from there hopefully.

soundcloud.com/hyqxyz/monad

What is the hardest programming language?
Writing a program in which one of them is the highest challange?
If I wanted to impress you with my programming skills, what would it take to program in what language?

en.wikipedia.org/wiki/Malbolge

do a chris sawyer and write a game in x86 ASM

How has no one noticed it yet.

loli = list([dict({'loli':'the best'}),dict({'lolicon':'saikou'})])
print('{}'.format(*loli))

That's a myth...

chrissawyergames.com/faq3.htm
He wouldn't lie about his accomplishments, now would he.

c++ homework, supposed to implement a stack with a linked list and keep track of the minimum int in the stack, need help

undeserved trips, go make your homework yourself.

eat shit fag, everyone starts somewhere, i have the whole stack implemented and working i just can't get the getmin working

That only prints {'loli':'the best'}. If you want it print all the elements of all the dicts joined, then do
print({k:v for k,v in d.items() for d in lolilist})

write a function to do what you want not that i understand what that thing is, just write a function that returns a stirng
like a __str__(self) sort of thing
ignore last part if you have no idea what it is

Maybe the hardest language that has a point to using it? Assembly perhaps?

keep a pointer to the node that containts the least element and update as inserts/deletes happen

after your first insert Node* min_ptr will point at the head

ya, exactly what i wanted all the elements thanks.
even tho its giving me d is not defined, i understand now many thanks

Is it a common thing for these pics to go unnoticed in these threads?

It's kinda funny.

you sick fuck stop attention attracting with those retarded picturs, trying to trigger people

you probably should have mentioned that
this happens on stackexchange a lot: i start carefully leading someone down the road toward a solution and then they reply "why are you telling me this i did this part already"

Maybe I'm too far gone, but assembly is easy to understand for me. I can't really understand the high-level procedural languages. Their attempt to mask human logic onto computer logic is awful IMO and unintuitive. I can only program in assembly and functional styles anymore.

link = input("Enter Youtube link:")
cmdline = 'youtube-dl --format "bestaudio+bestvideo/best" '+link
print (cmdline)

How do I get a .py file to enter "cmdline" into cmd in windows?

what are we supposed to do about it?
they don't know shame

1.assembly is human logic
2.high level languages are assembly
3.not judging your choice of language

I've tried to do that but for some reason it only stores the first number pushed into the stack
sorry lad, my issue is in my push and pop functions i know that, just don't know how to implement the checks


void push(int i)
{
Node *temp = new Node(i);
temp->next = top;
top = temp;
}
int pop()
{
if(top !=nullptr)
{
Node *temp = top;
top = top->next;
int d= temp->data;
delete temp;
return d;
}
else
return -1;
}

>for some reason
the reason is you wrote it wrong

that's how you are supposed to do it, try harder

youtube-dl does best by default

For some reason if i call this function from my main, the w and h get passed as 1 instead of whatever default value i put in the declaration.

void drawFilledRect(SDL_Renderer *ren, float x, float y, int w=50, int h=50, bool fixed=false);

What could cause this?
If I call them from another cpp file it works correctly.

i don't see anything relating to the minimum. what did you try?

I took it out, but this is what I have for my push, not sure if I'm on the right track or what
void push(int i)
{
if(top != nullptr)
{
Node *temp = new Node(i);
temp->next = top;
top = temp;
min = top->data;
}
else if(inext = top;
top = temp;
}
}

use fucking code tags boi
this is unreadable.

I think my record for making a game in x86 asm was 4 hours

Pictured: that game

void push(int i)
{
if(top != nullptr)
{
Node *temp = new Node(i);
temp->next = top;
top = temp;
min = top->data;
}
else if(inext = top;
top = temp;
}
}

there are issues. let's walk through the logic
if the stack isn't empty, you push i on top and set min=i. say your stack is just a single number 2, so min ought to be 2. then i push on 1 and the stack is 1 -> 2. what should min be now? what does your code actually do?

i only like oppai loli

i fucked up. push 3 on there. i always think about maximizing because i'm a positive person

the code is supposed be a stack that takes some ints and can return the minimum int

this answers neither of my questions user

Anyone here expert at make/gcc stuff related to Linux kernels? I have this problem:

superuser.com/questions/1101134/fedora-24-no-build-include-try-to-generate-autoconf-h

And don't know what to do.

Oh, and actual code snippet just in case you need to speedcode in asm:

; reset some stuff
game_reset:
mov ax,0x2000
mov es,ax

mov ax,[score]
mov [lastscore],ax
mov cx,ENT_COUNT
mov bx,entities
lp_rstents:
mov word [bx+ent_type],0
add bx,8
loop lp_rstents

mov word [plr_x], 160-4
mov word [plr_y], 180-8
mov word [plr_vy], 0
mov word [score], 0x0000
mov byte [keys], 0
mov byte [ticks], 0

why would it trigger people? it's a well done picture. the artist is very talented.

I just need to have the program enter the cmdline in cmd now. Any tips? I guess I can't just use the string name.

I found the problem, the bool fixed should go before w and h or else you can't do
drawFilledRect(ren, 0, 0, true);

tkSimpleDialog.

show it to any non-japanophile weeb and they'd tell you it's drawn cp or whatever

anyway my point is that in the example i gave your program will say that when the stack is 3 -> 2 the min is 3. your first block always assumes that i should be the new min and that's definitely not what you want
so include some more logic to decide whether or not min should be replaced
the "else if" confuses me too. you only end up there if the stack is empty and then there's really nothing to test for. it should be clear what to do with top and min in this case

with this pretty much understood that's it can't be done, gonna have to do it the ugly way

Explain to me the ternary operator. Why or when would i want to use it onstead of a simple if-else?

I've used it a couple of times in school project, just for the xp, but everytime people have gone "what the fuck is that?i have no idea what's going on here". It seems that it only makes code harder to read.

stackoverflow.com/questions/38987/how-to-merge-two-python-dictionaries-in-a-single-expression

It's baggage from systems where memory was scarce, so they tried to make statements very succinct.
Nowadays it's still useful, for example where do you want a simple assignation based on a condition, because sometimes clarity is often achieved through brevity.

>the ternary operator
?: is A ternary operator, the conditional expression

As its name implies in languages like C it is an expression, rather than just a statement like if-else, so it can be used in other expressions, for example
a = b ? c : d

you could not do
a = if (b) { c; } else { d; };
in C since if is a statement, not an expression, it would have to be
if (b) {
a = c;
} else {
a = d;
}

otherwise, its not really better or worse than an if-else, simply shorter, which can sometimes be a plus, but as you mention can also sometimes be a negative.

Sometimes, you need to conditionally assign a variable.
unsigned i;
if (!found)
i = strlen(str);
else
i = found - str;
This is so common that they streamlined conditional assignment.
unsigned i = (!found) ? strlen(str) ? found - str; is much simpler.

Do I need any special specs or not to program and compile/debug shit or not? I've got an Atom netbook running Manjaro and this laptop

Is there anything more exciting than watching text scroll by rapidly in the terminal while compiling?

Watching your program work correctly the first time after writing 100+ lines of code with no testing.

Are there other ternary operators?

Depends, how fast do you want it to go?

I've compiled shit on a 266MHz Celeron w/ 128MB of RAM and less disk space than you have RAM and it took probably about 15 seconds to compile a program which used Allegro 4

You'll be fine

Big fan of the Pepe OPs, hope we see more.

I should probably add this was using DJGPP on FreeDOS

For comparison, a raspi1 takes about the same length of time to compile shit

Done that I think at least twice, feels good

My best achievement however was implementing closures in C by generating x86 machine code on the fly and it worked fucking perfectly the first time

Ternary operator is really the wrong term for it, as it describes the operator as having 3 elements.
The ?: "conditional operator" is usually the only ternary operator in the language, so everyone calls it that.

Nah, that's default mode. Watching your program not working after writing 100+ lines with no testing is gutting, though.

What's VPN should I use famalams?

HideMyAss?

No, you brought that on yourself for not testing.

Not in common usage in programming languages, but more generally in mathematics yes

Sure. Still feels bad man. Especially when you just write boilerplate seters and geters.

Oh I see.
You're just cargo culting.

Hey i'm trying to learn C. I've written this program that asks the user to input an integer, then stores the integer and prints it to the screen.
#include
#include

int main()
{
int num;
printf("Please enter a number: ");
scanf("%d", &num);
printf("You chose the number: %d", num);
return 0;
}

What if I wanted to allow the user to input any number they wanted? such as a negative or decimal. I know I would use a double? Would I just allocate space for a double n and add a "%f" to my scanf? Help please.

Also what supplements do you guys recommend for learning C? My textbook is kinda awful so far and I believe it only gets worse.

>but more generally in mathematics yes
Like?

Oops meant to leave my question outside the code tag

This is /dpt/, not /sqt/ or /fglt/, ask there.

>You're just cargo culting.
What?

No legitimate programming methodology requires the use of setters and getters unless you're writing a library with an unchanging public interface, like an API.

>What if I wanted to allow the user to input any number they wanted?
You would probably wanna read the string, and use several functions to determine if the string is a int, or a float.

can you show me an example sensei. I know what you mean about creating functions to check, I'm just not sure how to go about it exactly

Why not just read a float instead of an int?

But that's what they told us to do in school.

Don't fall for the OOP meme.

would any of you be interested in reading some math-heavy but otherwise friendly articles on machine learning aka meme science?
i'm trying to figure out if there's anything interesting. the notes are mostly for a friend but it would be fun to get more eyes on it

it's not clear to me what the exact definition of ternary should be. i think the thing that makes sense is "function with three arguments". that makes it seem completely dull, which it is
i wrote down M_{g,n}(X) a lot today. g and n are nonnegative integers and X is a geometric object. i need all three of those inputs

I haven't programmed C in like two years, but you can do this:
>Read the string
>if the first character is the "-" then is a negative number
>if all the next characters aren't letters (aka doesn't contains a point) and are valid digits then it's a int (check for overflows)
>if all the next characters aren't letters but contains a point character then it's a float.
You can work with that I guess, maybe there's a formatter string to do this but I can't remember.
Because the scanf will read the buffer? Leaving nothing left to read?

You're a victim of the "college as job training" school of thought.
Enterprise now dictates what is taught in programming classes since no company is willing to train people anymore.
If some shitty paradigm like OOP becomes popular, classes will teach it, even if they have no time to teach the theory and fundamentals that would otherwise be required to understand OOP.
This is why you have tons of graduates who literally CANNOT COUNT DOWN FROM 700 in a FOR LOOP because it wasn't explicitly taught to them in a formal class.

Search falcon's trip if you don't believe me.

No, I don't like those generals.

Thanks for the suggestion though.

Again, lads. What VPN should I use?

But that's not really an operator, is it?

You do know that scanf's %d will automatically accept - signs?
If you want decimal points, use %f and a double argument.

It's a little late. I've already been indoctrinated.

>use %f and a double argument
Small correction, after looking at the man page:
%f for float.
%lf for double.

Operators really just represent functions (in the mathematical sense).

i don't see it as a meaningful distinction i guess. it's all just syntax
what about tensors, then? u,v,w vectors form u (x) v (x) w

You can view everything in programming (including and especially operators) as functions.

I got a lot of travel agencies.

what do you listen to while programming

youtu.be/Qpoy9iIi5ok

Does this look okay for putting in a CMakeLists.txt?

if (WIN32)
# We are cross compiling
if (UNIX)
set(UNIX FALSE)
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()

# Ensure that if we are compiling on Windows, that it is quite clear
# that MSVC will NOT be used
set(MSVC FALSE)
set(MINGW TRUE)

set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
endif()

I expected too much from the average user of Cred Forums.
rbt.asia/g/thread/S56718622

youtube.com/watch?v=KbNXnxwMOqU

I use BTGuard.

Looks fine. What's supposed to be wrong with it?

why do you need one

rbt.asia/g/thread/S56718622#p56721877

Falcon talks about how he found a dev with 4 years experience who couldn't count down from 700 with a loop.

kpop
macross soundtrack
nightcore youtube videos with lots of anime boobs

>kpop
based

Too damn cute and purdy I want a blowjob from her, dem purdy lips

lately im more into the macross soundtrack tbch

youtube.com/watch?v=5mzsD2rfR94

Why do so many kpop girls put stick-on gemstones under their eyelids?
It makes them look like extraterrestrial creeps.
Also it looks uncomfortable as fuck.

they dont the makeup artists employed by their agency do it

Not sure. I'm new to CMake, so I'm trying to make sure I'm not getting any bad practices in. Some guides I've read suggest not manually setting the CMAKE_C_COMPILER variables, and instead relying on the CC variable in your shell, but the problem is that on Windows, that variable does not exist! So if I were compiling from a Windows host to a Windows target, the result would be... gross.

What are you actually working on, anyway?

>give up on my homework assignment 2 days ago after hitting a brick wall 75% through
>the instructions look like jibberish, i can understand the words but they make no sense
>come back today
>makes perfect sense

After seeing this:

reddit.com/r/unitedkingdom/comments/53y1wi/a_redditor_was_arrested_and_fined_for_an/

I thought I'd start using a VPN to be safe.

What's wrong with this? I started java today
public class Mileage
{
public static void main (String args[])
{
Scanner scan = new Scanner(System.in);
//Stating that the program will calculate gas mileage
System.out.println("This program will calculate gas mileage.");
//Asks the user for how many miles they drive
System.out.println("How many miles were driven? Enter only numbers.");
//Declaring miles as a variable and assigning it to the next int inputted
int miles = scan.nextInt();
//Telling the user the miles they drove
System.out.println("You drive " + miles + " miles.");
//Getting the gas price
System.out.println("And how much per gallon is gas? Enter only numbers.");
//Declaring gas as a variable and assigning it to the next float inputted
float gas = scan.nextFloat();
//Telling the user the gas price they inputted
System.out.println("You pay " + gas + " per gallon for gas.");
//Dividing miles drove by the price of gas to get their miles per gallon
float mileage = (miles / gas);
//Telling the user their miles per gallon
System.out.println("You get " + mileage + " miles per gallon.");
}

Britbongs are so cucked.

Is it worth writing a complex makefile to conditionally recompile object files?

Would using the $^ $< macros be portable in any version of make?

don't think u understood, but it's ok thanks for trying to help

Nothing right now. Just learning CMake for the hell of it, and wanting to see if I can make a universal CMake file for most of my uses.

need to import java.util.Scanner; at the top to make Scanner visible.

I want to make something to help me organize my doujinshi and lewds folder. Any suggestion?

Nah we voted for Brexit and the majority of us support free speech, parliamentary democracy is a pain in the arse tbqh.

Your comments provide redundant information.

>Is it worth writing a complex makefile to conditionally recompile object files?
Unless you have millions of lines of templated C++ code, not really.
Code up to a couple tens of thousands of lines should be instant builds even if you do full rebuilds every time, trying to use some fancy build system is just likely to slow that down if anything.

Now all I have to do is make a .bat program that opens my .py program as a desktop shortcut.

That's going to be easy right?... right? )': [spoiler]how do you guys do this all day?[/spoiler]

you are dividing a float into an int. use a double instead of a float.

You just need to get your guns back, and you'll be all set.

Nigel Farage is one of my heroes.

how about making just a bat
set /p LINK=
youtube-dl --format "bestvideo+bestaudio/best" %LINK%

disregard this comment. it works, just add the import.

>work on a project for a few months
>finally finish the toughest parts and get everything working perfectly
>only the gui left to implement
>lose all motivation

fuck

Guide programming is fucking boring. Always do that first.

I don't know why yours worked but the other's didn't.

I love you.

i believe u forgot --format or -f before the "bestvideo+bestaudio/best" with the ones that didn't work

>about to make a pull request
>check recent commits
>pony avatar
folder deleted, repo unstarred

When does a binary tree become more efficient than a switch case? I am dumb and can't into computational complexity.

You're doing God's work user
I hope you do the same to frogs

>Comparing a data structure with a programming statement
What?

If you mean a C switch, then it doesn't, ever.
A c switch can be compiled to a jump table which is O(1), and a single pointer dereference meaning the time constant is even lower than for a binary tree to do one jump.

but of course is completely unfeasible in many situations for many reasons

I have a quick question guys, what does this mean?

for (--index; index >= 0; --index )

I am asking on the first part[the part where the loop starts(--index)]. Does that mean that the loop starts at the end of "index"? Never seen a for loop start like that, so I am a bit confused.

--index means index = index - 1

It just means the first thing you do when entering the loop is decrementing index.

for (initialization; termination; increment) {
statement(s)
}

The initialization expression initializes the loop; it's executed once, as the loop begins.

When the termination expression evaluates to false, the loop terminates.

The increment expression is invoked after each iteration through the loop; it is perfectly acceptable for this expression to increment or decrement a value.

Thanks, it's for a morse code encoder so I'm not sure which will be better.

Use an array

Pre-steps index once before the loop starts because I'm guessing index is currently at 'one-past-the-end' (like an array of length 10, and index is 10 currently but 9 is of course the last valid index so you need to set it to 9 if you're gonna access array[index] in the loop).

new

google python subproccess

Thanks anons, now I truly understand the program. I wish one day to be as good of a programmer as you guys.

>71 posters
>324 posts

I think so