/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: a templeos qa tester.jpg (250x250, 6K)

Other urls found in this thread:

swift.org/blog/swift-5-exclusivity/
myredditnudes.com/
twitter.com/AnonBabble

Where's my anime, faggot?

Blessed are those who are kind to the newbs.

>Implying Jesus isnt anime

nth for nim!

Variety is the spice of life.

If you're using Python, you're not a real programmer.

Attached: gum_consider.png (540x540, 26K)

test

The other thread isn't even at bump limit you faggot.

Python is fine for simple tasks.

Are you saying Jesus is a fictional character?

I absolutely fucking hate it, when things suddenly change. This thread is atrocious.

it's over 300.
how many posts did you want in one thread?

It spoils you and encourages laziness. When you go back to using real languages, like C, you feel like it's a worse experience.

Be responsible. Don't do Python.

still try to figure out if that
import time
primes = list(range(1, 1000000))
startTime = time.time()
#print startTime

target = 716829
max = len(primes)
min = 0

def glaxy(primes, target, max, min):
while target:
guess = (max+min)/2
#print primes[guess]
'''
if(max < min):
#print "number not in the array"
return -1
'''
if(primes[guess] < target):
min = guess + 1
guess = (max+min)/2
#print "inside min"
elif(primes[guess] > target):
max = guess - 1
guess = (max+min)/2
#print "inside max"
else:
print primes[guess]
#print "found it! " + " guess: " + str(primes[guess]) + " target: " + str(target)
break

glaxy(primes, target, max, min)
endTime = time.time()

result = endTime-startTime

print float(result)

Attached: 69b.jpg (1218x1015, 212K)

python peaked at around 2.7

Attached: bestgirl.gif (500x380, 1.1M)

page 10 you ADHD zoomer.

>you feel like it's a worse experience.
Because it is.

seppleshits on suicide watch

Attached: 1542080369037.png (682x792, 234K)

Every moment Python saves you is time you can invest in writing C type signatures.

anime is real, reeee

Attached: 1544749120880.png (538x538, 492K)

>you feel like it's a worse experience.
It is. Your lack of self-awareness is amazing.

Ditch Python2 already. Use print(stuff). And stop overwriting functions like min and max with your own variables.

>going back to school
>decent at python and perl
>degree is going to make me take Java and C#
how big of a dicking am I in for? haven't done a compiled language since I was making AOL punters in VB4

proper new

Java 9 has a REPL.
I haven't tried it.

Fuck off, retard.

Python is the most powerful programming language.

what is your goal?

im writing a program in python that takes a bunch of garbage (actually machine) bytes, converts them to ascii and outputs them to the terminal. A bunch of the characters, however, are weird whitespace characters that make formatting the output impossible.
Is there a way to enforce that each characters only takes up a width of 1, and no new lines or anything?

Attached: Screenshot from 2019-02-05 22-19-00.png (1268x741, 243K)

