[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 338
Thread images: 24

File: daily programming thread2.webm (2MB, 600x338px) Image search: [Google]
daily programming thread2.webm
2MB, 600x338px
old thread: >>56372501

What are you working on, /g/?
>>
Why doesn't GHC have a {-# LANGUAGE KitchenSink #-}

>>56375507
Thank you for using an anime image
>>
>>56375524
You can put the extensions you want in your cabal file. Still better than pragmas in every file.
>>
>>56375310
Find a US employer willing to sponsor people for visas, get them to offer you a job, hope you get an H-1B visa (there's not enough for everyone who qualifies for one)

OR

Get a job with a company that has a US office, work with them for a year, ask them to transfer you to the US office and get you an L-1 visa. Apparently Microsoft sometimes gets new hires to work in Vancouver for a year before transferring them to Washington
>>
File: 0001.jpg (342KB, 984x1400px) Image search: [Google]
0001.jpg
342KB, 984x1400px
>>56375507
I wanna login in a programatically way to http://www.pixiv.net/ and save the cookie, that will allow me to do search request without being limited to search upto the page 10.
How can I tacke this?, II'm not even able to found the pixiv's POST url to do this.
>>
>>56375507
Is she a guy?
>>
>>56375616

> F12
> Network tab
> Do request
> Right click, copy as CURL

done, there is your curl command including cookies
>
>>
Does RAII have any downsides?
>>
i just want a post near the top
>>
I'm reading pic related and it's great. Can we have more suggestions of language-independent books? Any topic is welcome.
>>
>>56375652
It prohibits TCO
>>
>>56375652
If you have move semantics, not really.
>>
>>56375653
Well, is she?
>>
fucking hell latex is enormous
>>
File: 61V8Fv5f6uL.jpg (95KB, 359x500px) Image search: [Google]
61V8Fv5f6uL.jpg
95KB, 359x500px
>>56375658
huehuehue forgot the pic
>>
>>56375670
It inhibits TCO. Functions that don't need RAII can use tail calls.
>>
>>56375658
You're reading nothing? Me too!
>>
>>56375691
Fine, you chuntering autist. Is the pink-haired one a guy?
>>
>>56375640
Now I'm going through all the links to found exactly where's the url request that does the login, I thought it was gonna be a POST since that doesn't creates an url with the send data, but all I've found are GET requests.
Thanks anon.
>>
>>56375670
function example(...) {
function recursive(raii& x); // ...
raii x;
// constructor
recursive(x,...);
// destructor
}
>>
>>56375616
Ruby + Nokogiri is a good way to scrape sites. Mostly because Nokogiri is an arsenal-tier library.

You basically just require nokogiri and open-uri...

Then in order to get information from a page, you just Nokogiri::HTML(open("https://some/url")), then use .css("#some-selector you[tested=in] > .javascript") on that to grab the elements you are interested in, in a way that you can iterate with things like .select, .map, .inject, or whatever.

This of course lets you fetch the URL of other pages to also open() and .css().

The only trick is that you need to do a little bit of cookie management and pass that as the second argument to open().
>>
>>56375721
Yes, completely and utterly. I've put more sausages in my mouth than you've had hot dinners.
>>
>>56375732
I'm using C# (haven't used Ruby in ages), and I don't really wanna use a library since this seems simple enough. If I can't solve this in a decent time will search for a lib.
>>
>>56375773
Why would I do that? I'm very happy with my life. Perhaps you're envious?
>>
>>56375589
Also, be white. We do not need more nonwhite people here.
>>
Hey peeps, completely new to programming. Trying to make a program that checks if 3 numbers are in ascending or descending order, and prints true of they are, and false if they are not. But i get compiler errors thrown in my face, and i have no idea why. I'm supposed to learn from this, so i would greatly appreciate if anyone could explain the whats and whys.
package assignments;

public class Order_check {

public static void main(String[] args){
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
int c = Integer.parseInt(args[2]);

if(a < b && b < c){
System.out.println("true");
}
else if (a > b && b > c){
System.out.println("true");
}
else{
System.out.println("false)");
}
}
}
>>
{-# LANGUAGE RankNTypes, GADTs, TypeFamilies, MultiParamTypeClasses #-}
{-# LANGUAGE ExistentialQuantification, ConstraintKinds, TypeInType #-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts #-}
{-# LANGUAGE PartialTypeSignatures, FunctionalDependencies #-}
{-# LANGUAGE MonadComprehensions, BangPatterns, ViewPatterns #-}
{-# LANGUAGE StandaloneDeriving, DeriveAnyClass, DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell, QuasiQuotes, UnicodeSyntax #-}
{-# LANGUAGE ParallelListComp, TransformListComp, Arrows, RecursiveDo, DoRec #-}
{-# LANGUAGE NamedFieldPuns, NamedWildCards, RecordPuns, RecordWildCards, DisambiguateRecordFields #-}
{-# LANGUAGE RebindableSyntax, PostfixOperators, TupleSections #-}
{-# LANGUAGE NegativeLiterals, BinaryLiterals, NumDecimals #-}
{-# LANGUAGE OverloadedLists, OverloadedStrings, LambdaCase, MultiWayIf #-}


>Haskell
>>
Had my third CS class today, and we already wrote Fizzbuzz

Great professor tbqh
>>
>>56375808
I don't have AIDS. My boyfriend and I both got ourselves tested before sleeping together.
>>
>>56375589

What about US citizenship?
>>
>>56375857
doesn't matter, auto unboxing
>>
File: akari-reader.png (65KB, 1080x916px) Image search: [Google]
akari-reader.png
65KB, 1080x916px
bored
>>
File: Africa Political Large.gif (228KB, 1825x1919px) Image search: [Google]
Africa Political Large.gif
228KB, 1825x1919px
Despite sjw-bullshit, what are your excuses for not learning and using Rust?
Do you feel you would become a sjw if you used it? And that's all what stops you from becoming CURRENT_YEAR programmer?
http://www.infoworld.com/article/3114475/open-source-tools/the-next-version-of-fedora-picks-up-rust.html
>>
>>56375892
Do you have it or qualify for it?
>>
>>56375952

Well, so, for example, If I have a H1-B visa and work for three years, do I qualify for citizenship?
>>
>>56375857
int is an Integer. I found my mistakes. Wasn't in the code, but i fucked up compiling for reasons.
fyi i didn't decide to use java, it's just what we have to.
>>
>>56375732
Nokogiri is great..! Also, add Pry into the mix and you basically make the thing effortless.

This is me trying to scrape the contents of this thread as a bit of a demo: https://asciinema.org/a/7jlodigt8vkldvjjzq40393z3

There are a few gaps in there when I was getting the classes from my web inspector, but none are longer than a few seconds.

Also sure, I could have gone much further, but I think it shows how you can incrementally do things with this.
>>
>>56375985
No. I can't remember whether you're entitled to apply for a green card on either visa, though. Five years in the US after you get a green card and you can apply for citizenship.
>>
>>56376020

What are the benefits of being a US citizen?
>>
>>56376026
*whispers softly*

freedom
>>
>>56376026
a lot of bullshit that might not be worth the hassle, to be honest. Just a green card is enough to legally live in the country with no worries at all.
>>
>>56376044

1/10 too obvious
>>
>>56375940
make a --tail command
>>
>>56376051
Citizenship can't be revoked.
>>
>>56376063
yes it can

don't make absolute statements unless you know what you're talking about
>>
>>56376026
neetbux
>>
>>56376026
None, The downside is that now you have to pay taxes in both countries.
>>
>>56376044
designated sharting marts
>>
>>56376072
Well shit. I had no idea.
>>
>>56376098
He didn't say it was bait, anon
>>
>>56376099
>this meme
It's immigrants who can't handle American food who do that.
>>
File: wJyOK8S.gif (4MB, 640x360px) Image search: [Google]
wJyOK8S.gif
4MB, 640x360px
>>56376010
Next step: Automatic shitposting.
>>
time to write a compiler for my markup language! wish me luck!
>>
>>56376098
I assumed it was trolling, considering you are better off as a citizen of basically any other first world country.
>>
>>56375948
I'm learning it, it seems alright.
Don't think I like that Cargo checks for a new version of the language every time it runs though.
>>
>>56376142
Good luck anon..!
>>
I do actually have an Uncle in America in Chicago, think I could shill that as a way to enter the country?
>>
>>56376063
It can only be revoked if you falsified your information when getting it.
>>
>>56376153
>tfw US, UK, and Irish citizenship
>>
>>56376124
you just have extremely low quality food and you're fat as fatass

>muh freedom
>muh freedom to drink HFCS coca-cola, has to import cane sugar soda
>>
>>56376160
He'd have to get your parent in, then your parent would have to get you in, it would likely take decades.
>>
>>56376160
Yes, they can put in the paperwork to get you a resident alien card and after 5 years you can become a citizen.
>>
>>56376160
>shill
stop using that word when you don't know what it means
>>
>>56376190
5'11, 127lbs
>>
>>56376164
source on that ever happening
>>
>>56376216
hahaha that's even worse
>>
I suppose the most important question is, can you start a business in the US if you're not a US citizen?

I know that Tom Syndicate guy made his own betting site, but IDK if that's applicable
>>
>>56376223
meant to reply to
>>56376163
>>
What'd be a good project to get into machine learning with?
>>
>>56376242
https://www.youtube.com/watch?v=mvTbzQl9Bag
>>
>>56376164
you can revoke your own citizenship
>>
>>56376242
Just look up "britain racist, you'll find tons of cherry picked articles about british citiznes being arrested or lambasted for saying something "racist" against immigrants.
>>
>>56376076
This is the USA we're talking about.

In most states, if you're poor the federal government actively fucks up your life rather than helping you in any way.
>>
>>56376267
The term is 'renouncing'.
Also why would you do that.
>>
>>56375834
All polling data indicates that Trump will lose and Clinton will win. :^)
>>
File: pepe_smug.jpg (110KB, 800x800px) Image search: [Google]
pepe_smug.jpg
110KB, 800x800px
>>56376026
>us citizen
>benefits
Pick one.
>>
>>56375707
>>56375625

Yes.

The anime and manga are really unsubtle softcore fetish porn, it's not well-written. Bullies keep forcing the main character to trap, and somehow his brother is also a trap but on purpose.
>>
>>56376010
>https://asciinema.org/a/7jlodigt8vkldvjjzq40393z3
That is why I think Nokogiri is fantastic.
AFAIK, nothing exists like that for another language. (Though DOM emulation brings some things kinda close)
>>
File: 4wayvi1-03-94854.png (60KB, 975x686px) Image search: [Google]
4wayvi1-03-94854.png
60KB, 975x686px
>>56376314
k

we'll see on election day
>>
>>56376314

So, Nate 'Silver' or Nate Copper as I like to call him runs the website 538, his poll tracker which takes into account all polls, went from 90% certainty of a Clinton victory to 74% certainty, and it only seems to be dropping.
>>
>>56376330
>bullies
>unsubtle softcore fetish porn
Please refrain from talking about things you know nothing about.
>>
> If you enjoy getting locked up for "hate speech"

>>56376266
http://www.dailymail.co.uk/news/article-3580951/Call-centre-worker-arrested-online-footage-Nazi-dog.html

Mr Meechan was arrested on April 28 and kept in custody overnight before being released on bail from Airdrie Sheriff Court the next morning
>>
>>56376362
>kept in custody
>had to pay bail
>not locked up
>>
I wonder when the mods will start purging all the /pol/ posts.
>>
How many programming languages do we need? How should they look?

I want at least something like these:

>A language that emphasizes correctness above all else
Idris seems like a great option. I've never used it, but reading the docs it sounds like the dependent types use a theorem proving system similar to Coq (though less powerful atm). A general purpose functional language with integrated support for proving properties of code and expressing them dependent types seems like a great idea.

>A high level language suitable for kernel, microcontroller, and general systems development
Rust is my current favorite in this space. It isn't ready on all fronts, but I really enjoy programming in it, and I think it proves the concept at the very least. There are a few design decisions I don't agree with, and areas of development I think could use more focus, but for the most part it feels like "C++ done right", and working with C++ every day for my job, I want Rust features all the time.

>A scripting language
Python? Ruby? Nim? A language in this space should have a lightweight syntax, support deep reflection and introspection, and emphasize rapid prototyping above correctness, whole guaranteeing as much safety as possible without getting in the way of the programmer.

>A shell scripting language
Bash? I haven't really been able to break away from it. I tried fish and zsh, but bash is the standard in so many areas that it is hard to break away from.

Bash definitely isn't the "correct" language for this space, there are tons of problems with it. But I haven't seen a very compelling design for a great shell language.
>>
>>56376411
you're the one shitting up the thread fucking faggot >>>/lgbt/
>>
>>56376409
>implying the first two can't be the same
>>
>>56376409
Haskell is the only programming language we need

>>56376392
Shortly after people actually start reporting them
This is the number 1 reason posts don't actually get deleted
>>
>>56375940
I might do the same thing, while there is no captcha
>>
Can I create an ML algorithm to generate songs in this style?

https://www.youtube.com/watch?v=fnb7EqfykF4
>>
>>56376427
they can't
>>
>>56376429
Reporting is a massive chore.
>>
JavaFx Tutorials?
Any good ones you did?
>>
>>56376378
You can be kept in custody for 24 hours for basically anything. Being "locked up" implies actual jail time of ≥ a month
>>
>>56376435
You can create an ML algorithm to do anything
>>
>>56376440
kill yourself
>>
>>56376453
With a 4chan pass, your reports are instant with no captcha needed and they receive higher priority on mod queue.
>>
>>56376427
I wish, but I don't think it can happen. A language in the second space needs to support inline assembly, which doesn't jive with "correctness above all else".
>>
>>56376474
>they receive higher priority on mod queue.
source?
>>
File: 1399453530487.png (22KB, 651x429px) Image search: [Google]
1399453530487.png
22KB, 651x429px
Reposting since nobody responded.

Anyone here use Scala? How is it?

Thinking about learning it, I already know C and Python.
>>
>>56376487
I'll clarify my point: You can be kept in custody for 24 hours for basically anything *in the US*.
>>
>>56376493
It's really horrible. Look at the damn syntax.
Jesus.
>>
>>56376493
you have awful taste in languages
>>
File: 1420605111401.gif (2MB, 479x349px) Image search: [Google]
1420605111401.gif
2MB, 479x349px
>>56376138
I see this is working wonderfully already.
>>
File: 1467398868589.jpg (475KB, 852x973px) Image search: [Google]
1467398868589.jpg
475KB, 852x973px
>>56376510
>>How's Scala? I know C and Python
>you have awful taste in languages
There's absolutely nothing wrong with C
>>
>>56376451
>>56376478
Well, why not? Postulates allow you to reduce potential unsafety to specific assumptions - even better than what Rust provides.

It's easy enough to have a flag that enables or disables postulates on a larger basis like per-module or per-project.
>>
>>56376525
C++ is better in every way
>>
>>56375818
Reee why do people write such rigid code.

static bool IsDescending(int[] arr)
{
int? prev = null;
foreach (var val in arr)
{
if (prev == null)
prev = val;
if (val > prev)
return false;
prev = val;
}
return true;
}


This is C# but the syntax is more or less the same.

Does it bug anyone else when they see something written in such a way? Or is it just me being autistic?
>>
>>56376525
Nothing wrong with python either.
>>
File: Bait.png (114KB, 955x957px) Image search: [Google]
Bait.png
114KB, 955x957px
>>56376568
>>
>>56376567
Oh this code is dumb as well. My brain didn't think to just set
int prev = arr[0];
.

How very silly of me.
>>
File: 1465740370726.png (39KB, 620x456px) Image search: [Google]
1465740370726.png
39KB, 620x456px
>>56376568
kore- kore wa bait desu?!
>>
>>56376579
What is wrong with python? People say it's bad but I never understood why. Yea it's slow but I don't use it for anything that requires hardcore computing. What is wrong with using it for webscraping and file handling and shit like that?
>>
Can someone suggest a good program I can write to learn Python syntax? I've been programming for three years but the intro to CS course I'm taking is moving at a snail's pace, so I want to go ahead and learn this shit on my own.
>>
>>56376600

Yeah what is actually wrong with Python?

It's fucking great.
>>
>>56376342

>it only seems to be dropping

Last month Trump was at 48% certainty of winning after the RNC convention. And he has done nothing but drop hard mostly due to the stupid things he says on a regular basis.
>>
>>56376592
see>>56376600
>>
File: 1466544326223.jpg (32KB, 557x612px) Image search: [Google]
1466544326223.jpg
32KB, 557x612px
>>56376605
>Nothing wrong with that
>>
>>56376565
so this... is the true power.... of C++.............
>>
>>56376600
>webscraping and file handling and shit like that
that's some gay ass scriptfagging it's not real programming and you can do those things with better correctness and performance etc in real programming languages
>>
>>56376567
Or you could just

arr.zip(arr.skip(1)).every((a,b) => a<=b)


in a non-autistic language
>>
>>56376632
kill yourself faggot
>>
>>56376545
The funny part is that women and minorities are underrepresented in programming
>>
>>56376625
But it works perfectly fine in python and is much faster to create. Like I said, i never use it for hardcore programming because it isn't meant for that. It is literally for scripts. Why would I write something to scrape a website in another language when I can do it in python in half the time.
>>
>>56376646

If minorities and women don't choose programming jobs, it's nobodies job to choose it for them. Besides I thought there were plenty Indian's into programming.
>>
>>56376648
Good taste. Rust is really nice.
>>
Can your language implement
traverse_
?
>>
>>56376653
Programming /= coding
>>
isDescending [] = True
isDescending (x:y:ys) | x >= y = isDescending (y:ys)
>>
>>56376653
it's a truly awful language and only baby duck syndrome ass faggots thinks it's faster to develop in python than in java
>>
>>56376686
Ok, it's not a good programming language. It's a good language for what it is meant to do though, that is my point.
>>
>>56376688
oops, forgot to add:
isDescending [x] = True
isDescending _ = False

>>56376692
it's like a for each loop but embeddable in arbitrary monads
>>
How can you determine how much memory is a specific thing taking in your program in C++?

Let's say I have a vector of active clients, would it be like
sizeof( clientClass ) * clientsActive.size()

Or something different?
>>
>>56376692
It's more generic than iteration.

>>56376709
It has nothing to do with monads.
>>
>>56376697
>not an argument
Just saying it is awful doesn't help anything, explain. I am giving you reasons why it is great for making scripts. You are just saying it is bad.
>>
>>56375834
>europeans
>white
>>
>>56376661
Programming /= coding.
>>
>>56376724
He's not wrong. It can be used with monads because monads are all applicative functors.
>>
>>56376724
>it has nothing to do with monads
applicatives, sorry
>>
>>56376728
>/dpt/ - Daily Programming Thread
>Programming
>>>/g/wdg
>>
>>56376748

What's the difference?
>>
Indians came from the cacausus mountains, so stop making fun of them.
>>
>>56376632

But I'm not a polturd you moron
>>
>>56376749
That's like saying fmap uses monads. It is irrelevant and unhelpful.
>>
>>56376741
white by burgerland standards
>>
>>56376777
>it's like a for each loop but embeddable in arbitrary monads
in retrospect this isn't false
>>
>>56376762
I am not developing a website. But I guess you don't know how to make a real argument so whatever.
>>
>>56376762
What does that have to do with web dev?
>>
>>56376791
>>56376792
>unironically using python
>>>/reddit/
>>
>>56376526
It is possible, but I don't think it is the right approach. There's a big difference between "you have to trust the language implementation and this set of properties we haven't proven" and "you have to trust the language implementation".

If you ever include inline assembly you can't prove in the name of performance, I suspect you'll hardly be able to use the library ecosystem at all without pulling in something unproven.

Perhaps if the language required that you provide a equivalent implementation that's compatible with the prover? So you can opt-in to unproven platform-specific optimized versions of your code, or build with --strict or something and use the slower, portable, and proven alternatives?
>>
File: 1440989193297.jpg (236KB, 633x758px) Image search: [Google]
1440989193297.jpg
236KB, 633x758px
>>56376792
>>56376791
REEEEEEEE
STOP USING PYTHON I WONT STAND FOR THIS!!
>>
>>56375507

In android Open GL 2.0:

if I only want 2 dimensions, is the correct way to do this just ignore Z coordinates? How should I change my projection matrix if I'm only expecting to deal with 2d so I'm not performing calculations on the Z coordinates?

also in my past experiences with Open GL, I learned that instead of moving the camera they translate all of the matrices you are rendering.

I assume that means at some point it will loop like the background of scooby doo when they are driving.

How do I prevent this?
>>
>>56376826
orthographic camera

>I learned that instead of moving the camera they translate all of the matrices you are rendering.
>I assume that means at some point it will loop like the background of scooby doo when they are driving.
what
>>
>>56376631
arr.Zip(arr.Skip(1), (curr, next) => curr >= next).All(x => x);


It can be done in C#.

Does that make it not autistic?
>>
>>56376857
yes

the
.All(x => x)
is weird tho
>>
>>56376867

youre a legit idiot pal.
>>
>>56376790
It's imprecise.
>>
>>56376867
>doesn't want trump to win
>inadvertently shills for him by bringing him up and plastering his image everywhere he goes
lmfao
>>
how do you force yourself to program every day?
I play LoL and want to stop but I often don't know what to do in free time when I tried quitting.
Do any of you use any stimulants when programming? Does coffee actually helps?
>>
isDescending a = and $ zipWith (>=) a (tail a)
>>
>>56376926
>giving someone attention means you're making him less popular
lol k
>>
>>56376806
The only people who should need postulates are library developers, driver developers, OS developers, etc.
If you never use a postulate in your code, you know for sure that it's safe, and any problems are upstream. All bugs are due to incorrect postulates. It doesn't poison the safe parts of the code - this is a common misconception.

>Perhaps if the language required that you provide a equivalent implementation that's compatible with the prover? So you can opt-in to unproven platform-specific optimized versions of your code, or build with --strict or something and use the slower, portable, and proven alternatives?
Yes, you could use postulates to show equivalence of the constructive and optimized forms. That said, you want to have some features (panics, RAII, can be guarded by an effect system) in place so that you don't have to worry about representing an unsigned integer as a natural number plus a proof that it's less than UINT_MAX, or a natural number under a quotient that makes it modulo UINT_MAX, etc.
>>
>>56376934
Same problem. Seems like you just need to have a passion or a need to solve problems. Coming up with pointless projects don't work for me. They need to be something I have to solve or need to solve.
>>
>>56376600

absolutely nothing

a successful person (not a NEET) sees the value in getting programs in and out the door.

50% of programming doesn't need to run fast, should be portable, and needs to get made ASAP. Python is perfect for that

An example would be the people recently who made tens of thousands of dollars off of that Pokemon Go API on Shithub selling accounts. Now it's way too late because the fad is over and Ebay shut them down. Those who made money had to be programming since day 1. Did they waste time trying to allocate memory and rewriting libraries? no.
>>
>>56376944
>>56376631
like how the haskell version is basically unreadable and still not even shorter
>>
>>56376984
have fun on election day
>>
>>56376850

Instead of rotating the camera I mean

like to simulate turning left in 3d, they would translate everything right
>>
>>56376999
Well, obviously a language/paradigm that you know is going to be more readable than one you don't know. The Haskell is perfectly readable to me, and I'm not that poster.
>>
What is a stack where you pop from index 0 and push to the end called?

is it a buffer?
>>
I wrote some C++ at the weekend.
>>
>>56376934
Discipline, coffee won't help for long since you get accustomed (and dependent) to it, I need to drink like 3 cups a day to not feel like shit.
>>
>>56377038
Queue
>>
>>56377038
Queue
>>
>>56376926
>pic

Or else what?
>>
File: normalisedCoords.gif (4KB, 468x259px) Image search: [Google]
normalisedCoords.gif
4KB, 468x259px
>>56377022
you rotate everything relative to the "camera" which is equivalent to rotating the "camera" relative to the scene
>>
>>56377038
Queue
>>
>>56377038
que
>>
>>56375616
import requests
s = requests.Session()
s.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'
s.post('http://www.pixiv.net/login', data={'u': 'username', 'p': 'password'})

https://developers.google.com/web/tools/chrome-devtools/profile/network-performance/resource-loading#view-details-for-a-single-resource
https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor#Network_request_details
>>
>>56377038
por que
>>
File: triggered.gif (4MB, 500x281px) Image search: [Google]
triggered.gif
4MB, 500x281px
>>56377035
>>
>>56377038
Queue
>>
>>56376999
and takes a list of booleans and returns true if all of them are true, i.e. if there are no false elements

zipping a list with its tail gives you its moving pairs, i.e.

a     = [1, 2, 3, 4]
tail a = [2, 3, 4]

(zipWith f) a (tail a) = [ (f 1 2), (f 2 3), (f 3 4) ]

(zipping will cut a's 4 off)

(zipWith >=) a (tail a) = [ (1 >= 2), (2 >= 3), (3 >= 4) ]
>>
>>56376934
Have shit to do. It sounds like you have fucking nothing to do. You don't need to be employed to have something to do, either; instead of playing league of losers, make some utility for league of losers. Or not, it's on Adobe Air or some shit, so fuck that noise. Follow in the footsteps of Sanford Kelly and instead of picking a top tier, just pick a project.

1) I don't like telling people to unironically go to plebbit but their sub "DailyProgrammer" is great for just doing something.

2) Get autistically involved in Lua scripting for Gmod if you're really into the gaymes aspect; I know two guys who have gone on from that to actually being gainfully employed just because they had lots of medium-scale Lua scripting for Gmod.

3) If you're not gainfully employed but merely employed, find something to make easier/automate. Make an Android/iOS app for yourself to track shit if you do delivery for a local pizza place.

4) If you're in college/university and you have a Blackboard-like internet suite, make something that logs in and prints out any alerts/messages you have in your inbox at all.

5) On the subject of Gmod and gaymes, you could make a small mod to change an aspect of gameplay or something.

Doesn't matter what you do so long as you just fuckin DO.
>>
>>56377125
DELETE THIS
>>
>>56377143
name one good reason, without involving trump memes, why hillary should be POTUS
>>
>>56377129
uncurry (++) . partition (9 /=)
>>
>>56377038
Queue
>>
>>56376409
Should there be a fifth category for game development, or is Rust suitable for that you think?
>>
>>56377165
She has extensive political experience.

Trump sold some houses.
>>
>>56377129
>>56376944
sure, it's the exact same thing I did, just the ordering of words (and syntax with $) is in my opinion weird and unintuitive.
>>
>>56377183
Game development is engine systems + gameplay scripting. Clean split at the language boundary.
>>
>>56376934
>how do you force yourself to program every day?
I don't. I just write things when I feel like it or think it is important to do so.
>>
>>56377183
Idris is suitable for game development.
>>
>>56375948
The stupid syntax. Everything is backwards and lots of keywords are changed for no reason. There's a reason normal syntax is standard.
>>
>>56377165
Not an American but if he led my country I would be fucking terrified. Clinton might be a conniving snake but she's no different than any other politician. Trump would fuck the US in so many ways
>>
File: 4459353701_826a3c120d.jpg (126KB, 489x400px) Image search: [Google]
4459353701_826a3c120d.jpg
126KB, 489x400px
>>56377223
>>
>>56377197
oh, i didn't actually notice
f $ n = f n
basically it just lets you avoid parentheses, i.e.
f (long expression)
f $ long expression
>>
>>56377223
Idris is Haskell with proofs. It's still garbage collected and all that.
>>
I only know some programming basics in python. How difficult is it to create a simple game like pic related? (Jump and Run + Fighting enemies). And what language makes sense? Thanks a lot
>>
>>56377098
Python? Also:
>http://www.pixiv.net/login
That won't work.
I can't find the url to login, apparently the login is made by a JS function passing the pixiv_id, password, captcha, and g_recaptcha_response.
I could only send the email, the password doesn't work, for example:
https://accounts.pixiv.net/[email protected]&password=123
Only the mail appears in the field.
Guess I'll look into nokogiri.
>>
>>56377234
Are you referring to

x: T

instead of

T x

?

That's so minor that you should be ashamed of yourself for not being able to cope with it and getting so triggered over it.
>>
>>56377250
>jump run fight
Trivially easy
>>
>>56377250
>>>/vg/agdg
>>
>>56376429
>Haskell is the only programming language we need
This is why people dislike Haskell posters. Haskell is good for writing compilers and doing mathematical simulation type stuff (although nobody uses it for that for performance reasons).
On the other hand, explain to me why Haskell is the easiest and safest choice for writing a 3D modeling studio in, and I will explain to you why you are wrong.
>>
>>56377243
>>56377247
https://github.com/idris-hackers/idris-demos/tree/master/Invaders

>>56377250
Literally impossible
>>
>>56377264
literally kindergarten tier insults lmfao
>>
>>56377165

Cause I don't want the world to end this decade.
>>
>>56377287
It has the capability to do game development, but is it good at that? Fuck no.
>>
>>56377287
>Invaders
kys
>>
>>56377282
Haskell is the most pragmatic and practical mainstream programming language.
>>
>>56377301
Gamers demand bug-free experiences, and Idris is one of the best languages for providing those.
>>
>>56377287
>>56377301

Idris is already a game

>code that can't be proved doesn't compile
>very difficult theories are bosses
>each level is a module
>>
>>56377324
Game bugs are a little different than regular software bugs. Good luck writing a proof that you can't get stuck in collision geometry.
>>
>>56377333
Idris facilitates correct code.

Python, JavaScript et al. facilitate bugs.
>>
>>56377251
For logins, this might be relevant too: https://github.com/uasi/pixiv/blob/master/README.md

There is another gem that deals with the mobile API directly too.
>>
Should I learn Scheme or Haskell or Idris?
>>
>>56377324
>Gamers demand
a lot that they don't deserve and can't have

>wtf this isn't 60 fps???? but i've got 9 titans and i5?????
>wtf this is only 60 fps???? there are barely 3 million polygons???

This is reason we get all these crap games and shitty studios and endless minecraft remakes, and buggy as fuck releases.
Gamers' demands have far exceeded supply.
Only AAA games can _barely_ deliver disappointment.
>>
>>56377263
I'm referring to everything
>fn
Redundant keyword, the parentheses should make it clear you're declaring a function, not a variable
>fn foo() -> bar
Again, the -> is redundant
>let
Should be spelled "auto", "mut" should be default, why does "const" declare constants in some lines but not others" And why doesn't "static" do what it says it does.
>unsafe
Should be the default
>match instead of switch
>forced braces in if statements
>no C style for loop even though you need it for some things
>exclamation! marks! everywhere!
It's just a disappointment
>>
Is there anything inherently wrong with:

answer = Character.toString(str_remainder.charAt(remainder - 10)) + result;


answer is a string
remainder is an int
str_remainder is a string
result is a string
>>
>>56377364
This one: https://github.com/yuri-g/ruby-pixiv/blob/master/README.md

Though I have but used it.
>>
>>56377372
If they want realistic graphics and adrenaline-pumping experiences, they should join the army. They won't get any lag there, so they'll really be able to be all they can be.
>>
>>56377372
And the amount of optimisation and extra code needed for that alone is fucking ridiculous
There are probably hundreds of different optimisation algorithms in place in most modern games
>>
>>56377324
bugs aren't even one of the main concerns it's graphics performance gameplay story etc
>>
>>56377377
> the parentheses should make it clear you're declaring a function

You mean like in C where it takes minutes to find out what a declaration means in some cases? (Is it a function pointer? a variable? a prototype? etc)
>>
>>56377377
what about functions that take no arguments, as opposed to a function that takes unit as an argument?

let is shorter than auto.

unsafe as default would rather defeat the point of rust, wouldn't it?
>>
>>56377377
>>let
>Should be spelled "auto", "mut" should be default, why does "const" declare constants in some lines but not others" And why doesn't "static" do what it says it does.

This is coming from functional languages, read it like mathematics:

let x = 5 in x * 2

>match instead of switch
Again, functional languages.
Match returns, switch just side effects
>>
>>56377394
>sink 50 hours into a game
>finally ready to take on the final boss
>get him down to 1hp
>deliver the final blow
>game locks up
>corrupts all your saves
>>
>>56377381
Probably not but your code isn't very reusable at all. It will only work with answers of a certain length for example.
>>
>>56377423
if that happens it's more likely that it's intentional for pirating the game
>>
Is it considered bad practice to name variables and types using your native language?
>>
>>56377423
Lower performance demands will allow us to move into real programming languages like ML languages, Lisps, Haskell, etc where we work at a higher level

>>56377444
No
>>
>>56377444
extremely bad
>>
>>56377377
>Redundant keyword, the parentheses should make it clear you're declaring a function, not a variable
>Again, the -> is redundant
You may have a point here, but this is minor stuff.

>Should be spelled "auto"
Auto is for type inference. Let is for introducing a binding, and you don't need to write auto to have the type inferred.

>why does "const" declare constants in some lines but not others
It always declares constants or, eventually, pure functions.

>match instead of switch
Bikeshedding.

>forced braces in if statements
So that you don't need to put parens everywhere. Would be nice to have ternary syntax, though.

>no C style for loop even though you need it for some things
Rust has iterators.

>exclamation! marks! everywhere!
To show what is a macro invocation vs. a function call.

>"mut" should be default
>>unsafe
>Should be the default
Shit opinions.
>>
>>56377439
Or the game wasn't tested for my localization
Or it assumes you'll be using a certain system configuration
Or it was rushed out for xmas before it was properly tested
>>
>>56377409
>what about functions that take no arguments, as opposed to a function that takes unit as an argument?
void main()


>>56377411
>This is coming from functional languages
What is functional language and math doing in a systems language?
>>
>>56377444
write your code in english
>>
>>56377444
>>56377450
unless you're working on someone else's codebase or with a team

>>56377466
>What is functional language and math doing in a systems language?
Being useful
>>
>>56377450
stay delusional

go ahead and start your game dev company using ML languages if they're so good lmfao
>>
>>56377450
>Lower performance demands
Yeah, right.
>>
check out what I did in some code today

else {
die(":^)");
}

it's live too
>>
>>56377444
English only.
>>
>>56377038
Queue.
>>
>>56377485
Was it part of a for-else loop?
>>
>>56377450
>>56377455
Getting conflicting messages here, guys.

What about using #define to rename the built-in language constructs?
>>
File: carlos.png (272KB, 560x560px) Image search: [Google]
carlos.png
272KB, 560x560px
>>56377507
Are you working on your code or shared code?

>>56377065
Pop :^)
>>
>>56377491
What if the majority of the team doesn't speak English as a native language?
>>
File: zig.gif (19KB, 480x240px) Image search: [Google]
zig.gif
19KB, 480x240px
i want the rust shill defense force to leave
>>
>>56377514
Shared code.
>>
>>56377519
get a better team
>>
>>56377519
Program in the team's language
unless you have a client who wants the source code in english

you can always document foreign names with english names, like

float mizu; // water level
>>
>>56377502
nope just normie if else
>>
>>56377537
 N
PORTABLE
T E
A
L
LAME
Y
>>
>>56377519
It would be a fun to type.
(defn 売る [所 番号]
(書く 所 番号))
>>
>>56377580
>TEALLY
What did he mean by this?
>>
>>56377537
>A system programming language intended to replace C.
>In addition to creating executables, creating a C library is a primary use case. You can export an auto-generated .h file.
???
>>
>>56377580
>TEALLY
>>
>>56377548
I've been trying, but they're a bunch of Europeans and the codebase isn't in any single language. It's a mixture of French, German, Dutch, and Swedish.
>>
>>56377593
>>56377588
>not knowing what teally means
How new are you?
>>
>>56377601
As in, I try to contribute, but they keep telling me that I'm using the wrong language, and that I should have used Swedish where I used French, or the first half should have been Dutch, and so on.
>>
Anyone well versed in relational database systems that can help me out here?

I've got a list of data that exists out of 3 types.
They share most of the attributes, expect maybe 1or 2 extra attributes for each type.

How would I go about this?

- Put all in the same table, give them a categoryId and just leave the unused fields open.
- Create different tables, one for each category.
- A mix of the above. Put all in the same table, put the extra data in separate tables.

I will often need to query a list off all the types together
>>
Hvis du snakker ikke norsk, kan du ikke programmere.
>>
>>56377519
russians program in english, why do you need to know the language in order to code in it?

memorizing function names is different in every language, you don't need to know what that word does.. just that "print" prints shit etc
>>
>>56377635
just tell them to learn english, fucking europeans
>>
>>56377671
Hard to say without knowing the exact use case and subject matter, but you could certainly throw it all in one table, with a "type" reference to another table that contains the details of the types.
>>
>>56377676
Nice norsk Ahmed
>>
>>56377548
I hope you're not serious
>>
>>56377209
And Lua is implicitly the gameplay scripting language, but it has global-by-default and undefined variable names evaluate to null.

Is there a better gameplay scripting language?
>>
>>56377423
All of that can happen except
>>corrupts all your saves
which is virtually impossible.
>>
>>56377726
Scheme
>>
>>56377377
>>56377457

>match instead of switch

Because match does exhaustive pattern matching similar to haskell, it's only remotely similar to switch.

Just read this:
https://doc.rust-lang.org/book/match.html
https://doc.rust-lang.org/book/patterns.html
>>
>>56377324
>Gamers demand bug-free experiences

I'm pretty sure I buy every open world Bethesda Title full price at launch and those are buggy pieces of shit that need to be unofficially patched and cleaned because bethesda wont even clean their own master files of dirty edits.

That might be a rare case of stockholm though.
>>
>>56377324
I hope they don't live on the east coast then
>>
>>56377377
Match very very much is not a C-style switch-case system. Calling it switch would confuse people.
>>
>>56377799
People deserve to be confused.
>>
>>56377457
>Would be nice to have ternary syntax, though.

They're not needed since if/else and match are expression that return a value, meaning you can simply do this:
let x = if y > z { true } else {false}


Same with match.

Also forced braces for if/else are a plus since something like the goto fail bug becomes impossible.
>>
>>56377799
C-style switch is more intuitive. It's limited, but that's for the sake of performance.
>>
>>56377371
Ada.
>>
>>56377466
>void func() syntax

eww

My least favorite syntax from C. It's bad, it's unintuitive, and it violates the principle of least surprise. fn foo() { expression } is much nicer.
>>
>>56377849
I know, but it would be nice to have ternary syntax for the simple cases so you can just say
let x = y > z ? true : false;
, barring the fact that really it would just be
let x = y > z;
.

>>56377856
Matching over a "C-style" enum almost certainly ends up being the same thing.
>>
>>56377856
>C-style switch is more intuitive

Human brains are hard-wired to recognize patterns (e.g. seeing things in cloud, seeing random faces in objects, etc). I'd say pattern matching is more intuitive.
>>
>>56377856
Yep, and that's why it's different from match.

I could see there being room for both a match and a switch syntax in Rust, because they are different things. That's what I'm trying to say here. Naming match switch would fuck with people.
>>
>>56377935
the only thing that switch has that match doesn't is stuff like fallthrough and jumps
>>
>>56377748
Using a Lisp for game scripting is an interesting idea. The performance worries me a little bit, though, and it would be modder-unfriendly towards normies who can only think in terms of procedural or OOP programming.
>>
>>56378003
>implying functional programming, especially when it's not pure, is really any different from procedural programming
>>
>>56377956
also a performance guarantee that it compiles to a jump table
>>
>>56377927
Human brains are imperative. Doing things in order is the most intuitive of all.
>>
>>56378003
Most lispers write procedurally
>>
>>56377601
>German, Dutch, and Swedish
they should know english decently well. drop the frenchfags
>>
>>56377880
I was using true/false just as an example, i could've used anything else.

Also if you need to have multiple if/else it will stay readable, ternary syntax quickly becomes unreadable, in my opinion.

let x = if y > z {
1.0
} else if y < z {
-3.14
} else {
0.0
};

vs.

let x = y > z ? 1.0 : y < z ? -3.14 : 0.0;
>>
>>56378072
MultiWayIf extension for Haskell:
let x = if | y > z ->  1.0
| y < z -> -3.14
| True -> 0.0
>>
just spent an hour and a half trying to run a file in a different directory from fucking sublime text

here was the solution
{
"cmd": ["python","../../../run/main.py"],
"working_dir": "$file_path",
"selector": "source.dosbatch"
}


shit is janky like you wouldn't believe, they have absolutely no documentation
>>
>>56378110

Managed to replicate it in a hacky way using match in Rust:

let x = match () {
_ if y > z => 1.0,
_ if y < z => -3.14,
_ => 0.0,
};
>>
>>56378232
rust's match is based on Haskell's, I think, which is why you can add pattern guards (i.e. a boolean condition)
let x = case () of
_ | y > z -> 1.0
_ | y < z -> -3.14
_ -> 0.0
>>
>>56378141
Just us VS Code senpai
>>
>>56376988
>>56377050
>>56377220
Thanks for the advice.


>>56377136
Thanks for writing it all up. Much appreciated.
>>
>>56378110
>needing an extension for that
(setf x (cond ((> y z) 1.0)
((< y z) -3.14)
(t 0.0)))
>>
>>56377927
You can make that argument in favor of anything.
>>
>>56378366
it's just a syntax extension, it might get added to the language at some point, but you can pattern match in definitions too

myfunc x | y > z =  1.0
| y < z = -3.14
| true = 0.0
>>
>>56378141
>>56378314
This
>>
In openGL ES 2.0, what does

[code ]GLES20.glDisableVertexAttribArray();[/code]

and

GLES20.glEnableVertexAttribArray(mPositionHandle);


do
>>
File: 1460577020386.png (38KB, 227x367px) Image search: [Google]
1460577020386.png
38KB, 227x367px
>>56378591
Disables or enables a vertex attrib array, respectively.
>>
>>56378591
it sets it up so you can call glVertexAttribPointer with mPostionHandle so that the gpu knows where to get the vertex attributes
>>
import Control.Monad (mplus)

match :: [a -> Maybe b] -> a -> Maybe b
match [] _ = Nothing
match (f:fs) a = f a `mplus` match fs a
>>
>>56378141

>run a file
>from fucking sublime text
Anon, you use your text editor to edit files. You use your terminal to run files. Use the right tool for the right job.
>>
>>56378698
Tell that to the emacslards.
>>
>>56378738
As an emacstard, this.
>>
I'm starting to learn visual studio. So it's just click and drag, right? There's barely any coding of my own going on. Holy shit, I didn't know it could be this easy.
>>
File: hol up.png (119KB, 214x271px) Image search: [Google]
hol up.png
119KB, 214x271px
>line numbers in visual studio are off by default and turning them on is buried behind a bunch of options

why tho
>>
>>56378950
>>56379185
VS mind

but I'm not the first guy posting b8
>>
>>56379185
LoC is an oppressive, ableist metric.
>>
>>56379300
There is no good metric.
>>
>>56379311
$$$
>>
>>56379311
The inverse of privilege is a good starting point.
>>
>>56379320
It's not a code metric.
>>
What language is good to learn the OOP paradigm? Java is not too good at it and the language gets in the way a lot.
>>
>>56379385
OCaml
>>
>>56379300
newfag here

what do people even use besides line numbers, like why would you ever want those to not be shown? how are you supposed to find which lines errors are on?
>>
Euler 42 Solution


words = open('p042_words.txt')
words = words.read().split(',')


def is_triangle(n):
return (1 + (1 + 8*n)**0.5) % 2 == 0

def triangle_words(t_w):
for word in words:
wv = 0
for c in word[1:-1]:
wv += (ord(c)-64)
if is_triangle(wv):
t_w += 1
return t_w


print (triangle_words(0))

>>
>>56379436
Shortcuts jump to lines faster than scrolling to them, and the numbers can be visual clutter.
>>
>>56379385
learn prototype oop with lua
>>
>>56379492
ah okay thanks, now I just learned I can double click on the error and it will just jump to it instead of finding the lines manually . . . like I have been doing
>>
would it be faster to write an interpreter of my own defined math equations and characters to LaTeX or straight up learn LaTeX and write everything in it to begin with?
>>
>>56379385
Smalltalk will show you both the strengths and weaknesses of OOP whereas most languages just kind of assume it should be used everywhere.

Same way Haskell shows the strengths and weaknesses of FP.
>>
>>56377377
let has nothing to do with the type you fucking moron
and it's been "standard" longer than "auto" or "var" or whatever the fuck else you've been using
>>
>>56378015
probably doesn't do that in all cases, does the standard actually guarantee that? it could be worse in certain circumstances than a couple branches.
>>
>>56379586
you'd learn latex in the process of making the interpreter
>>
File: wojak.png (9KB, 645x773px) Image search: [Google]
wojak.png
9KB, 645x773px
Pro/g/ramming nub here. Just finished reading through chapters 1-6 in K&R, and skimmed over 7 and 8 because it seemed like more of a reference.

So...what now? I'm looking to tackle a project that would really test my skills with regards to structs and pointers, but at the same time have it be a somewhat "practical"/"""fun""" program/project that would actually get some use.
>>
>>56379776
in C it always will

in other languages no
for instance in Rust, using that (if cond) thing means a match can't guarantee 1 jump
>>
>>56379829
brainfuck interpreter?
>>
>>56379478
How long does it take to program one of these?
>>
Between Hackerrank, topcoder, leetcode oj, project euler and others, which is the best to practice coding?
>>
Project Euler is far more a test of your grasp of number theory than programming skill.
>>
>>56380156
Programming is Math and Math is programming though
>>
>>56380203
Well, it just so happens that mathematics is an extremely broad discipline of which number theory is only a part.
>>
>>56380156
problem solving is a crucial part of non-pajeet tier programming
>>
>>56380286
I'm just saying Project Euler isn't the way to do it.
>>
>>56380296
fair enough
>>
>>56380391
Thread posts: 338
Thread images: 24


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.