/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1558818210000.jpg (1280x720, 302K)

Other urls found in this thread:

quil.info).
drive.google.com/folderview?id=1JNjTFSMYfLJoKOWRPFAkyaMod95imSwg
news.ycombinator.com/item?id=20104173
about.gitlab.com/handbook/communication/#say-thanks.
en.wikipedia.org/wiki/Printf_format_string#Length_field
twitter.com/AnonBabble

Programming

I am retarded.

Attached: f6cad5172e2e8d44da168d71b28d04bd.gif (647x363, 650K)

Attached: 13-22-35-1559560866908.jpg (1024x777, 72K)

Been doing a lot of Processing lately, is anyone familiar with the niceties of dealing with the PApplet window? I'd like to handle them programatically but I don't know if that's possible.

Attached: kendrick_goodkid.gif (500x500, 2.54M)

>anime
You truly are

>ident-based blocks
Who thought this was a good idea?

I might be able to help. What do you want to do?

Smart people

whats wrong with it?

I've asked this before but what is the best algorithm/data structure to represent an infinite but discrete 2D grid, other than a quadtrees? A basic 2D array is not viable because the use case involves a lot of potentially empty space and resizing. It is worth mentioning that I am working in the confines of C89 but I can make it work.

Handle multiple windows from a single sketch, is that possible? Or, I guess, what's the most efficient way to have multiple windows? I know Ravenkwok did stuff in Windows but I'm working with macOS. Would that be in the quartz view layer or something?

You can put anything in an r-tree.

my brain is rotting understanding functions inside of structs and dunders in python

Attached: IMG_20190112_145124.jpg (705x705, 78K)

How many elements are going into that grid?

Because it's infinite I would use a map keyed by coordinate for a top level of chunks and then use ordinary spatial partitioning inside each chunk.

they're a horrifying hack is what they are

I've done multiple windows but I know nothing about macOS.

>my brain is rotting ... python
sasuga

whoops, mis-quoted

maybe a kd tree?

Attached: kanye_ye.gif (500x500, 1.87M)

I saw it :)

I figured the first part I think but dunders are still fuzzy concept to me

I should mention that I use a wrapper called Quil (quil.info).

float f = (float) ((new Random().nextInt(101)+50)/100)
mediaPlayer.setPlaybackParams(new PlaybackParams().setSpeed(f));

By using this my game will go from hours of music to thousands of years of music


1. write jingles of different lengths
2. Put two on at the same time
3. Modulate the speeds

With 92 jingles of an average length of 241 seconds, and combining every combination of two gives about 15 years of music from only 6.1 hours of base tunes. Then with 101 increments of speed the combinations go to 150000 years of music.

>a billion guns

Attached: wtf.jpg (540x674, 130K)

can i hear it somewhere?

forget games dude, just be a musician, you'll be rich

Dunders are plain old methods. The difference is you don't call them directly. Instead, they get called by built-in Python stuff.

Back when I learned Python, we used dunders but nobody called them that yet. They were just called methods with special names.

Can I just say what a wonderfully fast and efficient language this is?
Sure, it's ugly and bare bones, but it really gets the job done fast.

Attached: index.png (225x225, 3K)

C++ gets the job done faster.

drive.google.com/folderview?id=1JNjTFSMYfLJoKOWRPFAkyaMod95imSwg

I posted a bunch of them to Google drive to share, but I haven't finished all of them yet. Each one goes with a monster, so when they are in the field their songs play.

Attached: Screenshot_20190605-081115.png (1080x1920, 176K)

I'm starting now and didn't know about methods, maybe understanding them first will make dunders a more digestible concept. thanks!

For sure!

and C# faster again

Attached: shejudges.net.png (149x157, 41K)

Anone, I brought you some mochi since you are so hard at working on your JavaScript project you forgot to eat!

Attached: 1efa629472631318bd9b4e9c3d775fed.jpg (571x800, 71K)

Season 2 when?

Attached: b69fa6581dbd39a3684cfdf349f57f14.png (600x300, 159K)

False. A VM can never be fast.

I was just in the previous thread and no, it doesn't, it's about 20 times slower than C.

Thanks!

>copy paste code
>now the entire thing is messed up
>add a single space
>entire program breaks
That

>But muh IDE fixes it
If you need an ide and cant code in just notepad, then your language sucks

What's a named pipe? Retard-friendly explanation pls
I know what an anonymous pipe is

Those monsters look hilarious and the music surpassed my expectations. When will this gem of a game be available?

Attached: all smiles.jpg (691x724, 96K)

You should rewrite your game with Flutter.

It's a pipe that has a name associated to it.

Webdev here. Apparently I'm overpaid and no one else will hire me. What's a good coding exercise for re-learning fullstack so I can look good during interviews? I'm thinking of making a personal website but I can't seem to justify adding a Java backend to something that will basically just be a single page 'About Me Blog' simulator.

well of course, I'd assume that
But can one say that unlike an anonymous pipe, a named pipe exists even after the process creating it has terminated?

make a Jow Forums clone #6456123

aw shucks - guess I'll have to do some digging. well thanks!

Attached: flume.gif (500x500, 2.86M)

>Webdev here
Then fuck off

