/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

live.sympy.org/
docs.sympy.org/latest/tutorial/intro.html#what-is-symbolic-computation
nikita-volkov.github.io/stm-containers/
stackoverflow.com/a/18101261
docs.oracle.com/javase/tutorial/reflect/
docs.sympy.org/latest/modules/functions/combinatorial.html#fibonacci
twitter.com/SFWRedditGifs

Reiterating my question here:

>elegant objects for your butthole
>cactus

Whether or not to buy Microsoft Surface Pro 4 (i5, 8GB, 256GB)TypeCover, Dock, Mouse and 23 months warrenty remaining for £850 - Been charged 19 times, hardly used, immaculate condition.

Not the 2017 refresh but still.. For dev work I think it would be decent.

>algorithms are our enemies

reiterating my answer here:
semi-niche, semi FP-meme: scala
enjoy dem compile times and free monad cultists

>made a pull request
>included a very handy feature
>but also changed every type in his solution to explicit types because fuck using var for every variable

do you think they'd really care?

Orthodox C++ > C > Modern C++

Lisp is the most powerful programming language.

Workin' on an android app. Has anybody used the Twitter API before? Shit is super slow and I'm trying to figure out why.

>changed every type in his solution to explicit types because fuck using var for every variable
seek help

>Shit is super slow
what is slow? getting twitter posts or whatever?

why?
I press 1 button and it automatically changes the type. its not like I autistically went in and manually changed them myself.

first for python

:^)

>changed buttload of code because my opinion is objectively correct

>pull request includes
>- useful feature
>- changing a shitload of stuff to shove my opinion down receiver's throat
lennart, is that you?

what's your favorite python feature?

i like flatning a list with sum
my_list = [[1,2,3],[4],[2,3,4],[9,5,4]]
print (sum(my_list,[]))
#output: [1, 2, 3, 4, 2, 3, 4, 9, 5, 4]

>thought I was good at using c#
>look at source for somewhat complex program
>took 5mins to realize it was even c#
hahaha

>list + empty list = flattered list
Javascript-tier language design.

i like the part where it allows me to write medium-sized software pretty quickly

but i guess f-strings are fun and async/await are as well

Is there a place on the internet you can go to which is like a catalog of APIs and data samples which you can use to build programs in Python, R and other data science languages?

Threadly reminder that the Haskell type system is proven to be theoretically optimal.

kaggle

Use static functions, not class methods.

Haskell is inconsistent.

Nah, the TwitterKit they've pushed out. Initializing it seems to take forever. All I'm doing is using a search query to pull hashtags to display and I'm debating on just scraping it all and just building a simple little feed to display the tweets.

This is objectively wrong.

>sum
This just sums the elements of iterable passed in the first argument, treating second argument as the initial value of the sum (if not given, 0 is used instead and this case will give you an error).

Because you are summing nested lists, you actually get [1,2,3]+[4] as a result of sum([[1,2,3],[4]],[]), which is equal to [1,2,3,4]

Ahem.

reminder not to use emoji's as a filename

>t. butthurt lisplets
Science and type theory is on our side. Get bent.

>using operating systems and/or products that cannot handle unicode

stop using shit software

proof :: a
proof = proof

Idris is suboptimal.

whats that even mean?

God is on ours. Enjoy Hell.

>implying there's anything wrong with this
Learn some actual type theory, lisplet.

>god
I guess it's fitting for lispers to be filthy theists in 2018.

It means he doesn't understand it.

live.sympy.org/
copy-paste:
phi = (1 + sqrt(5)) / 2
def fib(n):
return floor(phi**n / sqrt(5) + 1/2)
for n in range(75):
print n, fib(n)

>Doesn't have linear types

lol
Actually, I'm not sure if any general purpose programming language has it

How can you guys like these books? They consistently offer the worst programming advice I've ever read, Yegor is a hack.

You'll regret worshipping your type theory when you're burning in a lake of fire.

I am going to do this right now and see what happens haha

How high can this go before you start getting incorrect answers due to floating point rounding errors?

>linear types
>caring about meaningless shit

