/dpt/ - daily programming thread

babby's first combinatorics homework edition

Old:

Other urls found in this thread:

worditout.com/
rust-lang.org/conduct.html
en.wikipedia.org/wiki/Approximations_of_π#20th_century
backchannel.com/who-was-ramanujan-83b4d5b05665
twitter.com/NSFWRedditGif

>299 posts
Yeah, fuck off.

Saged.

>git gudder
>suddenly find myself needing linux
What does it mean?

...

4th for Go.

Stop crying you stupid fucking woman, clearly you're fucking new around here

>being this butthurt

so in trying to learn Berkeley DB and following their stuff but clang and gcc both claim they dont know of db_create...

i included db.h and checked to and if it existed. Why would it not find db_create?

>b-b-b-b-b-b-b-b-ut i-i-i-i-i-i-i w-w-wanted to make the op image!
>wwwwwaaaaaaaaaaaaaahhhhhhhhhh
Fuck off you stupid fucking child

>>b-b-b-b-b-b-b-b-ut i-i-i-i-i-i-i w-w-wanted to make the op image!
what the fuck?
>Fuck off you stupid fucking child
nice projection

>get ears cleaned out
>can hear 20% better and can tell the difference between 320 mp3 and flac

I bet you fags use cotton swabs

>h-h-h-hahah-ha y-youre p-projecting

git is best on linux

nick bate is that you?

>this thread only has 4 on-topic posts

Some of these would be fun for a newbie programmer to do in their learning language.

That's what happens when someone starts such a cancerous thread

You don't need a computer for them

They're still good practice for learning basic syntax in a language.

NEW THREAD WHEN?

reported

Reposting for Sup Forumsentoomen help
>need block device with FAT32 partition for USB gadget
>want to "export" CIFS share as that device
>planning on writing a FUSE file system that creates the block device from scratch and places all the files in the CIFS share into it, redirecting reads to the CIFS share when reads are performed on the specific file in the virtual FAT32 file system
Is there an easier way to do this? Like a way to turn a directory tree into a block device or something?

>7
ishyggy

Clearly the janitors lost us long ago if a thread can be made 12 posts too soon

>turn a directory tree into a block device
you don't even realize what those words mean, do you?

pure chaos, totally worth incessantly shitposting over

Making a scraper.

Scraped the previous thread, here's a frequency map of it.
I'll probably think of some way set it up graphically on my end later on.

>java
>Poo
it's pottery

>telling a faggot off for breaking the unwritten rules of the thread by splitting it so he can post his own fucking image
>shitposting

Eventually it'll be 20 posts early, and then 30 posts early. A few days ago (or maybe more?) we were having threads 50 fucking posts early

>applying for C# and SQL jobs
>have no idea what kind of questions C# jobs will ask

anyone got any ideas? is it going to be just about the language C# or will there be algorithm designs? I would be better with algorithm designs as some of the stuff with C# I don't know like delegates, Reflection, anonymous methods.

I tried to look up interview type questions in C# but they all strictly focused on the minutia of the language.

Oh no! That might interfere with these TOP QUALITY discussions!

whoa! 30 posts already! this thread is old, when do we start a new one?

help me understand this.

so you scrap the entire thread, and then you build an image automatically with those words written?

Reminder that ALL /dpt/s are cancerous these days, regardless of when they were started or if the old thread was at the bump limit

can you even EOF, jsfeg?

Should do it just to provoke more autistic conniptions tbqf

Who the fuck is jsfeg and how retarded are you to presumably be defending someone who says sum types aren't necessary?

I didn't build the image myself, not yet. It's something I'm going to implement later.

I merely scraped the thread for posts and built a dictionary with word frequencies. Then I used some online tool to make the image.

>I can't into
jshit confirmed

retard

Well I've been asked about LINQ knowledge, delegates, properties, if I ever used winforms and know what an event is.
As I said cpp is my strongest side I've been asked few questions about it.
From sql - transactions, difference between having and group by, dbms i know and worked with etc.

i'm working in .Net now but back then I wasnt attending purely for that position as it's an ousourcing company and they use shittons of technologies.