It's got a lot of feature-creep, but I'm reigning that in. Hopefully by the end of the year (I started learning to program last june, and I'm picking up speed as I get better at it). The main things to do are improving the UI and completing the music and any other assets.

whatever you write into the file, another process can read out of the file
it's just a pipe though, it's a kernel abstraction.

IN THEORY a VM could be even faster than a statically compiled program by adjusting the code for the needs of the moment. Your C++ compiler has no idea what happens to your program after it finishes compiling it.

Yes precisely, it won't get removed until you either explicitly remove it or restart the system.

>Your C++ compiler has no idea what happens to your program after it finishes compiling it.
Yes, it does.
-fprofile-generate
-fprofile-use

>what is profile guided optimization

There are limits to what you can predict. What if some end user only ever runs certain branches on Tuesdays? In theory, a VM (not today but someday in the future) could adjust for that and weed out all those useless branches (but only on Tuesdays).

thanks!

why do functions in the linux kernel keeps moving from file to file then it just fucking vanishes???

stuff are marked for deprecation for some time before being expunged.

>predict
PGO doesn't predict.

The virgin if(p != null)[/code/]

The chad catch(NullPointerException)

"remote working is bad because a more talented guy living at the end of the world may take my job." -- gen z larper.

Attached: doompaul.jpg (680x512, 62K)

>predict
>branches
If only there were a way to do this...

the chaddest >>=

Half the programmers I know tell me most of our their job is taking pajeet code and fixing it into something that actually works
Every big company either outsources or directly imports third world rapists on trump visa to write their code now

whats the point of removing old functions? i thought torvald is big on not breaking userspace

I have just written my first bloggpost for the company blog. Got published this morning. Feels good man.

Why not be gross and go map from int to map from int to thing?

kernelspace is not userspace.

It predicts that the way the program is used in the future will be the same way it was used during profiling, does it not?

The only way you can make a case that VMs cannot theoretically outperform statically compiled programs is by arguing that your compiler can know the future before it happens.

Make a rest service endpoint using JavaSpark. It makes Java Great Again. Also use Lombok.

no need to import them anymore. look at this comment from gitlab's ceo news.ycombinator.com/item?id=20104173
650 workers, all remote. even wrote a "communication" tutorial for people to learn to say thanks about.gitlab.com/handbook/communication/#say-thanks.

do you know what version of linux tree i should check out for LDD3? Every versions I tried will have missing something

I'm not the original user and I don't even know what LDD3 is.

the interface between user and kernel are based on system calls: you put a number into a register to invoke an operation. whatever procedure implement that operation is transparent to the user.

>you put a number into a register
No, you don't. Physical implementations of computers don't support numbers.

I AM NOT GOING TO STOP GIVING SHIT UNTIL YOU FIX GLUG OVER TIME.

Linux Device Driver 3, its a book about how to write linux drivers

Yes they do, they support ranged integers.

0 is an integer. 1 too.

Exactly.

unsigned int a = 1;
printf (" %u, %p", (unsigned int) &a, &a);

>1815603052(0x6C37E76C) 0x7FFE6C37E76C

What is %u printing? I know it's some sort of address but why doesn't it print the whole address?(missing 7FFE)

I think it's just a cheap troll, "computers only support voltages", that kind of shit

what about 2?

Because you cast it to unsigned int. It's possible that on your platform unsigned int is 4 bytes long while a pointer is 8 bytes.

The % stuff also specifies bit width (except %s), try %lu or something

thanks. Gave them unsigned long types instead. Might be because I run 64-bit

en.wikipedia.org/wiki/Printf_format_string#Length_field

c99 standard says the only safe cast between pointer and numeric value is to types: intptr_t, uintptr_t
you can then print that value with PRIdPTR, PRIuPTR from inttypes.h

%u is just unsigned int, and under windows that just gives you four bytes, while pointer addresses are 8 bytes.
I used %llu not too long ago for that.

That is only, assuming your JIT optimization gains outweigh the costs of running a VM and keeping statistics.

even going there, he would be wrong. the numbers 0 and 1 are abstract things that we represent in multiple ways like with symbols ("0" and "1"), voltages (high/low), light signals (on/off), hand's fingers, ... numbers doesn't exist themselves but theirs representations may do.

This.
JIT code has to be instrumented if you want to keep track of which branches are taken, and that introduces overhead.

What do you guys think about Code Complete? Worth reading?

I'm considering picking it up. It's also pretty well-priced for a 1000-page tech book.

Uncle Bob's trilogy is much better.

My little "wrapper" for creating variable length strings out of ordinary (fixed-size) character strings. Language is Fortran 95.

type varstring_t
character (len=1), dimension (:), allocatable :: sText
end type


!
! Convert a standard character string into a variable length string.
! Memory is allocated for the string.
!
subroutine VarStringCreate(sText, varString)
implicit none
character (len=*), intent(in) :: sText
type (varstring_t), intent(inout) :: varString

integer :: iNumChars
integer :: i

! If exists: remove old record
if (allocated(varString % sText)) then
call VarStringDelete(varString)
end if

iNumChars = len_trim(sText)
print *, 'Creating variable string of length: ', iNumChars

! Memory allocation
allocate(varString%sText(1 : iNumChars))

! Copying chars
do i = 1, iNumChars
varString%sText(i : i) = sText(i : i)
end do

end subroutine

This program doesn't compile in g++, therefore it's not programming related.
Get out.

I only use the best hardware for professional coding sessions.

Attached: 1559641072836.png (329x498, 208K)

1. It is not a complete program.
2. It compiles well in gfortran, therefore it is programming related.

>gfortran
except gfortran isn't g++, so it can't be programming related.