/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/majestrate/XD
stackoverflow.com/a/11822850/5132608
twitter.com/NSFWRedditGif

First for (giving her the) D

Would you (((pair program))) with a titty monster?

i'm not a homo but i was going to say "no because i'm a homo" for keks
i then realized
do you think when homos are forced into straightish situations they have the same feelings about it as straights do when the situation turns too gay
like
"ew that's fucking gay"
except they're the homo instead
so it's like
"ew that's fucking straight"
like
hot girl showing too much tit
the faggot: "wow put those away you perv there might be children watching"
steamy lesbian makeout
faggot: "gross get a room you two"

Yes, she can sit on my lap and type while I sniff her hair

I think most queers just say "hahahaha honey i ain't no jive ass nigga" during those situations

>i'm not a homo but i was going to say "no because i'm a homo" for keks
>i then realized
>do you think when homos are forced into straightish situations they have the same feelings about it as straights do when the situation turns too gay
>like
>"ew that's fucking gay"
>except they're the homo instead
>so it's like
>"ew that's fucking straight"
>like
>hot girl showing too much tit
>the faggot: "wow put those away you perv there might be children watching"
>steamy lesbian makeout
>faggot: "gross get a room you two"
is what homos think in that situation

Here's my kode from another thread. Guess what it does.
procedure convert(n, r)
res := 0
reverse(n) ? while res +:= r ^ (&pos - 1) * move(1)
return res
end

The language is Icon.

Daily reminder Rust 1.20 is out, don't forget to `rustup update`, guys and gals!

Dumb akariposter

Is this good?
def doble(n):
n=int(n)*2
print("That number's doble is "+str(n))
while True:
print("A number.")
doble(input(""))

Dumb frogposter

>Are there any alternatives to RDBMS that are also RDBMS?
Gee, I wonder.

Community platform.

QUESTION:
Are there any alternatives to traditional SQL relational databases
which are just as fast, lets you query data by relations
and also support transactions?

>says teh frogposter

Literally

Ai-chan = Kouhai-chan > *

Yeah I know, but I did add "SQL". So there.

There's a lot of alternatives, key value stores and what not, and maybe they're great, but they lack some of the amazing features I can find with e.g postgres.

I have over 100,000 rep on stackoverflow. how easy should it be for me to get another job? I'm bored at my current one.

>What are you working on, Sup Forums?
official /dpt/ ultimate SoKoBan. finished the level checker. will now implement the game-play logic, then the gui and game rendering. wish me gambatte.

>mentioning the word frogposter
Dumb frogposter

MongoDB ofc.

i just noticed you casually and subtly suggested i'm a homo there
well played sir

>Guess what it does.
>The language is Icon.
why are you requesting an impossible task of us

make an AI for it

Return won't work, the process on a thread just keeps going until it finishes. Thanks for help anyway.

If it was a language everybody knows this would be trivial.

not him but im pretty sure there's a way to terminate those threads
check the docs on the python site if you havent

You could have 0 rep on stackoverflow and it wouldn't change anything.

Nobody cares about some meaningless number on some helpdesk site unless you're applying to be some kind of management position in your area of expertise.

Not so.
Icon's semantics are fundamentally counterintuitive.

sauce?

kek. resolving sokoban is PSPACE (harder than NP complete)

>some kind of management position
that seems like it would be an improvement desu

no 'n' must be converted to a number then to binary then to string then you add a "0" then you convert it back to base 10 (string) then to an int and then you print it like you did.

It's pretty comfy once you've stepped into the void. I like how everything is a statement, failing, generators.

oh
didnt know

u dont need to fully resolve it though?
surely there's approximation algos

Good input. Interesting chart.

gross m9

github.com/majestrate/XD

I added an sftp storage driver to my i2p bittorrent client.
I have no idea if it works or not :+DDDDD

>XD
fuck off

>asspain
FUCKING FINALLY someone gets annoyed by the name, it took ages.

