/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

hackage.haskell.org/package/TicTacToe
stackoverflow.com/questions/23850472/how-to-use-sdl2-and-sdl-image-with-cmake
maniagnosis.crsr.net/2011/05/tony-morris-on-static-types.html
xfce-look.org/content/show.php/Rele?content=77260
btlive.tv/
github.com/Dako300/BasicTV
twitter.com/SFWRedditGifs

First for akari-bbs!

First for C

>yfw tic tac toe can't be done elegantly in fp langs

Yeah, finally got it

hackage.haskell.org/package/TicTacToe

>tfw Mook changed shit with the API and killed my Sup Forums programm
>too lazy to fix it

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.

are haskell guys too smart to be employed?

not
>if you want menes, use Haskell
STOP LYING

Shinji might be a whiny bitch but he is male.

Autotools or CMake

>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.

Autotools works fine with mingw

stackoverflow.com/questions/23850472/how-to-use-sdl2-and-sdl-image-with-cmake

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!!!!

> 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.

>500 lines
>half the LOC of xmonad

Well it's not Rei or Asuka

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?

>CLisp
feeling edgy, today?

Need more monitor :(

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.

maniagnosis.crsr.net/2011/05/tony-morris-on-static-types.html

im racist

Animated

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?

Fug, I'm Artyom.
Rolling.

xfce-look.org/content/show.php/Rele?content=77260

>odd dubs
main = print 0

The C standard library

Why is that ?
It's a great language

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?

just obfsucate it, faggot

Release it under GPL v3.

Just change original authors name to yours and delete all comments

it's open source

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

>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.

this is a shitpost, can you explane further

>tfw to smart for haskell

preprocessor macros

Edwin, is that you?

Is Allegro as good as it gets?

sdl2 you faggot

public, private

recur in Clojure

sdl2 has terrible performance

mutability
dynamic typing
side effects
object oriented programming

Let me take a look.

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.

Vince Staples did it better :^)

sbcl is the best

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.

>memory leaks
>shitty platform support
Allegro cl is better, though all cl implementations suck.

but its the fastest

Which is best?

>not programming your art

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.

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 Sup Forums 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

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.

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
it's simple enough that I could remake that with some short code

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.

if you do only what you say then they'll probably figure it out

>allegro
stop shilling, you fag

I'm working on a decentralized and encrypted TV platform

Like, Tor for TV? My first and foremost concern would be video quality.

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?

Modified Waterfall

Finally someone programing something useful.

Is it open-source? I would contribute. Also it reminds me this btlive.tv/

Hey Artyom, why do you ruskies use G in place of H often?

>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.

I can't do this in pure javascript?

imgur has API keys, and they can disable your account if you upload too much on their free plan.

that would be what reddit does

although they started to host on their own website

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?

The target platform is a Raspberry Pi. As it stands now, the Pi should be able to handle receiving and decoding medium quality streams (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

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.

The source code can be found here
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

You're not thinking simple enough. You don't need to reproduce the shittyness of popular TVs and streaming platforms.

>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

Who here Verilog?

what does decentralized mean here?

never understood this concept of "decentralization"

one server has the authority over the content

so your tv application has a lot of servers?

I use chisel, i cbf with verilog and vhdl

>Scala hardware description
wtf
How is it though?

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.

so the internet we use are centralized or decentralized?

>laying on your stomach
>ever

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

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

Technically yes, but it operates as an oligarchy

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