/dpt/ - Daily Programming Thread

What are you working on, /dpt/?
Old thread:

Other urls found in this thread:

github.com/emirpasic/gods
goinggo.net/2013/12/macro-view-of-map-internals-in-go.html
twitter.com/NSFWRedditImage

Reading through Nim manuals, the OOP design is somewhat rather confusing, because the lack of a proper book.

No, "Nim in Action" is not a good book

>android app
>get user to sign in with google
Is there any way to access his google searches after this?

First for WHY IS HTML PARSING SO SHIT JESUS? Also, recommend me some concise C documentation please. R-K is a bit tedious.

typical autistic rubyfags

Imagine working with a language with no map, fold and filter

Someone needs to make a whole family to go with nogenerics.info

imagine working with a language with no >>=, return and existentially quantified rank n kind polymorphic GADT constructors indexed by type level natural numbers

>imagine working in a language with no for loops
que?

What is wrong with NIA?
Nim seems pretty interesting, but i hate learning new langs without a book.

Imagine working with a language where the only values usable at type-level are numbers.

Are you that hasklet that was bitching about data x: Nat?

>What is wrong with NIA?
I don't like the style of that book. It's more focused on "application" like "let's make a twitter clone" or "let's make a text perser" etc

This makes it hard to find specific topic and how Nim approaches them. Like if I'm looking for "Member functions" I can't use the book. I have to read the manual in the website which needs more polishing

...

Ah, well usually those atleast cover on the subject enough for you to get the gist as it comes. But i agree, very unfortunate desu.

I wanted to share files from my server in a manner that requires auth but does not require the user to use an FTP client or other outdated fuckery. I also wanted to easily be able to grant or revoke file permissions.

I looked at existing options and hated them. They were incredibly bloated and required a full-fat database server just to store basic info.

This is what I've came up with so far. It's a small Node app with a very lean frontend. It uses an SQLite DB and can basically run anywhere with a node 8.x binary.

Workflow: I login as admin, browse to the file, and click it to add it to the list of managed files. Then under Files I click "Sharing" and enter a comma-separated list of usernames who can access it.

The users can log in and will see a simplified screen, with only the Files section listing only the files they can access.

It's in an early stage. Next steps:
* Generate cookieless download links (random token and IP locked) for use in streaming players etc
* Improve the sharing UI, have it present a list of checkboxes
* UI for adding/managing users (I currently just run SQL statements)

pls respond

No, I'm an Idris-fag and I find Haskell's attempts at DT amusing.

Yeah, imagine that.
Fortunately I use Haskell most of the time.
For everything else there's Agda.

Or Idris, if you want to be a special snowflake.

Its gonna be even worse when they add an actual implementation.

And I didn't mean to imply that Haskell only has numbers at the type level.

GADTs and datakinds are not an attempt at dependent types

I dont ever reply to this posts and just lurk but wanted to thank everyone who helps others and gives them advice and fixes especially the ruby tripguy

:)

>tripguy
tripgirl*

kys

girls cant code and dont browse chinese imageboards.

why would you want this?

Stop asking too many questions, goy

I always wondered whether any girls actually browse here to program. There aren't many opportunities for them to attention whore, like in Sup Forums, /soc/, /r9k/, etc.

oy vey

If anything theire probably in /wdg/ since front-end is more womeme friendly.

>There aren't many opportunities for them to attention whore
False

why would a man call himself ruby and program in ruby?

Do you have the image that talked about women being replaced with anime traps?

...

Is there a sort of agreed-upon biblical text for starting out with algorithms?

I want to learn how to implement basic operations such as logarithms in software, or at least understand how they might be implemented by hardware. There's a lot of different texts that I see floating around and I'm not sure if there's a specific one that's considered as an authority.

i've never seen any actual girl post in /dpt/ with proof. there was a tranny who claimed to be a girl and posted pics but it looked like a tranny and iirc a few weeks later the same person admitted to being a tranny and posted another pic with the same shirt/top as before

I am a girl :3

>I am mentally ill

seek help

post panty drawer

This tbqh. Women are less likely to be able to program well, or do anything STEM in general

Webdev is harmful to a man's mental health tbqh.

C and C++ will be replaced by Rust.
Java will be replaced by Kotlin.
All programs and apps are going to be in the browser.

Kotlin is ugly as fuck, I honestly prefer Java

Too optimistic, we still can't "replace" FORTRAN and COBOL. More like language landscape will continue to fracture until each major project uses its own language.

I'm 25 and RETARDED

What is minimum maths required for computer science? I've already been accepted to university as a mature student but now I need to actually learn maths before I enter next year.

What to learn before first semester kicks off?

>All programs and apps are going to be in the browser.
Maybe .io trash.

>HTML parsing
>C

Literally trivial in any modern language. This is simply not a job for C unless you have some seriously restrictive requirements.

computer science courses vary a lot in terms of the maths you'll need

Just check the syllabi for your classes and brush up on topics they explicitly discuss.

You won't need more than basic algebra for most of it.