>union types
>not sum types
I'm unable to even

What?

Could you share that tool?
And what format of input data does it accept?

Looks pretty nice desu.

What's the best hash map for C?

>struct types
>not diff types
wtf user?

I'm running into some design issues.

Basically I want to tag images using directed graphs. So if there's two people in a picture kissing, the simple tag graph would be

(Person A) (Person B)

Now, by the current mindset of searching pictures with tags, we'd have three tags in this picture. Person A, Kiss and Person B.

In a graph the persons would be nodes, and the "relationship" an edge. Now, from a user perspective, I want to search for any images that has the tag "kiss" in them. In other words, this qualifies as both a node and an edge.

Anyone familiar with graphs and storing/querying them using relational databases?

anyone?

surely you mean product types

I asked user to do something like this

type BankAccountStatus = Closed | Open of float

He said it was disgusting and retarded

>captcha solver
surprisingly easy

the one you write yourself

I just googled word frequency map and got this: worditout.com/
I'm sure there are better tools out there but this one worked fine.

>So if there's two people in a picture kissing
please keep this sexual language out of /dpt/. we, as a community, really have to adopt a code of conduct.

Keep2Share's shitty captcha I should add, not Google's

Thanks, my gf is making her final projects related with literature. This thing might come handy in some of her presentations.

whats your accuracy?
whats your process? are you using a neural network?

>not getting the i

neat

Trying to automate downloading your fetish porn off k2s, I see.

Does anyone know of any free pre-packaged gamestate C++ libraries similar to HUMP's Gamestate.lua?

>pre-packaged
>C++
babby...

>babby
this isn't reddit user

okay pre-packaged is clearly the wrong term but I mean pre-written or something. You know how SDL, OpenGL, etc. let you use GR4PH1KZ without having to write your own GR4PH1KS rendering code? I want something that'll let me use gamestates without writing my own gamestate code.

>whats your process? are you using a neural network?
Deep convolutional neural networks

What do you mean by gamestate?

How do you decide what to put as a template parameter when writing C++ code?

Like if you're implementing something that uses floats, it makes sense to use a template because somebody else might want to use doubles.
Maybe internally you use a std::vector to store values, but in order to allow people to use custom storage and allocation, you might want to template the container as well which makes your code rely on generic container concept and makes it use types like Container::iterator all over your code which makes it completely unreadable.

Also, how do you know if you're supposed to implement something as a function or a class?

For example the algorithm you're implementing takes two lists of values, does some computation on them and returns the result.
If you implement it as a class, you take care of the storage of the values, its changes and implement the algorithm as a method.
If you implement it as a function, the user has to write a lot of extra code, but makes it much more flexible to use.
Another example would be the regex library which is implemented as a bunch of templated functions in the standard.

I feel like once you get to the point where you know too much about C++, it becomes harmful to your productivity because you start worrying about things like this instead of just writing code.

I'd like to learn some assembly, but I have a question

Is it similar conceptually to the register machine language that they develop in chapter five of SICP

Has anyone tried using git to maintain version control for things that aren't source code?

Would it work on project files for other software?

post your favorite language and one of it's flaws, I'll start:

Rust
none

rust-lang.org/conduct.html

Template everything

fine for text based files, don't use git for binary files though

Rust has no stable ABI

BTFO

And end up with like 10 template parameters for a simple A* algorithm implementation.

There has to be some guidelines as to what to template and what not to template.

write your own gamestate shit fgt there is no "one size fits all" unless you're doing some really babby shit but then it'd be trivial to write it yourself anyway. if you're trying to avoid learning things at all costs then C++ is not what you should be using