Looks cute

>go
>not gpl licensed
into the trash it goes.

using GPL with go would be like going to an orgy knowing you have a bad case of herpes.

It looks like the only thing you need is something in download_files() to raise an exception upon a cancel event.

How do you guys handle switching back and forth between languages? I occasionally move between python, lua, javascript and c#

for example, in some languages a boolean statement is 'True', while in others it's 'true'.

Some doesn't use semicolons to end statements. Some use :, or 'then', etc.

Do you just spend 10 minutes refreshing on basic syntax? its pretty annoying

Gonna try to find other solution. I don't want to make my downloader dependent on GUI or thread class. But I'm going to take your suggestion into account I don't find other solution. Thank you.

I do it by not having sub-average intelligence

There are languages with syntax derived from C and languages with syntax derived from BASIC. Everything else is weird shit you won't be using very often anyway (don't even mention lisp meme). Most simple mistakes are automatically fixed by good IDEs anyway.

I expected a bait response but i suppose I was wrong for having a little faith in some Sup Forumstard.

I have set of letters and numbers. I need to exit this loop when it encounters a number.
do {
scanf(" %c", &record);
printf("%c", record);
} while (record == 'H' || record == 'O' || record == 'w' || record == 'S' || record == 'P');

I feel like I tried putting everything in while condition but this loop just prints everything, even numbers and then stuck printing last letter.

It's not a bait response.
Most languages are fundamentally the same, their only difference is cosmetic.
If you actually get thrown off by the fact that some languages force semicolons and others don't it means you memorized a language and not how to program.

do {
scanf("%c", &record);
printf("%c", record);
} while (!isdigit(record));

Something like this should work just fine. isdigit() is in ctype.h iirc.

>Everything else is weird shit you won't be using very often anyway
The problem is when I actually do need to use it for something simple

>Most simple mistakes are automatically fixed by good IDEs anyway.
True, but I usually only have my IDE set to the main language I'm using C#.

I use notepad++ for everything else. I should proper get a proper IDE for them.

thanks for the non-bait reponse

>don't even mention lisp meme)
lisp is very intuitive and far from a meme

You do it by having literally nothing else to occupy your narrow mind, autie.

but it's not JS therefore 50% of programmers will refuse to even consider it

>javascript monkeys are programmers
funny joke

yes, thank you

javascript isn't funny any more, please make it stop

Yeah, now try to find a job where you use lisp.
It's mostly used in academia which isn't exactly known for their extensive hiring programs.

JS is biggest pile of garbage I've ever coded in. At startup I worked I avoided anything js like a plague, to the point of moving small chunks of code to the backend which was in considerably better Java.

there are no brakes on the javascript rapetrain

wchich is weird
it has a very beautiful syntax and a very easy syntax in more than one ways
the notation is easy to read (if you exclude the ))))))) ) at the end
it's easy to write an interpreter for such a notation AND to compile it
so it's useful to understand not just for lisp
@(function main () ()
(print_num (fibs_iter 10)))


@(function fibs (n) ()
(if (< n 2)
n
(+ (fibs (- n 1)) (fibs (- n 2)))))

@(function and (arg1 arg2) () (if arg1 (if arg2 1 0) 0))

@(function fibs_iter (n) (i a b tmp)
(= i 0)
(= a 0)
(= b 1)
(while (< i n)
(begin
(print_num a)
(= tmp a)
(= a b)
(= b (+ b tmp))
(= i (+ 1 i))))
a)

code rel is something i made a compiler to gnu asm for
im not trying to find a job, programming is plan B for me and a hobby

thanks pal, actually going to look on how to convert decimal numbers to binary, the rest doesnt make much sense, specially the end

>stackoverflow.com/a/11822850/5132608
SO BASICALLY THERE IS NO WAY TO GRACEFULLY AND EASILY CANCEL DOWNLOAD IN FUCKING PYTHON
GOOD JOB GUIDO VAN ROSSUM

