/dpt/ - Daily Programming Thread

What are you working on?
Previous:

Attached: 0008570294_10.jpg (500x374, 32K)

Other urls found in this thread:

en.cppreference.com/w/cpp/utility/bitset
myredditnudes.com/
twitter.com/SFWRedditImages

If the atlas has that quad at some weird angle, then you'll need to do some linear algebra perhaps.
OpenGL is pretty flexible. I'm sure you can do what you want, but it might take effort.

Trying to find a hidden message in an .mkv file. I've been working on thise for 16 hours. Fuck Lainanon they've ruined my life.

Attached: 946421fd2737c8805d5eb41e6d9cdad0940922463c7ef38f8fc8df415e9811d5.png (656x755, 39K)

Attached: sm.gif (640x480, 927K)

I am comparing two numbers represented in binary. How do I optimize this shit? Or it's just alright?
inb4 write a digital comparator
bool operator arg.bytearray[idx])
return true;
return false;
}
}

Attached: 1527213085932.png (500x577, 168K)

Like if you can get and set the uvs for each corner of your quad, then it might be something like this:
>D.uv = A.uv + (D.uv - A.uv) * 0.9
>C.uv = C.uv + (C.uv - B.uv) * 0.9
where 0.9 is whatever you want, with < 1 expanding the texture and > 1 shrinking the texture (and showing other parts of the atlas which you don't want).

why are your numbers represented in binary

That was a part of university project that went too far. Now I slowly become interested in byte fuckery.

represent your numbers as numbers and use bit shifting

>How do I optimize this shit?
Is 'bytearray' a char[] or what?

I want to suggest std::strncmp.

Just use bitshifting senpai

Yes, array of bool.

en.cppreference.com/w/cpp/utility/bitset

Initially I wanted to make imp() function through 'and', 'not' and 'or', then compare last bits and shift. Not sure if this is effective.
My add/sub/mul functions are implemented with logic operations only.

Well, I would have used this loop.

brainlet here trying to recreate something like voar (pic related)

should I learn C++ or Go for the websocket backend?

Attached: rQ4AZkQ.png (1112x718, 98K)

Go without a doubt

as someone who actually uses go and websockets i'd say C++
all of the popular websocket libs in go have horrid gc leaks because of http.Response.Body implementing io.ReadCloser

C++ is my go-to programming language that I use for most things. That being said, learn Go.

We all should have seen this coming

>using goto

Go is terrible, learn Haskell instead

dumb frogposter

can you give me a hint fot step 8? I can get the deciphering right. I think its a substitution cipher

why haven't you written a language

Neither, use Java vert.x
It's eventbus and sockjs bridge makes stuff like your pic trivial

I'm aware of bitset's existence. Yet it was a requirement to implement all binary operations by ourselves.

Quit your job, make video games

Attached: running.jpg (728x546, 47K)

>Haskell
academic wankery

Oh, in that case optimization shouldn't really matter if the point of the exercise is to demonstrate understanding of bits and bytes. I think what you had is fine if it passes all your tests.

I just change the geometry and it werks.

Attached: file.png (1922x1118, 320K)

at least Haskell is fun to program in

for you

>making indie video games
no thanks i want to be able to make money

4u2

that's impressive

Attached: ss-2018-05-27-01-29-38.png (1362x84, 11K)

It does, and prof. was surprised by seeing addition made with logic operations (as if in four-bit adder), and multiplication with shifts.
I passed, like, a more than semester ago, it just bugs me how to do a comparator.

Seal of Quality

Attached: Screenshot from 2018-05-26 19-39-55.png (584x97, 9K)

so currently beginning in python, have image information saved for each image saved in txt files.

have to convert them to csv and transpose them to make them readable for a software used by my company.

can i optimise this? that's all im asking.

oh shit forgot the pic fuck me

Attached: Screenshot from 2018-05-27 05-07-26.png (933x696, 88K)

I was at a cousin wedding.
Its 2AM fucking drunk as fuck
UwU fucking hell

would compE give me a good enough background for a masters in CS?

You've got it but it has an error which made it really hard. I ended up bruteforcing it.

yes, remove the prints, they probably slow you down by a significant amount of time if there's a lot of files

also lol I just noticed what the fuck are you doing? don't chdir + glob, the os.walk iterator gives you all the information you need you're wasting a lot of time doing that

is the type at XWW? I notice XW occurs singular but also XWW which is weird

Ignore line 5. XW and XWW makes sense once you solve it.

ah thanks knew i was duplicating somewhere but didnt know where.

thanks and also put those prints while writing the code for sanity checks. will remove those user, thanks.

also i meant as in optimizing by using some other approach other than mine? (inb4 multithreading)

still thanks man, peace.

these two things should significantly improve the performance anyway but other than that there's nothing you're doing wrong. but yeah you could use multi threading (well actually multiprocessing in Python) by first only reading the list of paths then splitting the path list and spreading the workload of transposing

thoughts on Java projects like Immutables, Google's AutoValue, or project lombok?

Attached: question cat.png (382x417, 325K)

Writing a kernel heap allocator in Rust
x86_64 assembly + Rust is pretty gud

being a vidya code monkey is even worse than being an enterprise monkey
at least enterprise pays for your soul

Can i have your attention!!!

thank you for your attention.

see

unless you love gaming and gamedev, it's much worse yeah. its one of those jobs you have to love to enjoy or else it's hell.

... anyone?

Fuck

Easier solution to automating Java boilerplate: don't use Java

umm heard of minecraft sweetie?

:f
forgive me friend im way to wasted

lol u realize its an exception and like >90% indie games fail

haha im drunk guise XD
fuck off you have to be 18 to be on this website

is this code

im 25 bruh
chill

Attached: 141711467649.png (645x729, 257K)

>it's okay everyone I'm a manchild, not an actual child

k

>takes free codes
>makes a program
>sells the program
"oh no user you can't do that"
watch me babe

im writing gay porno
garry rubbed his dick upon his crotch until it exploded into fine dust and was completely destroyed he then inserted it in to his asshole and deleted it as he whispered "delete buttock" in to his ear and his dick went null instantly with pleasure and erupted into non existence

Markov chain looking good

looks legit

Attached: 1512340048154.png (211x239, 6K)

how long until you cut your cock off?
any thoughts from someone that isnt a faggot?

use lua it has atomic objects

In opentk, it automatically renders the gamewindows at a given frequency.
is it possible to stop it from rendering automatically and make it render only when I call the render function?

I was trying to learn python as my first language in code academy, but I found out they still teach python 2 so I quit. Now I'm waiting for my copy of learning python 3 the hard way. I know this sounds like a question someone who isn't gonna be able to stick to it would ask, but out of curiosity how long did it take you to learn your first language?

I'm working on the following and the add to cart function isn't working because it adds the last instance in the list to the cart no matter what is selected, I can't think of a way to do this

items = []

#This for loop makes it very easy to extend the number of items displayed by
#changing the limit when the find_items function is run (try changing it to 20)
for item in range(len(master_list[cat])):
items.append([])
items[item].append(Label(item_frame, font=("Helvetica", 12), text=str(item + 1) + ": " + master_list[cat][item][0], relief="ridge"))
items[item].append(Label(item_frame, font=("Helvetica", 12), text=("$" + str(master_list[cat][item][1])), relief="ridge"))
items[item].append(Button(item_frame, text="Add to cart", command=lambda : add_to_cart(cat, item)))

items[item][0].grid(row=item + 2, column=0, sticky=NSEW)
items[item][1].grid(row=item + 2, column=1, sticky=NSEW)
items[item][2].grid(row=item + 2, column=2, sticky=NSEW)

Also yes that's tkinter for python, I didn't have a choice, any ideas?

Why should I use a database instead of plaintext json?

What are you doing with it?

trying to make 100k ECS entities run at 60fps. on 1 core. ;-;

A few weeks, I started with Java as well which is by and large one the harder ones

Also honestly just take the code academy course, it really guides you through it and gets you used to it step by step, if you want to move to python 3 later, the syntax is very, very similar to python 2

Just storing some basic diagnostic data (time, machine name). It will be polled once per minute, so I estimate about 113kb per day

Hey nigrets,
Brainlet here, how do I post code so it's appropriately displayed here?

...


just like this

That's a pretty light load. I would think JSON is fine for that.

[ code ] code [ / code ]

>in a scripting language
>with no dedicated gpu
>on a laptop
>celeron
>laptop is in toilet
>toilet is on roof
>roof is on floor
>i am on fire
>laptop is on fire
>house is on fire

...

Some scripting languages are pretty quick. Which one?

Why are people obsessed with node.js ?

luajit is SLOWER than c

Is it a custom ECS or some library?

nobody makes good code so i have to make my own.

bump

If it was me, I'd watch my memory access pattern really carefully. Unless you're doing super-complicated maths with each entity, I wouldn't think you'd be CPU limited, but you could easily be memory limited if you're chasing pointers or something. What is your performance at now?

100000 2d entities that are rendered as points
fps: 35
mem: 62mb
all entities are rendered always

Have you done any instrumentation / timing to see where the time is going?

its slow because luajit is slow.
i have to make a giant array of points in a system and that is what is making it slow.

i wrote some code and it feels like it's really bad and awful but it works

I'm starting to learn how to use PyQt. Is it better to just link the .py file with a .ui to create the UI, or convert the .ui file into the .py file and why?

I don't even know what language that is, but I see the word 'lambda' in there and variable capture is weird in some languages. Like, it sounds like it's capturing 'item' by reference instead of by value, so by the time the lambda is executed 'item' is the last item.

>luajit is slow
Can you put the slow parts in C / C++?

i try changing existing arrays aaaand its slower 20 fps

Yeah that's the issue, I don't know how to fix it though

Was that directed at me?