the easiest and most consistent route would be to just replace any non-printable characters (and ones you don't want to be printed) with a space or period, or something else to that effect

Can you detect the exotic whitespaces with string.isspace()?

do it faster than for loop

Hex editors like HxD tend to choose a character for anything that isn't a visible ascii character.

Here they chose '.'.
I don't feel strongly about what you choose. I don't like space. It's a much more common character in strings than period or one from the extended set.

Attached: HxDShotLarge.png (766x498, 36K)

What is "it?" What does glaxy mean?

i dont think isspace wil work for what im doing
i want to print EVERY character, but replace the ones that fuck with the formatting with something else
thats great and all, but how would i do that?

Lisp is the most powerful programming language.

I'm rewriting my chicken scheme FFI bindings so that they're automatically generated from lightly edited header files. I really wish I knew about this when I started writing them.

Attached: rance-reset-kalar-01-06.jpg (522x571, 52K)

is what I was talking about. You check the value of each byte, and print something else when you need to. It's not that hard.

>glaxy
it dosent mean crap
google binary search

google "ascii table" to see the first 256 characters then decide which ranges of characters you want to print and which to replace

>glaxy
It dosent mean crap
look for binary search

Your logic is pretty retarded user. Your base case should never be an else statement in recursion, that's pretty crazy to me. Isn't that some kind of weird anti-pattern>

Your base condition should be if the middle is equal to the item you are searching for.

Then if it isn't, you check if the middle is greater than the item you are searching for.
if it is you change the lowest number to be middle +1 (because middle is useless now you've checked it can't be middle)
else you change the highest number to be the middle -1

This is perhaps a bit hacky solution, but it seems to work:
"".join(["_" if "\\" in repr(chr(a)) else chr(a) for a in range(256)])

How do I stay motivated to write a decently sized program? I can't fucking do it.

Attached: 1.jpg (636x900, 223K)

what so dum about that? when all the statments are false else take over

gonna start using svn instead of git

wish me luck bois

Cute elf.

Write software you need.

stay gay

copy and paste code instead of writing reusable functions so your program will be bigger

Attached: Reset_-_gahaha.png (196x232, 74K)

a few hours of planning can save you weeks of programming

why?

clever

Just doing it can save you weeks of planning.

you have to find a balance

cunt i told you last time that binary search beats sequential every time

Except for when it doesn't.

my project has things other than code

How is that a problem with git?

I just cracked open a few .elfs and couldn't help but notice how every single one has the OS field set to System-V, rather than Linux.
So I read up on it and learned that it signifies which OS extensions are needed rather than which OS is targeted.
So, what is the Linux value for? What features does it enable?

git is a headache if you have a shit ton of assets

I've been using a git with almost 20 gigabytes and 12 000 files for a few years now. There's only some megabytes of actual code.

when was the last time?
are u CIA?

but wouldn't svn be better at handing it?

#include

int main(){
int i;
for(i=1; i

Attached: 1512858627847.jpg (493x596, 53K)

I want to make a simple project to practice but I can’t find any fun app to do with Kotlin Rx and Swift Rx.
Anything you guys would like? I’ll probably upload it to the app stores for free without adds.

When in doubt, make a game.

>Make a game
I’d rather make a RxCOBOL library.

Swift 5 has a runtime borrow checker

Forgot image and link
swift.org/blog/swift-5-exclusivity/

Attached: Example2-2.png (1271x70, 36K)

Bash is the most powerful programming language

MSWLogo is the best programming language

can't spell powerful without powershell

Will I get hired in a data analyst job if I have a master's from a for-profit school? Should I just try to worm my way in with an unrelated undergrad?

You are a little baby.
Look at this.
*works flawlessly for over 50 years and triggers zoomers*

Attached: A515BEAD-CA72-4100-B53B-028E90588996.png (614x326, 11K)

>can't even draw pretty flowers

Attached: the ultimate programming language.jpg (578x541, 71K)

I can BLACKED Europe instead.
Also surely you can edit a file and save it to png to create flowers programmatically.

Attached: E40E6F8C-0A2E-4548-8910-CD182C1EA514.jpg (837x291, 66K)

Fucking cobol. Why can't you be normal?

>WHY doesn’t this use static duck types tuplas and concatenating non linear algebraic tutsudelian algorithms like my new framework?!
Because COBOL aims to work.
Get fucked zoomer.

I wonder how long it will take for jannies to remove dick pic from the archived thread
Haven't used python much but pretty sure there should be a __iscontrol__ function somewhere but be careful with this because it should counts \t and \n as controls

I could be doing better things with my life.

#include
#include

int main(int argc, char** argv) {
int rows = atoi(argv[1]);
int columns = atoi(argv[2]);
if (rows > 0 && columns > 0) {
printf("+");
for (int j = 0; j < rows; j++) {
printf("---+");
}
printf("\n");
for (int i = 0; i < columns; i++) {
printf("|");
for (int j = 0; j < rows; j++) {
printf(" |");
}
printf("\n");
printf("+");
for (int j = 0; j < rows; j++) {
printf("---+");
}
printf("\n");
}
}
}

$ ./bin 0 0
$ ./bin 0 1
$ ./bin 1 0
$ ./bin 1 1
+---+
| |
+---+
$ ./bin 1 2
+---+
| |
+---+
| |
+---+
$ ./bin 2 1
+---+---+
| | |
+---+---+
$ ./bin 8 8
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
$

a response to

>O(n2)

Attached: e.jpg (259x194, 7K)

Also I flipped rows and columns.

Disgusting.
if(i%3!=0 && i%5!=0){
printf("%d", i);
}else if(i%3==0){
printf("Fizz");
}if(i%5==0){
printf("Buzz");
}printf("\n");

What I'd do is print a +---+ and the | | | | | inside the same loop thus slashing the complexity a bit. Too tired atm to actually do it, so call me names.

Attached: 355.jpg (680x1000, 72K)

You're a retard. I'd like to see you print kn^2 characters faster than O(n^2).

define "print"

>each iteraction must print one single square
Jesus fucking Christ.

>print(n * "x") is constant time
Just shut up, retard.

>copying memory is O(1)
>dividing by some k would alter the big O class

Attached: 1548129029142.gif (543x533, 415K)

What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo.

I'm writing a medium sized Java project that uses a lot of custom types. In C I'd just put them in a header, but in Java am I required to make a new class file for each type? Assuming I don't want to put them in my main file.

>am I required to make a new class file for each type?
Yes.

You can put non-public classes in the same file.

Is it wrong to say that going trough a array list via forloop a given number of times recursively is O(N) time complexity?

It is O(k * N)iggy

It's N times the number of recursions (if dependent on N).