are all languages retarded like this? or is it just python?

use curl

see this is what happens when everyone relies on hobbyist modules and nobody wants to write any new code or at least some bindings for curl.

we warned you about python user

reminder that guido wanted to remove lambdas from python

im sure it's your code's fault
what, you cant end a thread using an if branch inside the execution of the thread itself

thread runs a function
inside function
if bad shit is happening:
.....return

lol

I thought you were gonna try checking for bCancelDownload?
Why wouldn't this work?

we told you not to do multithreading in python bro

ok, instead of launching a thread
launch a brand new process
that process can be anything you want
for example a bash script that downloads the file with curl or another python script that downloads the file
if you want to cancel, just kill the entire second process
now you have true multithreading with python

I tried. But thread MUST complete its task before it yields control to main thread, or joins with it. I could go as another user suggested putting an 'if' statement in my download_files() function for cancel signal, but that would make my code spaggeti.

There are several ways you can accomplish this.
That guy alone listed several possibilities.
Don't expect modules to hold your hand 100% of the time.

we warned you about python bro
we told you dog

IT

JUST

KEEPS

HAPPENING

Fags are niggers from the 70s? ...that explains a lot actually.

>Don't expect modules to hold your hand 100% of the time.
;_;

Someone mentioned to launch a thread in a process. Anyhow, it seems that launching another process is the only sane option (although everyone on stackoverflow recommends threading for tkinter instead of using it with processes)

python is bad because this one idiot cant figure out his trivial code

i understand it has flaws, but this is the guy's fault

>>Don't expect modules to hold your hand 100% of the time.
>muh "maude you'lls"

dont use processes, it has significant overhead and you dont need it, besides you'll have to rewrite shit you already wrote and thought about for next to 0 gain

just add an if branch inside the thread, literally who cares

That's retarded.

>just add an if branch inside the thread
he doesn't want to do that for some reason

the magic "if statement" solution doesnt work. the downloading thread is blocked waiting for the download to finish. there's no place for an if statement.

See This is the mockup of my code there's no place to put an if. I need something to interrupt a method in the middle of it's execution.

>there's no place to put an if
You mean you have no control of the source of the download_files method?

>there is significant overhead for creating a process to download a file
>significant overhead for a process
>significant overhead
>A process
>singular
Give me a fucking break you insufferable autist. Spinning off a separate process for his download is perfectly fine.

is open source a meme ? i feel like in the amount of time it takes to get involved you could have just made something yourself.

good luck making a drop-in replacement for linux yourself.

i am talking about programming for an open source project. not using software.

>in the amount of time it takes to get involved you could have just made something yourself.
What does that even mean?

I have. But as I said, it would make Downloader class dependend on GUI. But I guess I could instantiate it with self.downloading = True, and if the cancel button is pressed that it could set self.downloading = False (and then raise an exception as another user suggested). But, I'd have to pass an instance of Downaloder class to both thread and the cancel button. You may be right, it doesn't sound like much of a spagetti code after all.

>its easier to write your own kernel than to contribute to the linux kernel
wat

how do you code an event handler? do you create another thread, that loops through all the list of events and see if any of them was clicked? what if during the iteration it missed my input how do i take input in real time??

Observer pattern?

python is bad because it is a very badly designed language. this has been covered repeatedly in /dpt/ history

What's the most beautiful/elegant programming language you know?

Lispspergs need not reply

like in the amount of time it takes to read licenses, read code of conducts, sign up to a bunch of websites for communication, navigate and map out the project, decode their bug tracker system, etc,etc. its not even worth it.

normal programming you just grab and go and you get to work on exactly what you want to work on.

>OOP can't do anything without "patterns"
my sides

>he actually sits down and reads the fine points of licenses and CoCs, instead of just noting the license type and ignoring the CoC
Are you autistic or something?