[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 312
Thread images: 26

File: 1481225269428.jpg (1MB, 3537x3335px) Image search: [Google]
1481225269428.jpg
1MB, 3537x3335px
What are you working on, /g/?

Old thread: >>58042656
>>
File: akari2.jpg (58KB, 514x524px) Image search: [Google]
akari2.jpg
58KB, 514x524px
First for akari-bbs!
>>
First for C
>>
>yfw tic tac toe can't be done elegantly in fp langs
>>
File: good shit.png (42KB, 508x521px) Image search: [Google]
good shit.png
42KB, 508x521px
>>58049050

Yeah, finally got it
>>
>>58049667
https://hackage.haskell.org/package/TicTacToe
>>
>>58049642
>tfw Mook changed shit with the API and killed my 4chan programm
>too lazy to fix it
>>
>>58049670
is it the same as the original or the amplitude in the midle is random?
>>
Can somebody PLEASE tell me the best build system to use for my SDL2 project. Everything i try to use with it never fucking works exactly right.
>>
Reminder:

If you want performance, use C.

If you want correctness, use Haskell.

If you want a job, use Java.
>>
>>58049676
are haskell guys too smart to be employed?
>>
>>58049735
not
>if you want menes, use Haskell
STOP LYING
>>
>>58049729
Shinji might be a whiny bitch but he is male.

>>58049733
Autotools or CMake
>>
>>58049758
>Autotools
I need something that works with Windows/Cygwin/Mac
>CMake
Probably works the least out of any build system I've tried. Can't get it to find my SDL libraries no matter what.
>>
>>58049779
Autotools works fine with mingw
>>
>>58049779
http://stackoverflow.com/questions/23850472/how-to-use-sdl2-and-sdl-image-with-cmake
>>
>>58049719
It's random.

I'm actually using Perlin Noise in the whole thing.
To increase the noise in the center I'm just multiplying the random shift by a normally distributed density factor.
>>
HAUSMEISTA!!!!
>>
>>58049779
> I need something that works with Windows/Cygwin/Mac
Even if it sounds dumb I have found that most sane way to build for windows is to crosscompile from Linux with MSYS2.
>>
>>58049676
>500 lines
>half the LOC of xmonad
>>
>>58049792
>>58049782
Well it's not Rei or Asuka

>>58049779
I have an SDL2 project using CMake that works fine. The only thing I had to do was:

target_link_libraries(${PROJECT_NAME} SDL2)
>>
What book should i read fort CLisp?
>>
>>58049858
>CLisp
feeling edgy, today?
>>
File: Desktop.png (141KB, 1920x1080px) Image search: [Google]
Desktop.png
141KB, 1920x1080px
>>58049620
Need more monitor :(
>>
File: choose your slav.jpg (196KB, 869x958px) Image search: [Google]
choose your slav.jpg
196KB, 869x958px
>>58049620
Daily programming challenge:

reply to this post, last two digits decides what you write.

write a program/script that:

>ends with an odd number -
>given your city's annual min/max temperatures from the previous year, estimate the temperature of next year by the month and display them in a neatly arranged row/column format.

>ends with an even number -
>caffeine fuels us. the recommended daily "useful" dosage of caffeine is 300 milligrams. pretend that you're not a total glutton and promise to consume only 400mg of caffeine per day, then write a script that estimates the amount of money you'd need to set aside for a month's supply of caffeine in your choice of energy drink.


>odd dubs -
>try to remember the amount of money you spent on dining out last week, then estimate the amount you'd spend on fast food next year and the percentage of income required to maintain that lifestyle.

>even dubs -
>some classical works of literature are available online for free, in plaintext format. find a book that interests you, then write a script that fetches a random quote spoken by a character in that book. a quote is a word or phrase surrounded by double quotes.

>daily challenge -
>write a program that accepts your pirated animu directory as an argument, then interactively plays the selected file in a media player of your choice.
>>
https://maniagnosis.crsr.net/2011/05/tony-morris-on-static-types.html
>>
>>58049885
im racist
>>
File: recording.gif (1MB, 505x505px) Image search: [Google]
recording.gif
1MB, 505x505px
>>58049814
>>58049670

Animated
>>
>>58049913
what window theme is that?

looks nice
>>
@58049885
>reply to this post
You're just fishing for (You)s.
>>
Is there c library with good implementation of basic allocators?
>>
File: artyom.png (346KB, 623x561px) Image search: [Google]
artyom.png
346KB, 623x561px
>>58049885
Fug, I'm Artyom.
Rolling.
>>
>>58049931
https://www.xfce-look.org/content/show.php/Rele?content=77260
>>
>>58049885
>odd dubs
main = print 0
>>
>>58049983
The C standard library
>>
>>58049866
Why is that ?
It's a great language
>>
>>58049873
Is that vim? And if so, what are your major plugins for that UI?
>>
are lisp macros just a hack

itt; what are the hackiest langs / constructs
>>
how much changes in some code is needed that I claim I wrote it myself and didnt just steal it?
>>
>>58050146
just obfsucate it, faggot
>>
>>58050146
Release it under GPL v3.
>>
>>58050146
Just change original authors name to yours and delete all comments
>>
>>58050156
it's open source

>>58050173
it's apache 2.0. the problem is not that the code I want to use isnt open source but it's one of those "post this whole license file" licence
>>
>>58049896
>If you write a function, I must be able to call it with the same arguments and always get the same results, forever.
>[This] rule is a typical virtue of functional programming: referential transparency
Wrong.
>>
>>58050218
this is a shitpost, can you explane further
>>
>tfw to smart for haskell
>>
>>58050111
preprocessor macros
>>
>>58050287
Edwin, is that you?
>>
Is Allegro as good as it gets?
>>
>>58050333
sdl2 you faggot
>>
>>58050111
public, private

recur in Clojure
>>
>>58050363
sdl2 has terrible performance
>>
>>58050111
mutability
dynamic typing
side effects
object oriented programming
>>
>>58050363
Let me take a look.
>>
>>58050243
If an expression is referentially transparent, you can replace it with its value without changing the behaviour of the program. This means the expression cannot have a side effect - any effect must be part of its value. Referential transparency is important when you talk about laziness, memoization, constant folding, etc.

Having the same inputs give the same outputs (determinism) is a slightly weaker restriction. Of course, every referentially transparent expression must also be deterministic.

Standard Haskell identifies them, but once you introduce something like unsafePerformIO you now have the ability to produce an expression that is deterministic yet not referentially transparent. This is dangerous in Haskell when so much of the language assumes referential transparency, so you have to be careful.
>>
>>58049670
Vince Staples did it better :^)
>>
>>58050333
sbcl is the best
>>
>>58050243
>>58050434
I'm kinda talking out my ass when it comes to the "dangerous in Haskell" part because GHC probably checks that a thunk isn't unsafePerformIO before doing something that requires referential transparency, now that I think about it.
>>
>>58050436
>memory leaks
>shitty platform support
Allegro cl is better, though all cl implementations suck.
>>
>>58050492
but its the fastest
>>
>>58050492
Which is best?
>>
File: Q0ol-Ylx.jpg (12KB, 250x250px) Image search: [Google]
Q0ol-Ylx.jpg
12KB, 250x250px
>>58050435
>not programming your art
>>
>>58050554
allegro cl seems the best.
ecl seems to be the buggiest, some libraries won't even work on it.
sbcl is decent but it doesn't work that well with windows or arm platforms.
High hopes clasp but it will take long time before it's usable.
No experience with commercial cl implementations.
>>
>>58050590
art = programming
>>
I'm working on a decentralized and encrypted TV platform, and I just finished a universal data exporter/importer. I'm going to start polishing up the networking and implementing VP9 compression.

If /g/ could make a TV box and system, what would you all want in it? Here is a simple list of things I want to include (or already have to some extent):
>IR extensible macros for fine tune control
>multiple screens at one time (windows)
>decentralized DVR system
>exporting to MP4, FLAC and other formats
>exporting to SSH, FTP, directories, DVDs, BD-Rs, and other mediums
>multiple video streams for different video qualities
>multiple audio streams for different qualities and multiple languages
>text streams for CC in multiple languages
>Bitcoin addresses associated with channels for donations
>Bitcoin addresses associated with nodes for donations (either on a BTC/GB basis)
>no upper limit on video quality
>TV Guide style system
>Tor integration

I'm also thinking of integrating Tox somehow, so there can be a live text/audio/video chat
>>
File: nani128.jpg (46KB, 600x600px) Image search: [Google]
nani128.jpg
46KB, 600x600px
How stupid would it be to make an imageboard where all the images are uploaded to imgur on the client-side before being shown?
That way I wouldn't have to store anything, ever.
And they could never block my server IP from doing it because it's my users uploading the pics, not the server.
>>
>>58050488
thunks should occur at runtime. IIRC, Haskell assumes that unsafePerformIO is never used because a lot of core library functions are implemented with it, which would cause lots of performance loss if they couldn't be optimized but I'm not 100% sure either way. there's likely some special comment you can use to make the compiler either ignore or pay attention to the unsafePerformIO depending on what the default is
>>58050590
it's simple enough that I could remake that with some short code
>>
>>58050744
Maybe you're just supposed to use strictness to ensure you don't ever actually end up with a thunk with a "top level" side effect.
>>
>>58050727
if you do only what you say then they'll probably figure it out
>>
>>58050686
>allegro
stop shilling, you fag
>>
>>58050703
I'm working on a decentralized and encrypted TV platform

Like, Tor for TV? My first and foremost concern would be video quality.
>>
>>58050797
>>58050554
>>58050686
Oops. Replace allegro cl with clozure cl.
I have never used allegro cl but I always mix the names.
>>
We don't do any project management system at work.
One of the senior devs and I have been considering prompting our boss to start doing something like SCRUM.

Are there any other that we should consider?
>>
>>58050893
Modified Waterfall
>>
>>58050703
Finally someone programing something useful.

Is it open-source? I would contribute. Also it reminds me this https://btlive.tv/
>>
>>58049994
Hey Artyom, why do you ruskies use G in place of H often?
>>
>>58050727
>And they could never block my server IP from doing it because it's my users uploading the pics, not the server.

You can't do that like this unless you forced users to install a browser extension.
>>
>>58050950
I can't do this in pure javascript?
>>
>>58050727
imgur has API keys, and they can disable your account if you upload too much on their free plan.
>>
>>58050727
that would be what reddit does

although they started to host on their own website
>>
>>58050966
I'm pretty sure CORS/same-origin policy would get in the way.

You could technically perform a request to the API instead but then you'd have to use your own token so they could easily shitlist you.
>>
How do I calculate the 3d orientation of a sphere in an image with opencv?
>>
>>58050703
The target platform is a Raspberry Pi. As it stands now, the Pi should be able to handle receiving and decoding medium quality streams (<=720p).

One feature I forgot is double encrypting streams. It will work something like this:
>Guide says such and such program is going to be live
>I click "Download Now" if such an option is available
>the highest quality versions (that can be played back) are downloaded
>the versions reference a public key that doesn't exist on the network yet, but will exist when the data becomes "live"
>This can be infinitely broke down to prevent people from skipping ahead of the supposed "live" time

>>58050823
I'm not too concerned with quality. Direct connections between the distributor and the receiver can be formed (or connections with one or two hops between), and the speed in these cases should be fast enough to handle it. Tor integration is optional.

One major downfall of Tor is that you can only have one TCP connection to send data over. This connection is saturating that Tor circuit to the max. Since this TV system (BasicTV) is decentralized, multiple connections can be created at one time and the effective throughput of the Tor connection increases by orders of magnitude (assuming we know what we need to fetch). The limiting factor now would be decrypting speed, not network speed.

Of course, data reaching all computers on the network in some way is going to be a problem, and there will be a broadcast delay that makes sense (7 seconds, probably) to fix this.
>>
Anyone else using F# here? I'm going through Beginning F# 4.0 and it's a pretty nifty language so far. I'm glad I decided to learn it. It looks like being able to leverage the huge amount of .NET libraries without having to use C# is going to be very nice. Coming from lisps, I'm kind of excited to tackle a problem without having to roll my own libraries for every little thing while still being able to use a comfy language.
>>
>>58050926
>>58050703
The source code can be found here
https://github.com/Dako300/BasicTV
Some parts are a mess, and I want to lay down some more foundation before I start making a team, but feel free to contribute
>>
>>58051049
You're not thinking simple enough. You don't need to reproduce the shittyness of popular TVs and streaming platforms.
>>
>>58051174
>You don't need to reproduce the shittiness of popular TVs and streaming platforms
what would you recommend?
>implying the shittiness doesn't come from anti-competitive practices, centralization, and insane prices
>>
File: sizeselectedsinglereadmemory.png (80KB, 1883x655px) Image search: [Google]
sizeselectedsinglereadmemory.png
80KB, 1883x655px
>>58051230
Who here Verilog?
>>
>>58051087
what does decentralized mean here?

never understood this concept of "decentralization"
>>
>>58051261
one server has the authority over the content
>>
>>58051298
so your tv application has a lot of servers?
>>
>>58051246

I use chisel, i cbf with verilog and vhdl
>>
>>58051339
>Scala hardware description
wtf
How is it though?
>>
>>58051261
The actual data is stored and forwarded across participants in the network (at will), as opposed to being stored in one place at all times. Great for anonymity and anti-censorship
>>
How do you guys sit while programming?
I usually sit at my desk or lie in bed on my stomach.
I find the pose in OPs pic very uncomfortable.
>>
>>58051382
so the internet we use are centralized or decentralized?
>>
>>58051407
>laying on your stomach
>ever
>>
>>58051381

I think it's awesome, now I drink the scala kool-aid.

Best part is that it doesn't infer latches. Definitely worth checking out, but you need a project with some real meat. I made a custom architecture for real time image processing with it, I don't think I could have done it nearly as fast with vhdl.

If you don't like scala I'm not sure chisel will change your opinion, but trying it can't hurt
>>
>>58050823
Because there are many different types of streams, any A/V broadcast can just have the audio component downloaded (news, podcasts, etc). That can also help with bandwidth

>>58051437
Technically yes, but it operates as an oligarchy
>>
>>58051050
I'm using it for some shit. Not really a fan of it as compared to other languages I use, but it's great for .NET. the library situation is very nice
>>
>>58051490
It sure isn't lisp, but it looks like a great lowest-common-denominator between the things I want/need from a language.
>extensive library
>nice to program in
>good support for functional programming

.NET doesn't have as many libraries as JVM languages or C++ do, but it's much nicer to program F# than it is C++ or Java for me, and it has much nicer support for functional programming and immutable data besides lambdas. It's not as nice as lisp, but I was really beginning to chafe against a few of the regular lisp problems so I wanted to try something different.
>>
>>58049620

doing some serious shit on a tight deadline
>>
>>58050926
If you configure an audio only stream, and set some settings in the configuration file, you can create a wireless house surround sound system. Interfacing isn't going to be as pretty as what Chromecast can do (unless I make an app), but it should be simple enough for most people to use.
>>
How do you get better at coding? How do you think of things to code? I can never think of anything to make
>>
>>58051573
looks rad

what is it?
>>
>>58051731
Legitimate pro tip:

Don't become "just a" programmer. Computer programming is just a tool and a means to an end. You should have other hobbies or goals that you can leverage computer programming to accomplish. If you're just a programmer you'll always be stuck with this problem of "I know how to program, but I don't know what to program!"
>>
Making a library in Rust for generating Rust code for C bindings. It's meant to be used from a build script (directly or indirectly with e.g. an API registry parser) and has builder syntax. It automates certain things like defining a function prototype when linking and a function pointer when loading and defining opaque types and handles to them simultaneously. Ideally this would all be possible with macros but it isn't.
>>
>>58051799
story of my life
>>
>>58051755

creates a 2d plane in 3d space

takes a grayscale image

gives each pixel a point on the plane

makes the 3rd coordinate (the height) of each point the color of the pixel
>>
https://www.youtube.com/watch?v=QM1iUe6IofM

Interesting talk I found in another thread.
>>
>>58051458
Well, any tools for improving productivity are definitely of interest. I'm working with a PhD student next semester on his research, which entails implementing a NoC hardware OS. He's very familiar with Verilog, but the dev process will be too slow IMO. He needs it finished for his defense in May and only me and him are working on it.
>>
>>58051877

At the norwegian university of science and technology we are using it for a big-ass FPGA for reservoir computing with cellular automata, so it's definitely up to the task. Personally I implemented an unconventional processor with chisel in 3 months (I worked a LOT though) and I found it great, so I think you should honestly go for chisel.
>>
>>58051925
>cellular automata
what are the rules?
>>
reverse engineering makes me want to kill myself, how the fuck do people have the patience to crack games
>>
>>58051954

programmable, so changes every experiment. I'm not on the project tho, but I do get to play with neurons which more than makes up for it
>>
>>58051925
How unconventional?

A CPU was what I've been working on for the past few weeks. Mostly in Verilog, but I had Python generating testbenches, and I wrote a simple assembler. It implements a subset of the ARMv8 architecture, with some exceptions for simplicity of implementation (since I only had two weeks to implement it and write a report). The picture in my OP is the data memory stage.
>>
>>58051980

autism
>>
File: 1.jpg (331KB, 1301x415px) Image search: [Google]
1.jpg
331KB, 1301x415px
wtf
>>
>>58051998

It's a programmable convolution engine, so it's not quite right to call it a processor really. It was fucking fast though.
>>
>>58049885

>given your city's annual min/max temperatures from the previous year, estimate the temperature of next year by the month and display them in a neatly arranged row/column format.
I am not a meteorologist, and have no idea how temperatures one year will affect temperatures the next. But strictly speaking, if I were to predict that every day would be 50 degrees Fahrenheit/10 degrees Celsius, I'd probably predict the temperature correctly for the majority of days here in Bellingham.

>caffeine fuels us. the recommended daily "useful" dosage of caffeine is 300 milligrams. pretend that you're not a total glutton and promise to consume only 400mg of caffeine per day, then write a script that estimates the amount of money you'd need to set aside for a month's supply of caffeine in your choice of energy drink.
How long is a month? Each month in our calendar can be between 28 and 31 days
>>
>>58052183
I think the best approach is to map the highs and lows to two different normal distributions, and average the intervals for each month, and average the high temperature month interval with the lower temperature month inverval.
>>
File: 1479580200592.jpg (65KB, 680x680px) Image search: [Google]
1479580200592.jpg
65KB, 680x680px
How to get "experience" for jobs?
Is it possible to get any work for C freshman?
>>
>>58052397
Sometimes you have to give jobs to get jobs.
>>
What should I code? Does someone have that big list?
>>
>>58052181
Sounds pretty cool.
>It was fucking fast though.
That's not something I've ever heard of a softcore processor. But I guess if the operations were well-implemented and specialized enough... Ever thought about taking it to the ASIC level?

The PhD candidate and I are mostly focused on FPGAs are a way to augment normal processing architectures for special tasks without hardcoding those special tasks. Imagine if NVIDIA had an FPGA on their chips, and their accelerated video decoders were implemented on those FPGAs. Improvements and bugfixes to the hardware accelerators could be bundled with drivers. The user could add also write their own tasks for the FPGA space and access the GPU's memory for preprocessing, etc.
>>
>>58049656
Thank you!
>>
i = 0

def func():
print ("%s" % i)
i += 1
print ("%s" % i)

func()


how the fuck do I fix this? I want to use i inside func
>>
>>58052528
def func():
global i
>>
File: mfw sjws.jpg (23KB, 630x341px) Image search: [Google]
mfw sjws.jpg
23KB, 630x341px
>>58051833
>Rust
>>
>>58052572
Can someone explain the Rust = SJWs meme to me?
>>
>>58052528
i = 0

def func():
#######
global i # <- here
#######
print ("%s" % i)
i += 1
print ("%s" % i)

func()
>>
>>58052596
https://github.com/rust-lang/rust-www/issues/268
>>
>>58052627
>https://github.com/rust-lang/rust-www/issues/268
Wait, what the fuck?

How about making the project be about code, and the quality thereof, rather than all this social science bullshit?
>>
>>58052627
Now is a great time to point out that InfoWars is going to be the first serious channel on BasicTV (non-copyrighted)
>>
>>58052456
Explain?
>>
>>58052680

>InfoWars
>Serious
InfoWars is about as serious and credible as The Onion.
>>
>>58052692
blowjobs
>>
>>58052659
>How about making the project be about code, and the quality thereof, rather than all this social science bullshit?
lol
how about no
>>
>>58052704
>implying the controlled mainstream media isn't a real problem
I'm not broadcasting it (solely) because I like it, but because it is not copyrighted. If you know of any other non-copyrighted news sources (not NPR nor PBS), let me know
>>
>>58052728
Fuck off SJW
>>
Am I the only one that thinks JavaScript is pretty comfy, especially ES6?
>>
>>58052839
Yes
>>
>>58052659
>That node.js post

>Literally says he would like to learn node.js but wait!! before that let's shove this bullshit down people's throat!
>>
>>58050369
Only if you use it like a fucking idiot.
>>
>>58052876
Which node.js post?
>>
>>58052896
https://github.com/nodejs/inclusivity/issues/82
>>
>>58050369
>SDL2 has terrible performance
what are you doing with it? SDL2 is pretty fast
>>
>>58052888
>>58052908
Real-time render of 3d objects in 60 fps using mesh networks and FFT's
>>
>>58052919
Then make your own renderer.
>>
>>58052919
>SDL2 has terrible performance
>doing all of that
The only thing SDL has to do is render it to the screen. If your computer is doing all of that, then SDL probably isn't the problem.
>>
>>58052919
>sdl for 3d
whut
>>
>>58052907
Why?

Just, why?
>>
>>58052952
>>58052961
>>58052965
thanks for the (You)s. i just made that up
>>
Is there any reason to use ints over double floats?

JavaScript manages with just double floats.
>>
>>58052965
probably just window, input and opengl context creation management
>>
>>58052981
Yes, there is.

JavaScript is shit.
>>
>>58052993
>JavaScript is shit.
not an argument.
>>
>>58052993
Such as?
>>
>>58052980
>I-I was just pretending to be retarded!
>>
File: ohyou.jpg (31KB, 600x456px) Image search: [Google]
ohyou.jpg
31KB, 600x456px
>>58052980
>>
>>58052965
>>58052985
3D in SDL is easy as long as you don't mind sticking to OpenGL 2.0 at most
>>
>>58053010
I never said it was an argument.

>>58053013
Smaller space requirements. Better performance.
>>
>>58053041
do you even know what an argument is?

lmao
>>
>>58053068
Arguments are what functions may be applied to.
>>
>>58053031
at that point you're just doing raw opengl
the fact that you used sdl to create a window isn't even relevant
>>
>>58053041
>Smaller space requirements. Better performance.
Negligible.

Ints are meme, all you need are doubles.
>>
>>58053031
For SDL maybe, but SDL2 allows you to use OpenGL 3.3
>>
>>58052952
>>58052961
>>58052965
That guy is a moron but SDL2 is still really slow.
>>
>>58053097
>>58053110
i'm writting SDL3 in this exact moment, and it will include OpenGL 4+ and Vulcan API
>>
>>58053110
no it isn't
I once ran a test to compare how many 2d sprites could update and render on my screen simultaneously between sfml sdl and raw opengl
there was almost no difference between them
and the number was absurdly high, I think it was around 100,000 32x32 sprites
>>
>>58053097
oh really? that's nice
>>
>>58053125
at 60fps*
>>
>>58052740

Copyright isn't really a problem if no one follows copyright law. You can say on paper all you want, "you do not have my permission to copy this." But in practice, you are always powerless to stop it. Governments have been cracking down on torrent trackers, but they cannot stop all of them, nor can they stop all of the other means of pirating things, nor can they even stop the wanton disregard the general population has for copyright law. At best, they can make it easier for people to not steal things. Netflix, Spotify, etc... make it easier for people to access content with a simple subscription, and this is for many, easier than piracy. But if content is not available through these channels, even normies do not hesitate to pirate any more than they hesitate to smoke marijuana with their friends.
>>
>>58053095
Ints are useful for:
Indexing arrays (can't do that with floats. inb4 but I can do it in javascript! js implicitly casts them to ints)
Being memory addresses
Bitwise operations
Not having floating point error when doing basic arithmetic operations.

>>58053110
Maybe if you don't know the difference between a surface and a texture.

>>58053117
I heard SDL3 is planned, is there actually code? link?
>>
>>58053095
Not negligible if you're dealing with many billions of numbers.
>>
>>58053165
>implying I don't know that copyrights are meaningless
I simply don't want to stream illegal content.
>>
How do i become a code monkey?
>>
>>58053241
you already are
>>
https://github.com/opal/opal/issues?utf8=%E2%9C%93&q=is%3Aissue%20conduct%20

Notice how all 4 were over 2 days
>>
>>58053263
oh snap.

What's the next level?
>>
>>58053311
code gorilla
>>
how exactly do i write multiple bytes to a file in common lisp?

write-byte only seems to be able to do one byte, and i have multiple functions that return bytes

it would be nice to not have to type (write-byte (function) file) every line, maybe this is doable with a macro?
>>
>>58053456
https://github.com/rpav/fast-io

maybe this?
>>
>>58053480
seems to be for single bytes too
>>
File: 1474738953331.png (98KB, 1054x530px) Image search: [Google]
1474738953331.png
98KB, 1054x530px
>>58053301
BTFO
>>
>>58053613

>>58046006
>>
>>58052627
why would you upload your personal notes on basic computer science to github?
is there something I'm missing here?
>>
>>58053642
cringe
>>
>>58053651
what?
>>
>>58053660
the avatar is cringy
>>
https://github.com/rust-lang/rust-www/pull/274


HOLY SHIT
AHAHAHAHA

>my three words commit got reverted
>I totally intended to contribute, I sw-swear!
>I just wanted to make sure you won't do something mean to me through unmentionned ways.
>>
>>58053732
we're doomed.

why don't SJW infest C++ , C, Assembly, .. comunities?
>>
>>58053745
They tried the D mailing lists, they got told to fuck off by the devs.
>>
>>58053779
based D devs. do you have a link?
>>
>>58053779
Link?
>>
File: Dlicious.jpg (840KB, 1580x3422px) Image search: [Google]
Dlicious.jpg
840KB, 1580x3422px
>>
>>58053745
>assembly
https://github.com/Charlotteis/charlotteOS

Got you covered!

And of course, "it" hasn't contributed a single line of code to anything ever.

I think you can best sum up "its" skill-set with one of its repo:

https://github.com/Charlotteis/poopthis
>>
>>58053791
>>58053786
http://forum.dlang.org/post/[email protected]
>>
>>58053806
explain this
https://github.com/Charlotteis/notes/blob/master/compsci/data_structures.md
>>
>>58053801
>>58053810
based
>>
>The syntax of systemd's unit files is inspired by XDG Desktop Entry Specification .desktop files, which are in turn inspired by Microsoft Windows .ini files.

https://wiki.archlinux.org/index.php/Systemd#Basic_systemctl_usage
>>
File: 1453447245918.png (10KB, 720x428px) Image search: [Google]
1453447245918.png
10KB, 720x428px
>>58053806
>She didn't even clear the screen
>>
>>58053818
Explain what, charlotte?

A Compsci 101 lesson?
Someone using github as a free file host?
>>
>>58053849
>implying i'm charlotteis
>>
>>58053843
>she
>>
>>58053843
>She
lmao
>>
>>58053880
>>58053888
Sorry, I keep forgetting these things are actually "men".
>>
>>58053647
Was wondering the same thing. Seems like they treat GitHub less as a place to submit code and more as a personal blog.
>>
>>58053171
GLFW already expedites Vulkan usage, I'd just use it instead.
>>
println returns void, so any call to println can be optimized away.
>>
>>58054327
this
>>
Which language should I learn? https://www.duolingo.com/register
>>
>>58054327
No, you retard. not if it causes side-effects.
>>
File: 1480963910723.gif (538KB, 318x400px) Image search: [Google]
1480963910723.gif
538KB, 318x400px
>>58054466
>american flag
>>
>>58054471
>side-effects
RRRRRRRRRREEEEEEEEEEE
>>
int c = getch();

is such a horrible idea.
I spent hours trying to debug my program because I forgot to cast c to (char)
>>
>>58054487
Kill yourself. Side effects are a requirement for any program that does something useful.
In fact a program that has no side effects by definition does nothing.
>>
>>58054481
Most English speakers are American, sorry Karen
>>
>>58054499
i spent a day once trying to figure out why my webpage didnt do anything, it turns out i never linked the button to an event
>>
>>58054504
actually, most English speakers are not american
>>
>>58054518
America = 320 million people
Canada + Australia + UK + New Zealand = about 130 million people
>>
>>58054466
>no option to learn Japanese
FUCK GREEK
>>
>>58054535
English is the most common second language spoken worldwide, idiot.
>>
>>58050703
Make it play Daala!
>>
>>58054499
why is this a problem. afaik casting char -> int is not an issue (unless only one is unsigned)
>>
>>58054556
Being able to fumble through asking how to get to Times Square =/= speaking English.
>>
>>58054586
You'd be surprised at how many ESLs browse this website.
>>
>>58054630
>ESLs
Extremely sensitive liberals?
>>
>>58054576
it's a problem if the int gets filled with garbage
int c;
c //prints out 1649296 (garbage from sometime before)
(char) c //prints out 32 ' '

if (c == ' ') {
//program wont reach here
}

if ((char) c == ' ') {
//program WILL reach here
}
>>
>>58054650
English as a second language, but the two have some overlap.
>>
>>58054674
Why does it matter if a language is second or even third if you learned them at the same time? This acronym seems retarded.
>>
>>58054674
I doubt there's that many, 4chan is an American website, go to a board with flags and the posts in English are 90% from USA, UK, Canada, Aus, or NZ.
>>
>>58054691
>4chan is an American website
>>
>>58054687
The importance of the acronym is just denoting that English isn't your first language.
Your autism is showing.
>>
>>58054716
So what?

If you can speak English then you don't need to say "oh I'm a special snowflake ESL"

If you can't then don't claim you can
>>
>>58054662
i think you have a misunderstanding
>>
>>58054716
Why is such an acronym even needed? Measuring someone's inherent proficiency by checking whether or not something is their first language is retarded. English can be your native language while still being your second or even third language.
>>
>>58054733
I don't think the normal context is "I'm a special snowflake" but "forgive me for my poor grammar and spelling."
Within the context of this conversation, it's simply pointing out that people all over the world speak English.
>>
>>58054759
If you have poor grammar and spelling but you are making a good point in your writing then it's going to be obvious that English isn't your first language and people will cut you some slack.

It honestly sounds like more SJW professional victim bullshit.
>>
How do you think of things to code?
>>
>>58054740
Who said the acronym ESL measures your proficiency? it's just a acronym meaning English wasn't your first language. Calm down retard.
>>
>>58054788
it's called a boss
>>
File: 1334579225946.png (107KB, 320x287px) Image search: [Google]
1334579225946.png
107KB, 320x287px
>>58054781
not everything is "professional victim bullshit"
get over yourself
>>
>>58054800
Will you be my boss
>>
>>58054800
>He needs a boss to decide what to do
lmao'ing @ your life
>>
>>58054792
Exactly, why is it even a thing then? Or are you implying someone who started "learning" English one day after his first language is going to be worse at it than someone who started "learning" it right away?
>>
>>58054788
I learn something new, and usually that gives me an idea for something new* to make.
*new to me, not to the world.
Example: I just learned how sockets work and how to work TCP connections or send/receive UDP packets, so I'm thinking of making an online game of some sorts, writing my own server and client applications. Another idea was a TCP/telnet forum server application. Like BBS, but in your terminal; the client application would handle presentation.
>>
>>58054821
You can be your own boss.

But if you can't decide what to do, you probably aren't.
>>
>>58054662

>it's a problem if the int gets filled with garbage

Then simply don't use uninitialized memory.
>>
>>58054828
Most people don't start learning their second language immediately after starting their first.
Which means that, usually, someone whose first language is English will be better at it. Part of this could be attributed to regular practice of the language, as the first language you learn is likely the one you use the most.
>>
>>58054858
it isn't uninitialized lmao, it's just heavily used
>>
HELL YEA JUST PASSED MY FIRST SEMESTER OF C++
TIME TO GET OUT THERE AND GET MY DICK SUCCED
>>
>>58054892
like your mum? kek
>>
>>58054662
you need to brush up on some fundamentals
>>
Halp, /dpt/, I need to take a dictionary containing the file owner name for each file name and then
return a dictionary containing a list of file names for each owner name, in any order.

so {'Input.txt': 'Randy', 'Code.py': 'Stan', 'Output.txt': 'Randy'}should return {'Randy': ['Input.txt', 'Output.txt'], 'Stan': ['Code.py']}.

Here's what I have so far, but it's not working. I spent 6 hours already today and I'm just about to give up. This isnt homework its just an online challenge problem, but tis really pissing me off since it says for beginner but I cant solve it:

class FileOwners:

def group_by_owners(files):
dict = {k: [] for k in files.values()}
for x in dict.keys():
# print (sorted(list(dict.keys())))
# print (sorted(list(files.values())))
if sorted(list(dict.keys())) == sorted(list(files.values())):
dict[x] += files.keys()


files = {
'Input.txt': 'Randy',
'Code.py': 'Stan',
'Output.txt': 'Randy'
}
print(FileOwners.group_by_owners(files))


Maybe I'm just making dumb mistakes or missing something simple, but I'm about ready to start some soduku I'm so frustrated...
>>
>>58054981
I'd help if you weren't using Python
>>
>>58054987
What's the solution look like in C?
>>
>>58055016
I wouldn't help you if you were using C either
>>
>>58055040
I'm not even the guy looking for help, but what meme language is your preference?
>>
>>58055051
D
>>
>>58054892

Using a variable over and over again doesn't cause it to be filled with garbage. Every time you assign it, you erase the previous value.
>>
File: 1332668385655.jpg (45KB, 492x341px) Image search: [Google]
1332668385655.jpg
45KB, 492x341px
>>58055057
>>
I want to use sublime text to write my c++ but I don't know shit about makefiles. Am I fucked? I don't want to use visual studio or whatever
>>
>>58054987
>>58055040
>>58055057
>>>kissless douche of /g/

Go groom your neckbeard, iToddler.
>>
File: soln.png (37KB, 897x428px) Image search: [Google]
soln.png
37KB, 897x428px
>>58054981

def group_by_owners(files):
newDict = {}
for k in files:
name = files[k]
if name in newDict:
newDict[name] += [k, ]
else:
newDict[name] = [k, ]
print newDict

files = {
'Input.txt': 'Randy',
'Code.py': 'Stan',
'Output.txt': 'Randy'
}
print(group_by_owners(files))

https://repl.it/languages/python
>>
File: 8.png (1MB, 1366x768px) Image search: [Google]
8.png
1MB, 1366x768px
>>58049620
I'm setting up my vim workspace for coding. Just finished ~decking out~ my WM to my tastes. Time for fucking around is over
>>
>>58055072

Makefiles are pretty easy to learn. Same with CMake, which is a program that makes makefiles.
>>
>>58055135
And CCMake, which generates CMake files.
>>
>>58055091
Thanks, I akshully feel more retarded now.

Think you can do it using just dict comprehension or the map() function?

or even bonus points if you can use the semantics I'm using.
>>
That's the right answer! You are one gold star closer to fixing the sleigh. You got rank [redacted] on this star's leaderboard. [Return to Day 18]

Yet another piss easy challenge.
>>
>>58055148
files = {
'Input.txt': 'Randy',
'Code.py': 'Stan',
'Output.txt': 'Randy'
}

def group_by_owners(files):
grouped = {}
for x,y in files.items():
grouped.setdefault(y,[]).append(x)
print grouped

if __name__ == '__main__':
group_by_owners(files)
>>
>>58055064
not when it gets assigned to integers, chars and ncurses' special chars
>>
>>58055145

CCMake is actually a curses interface to CMake. It is not a CMake generator.
>>
>>58055300
CCCMake generates a curses interface for CMake generator
>>
>>58055261
Why do I keep fucking up, Senpai? What's wrong with my code? Why won't it append. I'm still so confused...
>>
>>58055371

Now you're just making shit up.
>>
>>58055486
Cshitup is actually a curses interface to shitup. It is not a shitup generator.
>>
>>58055481
Are you asking about the code you posted here >>58054981 ?
>>
>>58055286

Assignment from an integer of a smaller size to an integer of a larger size (i.e. char to int) will always sign extend the smaller integer.

The following code, unsurprisingly, prints 5, rather than 261.
#include <stdio.h>

int main(void)
{
int i = 256;
char c = 5;
i = c;
printf("%d\n", i);
return 0;
}
>>
>>58055559
>The following code, unsurprisingly, prints 5, rather than 261.
you can't be this stupid
>>
>>58055572
>you, ruby "i paid $300 for a pony doll" sempai, can't be this this stupid
>>
>>58055511
Yes...
>>
>>58055572

You don't actually have an argument, do you?
>>
>>58055594
Alright. Please explain exactly what this does:
for x in dict.keys():
if sorted(list(dict.keys())) == sorted(list(files.values())):
dict[x] += files.keys()

Not what you think it does but exactly what it does.
>>
>>58055594
there's several problems with it
for example
>that dict comprehension doesn't work correctly
>you call group_by_owners incorrectly
>group_by_owners is missing a self parameter since it is a class method
>group_by_owners doesn't return anything, so it will never print the dict
>>
>>58054500
Yeah, you need effects to do anything useful. No reason they have to happen on the side.
>>
When do you use dictionaries?
>>
>>58055685
When I want to know the meaning of a word.
>>
>>58055617
It didn't do anything that was the problem. I tried to make it so that if the keys in dict == values in files to append the keys in files to a list of values for that particular key in dict
>>
AT&T syntax is fucking retarded, illogical, and ugly as fuck.
If you don't use Intel syntax you should probably just kill yourself immediately.
>>
>>58055685
when they fit the problem you're trying to solve
>>
>>58055693
I was aking more for a step-by-step explanation, Anon. Try to open the python interpreter and paste the following:
files = {
'Input.txt': 'Randy',
'Code.py': 'Stan',
'Output.txt': 'Randy'
}
dict = {k: [] for k in files.values()}
print(sorted(dict.keys()))
print(sorted(files.values()))
print(sorted(list(dict.keys())) == sorted(list(files.values())))
>>
>>58055784
Okay. It's a little late for me so I don't think anything will stick. But I though that a list function gives you an iterable which would then check of that iterable is equal to the list of the other one. But I can't even remember what it's supposed to do really. Thanks anyway. I'll try debugging with prob statements tomorrow
>>
>>58055831
Print* statements
>>
shoot me
>>
>>58055853
only if you shoot me at the same time
>>
>>58055864
that's a difficult concurrency problem
>>
>>58055202
Is that the Advent of Code? I was considering undertaking it this week, but if it's easy I don't think I'll bother.
>>
>>58056076
It depends how versed you are in problem solving, some challenges have taken me a significant amount of time to implement, some of them required me to rewrite them for part 2 where input got larger and optimize for efficiency, and some of them were a cakewalk, the first few days are really simple warmup though. Generally, I recommend doing them, it's always nice to solve a challenge and them come up with even more efficient and clean way to do it. I've seen some people do crazy stuff.
>>
>>58056098
Thanks for the writeup. The two stage concept seems interesting, I'll give it a whirl then.
>>
>>58056062
I'm sure we could get together and create some sort of mechanical jig that would ensure both of our guns fired at the same time.
>>
File: shamefrudisplay.jpg (30KB, 657x527px) Image search: [Google]
shamefrudisplay.jpg
30KB, 657x527px
>>58049620
>tfw too embarrassed by the spaghetti code my project's turning into to continue working on it
kill me
>>
>>58056624
May these repeating digits guide your hand towards refactoring enlightenment.
>>
>>58056624
>>58056640
Or not, sorry
>>
>>58053320
You either live long enough to become a code gorilla, or die a php harambe
>>
>>58056624
>Frogposter
>Shit at programming
Wow, what a surprise.
>>
> array-rank-limit
> 65529
>>
>>58056624
Stupid frogposter, no wonder your code is shit
It's your fault
>>
>>58057150
kek
>>
>>58057150
>>58057240
I don't get it.
>>
>>58057493
Just under a maximum signed 16 bit integer.
>>
New thread:
>>58057800
>>58057800
>>58057800
Thread posts: 312
Thread images: 26


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.