[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: 315
Thread images: 47

File: tmp_861-1342882291543417708150.jpg (47KB, 637x579px) Image search: [Google]
tmp_861-1342882291543417708150.jpg
47KB, 637x579px
What are you working on, /g/?

Old thread: >>62107950
>>
First for Lambda Ladies!

http://www.lambdaladies.com/
>>
>>62119052
First for shitposting
>>
If I wanted to start learning C++, where should I start??
>>
>>62119052
Nth for APL.
∇ x ← affine (A b c g); v X V T M i
x←0⍴⍨⍴c⋄T←⍉A⋄M←-A
→0/⍨∧/0≤V←M+.×X←c+.×⍨⌹T+.×A÷[1]×⍨v←b-A+.×x⋄⎕←(∣i),x-←i←X×g×⌈/(V<0)/v÷V⋄→2/⍨∨/⎕CT≤∣i

>>
File: Screenshot_2017-08-27_15-11-28.png (270KB, 505x487px) Image search: [Google]
Screenshot_2017-08-27_15-11-28.png
270KB, 505x487px
Continuing my fun with linear types
>>
>>62119122
int main()
>>
>>62119122
Read a book.
>>
File: cringe.jpg (24KB, 400x400px) Image search: [Google]
cringe.jpg
24KB, 400x400px
>>62119150
>placing the function return type and the function name on the same line
>>
File: 1500261898309.jpg (198KB, 935x799px) Image search: [Google]
1500261898309.jpg
198KB, 935x799px
>not writing in the thinking man's language
>>
>>62119194
int
main(argc, argv)
int argc;
char* argv[];
>>
>>62119211
>man
Sexist.
>>
What you think, dpt?

public class apples {
public static void main(String[] args) {
tuna tunaObject = new tuna();
System.out.println(tunaObject.toMilitary());
System.out.println(tunaObject.toString());

tunaObject.setTime(13, 27, 6);
System.out.println(tunaObject.toMilitary());
System.out.println(tunaObject.toString());
}

}


public class tuna {
private int hour = 1;
private int minute = 2;
private int second = 3;

public void setTime(int hour, int minute, int second){
this.hour = 4;
this.minute = 5;
this.hour = 6;
}

public String toMilitary(){
return String.format("%02d:%02d:%02d", hour, minute, second);
}

public String toString(){
return String.format("%d:%02d:%02d %s", ((hour==0||hour==12)?12:hour%12), minute, second, (hour < 12?"AM": "PM"));
}

}
>>
File: e91mp.jpg (26KB, 475x444px) Image search: [Google]
e91mp.jpg
26KB, 475x444px
>>62119233
Make your objects immutable, faggot.
>>
How important is it to know algorithms for job interviews for example being able to implement different sorting algorithms in your language of choice within a given time frame?
>>
>>62119250
immutability was mistake
>>
>>62119194
fn plusone(bar: i32) -> i32 {
return bar + 1;
}
>>
>>62119260
http://www.yegor256.com/2017/02/21/say-no-to-google-recruiters.html
>>
>>62119194
How do you return a char*?
>>
>>62119280
What esoteric programming language is this?
>>
What's the best language choice?

Rust for the low-level base, with a lisp interface on top?
>>
>>62119333
>Rust for the low-level base,
C
>>
>>62119333
Just say what you want to do, and someone might give a meaningful suggestion.
>>
>>62119327
static char *
function(...)
{
...
>>
File: >mfw dorks.gif (2MB, 500x374px) Image search: [Google]
>mfw dorks.gif
2MB, 500x374px
>>62119194
>having function return types
>>
Does anyone understand this and why it's not working?

>Running blocking pulse operations from pulse eventloop callbacks or other threads while loop is running is not supported by this python module. Supporting this would require threads or proper asyncio/twisted-like async code.
>Workaround can be to stop the loop (raise PulseLoopStop in callback or event_loop_stop() from another thread), doing whatever pulse calls synchronously and then resuming event_listen() loop.

I have this and it's not working. When I raise PulseLoopStop, it just exits (as expected I assume). Does anyone know how they exactly meant that? How can I raise that exception, do something and then call event_listen() again?

import pulsectl

pulse = pulsectl.Pulse()
def do_this(event):
raise pulsectl.PulseLoopStop
print("test")
pulse.event_listen()

pulse.event_mask_set('all')
pulse.event_callback_set(do_this)
pulse.event_listen()


This is the module I'm using for controlling PulseAudio. I'm a beginner and this has no documentation whatsoever.
https://github.com/mk-fg/python-pulse-control
>>
>>62119349
>using a language created before memory protection was invented
>>
Why if I input 6 for example it prints 6 two times and then 5,4,3...?
    int p, n;
scanf("%d", &n);

p = 1;
while ( n > 0) {
printf("%d\n", p * n--);
}

return 0;
>>
>>62119233
doesn't java let you do %p for am/pm? (and it'll be locale-aware for non-americans)
>>
File: 1503829456092.png (206KB, 800x800px) Image search: [Google]
1503829456092.png
206KB, 800x800px
Why do people argue over C and Rust? It really doesn't make any sense.
>>
>>62119442
Ikr, Rust over C is such a no-brainer...
>>
>>62119330
C
>>
>>62119424
>printf("%d\n", p * n--);
Don't do that
>>
File: 15006286503.jpg (163KB, 1024x768px) Image search: [Google]
15006286503.jpg
163KB, 1024x768px
PROGRAMMING CHALLENGE

Make a £sd calculator. It must be able to add, subtract in £sd, multiply and divide by decimal fractions. Lowest coin is farthing.

So far, we have a solution in APL and J!
What other languages will present /g/ later?
>>
Some Kotlin and it's fun
>>
>>62119230
thinking women are also allowed, if you can find them
>>
>>62119478
This is homework.
>>
>>62119280
auto plusone(int bar) -> int {
return std::plus<>()(bar, 1);
}
>>
File: 1502357646102.jpg (177KB, 709x821px) Image search: [Google]
1502357646102.jpg
177KB, 709x821px
>>62119392
>>62119448
>using a language for brainlets made by mentally fragile twinks
I need something stronger, more robust.
>>
>>62119122
Start with C.
>>
>>62119496
If you were trying to be funny, it didn't work.
>>
>>62119478
How many times did you post this already?
Nobody is going to do your homework for you.

Try Pajeets for some $$$ if you're that desperate
>>
>>62119525
>our code of conduct bans sexist jokes
I take it you posted your site here? >>62119087
>>
why would I use rust I'm not making a web browser
>>
>>62119424
it doesnt tho anon
>>
>>62119511
>buffer overflow: the language
>robust
This is hysterical.
>>
File: gooby.png (185KB, 300x300px) Image search: [Google]
gooby.png
185KB, 300x300px
>>62119052
>embedded python
why do this to yourself?
>>
>>62119541
Someone's frustrated he can't make any friends...
>>
>>62119564
>he
>>
My friend wants me to program for him for his UE4 game, but i have no experience with UE4. Anyone here know if blueprints is even usable to make a game? Or would I just be coding in c++ anyways?
>>
File: 1481962219570.png (31KB, 220x197px) Image search: [Google]
1481962219570.png
31KB, 220x197px
>>62119552
>pointing out insecure shit in your code should be a compiler job not a linter job
>>
>>62119499
>>62119531
It's not homework.
>>
>>62119508
>auto
>
-> int

for what purpose
>>
worst day of my life? when they changed GCC development to C++
>>
>>62119620
C++ is a meme
>>
>>62119620
muh consistency
>>
>>62119583
You can use both interchangeably, IIRC.
>>
>>62119620
for the cancer.
but you aren't complaining about the explicit template initialization of a totally useless template, in this context, that returns a temporary function with known types just to not type '+'?

(I should've left the return type off..)
>>
>>62119653
If I do something in blueprint, can I easily grab the code for it in c++?
>>
hello
made a program recently?
>>
>>62119052
I want this book.
>>
>>62119211
Is there a good book to get started?
>>
>>62119751
sure, start with k&r2 and ignore the haskell meme.
>>
>>62119751
what's your experience level?
>>
>>62119714
>tfw no anime programming books
>>
File: crust.jpg (231KB, 662x602px) Image search: [Google]
crust.jpg
231KB, 662x602px
>>62119552
Rust shitters sure do have a hard time letting go.
>>
>>62119778
https://en.wikipedia.org/wiki/The_Manga_Guides
>>
>>62119765
0
>>
>>62119765
Not him, but I just started reading The C Programming Language.
>>
>>62119815
Are they actually good.
>>
>>62119873
>>62119891
I started on LYAH but both that and RWH are pretty out of date now; that was over a decade ago and AFAIU they weren't updated to new standard lib changes &c. You could still use them if you don't expect every code snippet to compile out of the box

Can't wage for stuff https://github.com/bitemyapp/learnhaskell except maybe Byorgey's course which IIRC was pretty good (cis194)

>>62119922
I don't know. I vaguely remember skimming some pages of manga guide to databases (or was it statistics or something else); it seemed pretty neato. You can definitely learn from them though obviously you don't want to use it as a substitute of your usual textbooks.
>>
>>62119389

Is this okay? It seems to work, but I don't know if this endless while-loop is a good solution.
Can anyone spot something crucially wrong with this? Maybe performance issues (too much CPU usage)?

import pulsectl

def do_this(event):
events.append(event)
raise pulsectl.PulseLoopStop

def wait(pulse):
pulse.event_mask_set('all')
pulse.event_callback_set(do_this)
pulse.event_listen()

pulse = pulsectl.Pulse()

while True:
events = []
wait(pulse)
print(events)
>>
File: 1503384576560.jpg (162KB, 1280x720px) Image search: [Google]
1503384576560.jpg
162KB, 1280x720px
>>62119957
>over a decade

over half a decade*
>>
File: smwojak.png (117KB, 680x788px) Image search: [Google]
smwojak.png
117KB, 680x788px
PI = atan(1) * 4;
ONE = tan(45 * PI / 180);
>>
>>62119998
PI = atan(ONE) * FOUR;
ONE = tan(QUARTER * PI);
FOUR = floor(ONE + PI);
QUARTER = ONE / FOUR;
>>
>>62119873
>>62119891
Apparently this is good http://www.cs.nott.ac.uk/~pszgmh/pih.html
>>
>>62120003
fag
>>
Are microkernels a sensible design?

Does it really make sense to put the memory manager in userspace?
>>
Is Rust going to replace C and C++ as time goes on?
>>
File: 1503687807072.jpg (110KB, 914x892px) Image search: [Google]
1503687807072.jpg
110KB, 914x892px
>>62120053
You cant use ONE and FOUR etc before you define them anon
>>
>>62119132
Almost as cryptic as modern c++
>>
>>62119525
>zhe is triggered
Fuck off back to hackernews
>>
>>62119448
>>62120099
Rust is a dead language, it's dead on arrival. Everyone pushing it is just triggered that ZHE is not in control of the ISOC++ community.
>>
File: no int.png (165KB, 303x311px) Image search: [Google]
no int.png
165KB, 303x311px
Can someone explain to me how scope works in C++? This is a problem I had with GLM due to stupidity, but it seems like weird behavior to me.
I had:
void somefunction(){
glm::mat4 t;
t = glm::translate(t, glm::vec3(5.0f, 5.0f, 0.0f));
std::cout << glm::to_string(t) << std::endl;
}


void otherfunction(){
glm::mat4 t = glm::translate(t, glm::vec3(0.0f, 0.0f, 0.0f));
std::cout << glm::to_string(t) << std::endl;
}

void main(){
somefunction();
otherfunction();

}


somefunction() and otherfunction() were part of the same class, but I omitted that for brevity.

I'd have expected otherfunction() to give me some error since I was using 't' on its own declaration. Instead, the 't' from somefunction() seemed to have spilled over to it, and both printed the same values. Why did this happen? Shouldn't 't' have been cleared, or lost, once the program was out of somefunction()'s scope?
>>
>>62120191
What's wrong with it compared to C or C++?
>>
>>62120123
What kind of brainlet language are you using?
>>
File: ?.jpg (95KB, 445x629px) Image search: [Google]
?.jpg
95KB, 445x629px
>people would rather shit on other people for using another language instead of discussing what they're actually working on
>>
>>62120054
Thanks anon
>>
>>62119957
Sweet, I might pick up Databases and Calculus, a refresher is always good, especially when I remember nothing whatsoever.
>>
>>62119998
why not
double pi() {
double x, y;
long int n = 666980085;
int q = 0;
for (long int i = 0; i < n; ++i) {
x = (double)std::rand() / RAND_MAX;
y = (double)std::rand() / RAND_MAX;
if (pow(x, 2) + pow(y, 2) < 1) {
q++;
}
}
return 4 * (double)q / n;
}
>>
>>62120196
I don't see the problem here. You're declaring t inside otherfunction.
>>
File: 1499534692545.jpg (41KB, 492x492px) Image search: [Google]
1499534692545.jpg
41KB, 492x492px
>>62120355
>666980085
>>
>>62120196
glm::mat4 t = glm::translate(t, glm::vec3(0.0f, 0.0f, 0.0f));

how is that 't' for translate getting there, other function?
>>
File: 1495371259423.jpg (42KB, 401x401px) Image search: [Google]
1495371259423.jpg
42KB, 401x401px
>>62119052
I'm trying to guess how to use jsoup to download chinese cartoon titties from some booru.
>>
How often is batch mode used in actual projects?
>>
Worth reading?
>>
File: 32490405_p0.jpg (649KB, 1200x1697px) Image search: [Google]
32490405_p0.jpg
649KB, 1200x1697px
>>62120519
no, learn Haskell instead
>>
>>62120386
But I am also using it to initialize itself when I give it to glm::translate, which shouldn't work. And the contents from the 't' which should have been gone once somefunction was done were instead apparently spilled over.

>>62120424
It should have been from nowhere, but see above.
>>
Codeacademy any good?
>>
>>62120567
You're hitting uninitialized memory.
It just happens to be the case that the memory for the new t is the memory which held the old t.
>>
>>62120618
no
>>
File: 9780999081419.jpg (43KB, 400x493px) Image search: [Google]
9780999081419.jpg
43KB, 400x493px
This is by far the best book on programming.
>>
>>62119052
Does anyone has some resources to get into AI development? Assume I know nothing about AI.
>>
Thoughts?

public class Mouse extends Rodentia {

String name;

public Mouse(String name) {

this.name = name;

}

public void eat() {

System.out.println(name + " ate some cheese pizza!");

}

public void solveMaze(int minutes) {

System.out.println(name + " solved the maze in " + minutes + " minutes!");

}

public static void main(String[] args) {

Mouse ratly = new Mouse("Ratly");
ratly.eat();
ratly.solveMaze(3);
ratly.order();

}

}
>>
>>62119052
What actually is the best C++ for idiots type book? I can make basic programs that perform simple functions, but I'm still a retard.
>>
>>62119087
>http://www.lambdaladies.com/
>We need to segregate ourselves in order to code
That's not how you attack sexism!!!
>>
>>62120885
OOP/10
Terrible
>>
File: 1448039488470.png (152KB, 1194x810px) Image search: [Google]
1448039488470.png
152KB, 1194x810px
>>62120833
>"how to become a millionaire" tier book
>>
>>62120936
It's rated 4.9 on Amazon for a reason, turd.
>>
>>62120640
That makes sense. It just strikes me as odd that not even the compiler warned me about what's essentially
int a = something(a);
>>
File: 1501806894206.jpg (519KB, 1280x1079px) Image search: [Google]
1501806894206.jpg
519KB, 1280x1079px
>>62120981
And game of thrones is rated 9.5 on IMBd and Rotten Tomatoes
>>
>>62121022
Is -Wuninitialized on?
>>
>>62119087

I prefer to call them "functional females"..
>>
>>62119375
Disgusting.
>>
I just wrote this factorization algorithm and I think it's about as efficient as I can get it. Can anybody write one that's more efficient?
def factorize(num):
factors = []
end = num ** 0.5
for i in range(1, num):
if (i > end) | (i in factors):
break
if num % i == 0:
factors.append(i)
factors.append(int(num / i))
factors.sort()
return factors
>>
File: 1503253154884.jpg (35KB, 605x474px) Image search: [Google]
1503253154884.jpg
35KB, 605x474px
>>62120885
>this.name = name;
wat
>>
>>62121137
lol have you not studiet object oriented programming? He's setting the local variable name to the parameter name. IMO it makes more sense than following some naming convention for field variables, like _name.
>>
>>62121089
It isn't.
>>
>>62121180
I unironically love the C++ way of doing it.
class Mouse
{
public:
Mouse(std::string name): name(name) {};
private:
std::string name;
>>
Why don't more non-academic languages have dependent types? They're very useful.
>>
>>62121274
>std::string
>not having all your sexual transmitted diseases in
 using namespace std;
>>
>>62121325
#define condom namespace std
using condom;
>>
how should i start tackling a string that has been weirdly encrypted? i suspect im past the bulk of whatever they're trying to hide as the string was reversed and encoded into base64 and gives me what i suspect is a plaintext key as its in english

help would be greatly appreciated anons
>>
>>62121317
Dependent types arent really a thing that can be tacked on, they need to be there from the start.
>>
making an auto tester in python for my assignment in C. VERY comf
>>
Working on simulating a pinochle game, will do some simulations and analytics when finished
>>
I'm brainstorming ideas for a decentralized imageboard on IPFS using the pubsub feature. What I have so far:

- servers subscribe to "???chan/<board>"
- client publishes message to "???chan/<board>" to create a thread (optionally signed by their private key)
- servers adds thread to local DB, pin thread object on IPFS, and subscribe to "???chan/<board>/<hash of thread object>"
- similar procedure for posting to a thread
- servers can choose to index all messages, or only messages signed by trusted keys (e.g. to implement spam prevention)

Any obvious problems with this? Ideas?
>>
File: 150314124341.gif (1MB, 500x281px) Image search: [Google]
150314124341.gif
1MB, 500x281px
>you can't have the same function names for different datatypes
Who thinks that's a good idea and why?
>>
>>62119260

if u want to get hired, yes, if your position is even slightly technical they will ask you about trees and shit. Most of the time they give you a problem and let you suggest the best way to solve it.

its not all about the theory tho, they are also wondering if you are sociable and they want a human being in the team.
>>
>>62121520
>decentralized
DoA
>>
>>62121556
what do you mean lad?
>>
>>62121617

probably this? https://en.wikipedia.org/wiki/Polymorphism_(computer_science)
>>
>>62121556
You mean function overloading?
>>
>>62121520
>>62121578
Build a cryptocurrency around it
>>
>>62121729
Even more ded.
>>
>>62121116
>females
>functional
>>
File: neuromancer.gif (473KB, 500x355px) Image search: [Google]
neuromancer.gif
473KB, 500x355px
>>62119052
I KEEP JUMPING LANGUAGES WTF IS WRONG WITH ME ????!!!! I NEED TO DO A PROJECT NOW SO I CAN STAY ON TASK PLEASE HELP OUT. I know C, Java, some of C# and some of C++.
Right now I am taking a course on how to code simple data and I use dr racket for that course. Can't I just stick to one language and build something useful !?
Help a dude out please :D
>>
>>62121771
fuck off reddit.
>>
>>62121771
Isn't the point of working on your own project is to be working on something YOU think is fun.

But if you insist... I want you to make a program that detects and counts trap webms in /gif/. Good luck
>>
File: buaw.png (409KB, 500x497px) Image search: [Google]
buaw.png
409KB, 500x497px
stanford cs 101 is a good way to start with programming?
>>
how does back propagation through time work if the neural network is fully recurrent
>>
File: 2_7robotlaputa.jpg (86KB, 1224x765px) Image search: [Google]
2_7robotlaputa.jpg
86KB, 1224x765px
How do I program robots like the ones that live on Laputa?
>>
>>62121940

learn Rust, its the only language of the future desu.
>>
>>62121949
>language of the future doesnt even have ternaries
>>
>>62121940
>>62121949
can confirm all laputan robots run from rust source code rendered in cuneiform on strips of papyrus in their chests
>>
>>62121940
That is such beautiful film.
>>
>>62121980
>film
>>
>>62121366
Then we need new languages.
>>
>>62121940
I am not a machine!
>>
>>62121940
>>62122029
the larping faggot is right. i doubt you could program them, the way their wounds are illustrated makes it very clear they're bio-mechs
>>
>>62122018
Not really, im pretty happy with the choices we have now. Though if functional langs ever figure out how to get faster, that'd be great.
>>
>>62119581
>>62119581
Here, let's factor all the pronouns into one word you little
>shit
>>
: Use ( -- ) FORTH ;
>>
>>62122060
>Though if functional langs ever figure out how to get faster
Not gonna happen, computers are fundamentally imperative by design.
However, since functional languages are infinitely superior, it's high time we designed a computer that's functional by design. You know, with linked memory devices instead of serial ones (physical neural networks, maybe), and a processor that implements lambda calculus instead of Turing logic (no idea what that would look like).
>>
>>62122101
even more outdated than C
>>
>>62122103
>Not gonna happen
It will happen you dummy, we just need an academic team that actually care about speed instead of wanking to type theory or some shitty gimmick.
>>
File: 14880822453873.jpg (141KB, 900x554px) Image search: [Google]
14880822453873.jpg
141KB, 900x554px
>tfw too unintelligent for java
>>
File: 1503397263565.png (28KB, 250x354px) Image search: [Google]
1503397263565.png
28KB, 250x354px
>>62122176

hol tite fwend
>>
>>62122236
dumb frogposter
>>
>>62122236
dumb frogposter
>>
>>62122236
dumb frogposter
>>
>>62122236
dumb frogposter
>>
>>62122236
dumb frogposter
>>
>>62122236
dumb frogposter
>>
File: 1502129628903.jpg (7KB, 250x182px) Image search: [Google]
1502129628903.jpg
7KB, 250x182px
>>62122250
>>62122261
>>62122295
>>62122310
>>62122311
>>62122321
>>
>>62122236
dumb frogposter
>>
do NOT bully the frogs
>>
how the fuck did a frog get so many Yous
>>
>>62121124
After 2 and 3, all remaining primes can be expressed in the form 6n±1, so alternately add 2 or 4 to your candidate primes.
>>
>>62122329
>>62122334
>>62122336
dumb frogposter
>>
>>62122336
Because you touch yourself at night.
>>
>>62121771
Just do project Euler
>>
>>62119233
go away, thenewboston
>>
berp

>>743416902
>>
why can dynamic dispatch happen across overrides but not across overloads?
for example suppose i have a method that's overloaded depending on which derived class the parameter belongs to
i pass in a base class reference
why can't it figure out how to call the right method?
>>
File: ultimate reading enlightenment.jpg (1MB, 500x2855px) Image search: [Google]
ultimate reading enlightenment.jpg
1MB, 500x2855px
Make sure you know what books to read if you want to become a true programming expert.
>>
>>62121556
>you can't have the same function names for different datatypes
It's because of how linking works. You'd have to encode the parameter's types into the function name like C++
>>
redpill me on select(2) vs poll(2)
>>
should i listen to this site

https://matt.sh/howto-c
>>
Atom remembers the previous session state when run as root, but not when run as my user. I'm guessing it's a permissions issue somewhere, but where?

inb4
>don't use atom lel
>>
>>62122754
switch C and C++
>>
https://leetcode.com/problems/longest-substring-without-repeating-characters/description/

    public static int answer(String s) {
HashMap<Character, Integer> charSet = new HashMap<Character, Integer>();
int lengthCounter = 0;
int maxCounter = 0;

for (int a = 0; a < s.length(); a++) {
System.out.println(s.charAt(a));
if (!charSet.containsKey(s.charAt(a))) { // we have NOT yet encountered a repeating character
charSet.put(s.charAt(a), a);
lengthCounter++;
} else { // we have encountered a repeating character, reset
if (lengthCounter > maxCounter) {
maxCounter = lengthCounter;
}
lengthCounter = 0;
a = charSet.get(s.charAt(a));
charSet = new HashMap<Character, Integer>();
}
}

if (lengthCounter > maxCounter) {
return lengthCounter;
} else {
return maxCounter;
}
}


ITS O(N) FUCK YOU L33TKODE
>>
>>62119424
yeah dude put n-- in the next line
>>
>>62122901
don't use atom lel
>>
>>62122901
use vim you sadcase
>>
>>62122901
don't use atom lel
>>
>>62122236
>>62122329
dumb frogposter
>>
>>62122901
don't use atom lel
>>
>>62122901
use vim you sadcase
>>
https://www.youtube.com/watch?v=CBAhRImsxqc
49:42
she's going on dramatically about her mom wrapping up a sponge as a practical joke, saying she was a narcissist as if it's borderline abuse
>>
>>62123011
i think most of that was one guy but I got here late and also called the guy a dumb frogposter because he is one
>>
>>62119810
C is a meme pushed by fedora-tipping redditors that think they're edgy for using an outdated language.
>>
File: pascalbro.jpg (255KB, 774x992px) Image search: [Google]
pascalbro.jpg
255KB, 774x992px
Pascal still best language.
>>
>>62123086
I challenge your claim

Duel me
>>
>>62122901
Nevermind, fixed it.
For future reference, if you've found this on the archives after googling the issue:
>sudo rm -rf ~/.config/Atom/ ~/.atom/storage ~/.atom/compile-cache
>>
>>62122754
Why aren't there any Python books?
>>
How can I use Data.Time ParseTime with parsec?

https://hackage.haskell.org/package/time-1.8.0.3/docs/Data-Time-Format.html#v:parseTimeOrError

It has a nice parser defined but I'm not sure how I can call it correctly from a parsec parser function.
>>
File: 1474924891474.jpg (27KB, 600x418px) Image search: [Google]
1474924891474.jpg
27KB, 600x418px
>>62123241
>hackage
>>
>>62123297
hackage is god tier, can read the source of all the libraries you use right there
>>
>>62123241
Use readSTime or readPTime, then adapt that to parsec.
>>
>>62123343
Yeah, the
>adapt to parsec
bit is what I don't really know how to do, or do you mean read the source and reimplement it?
>>
Still learning python in Codeacademy.
Things that I learned so far
>I hate forced identation
>lists are a bit confusing
I supposse that I should review list and shit to solve all my doubts.
Also, does /g/ have a recommended cheatsheet for pyton?
>>
what's the best way to implement callbacks in modern C++? (11/14/17)
>>
>>62123377
Not sure, you could try looking for a data parser for parsec.
>>
>>62123377
>>62123430
*date parser
>>
File: 1498845987063.png (238KB, 1004x494px) Image search: [Google]
1498845987063.png
238KB, 1004x494px
A = [1, 2, 3]
B = [1, 2, 3]
C = [A, B]

In python, if I have a list of lists like above, how would I pull one value from one of the inner lists, and return which list it came from as information?
Say I want to pull a random value, in this case the 1 from list B, and I want to return that value, and I want to return the name of the list it came from. so I want to return "B1."
Would this whole process be easier if I were to just use a dictionary?
>>
File: file.png (169KB, 737x758px) Image search: [Google]
file.png
169KB, 737x758px
My SICP professor is requiring me to learn emacs. What do?
>>
>>62123467
Learn emacs.
>>
Trying to pick up Haskell again.

Is it normal to feel like it still hasn't "clicked" yet after a while?
>>
>>62123467
drop the """""class""""".
>>
Are there any other sites like codewars but better? for brushing up on skills with different languages or just coding challenges in general.

I already know of the really popular challenge sites but I'm looking for recommendations on which ones are the best
>>
>>62123501
Yes, it's a rabbit hole
>>
what is the best language with multimethods and why are they not a more common feature
>>
>>62123467
Use vi. It's not a requisite as i know to use lisp.
>>
>>62122901
your user and root are different users (duh), hence, different config files, preferences, etc.
>>
>>62123535
Haskell, type classes, combined with Haskell extensions it's far and away the most powerful, except for Haskell derivatives like Idris
>>
>>62119122
Edx has some courses going on right now.
>>
>>62123462
named tuple?
from collections import namedtuple

A = namedtuple('A', 'field_1 field_2 field_3')
B = namedtuple('B', 'field_1 field_2 field_3')

matrix = [A, B]
print(matrix[0].mro())


?
>>
I finshed helsinki Mooc java part 1 and started with Intro to java programming Comprehensive edition. I am a 35 year old recovering drug whos been clean for 2 years now. I can write simple programs but just trying to get multiple classes in java to work together makes me feel retarded. The only online people I see in java thenewboston anyone can recommend any good videos? for Java? Im not indian btw.
>>
Is this guy right?

https://www.youtube.com/watch?v=QM1iUe6IofM
>>
>>62123667
no
>>
>>62123667
>all the braindead runts screeching in the comments with a million upboats
pineal gland status: excised
>>
File: 1489358362847.png (9KB, 365x378px) Image search: [Google]
1489358362847.png
9KB, 365x378px
>>62123507
>tfw can't pass the first test challenge
>>
>>62123700
post it pls
>>
>>62123719
>The code does not execute properly. Try to figure out why.
int multiply(int a, char *b) {
return a b;
}
>>
>>62123736
srs
>>
>>62123420
perfect forwarding of weak-binding lambdas.
>>
>>62123518
Damn. Lazy evaluation is still a mind fuck.
>>
>>62123744
I don't even understand what they want from me.
>>
>>62123736
whoa
>>
File: dgfadg.gif (770KB, 540x304px) Image search: [Google]
dgfadg.gif
770KB, 540x304px
is a vector of a struct that only stores floats represented in memory the same way as an array of floats?
>>
>>62123751
b should be an int, not a pointer to a char, and "a b" should be "a * b".
>>
>>62123751
I solved it

apparently they want you to change "char *" to "int" and put an asterisk in the return statement.

Don't worry, there are MANY fully correct solutions to that problem. The problem writers are fucking retarded.
>>
>>62123751
depends on whether char *b is a null-terminated string or a pointer to a single char.
return a * ((int) *b) might work, idk.
>>
>>62123761
alignment might cause differences, but generally they're the same
>>
>>62123761
>>62123780
mind you the same bit is in a pointer from the vector, not directly in the vector, so you'd use &vector[0] or something
>>
>>62123761
I don't know shit about c++ vectors, but a struct with a float occupies exactly the same amount of memory as a float itself.

However, it may be possible that using one over the other messes with compiler optimization, but I don't know enough about that to give you a conclusive answer.
>>
File: 1501756658137.gif (1024KB, 218x228px) Image search: [Google]
1501756658137.gif
1024KB, 218x228px
>>62123769
>>62123774
>>62123777

This worked.

But seriously I started typing #include and setting up main and scanf for variables...
>>
>>62123797
You're overthinking it. Programming is as much of a creative endeavor as it is one of logic. Try to intuit what they want you to do.
>>
>>62123507
google code jam
>>
>>62122370

checked
>>
What's the design pattern to use when one thing at a high level can have several different low level implementations? For example, a renderer might switch between DX12, Vulkan and Metal from a single switch at the start. How can I do this without global state?
>>
>>62123849
plenty of things are used to solve that:
composition, facades, inversion of control
hell, even the visitor pattern can solve that

(also, opaque types, most of "SOLID," etc)
>>
>>62123790
>>62123787
I'm working with OpenGL and trying to send both to a glVertexAttribPointer call, and them being different somehow is the only conclusion I'm reaching. Say I have a plain GLfloat array with 16 floats and a vector with 4 structs that has 4 floats. Both of these work for the array:
glBufferData(GL_ARRAY_BUFFER, sizeof(simpleArray), simpleArray, GL_STATIC_DRAW);
//These were written for the vector, but work for the array
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(floatsStruct), (GLvoid*)(offsetof(floatsStruct, x))); //offset is 0
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (GLvoid*)0);


But neither work for the vector when I use
glBufferData(GL_ARRAY_BUFFER, structVector.size() * sizeof(floatsStruct), &structVector.front(), GL_STATIC_DRAW); 


And I'm not sure what to make of it. Funnily enough, both have the same size (64 bytes).
>>
>>62123849
Factory boyo
>>
>>62123949
You can also use
vector.data()
which gives you a pointer


It should be the exact same, unless the struct has differing alignment. Is there nothing else you're changing? (e.g. those two glVertexAttribPointer)
>>
https://hue.merkoba.com/
>>
>>62123949
Ugh, I literally have this problem every time I do an OpenGL project. Usually it's something to do with the values that I'm passing to glVertexAttribPointer. What does your struct look like?
>>
Done with my kernel's page virtual memory remapping process. Now it's time to take a break and masturbate.
>>
>>62123849
Service locator is global but seems like the best fit for this. At least it's what I use. Inversion of control would be fine too but you'd have to carry a stupid pointer around all the time for nonexistent gains in maintainability.
>>
>>62123467
Learn emacs
>>
>>62124044
>>62123990
I'm not pasting the whole code here, so here's a pastebin link:
https://pastebin.com/EfiyJRuz

The struct is very simple.
>>
>>62124226
I don't see what the problem is.
Try the vector with just raw floats?
>>
File: B_mOsG4WYAEKRlI.jpg (26KB, 599x375px) Image search: [Google]
B_mOsG4WYAEKRlI.jpg
26KB, 599x375px
How do moan ads avoid bloating up the stack?
>>
>>62124273
I just noticed the problem. I thought I had rewritten the array as a series of structs properly, but I somehow got st2.y and st4.y switched. That simple mistake was enough for me to assume something was wrong elsewhere, because I thought I couldn't possibly have made a mistake there.

Whoop dee doo. I only considered that might've been it as I was washing the dishes to take my mind off of the code.
>>
>>62124431
Don't forget you can use

v.data()
instead of
&v.front()
>>
>>62124376
Haskell is lazily evaluated
>>
>>62124431
Damn, I would never have got that.

Also, shouldn't your first glVertexAttribPointer call be of size 2 rather than 3?
>>
>>62123585
Once I did a Microsoft one that was pretty shitty
>>
>>62124491
Yeah it should. But that was okay, since my actual struct had 5 values (x,y,z,tx,ty) instead of 4. I just cleaned it up for the pastebin because I was only using 4 (z was always 0).

>>62124463
I won't forget. It's easier to type.
>>
how hard is it to do video recognition when the target video is provided? Does openCV do this out of the box? So I provide a video clip, if that clip ever plays during a separate video stream then the program will recognize it's on and alert me
>>
>>62121940
Well first off, it would need hardware to run a full-fledged AI, which nobody knows how it would work or if it would be based on current NN architecture.

In fact, it given a premise of having such AI capabilities, you would have a different AI code the code itself, manually. So probably no code to begin with.
>>
I guess it is because I am retarded, but I honestly got overwhelmed reading the first chapter of "The Algorithm The Design Manual". Has anyone read this book, if so, what are the requirements? I feel like you need to have dealt with Discrete Math, and Linear Algebra before touching this book.
>>
>>62122754
Nobody here is smart enough for advanced math.
>>
>>62124812
There's no "advanced math" book in that list.
>>
>>62124868
>There's no "advanced math" book in that list.
>Advanced Engineering Mathematics
Sure thing dumbass.
>>
>>62124955
If that makes you feel better, mathlet.
>>
>>62124979
>literally contains the words "advanced" and "mathematics" in the title
>not an advanced math book because i'm too smart lel
No. You're objectively wrong. If there are people who understand something well enough to write a reference book of reasonable quality on it, and even they call it advanced, it's objectively advanced, no matter how hard or easy it is for anyone else. If it's easy for you, fine. But if you think it's so easy for you that it's not advanced, you're just a snob.
>>
>>62119052
int x;
x = 4; //okay
int x[3];
x = {1,2,3}; //OMG WHAT ARE YOU DOING IT DOES NOT MAKE ANY SENSE WAAAH
>>
Is there actually anything wrong with Python aside from it being slow as dicks?

It's probably the comfiest language in existence.
>>
What do you, veteran/professional programmers, think is the best way to get an abstract thought, into code? This is by far the hardest thing for me as a beginner to overcome. How did you guys overcome this? Thanks in advance.
>>
>>62125050
nani?
int[3] x = [1,2,3];
>>
>>62125112
D is a good language. C++ is a POS
>>
>>62125050
>>62125112
3[int] [1, 2, 3} = x;
>>
>>62125125
agreed
>>
>>62125125
What about F#?
>>
>>62125130
>[1, 2, 3}
wtf?
>>
>>62125140
Didn't use it
>depends on .NET
Most probably garbage
>>
>>62125097
It's not a high performance bare metal language.
It's not a paragon of type theory and lambda calculus.
The real question is if there's actually anything *right* with it. If not either of those two things, then what?
>>
>>62125141
i[3][nt 1[2{]3,, ==; x
>>
>>62125144
What the fuck is your problem with .NET?
>>
>>62125149
>If not either of those two things, then what?
Extreme ease of use and expressibility?
>>
>>62125155
>>62125130
what is this abomination.
>>
>>62125157
Windows only. I has a neutered down version that runs on Linux but that shit is just a placebo.
>>
>>62125166
valid c++ of the future probably
>>
>>62123462
If A and B will always be in the same position in C, you can just pick a list at random by picking a random index from 0 to 1. That way, if the random index is 0, you know it came from list A and if it was 1 it came from list B.
>>
>>62125050
Explain this
>>
>>62121425
>62121425
Kode?
>>
>>62125157
I'm currently learning some WinAPIs and those are really the shit as they're the inner functioning of Windows and will always apply (plus you understand a lot on the strange issues of a lot of programs). .NET is only a pajeet tier collection of pre-made shit, on which meme languages like C# reside. True men don't use that OOP bloated stuff. If you have to use OOP at least go with Java which has the advantage of being universal as there are versions of the JVM for anything.
>>
>>62125050

>"int x;"
>allocate an int sized chunk and let x be a name for it with value semantics
>"x = 4;"
>populate it with value 4

>"int x[3];"
>allocate a 3-int-sized chunk and let x be a name for it with const pointer semantics
>"x = {1,2,3};"
>reseat x to this other 3-int-sized chunk instead
>MLEM can't do it
>>
>>62125050
It's because ints act like their values but int[3]s act like their addresses. If you want an int[3]-like type that acts like a value you should use this type instead:
struct { int first, second, third; } x;
x = {1,2,3};
>>
>>62125031
Your argument would hold if "Advanced" referred to "Mathematics", however it is advanced "Engineering Mathematics". Which is as close to advanced mathematics as using a telescope is to astronomy.
>>
Is it worth learning Swift?
>>
>>62125448
>doesn't have multimethods
no
>>
>>62125031
check the table of contents. Literally everything is undergraduate level (except the chapter on FEM for the Poisson equation, but I'm not even sure it talks about functional analysis).
>>
File: IMG_20170828_001125.jpg (314KB, 1080x1259px) Image search: [Google]
IMG_20170828_001125.jpg
314KB, 1080x1259px
How did I do?
>>
Can I use CLion indefinitely by resetting trail or something?
>>
>>62125493
memed HARD
>>
>>62125493
>62125493 ▶
I hope you ordered programming socks with this.
>>
>>62125507
How so? Fundamentals don't really change.

>>62125512
Maybe later.
>>
File: pol065.jpg (54KB, 426x463px) Image search: [Google]
pol065.jpg
54KB, 426x463px
>>62125493
Well done on achieving enlightenment.
>>
>>62125507
>$7.24
>HARD
?
>>
>>62119511
>not liking mentally fragile twinks
>>
File: hard_?.jpg (2KB, 691x181px) Image search: [Google]
hard_?.jpg
2KB, 691x181px
>>62125530
>>
>>62120281
>implying anyone is working on anything
>>
>>62125567
probably because he is one
>I need something stronger, more robust.
hue hue
>>
>>62125507
Michael Abrash is the only author whose books I have reread just for the sheer pleasure of his writing; the material itself was a bonus. The Zen books are must reads for any programmer. Even though the bulk of his material is outdated due to advances in technology, the clarity of logic that he brings to bear on an algorithmic problem deserves to be studied.
>>
>>62125570
!8'3
>>
>>62125570
>>62125613
i absolutely understood this exchange
yup
just a couple of normal human beings having a normal conversation
nothing wrong here
>>
>>62125570
*notices $7.24 HARD (?)* owo what's this
>>
>>62123467
Install Zext, my boy. Tell your "professor" to stop using bloat and start using his brain.
>>
>>62125622
&9
;@'(
59
43$$85
>>
New thread: >>62125667
>>
Need some advice on something I've been writing ideas down for for years, some business related customer management application. I started the application using nodejs as a back end without ever having used it, I thought it would be a good learning experience. I think doing this really affected my ability to make progress on the project.

Any suggestions for backend technogoly? I'm comfortable with c# and have some understanding of python. I want to use this project to learn something new, I don't think it's going to be node.
Thread posts: 315
Thread images: 47


[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.