/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

posteriorscience.net/?p=206
stackoverflow.com/questions/10102881/haskell-how-does-atomicmodifyioref-work
github.com/elbingobonito/Brainfuck-Haskell
lmgtfy.com/?iie=1&q=How do I learn JavaScript
dalian.waifu.pl/
twitter.com/AnonBabble

Please stop posting anime in a technology related discussion forum

Remember maggot!

If you use OOP or any of its ideas in your code, you're officially the sheep
you so greatly describe about when you say things about Apple fans.

Join the rebels, the one who think different, join the Functional Programming rebels!
Overthrow Codecuckism!

For starters, if you like Java (Ugh!)
- Learn Clojure or Scala!

If you like Python or Javascript (Double ugh!)
- Learn Elixir!

If you like C# or any .Net OOP language (Triple UGH!)
- Learn F#!

Otherwise, read the bible that is SICP!

There's also the Holy Language of Haskell!

ThirD

>Haskell users thinking their language is useful

enjoy never getting anything done, ever

Meanwhile I'm working at Facebook making new stuff happen while you're doing codemonkey shit

>SICP
>mfw we're that doomed that SICP isn't even taught in Lisp
posteriorscience.net/?p=206

i really really like Java
it's just so fun

If it's forbidden, report this thread.

haskell still requires help from OOP languages in order to do any work, you would know this if you actually worked for facebook

developing spam filters doesn't sound too interesting, except maybe for an copypasta-ing autist like you

>please

ok janny sure things

(keeps posting anime)

>haskell still requires help from OOP languages in order to do any work

>tfw professional Haskell programmer

if only you KNEW

yay, more hipster programmers!

So I am sending off a Post request to an api. However if I send too many it'll time me out.

I'm using xmlhttprequest. How do I make it pause and wait for a request to succeed before sending a new request?

It's true, though, particularly in this context.

The Haskell spam filters sit as a subsystem and small component of the entirety of Facebook's stack.

Every time with Haskell fags as "proof" that Haskell has jobs and real-world opportunities.
>muh facebook component

C# is more fun, user.

Join the comfy side of programming.

dumb frogposter

>javascript

You've got to resend; you can just tell the endpoint "Yo, let me know when I can try again."

You just have to try again after an interval.

haskell should stay in academia

If mutation is not purely functional, how do you count? Like if I wanted to count the number of words in a string would you write a recursive function with a base case of 1 and just set a value equal to the sum of all of them? How is this done? What if I'm counting a lot?

>can
can't*

Saying SICP is the bible of CS is like saying Spivak's calculus is the bible of math.

How do I set this interval?

im working on a C# program were i give it a code and it decodes it..

simple its my first C# app

Ada calls c functions using pass by reference if you want, which takes some getting used to

You sum them recursively. With the programmer using substructural types or the compiler doing optimizations, you can get the runtime benefits of mutation while maintaining all the static benefits of immutability.

Mutation isn't impure.

I've made a new observation today.
If you have to draw a diagram before writing code, your code will be shitty. No exceptions.

What language, dickbreath?

Post code.

I want to make fun of you, and also help you.

no like a cypher

I'm trying to make a very simple console game on C, and it's amazing how simple it is to get something working with just stdio.h. I miss having frameworks do everything for me (I learned Python first), but this has been quite a fun ride.

I've made a very basic Breakout clone so far. I'm not posting the code right now because it only works on the Windows console (it uses cls to clear the screen).

Yes, I understand that you're making a glorified Cracker Jack ring, I'm curious as to how you're going about it. I like reading beginner code.

i don't know C# that much im still leaning by watching shitty youtube videos

i have experience with php java script html and css

>inb4 pajeet

i just have not done anything new in a while and thought this would be good

>thought [YouTube language tutorials] would be good

ok pajeet

fuck you thats how i learned php java script html and css

know any better ways to learn code

>php java script html and css