what useful thing have you done with your meme language?

Boy, the blatant false-flagging is real.

Tcl is nice

supposedly infinitely
docs.sympy.org/latest/tutorial/intro.html#what-is-symbolic-computation
>Symbolic computation deals with the computation of mathematical objects symbolically. This means that the mathematical objects are represented exactly, not approximately [...]

If their system is that flawed, you may as well try putting
';DROP TABLE users;

I have tried SQL injection before, didn't appear to work. I did however notice a flaw in one of their submit forms which posted to a page, but when directly going to the post page a bunch of information was output that shouldn't have been showing endpoints for their API.

nikita-volkov.github.io/stm-containers/

thx my man I didn't know.

TypeError: sum() can't sum strings [use ''.join(seq) instead] sorta unintuitive tho, but if guido wills it...

it's ironic/trolling

more like
');DROP TABLE users;--

i like flattening sequences with .flatten
@ Seq(Seq(1,2,3), Seq(4,5,6)).flatten
res1: Seq[Int] = List(1, 2, 3, 4, 5, 6)

inefficient tho

>Threadly reminder that the Haskell type system is proven to be theoretically optimal.

Haskell niggers actually believe this.

>>> from math import floor, sqrt
>>> def fib_phi():
... n = 1
... while True:
... yield floor(phi**n / sqrt(5) + 0.5)
... n += 1
...
>>> def fib_add():
... a, b = 0, 1
... while True:
... a, b = b, a+b
... yield a
...
>>> p = fib_phi()
>>> a = fib_add()
>>>
>>> while True:
... result = (a.next(), p.next())
... if result[0] != result[1]:
... print result
... break
...
(308061521170129, 308061521170130.0)
>>>

nice but, that's not python,

>while True:
>not While 1:

you forgot to import sympy, fucking retard