open Num
open Printf
open Random
open Unix
let spawn f =
let fdin, fdout = pipe () in
match fork () with
| 0 ->
let pid = getpid () in
init (int_of_float (time ()) + pid);
let oc = out_channel_of_descr fdout in
f oc;
exit 0
| pid -> fdin
let work oc =
let rec loop count success =
let x = float 1.0 in
let y = float 1.0 in
let count = succ count in
let success =
if x *. x +. y *. y < 1.0 then succ success else success in
let count, success =
if count mod 20_000_000 = 0 then
begin
Marshal.to_channel oc (count, success) [];
flush oc;
0, 0
end
else
count, success in
loop count success in
loop 0 0
let rec print_int oc n =
if n >= 1000 then
fprintf oc "%a,%03d" print_int (n / 1000) (n mod 1000)
else
fprintf oc "%d" n
let radix = Int 1000
let rec print_num oc n =
if n >=/ radix then
fprintf
oc "%a,%03d"
print_num (quo_num n radix)
(int_of_num (mod_num n radix))
else
fprintf oc "%d" (int_of_num (mod_num n radix))
let main_loop children_count =
let rec loop accu = function
| 0 -> accu
| k -> loop (spawn work :: accu) (pred k) in
let start = gettimeofday () in
let fdins = loop [] children_count in
let rec loop count success =
let rs, _, _ = select fdins [] [] (-1.0) in
let rec take count success = function
| [] -> count, success
| fdin :: css ->
let ic = in_channel_of_descr fdin in
let c, s = Marshal.from_channel ic in
take (count +/ Int c) (success +/ Int s) css in
let count, success = take count success rs in
let pi = approx_num_fix 30 (Int 4 */ success // count) in
let speed =
int_of_float
(float_of_num count /. (gettimeofday () -. start) +. 0.5) in
printf "%a\t%aHz\t%s\n" print_num count print_int speed pi;
loop count success in
loop (Int 0) (Int 0)
let () = main_loop (int_of_string Sys.argv.(1))

>We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.

Go
literally none

Sauce? I have some books on these Olympiad problems but I can't find this combinatorics one.

Well shit, that's a good question. You just made me throw out everything I thought I knew about porting this lua game to C++.
It's not about avoiding learning things, it's just kinda confusing sometimes when someone says "DURR how do I write X library" and people tell him to stop being a retard and use a pre-written library.

the syntax is literally disgusting and there are no real advantages of it over java except you can be a stupid ass smug hipster about using "not java"

Nice, why are you using this shitty approximation though? Ramanujan came up with nicer.

you should always avoid external dependencies unless it's some stupid standardized shit that you can't be arsed dealing with like decoding mp3 files or something, gamestate stuff is not standardized at all, it depends heavily on the specific game, it's definitely something you should write yourself

and the JVM startup, and the memory usage, and the simpler language, and...
kys, pajeet

Too lazy to implement a good algo
>Ramanujan came up with nicer
gimme link

kys dumbass go sucks fucking ass and is an irrelevant hipster lang

This. This is one of its major pain points and the reason it can not replace C currently. Its verbosity is also somewhat of a major pain point.

You're the kind of faggot he's pointing out, dipshit. Good one reiterating the point he was making, though.

var facts [10001]*big.Int
facts[0] = big.NewInt(1)
big_i := new(big.Int)

this is what gophags actually believe

en.wikipedia.org/wiki/Approximations_of_π#20th_century
There are two in the article, but he has many more. Just look around the internet.
Stephen Wolfram wrote a great article on Ramanujan btw: backchannel.com/who-was-ramanujan-83b4d5b05665

>not quotient types

>Too lazy to implement a good algo
Literally every other "algorithm" I can think of is easier to implement and better than that monte carlo bullshit (which is a horrible example for monte carlo btw).

Pic related is probably among the best. Extremely fast to implement as well if you do it right.

calm down pajeet, you'll have to learn Go sooner or later

this is what gophags actually believe

The Ramanujan approximation is remarkable in its own right, but practically useless for numeric reasons. So, please, don't implement that, you will enter a world of pain (and probably won't get further than a single step without arbitrary precision libraries and even with it gets pretty fucking shitty after 7 steps or so).

Pajeet, go back to

>uses go
>thinks he has the mandate to call others pajeet
stay smug hipster fag

The spigot algorithm is used for computing specific single digits, not for expansions.

>The Ramanujan approximation
What do you mean? There are many, some of which are great for numeric methods.

>uses Java
>calls others pajeet
literally can't make this shit up
did you even pass meme school kid