:(

>fuck you thats how i learned php java script html and css

mfw I was right

it feels bad to be right sometimes

Pick up some reading material and write something instead of wasting your time watching videos for 5th ‘language’ and still asking for ways to learn

What?

writing a tool to do some primer design for molecular biologists

mostly just simple string comparisons, but there's so many edge cases to keep track of that the bookkeeping is a nightmare.

Is it even possible to do a multi consumer multi producer lockfree queue?

yes

If this post is out of place, please tell me and I will delete.

I looking to pay a company to create a high quality StumbleUpon clone to my specifications. How much should I expect to pay for a project of that magnitude (and do you have any recommendations as to who to hire)?

Use stackoverflow.com/questions/10102881/haskell-how-does-atomicmodifyioref-work for the queue

Never worked with Android so I'm gonna start writing a bullshit little app.

The fucking yellow book.

It will teach you C#, and it teaches you how to program before you even touch C#.

Sounds to me like you can't afford it either way, you want a high quality clone of a product that has been 10 years in the making and you don't even have a rough idea how much and where to go with it. Estimate 50-100k per developer a year (or more depending where you go and what you want) and triple the estimate for how long it would take then rethink what you're doing. Ideas are not enough.

Would probably be $40k+, plus lots of infrastructure to maintain the application and whatnot.

That's being conservative.

Thats about what I expected, just wanted a second voice. Thanks

Anyone have experience of Haskell on Android? I write Haskell day-to-day so thinking of dicking around there while I have some spare time. The easily-found resources all seem out of date, Keera Studios has been really quiet as far as I can tell and they were the main public user; NDK examples use Ajhc and that project closed quite a while ago.

t. DVD c programmer

I love how this low-quality bait is still producing (You)s for this poster

...

>tfw you're slightly color blind and /dpt/ is committing micro-aggressions against you

How do I learn to program?

InteliJ Idea is much, much more comfier than MonoDevelop

Holy shit you're right.

Probably means where in C you have
void foo(int *bar)
when interfacing with this function in Ada you could declare it like
procedure foo(bar: in out Integer);
and not worry about access (pointer) syntax, instead treating it just like any other pass-by-reference parameter.

Not that this is anything special really, lots of languages with C interfaces work similarly. Ada apparently has a peculiar feature though in that record types declared as using C conventions suddenly become pass-by-reference by default unless you use a special convention C_Pass_By_Copy.

I'm trying to hack the C++ compiler into running some code before main() by declaring a global object and having code run in it's constructor, e.g.
struct Hello {
Hello () {
std::cout

Depends, what do you want to do with it?
There's plenty of books and online resources to use, basically just gotta pick a language, set up a dev environment and run with it

Thanks

>I'm trying to hack the C++ compiler into running some code before main()
why

Trying to make an online multiplayer advance wars with everyone's favorite language PHP.

What i'm getting into, guys?

Setting up some functions that are going to be called in main() so that I can just add extra .cpp files without changing the file containing main() each time.

okay but why

github.com/elbingobonito/Brainfuck-Haskell

god, haskell code is so beautiful

that Parses newtype reminds me of state

Almost, the foo function you're calling should be changed to int bar in that case.

Do we still hate rust?

Yes

So if I draw the diagram after I code does that mean it's really good? =)

Post code.

How do I learn JavaScript senpai?

...

You kill yourself first, degenerate weeaboo scum

lmgtfy.com/?iie=1&q=How do I learn JavaScript

Seriously.

Make a lisp interpreter in it.
dalian.waifu.pl/

Kek, stop trying to make that shitty general work, lad.

Nobody likes /wdg/, not even JavaScript programmers.

kys

/wdg/ OP has information what
wants.
What else?

It's a shitty general and we shouldn't encourage thread splitting.

JavaScript is just as welcome here as any other programming language.

Hate to ask for homework help but I'm pretty stuck and google searching isn't returning the information I need.

For my class's second to last lab (we're using POO IN LOO), we have to read a text file structured as follows using Scanner:
- The first line will have a number which will represent the length of an array, int len = scan.nextInt()
- The subsequent lines will be two sets of three-letter nation abbreviations on each line, ie. USD GBP

We use that number from the first line to instantiate an object array for a custom class called Exchange: Exchange[] exch = new Exchange[len] and then populate that array with Exchange objects that take the abbreviations as parameters: Exchange ex = new Exchange(from, to). My current problem is that I'm able to instantiate the array but whenever I try to fill it with the objects, the array is only filled with the last entry in the text file, so when I use a foreach loop to check what's in the array where len = 6, it looks like:

USDDKK
USDDKK
USDDKK
USDDKK
USDDKK
USDDKK

My codeblock that reads the file looks like:

while (scan.hasNext()) {

if (scan.hasNextInt()) {
int len = scan.nextInt();
exch = new Exchange[len];
}

if (scan.hasNext()) {
from = scan.next();
to = scan.next();
Exchange ex = new Exchange(from, to);

for (int i = 0; i < exch.length; i++) {
exch[i] = ex;
}

}
}

Am I shitting in the street too hard?

And I don't think so.
JavaScript perfectly fits in /wdg/, and you cannot use JavaScript without a bunch of web technologies. Hell, it is the language for *Web* browsers, why JavaScript posts must not exist within more spesific threads?

>specific
fix

Anyone good with MySQL?

I'm trying to filter the results to be a certain year but they always come out the same and just ignore the 'WHERE'

SELECT
p.ProvinceName
, avg(cnd.Price)
, max(cnd.Price)
, min(cnd.Price)
, std(cnd.Price)
FROM (
SELECT
s.Price
, s.CountyID
FROM sales20102016 s
WHERE s.SaleDate = '2012'
) cnd
JOIN counties c ON c.CountyID = cnd.CountyID
JOIN provinces p ON p.ProvinceID = c.ProvinceID
GROUP BY p.ProvinceName;

Wow, it's just like the IT labs I had to work

Look at your for loop and think about what it's doing each iteration
Also, I'm willing to bet that int len = scan.nextInt(); is going to cause you issues

>never actually used bullet
>know the code better than most contributors
>never rendered a 3d model
>wrote big parts of a library
do people actually use what they write?

Try 2012 without the ''

I think it's about time to get over memes and clearly say, what's so wrong with OOP and what's so right with FP.
Anyone?

Which scripting language would be better to use for automating tasks and web scraping, and what resource for learning you recommend the most? I'm not new to programming, already know some Java and C#.

Thanks you boys!

(No bully pls)

Still works; alas no difference.
I think its doing the functions before looking at the WHERE but I forced the FROM to sub query.

Thanks anyways though.

Can you guys post some learning sources?

>Wow, it's just like the IT labs I had to work
pic related

>Look at your for loop and think about what it's doing each iteration
D'oh. I'm taking the same object I instantiated at the start and putting it in every spot in the array instead of actually instantiating a new object for each spot in the array.

>Also, I'm willing to bet that int len = scan.nextInt(); is going to cause you issues
Oh, I see why... I think. Shouldn't it be "ok" in the context of a lab in that the first line will always be an integer?

I don't think there's anything fundamentally wrong with OOP, it's just not very useful and it tends to have a negative effect when it's used inappropriately. FP is basically a refinement of procedural programming and isn't ever really a bad thing unless you go to far trying to make shit immutable because you've bought into the meme that I/O, mutation, etc. can never be pure.

Can you use WHERE in the outside query?

Functional programming is explicitly about keeping your shit immutable, by treating everything like a mathematical formula and not falling back on crutches like state variables.

What do you think FP means?