CL-USER> (loop for x in '((1 2 3) (4 5 6)) append x)
(1 2 3 4 5 6)

>while 1:
u n p y t h o n i c

rude

>(308061521170129, 308061521170130.0)

stackoverflow.com/a/18101261
>Fixed point arithmetic is inaccurate. Jason's C# code gives incorrect answer for n = 71 (308061521170130 instead of 308061521170129) and beyond.
>For correct answer, use a computational algebra system. Sympy is such a library for Python. There's an interactive console at live.sympy.org/

I'm trying to make a filename out of a string in c++ and i'm getting a "cxx::__concurrence_lock_error.txt" error.
int a = 1, b = 1;
const string ext = ".txt";
string fName = "output/A" + a + 'B' + b + ext;
cout

just raising awareness of simpler/more readable ways to do it if given the choice of language
conversely, there's plenty of things which are done more simply/readably in Python compared to Scala

// concatenating strings
#include
#include

main ()
{
std::string firstlevel ("com");
std::string secondlevel ("cplusplus");
std::string scheme ("");
std::string hostname;
std::string url;

hostname = "www." + secondlevel + '.' + firstlevel;
url = scheme + hostname;

std::cout

>C++
>usable language
mmm, excellent footgun heritage

how do you like Scala?

what can you do with it that you can't do in other languages?

Also, have you done any interesting project with it?

learn lisp

wrong reply?

>>> a = fib_add()
>>> p = fib_phi()
>>> n = 0
>>> while True:
... n += 1
... result = (a.next(), p.next())
... if result[0] != result[1]:
... print result
... print n
... break
... if n % 1000 == 0:
... print n
(10597999265301490732599643671505003412515860435409421932560009680142974347195483140293254396195769876129909, floor(0.5 + sqrt(5)*(1/2 + sqrt(5)/2)**509/5))
509

SymPy makes it a bit further but not by much.

You can't concatenate strings with non-string non-char* types. Look up std::to_string or std::stringstream.

scala can't into metaprogramming

No.

#include
#include
#include

main ()
{
std::stringstream ss;
std::string firstlevel ("com");
std::string secondlevel ("cplusplus");
std::string scheme ("");
std::string hostname;
std::string url;

ss

Can't do anything with lisp, learn something like Go or C.

that's ugly as shit

>what can you do with it that you can't do in other languages?
you can do everything in every (turing complete) language, but
> Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.
personally I use it as Python with a sane(ish) type system
as a colleague once said "I'm not smart enough to write robust software in a dynamically typed language". Dude was a PhD, publishing papers, working in the industry and producing excellent code in OCaml and Haskell

>how do you like Scala?
note: there's plenty of downsides to Scala (as with most other languages). Then again, I personally find it the most pragmatic of the languages with type inference, FP, OOP, and providing the choice between mutable/immutable data and eager/lazy eval. Probably the one most likely to get one a job (then again, Kotlin's got some big backers)

If you're interested and got a non-Windows env somewhere, try the Ammonite REPL.
There's also the free coursera courses from the inventors of the thing.
/shill

Well, then you guys definitely trolled me. I spent 80$ on these pieces of shit

Sounds like the perfect opportunity to submit a bug with the guys

HAHAHAHAHAHAHAHAHAHHAHAHAHAHAH

list comprehensions are neato

>buying books when you have them all online

baka

These nihilistic approach to programing make me chukle.
For them, programming should not exist.

>HAHAHAHAHAHAHAHAHAHHAHAHAHAHAH
oh man, sorry, but this^^^
make use of this experience and turn it into a valuable ($80's worth!) lesson for the future
when it comes to memes, try before you buy

Hey Sup Forums, I need some help:
I'm currently writing a small guide on test driven development and I wanted to use NUnit and NUnit.Mock as mock has very easy to use syntax and is not very complicated at all (this is just an introduction, later we will use CPPUnit).

I install NUnit 2.6.4 as required by NUnit.Mock as its no longer developed but VS 2015 is giving me this error and my test fails:


Result Message: System.IO.FileLoadException : Could not load file or assembly 'nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


Why does it not see that I have 2.6.4 install? I also tried 2.6.2 and it couldnt find it either.

It handles any basic type, not just strings and chars.

i haven't read them desu so i don't know if they're that bad but yeah take anything you read on Sup Forums with a grain of salt

seconded
there was some inbreeding happening between the haskal and python lads on the subject, IIRC

I submit on average a bug a day over a working week, I don't have time to understand and shepherd another bug related to software I don't use and barely know. If you (or anyone else) is singing the praises of SymPy in here, I've given you a golden ticket to get yourself into the good books of devs you interact with far more than I.

Does anyone here know anything about Runescape? I haven't played since I was 10, but my girlfriend's coworker wants to learn java to create a bot for his RS character so he can sell it. At first glance, it looks like there are programs out there that he can script in some proprietary language and not have to get into the network programming in java, but generally at the application level, how is a bot created? Do you fake a client and send the server data (events like "right click fish, left click cook", or whatever), or is it even simpler, where you pre-program the mouse to do the actual clicking?

Weirdly, the package is not listed as 2.6.4 (I used nuget to install):
Install-Package nunit -version 2.6.4


I just did 7 captchas fuck you

Most of the time they capture the screen and click on defined patterns (or even in the past, simple pixels with unique colours).

They're extremely easy to spot.

Trying to fake the client is even worse for being spotted as they can control the protocol and know it inside out, even the tiniest mistake will stand out like a sore thumb to any antibotting team they have.

circa 2009 the best/practically unbannable bots were based on reflection
docs.oracle.com/javase/tutorial/reflect/

i think now they have a fancy downloadable client which is much harder to reverse engineer but maybe old school and private servers are easier to bot

wonder if sympy.fibonacci has the same issue
docs.sympy.org/latest/modules/functions/combinatorial.html#fibonacci
from sympy import fibonacci
fibonacci(509)

>I just did 7 captchas fuck you
legacy captcha?

>program meant to draw Delaunay triangulations, Voronoi tessellations, and relative-neighborhood graphs based on points randomly placed on a sphere and projected onto a flat surface
>consistently works fine with between 4 and 128 points
>consistently spergs out (assigns only one Delaunay triangle to an edge) with 129 or more randomly-placed points
What the absolute fuck?

Well, at least I can still make cool images with only 128 points.