Don't browsers have to parse C? Aren't most browsers in C++?

Well, you didn't say you were making a browser.

I thought you just wanted to parse HTML and work with the data.

Imagine working with a language with no generics.

you only need generics if you have strong typing

>All programs and apps are going to be in the browser.
Any programs or apps that do that run like absolute fucking cancer.
See: Atom and most especially, Discord.

Algebra, things like sums, sequences/recurrent relations, basic diff calculus, lambda calculus, type theory and discrete maths.

I'm not trying to parse in C kek. I'm not retarded. Also, isn't me, I'm not making a browser. I'm remaking my friend's Python program for fetching some shit from a webpage.

>Don't browsers have to parse C?
No, they have to parse html/js/css.

Thank you based developers

Rust is a replacement of C++, C being minimal and complete, it will stay for a long time

HTML parsing is trivial in Python. What's the page? What are you trying to retrieve?

As long as the data isn't generated client-side by jQuery or something, you write some XPath and then use whatever functional set-comprehension methods Python has, and off you go.

People that talk about Go fall into two categories:

1. Have actually used it
2. Bitch about lack of features

Give me some real-world examples where generics are absolutely needed in a way that interface doesn't cover. Automatic loss if your example is better optimized but functions the same.

*computer scientists
"developers" is an insult.

this desu. Rust is hipster shit anyway. dog bless C

BeautifulSoup

sorting? map? fold? binary search? data structures?

how does map look in Go?

>language relies on external library to perform basic interaction
gas Pyfags

...

Isn't that the pantyshot?

YOU MADE ME HUNGRY user FUCK YOU

your language relies on external libs to do something useful too

Where do i go to learn python? I like learning by doing projects and "Learn Python the Hard Way" seemed like a very good idea.

However Sup Forums really hates it. Is it just Sup Forums sperging or is it really that bad?

It's a good idea. Sup Forums hates every language that people actually use

You can easily do all of them with interfaces.
github.com/emirpasic/gods

In addition to the above, Go has language-level generic maps.

Sup Forums doesn't hate it that much imho. I learned it with a sufficiently complex project in mind and the documentation handy. I wouldn't use Python though, you'd be better off with something a bit more useful unless it's your first

I'm not talking about the datastructure, I'm talking about the function. What does map look like in Go?

> Give me some real-world examples where generics are absolutely needed in a way that interface doesn't cover.
Any code with actual performance requirements, dynamic dispatching is slow as fuck.

Engineers would be fine desu

was pokemonGO written in go?

no

...

goinggo.net/2013/12/macro-view-of-map-internals-in-go.html

>github.com/emirpasic/gods
>Ctrl-F "interface{}": 99 matches
You might as well write in python.

thank you both

So you're saying the book isnt actually bad and its just Sup Forums being Sup Forums right? I also read that it's riddled with mistakes which makes me scared. Do you know anything about the second book?

I'm mainly a java/C monkey, but know some other languages at the basic level.

fucking retard

>He doesn't know the difference between the `map` function and the `map` data structure
So go-fags are really retarded.

dude look out, he might even use a bunch of other curly braces and english words. It's almost like it's code or something

Go is such trash.
type Map interface {
Put(key interface{}, value interface{})
Get(key interface{}) (value interface{}, found bool)
Remove(key interface{})
Keys() []interface{}

containers.Container
// Empty() bool
// Size() int
// Clear()
// Values() []interface{}
}

>implementing your own map
>real-world example
pick one

Is storing two integers values in a double a good idea?

it really isn't
just use a struct with two integers

AHAHAHA AHAHA HOLY SHIT
GOFAGS BTFO

I'm not sure if you're trolling or you're really so retarded you don't know that "interface{}" in Go is, it's like "void*" in C, it's both slow and unsafe as fuck.

someone requested a bot that draws a random card from a deck of 52 cards plus 2 jokers. figured itd been long enough since I worked on something that I could hammer this out in an hour or so.
Wrote it in python. Wrote a card class and then when i went to write the deck class just kinda keyed out the entire deck instead of making it with a loop.
working fine enough, though.

>Keys are unordered.
package main

import "github.com/emirpasic/gods/maps/hashmap"

func main() {
m := hashmap.New() // empty
m.Put(1, "x") // 1->x
m.Put(2, "b") // 2->b, 1->x (random order)
m.Put(1, "a") // 2->b, 1->a (random order)
_, _ = m.Get(2) // b, true
_, _ = m.Get(3) // nil, false
_ = m.Values() // []interface {}{"b", "a"} (random order)
_ = m.Keys() // []interface {}{1, 2} (random order)
m.Remove(1) // 2->b
m.Clear() // empty
m.Empty() // true
m.Size() // 0
}


Go just needs to accept its a toylang

it might be in that platform

>can only import code on github

lol wat

a struct with two ints should compile down to the same

interface{} is a shitton safer

look the FUCK out, someone coded an unordered map in go

>slow
no

should also probably get around to making my own gitlab, but I dont think I have an extra box laying around. will probably have to hit up university surplus again soon.