[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: 35

File: SICP - Simplicity.png (673KB, 1280x720px) Image search: [Google]
SICP - Simplicity.png
673KB, 1280x720px
Old Thread: >>59939652

What are you working on, /g/
>>
>>59947259
thank you for using an anime image
>>
>>59947259
Lisp is the most powerful programming language.
>>
>>59947267
right now i'm going through cracking the coding interview in python. this summer i'm going to be doing a research internship with machine learning so it'll be interesting how that turns out
>>
is python supposed to be the most basic programming language? it seems everyone learns it as an intro
>>
>>59947303
No.
>>
next() in java only reads until a newline, is there something that reads everything in a txt file, newlines included?
>>
>>59947300
Good luc man!

>>59947303
Not necessarily BASIC (although that is a programming language ;) ), but it is easy to pick up because it hides a lot of the nitty-gritty features of languages like C, C++, or Lisp. It's quite easy to do what you are thinking with a python script, making it beginner friendly.
>>
>>59947300
damn that sure sounds interesting.
>>
>>59947303
Nah, but simple languages are for children and teens who aren't in college yet.

Like logo and shit.
>>
do people actually sit together and study?

being near people is distracting
>>
>>59947312
i don't think so, i know in python they have file.read(). in java i think you need a loop
>>
>>59947330
Shit yeah it's fun, we used to quiz each other and explain each other stuff, not sit in silence and study like weird mormons.
>>
>>59947330
go to your nearest library, of course people sit together and study. they do it for group work or just studying in general. i prefer studying at home now though, got all the food and coffee to get comfy
>>
>>59947312
While (next)
>>
>>59947312
https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAllBytes%28java.nio.file.Path%29
>>
>>59947330
When I was in school, we did. It was entertaining. Kind of miss it.
>>
>>59947322
who are you?
>>
>>59947367
the guy you replied to.
>>
>>59947373
doubt it
>>
File: Capture.png (21KB, 622x280px) Image search: [Google]
Capture.png
21KB, 622x280px
>>59947378
>>
>>59947351
I mean, looking back, I kind of regret not going into study groups since the very beginning. I was doing pretty miserable both grade-wise and emotionally on my second year.

Study groups both improved my grades and my mood.
If you find you can't concentrate when doing your homework and studying, do try doing it with friends, can't recomend it enough.
>>
File: 364772992.jpg (59KB, 640x480px) Image search: [Google]
364772992.jpg
59KB, 640x480px
programmers...do you feel any smarter because you're a programmer? Have you noticed any positive changes to your cognitive functions?
>>
>>59947289

Can your Lisp do this?
rubyist@Overmind:~$ irb
irb(main):001:0> class Fixnum
irb(main):002:1> undef_method :+
irb(main):003:1> end
=> Fixnum
irb(main):004:0>
/usr/lib/ruby/2.3.0/irb/input-method.rb:153:in `gets': undefined method `+' for 3:Fixnum (NoMethodError)
from /usr/lib/ruby/2.3.0/irb.rb:469:in `block (2 levels) in eval_input'
from /usr/lib/ruby/2.3.0/irb.rb:623:in `signal_status'
from /usr/lib/ruby/2.3.0/irb.rb:468:in `block in eval_input'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:189:in `buf_input'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:104:in `getc'
from /usr/lib/ruby/2.3.0/irb/slex.rb:206:in `match_io'
from /usr/lib/ruby/2.3.0/irb/slex.rb:76:in `match'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:283:in `token'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:265:in `lex'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:236:in `block (2 levels) in each_top_level_statement'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:232:in `loop'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:231:in `catch'
from /usr/lib/ruby/2.3.0/irb/ruby-lex.rb:231:in `each_top_level_statement'
from /usr/lib/ruby/2.3.0/irb.rb:485:in `eval_input'
from /usr/lib/ruby/2.3.0/irb.rb:395:in `block in start'
from /usr/lib/ruby/2.3.0/irb.rb:394:in `catch'
from /usr/lib/ruby/2.3.0/irb.rb:394:in `start'
from /usr/bin/irb:11:in `<main>'
>>
>>59947389
so this.. is the power.. of inspect element..
>>
>>59947409
No.
>>
>>59947407
>I kind of regret not going into study groups since the very beginning
i did study groups since first year and was still miserable both grade-wise and emotionally
>>
>>59947409
>do you feel any smarter because you're a programmer
no, because I still have to look everything up before I understand it or have some pajeet on youtube explain the problem to me
>>
>>59947415
whatever you want to believe m8.
>>
>>59947409
No, but I used to have a pretty shit memory, either it improved because of programming, or just the additional responsibilities of both college and working, or puberty didn't do my head much good.
>>
>>59947419
Maybe you need better friends.
>>
>>59947414
Do you want a meme medal or some shit for that?
It seems pretty fucking useless.
>>
>>59947474
he's trying to get people to shit on ruby so he can feel like an embattled victim
>>
>>59947467
that's the hard part isn't it. they were study groups organized by the science association, it would have one older student mentoring it, and others who signed up online.
>>
>>59947414
That one is simple. Just call the unbound :+ and Lisp will complain.
>>
>>59947474

Lisps pride themselves on their strong metaprogramming capabilities, but Ruby has a lot of interesting strengths. They can add and remove methods from objects at runtime, create types at runtime, modify types at runtime, and more. Where Lisp has macros, Ruby has a lot of... quirky tricks up its sleeve.

>>59947485

Nope!

>>59947518

How would you unbind the + function in Lisp?
>>
>>59947608
(fmakunbound '+)
and unlock the COMMON-LISP-USER package.
>>
>>59947622
Typo, COMMON-LISP package.
>>
File: tdd.jpg (59KB, 550x690px) Image search: [Google]
tdd.jpg
59KB, 550x690px
retail epub is up on bibliotik yall :^)
>>
>>59947707
does this book teach me how to type on keyboards?
>>
>>59947736
no it helps you grow as a person by controlling cars with your keyboard
>>
File: pajeet.jpg (58KB, 680x646px) Image search: [Google]
pajeet.jpg
58KB, 680x646px
I'm learning C++ to develop my own indie game, was it a correct choice? Engine i'm planning is Unreal Engine 4, I heard Unity is cancer towards the industry.
>>
>>59947759
Take a look at godot if you're a poorfag and don't want to shell out money.
>>
>>59947759
Do you even need to know how to program in UE4? Pretty sure the blueprint system makes the vast majority of it non-programmer-friendly
>>
>>59947759
>I'm learning C++ to develop my own indie game, was it a correct choice?

Yes. C++ is a language of video games.

>Engine i'm planning is Unreal Engine 4, I heard Unity is cancer towards the industry.

If you need a 3D engine for your game, you should probably consider making some smaller scope games first.
>>
File: 1472084586481.jpg (44KB, 640x636px) Image search: [Google]
1472084586481.jpg
44KB, 640x636px
When will rust take over?
>>
>>59947947
When enough companies and developers decide to use it such that in the future the majority of system software is mostly programmed in Rust.
>>
File: pence.png (727KB, 677x741px) Image search: [Google]
pence.png
727KB, 677x741px
>>59947608
metaprogramming seems like a bad idea and always annoyed me when I couldn't look up where a method was defined

I still like ruby though. If you like lisp more than ruby you're a tryhard imo.
>>
>>59947759
UE is a superior engine, but Unity is fine provided you don't just use all the stock assets, world building, and physics, which is main reason everybody loathes it
>>
>>59948028
get a better editor?
>>
>>59948028
Lisp is more cyberpunk tho
>>
Metaprogramming is a programming technique in which computer programs have the ability to treat programs as their data. It means that a program can be designed to read, generate, analyse or transform other programs, and even modify itself while running.
>>
>>59948028
The whole point of metaprogramming is to reduce rewriting code, which is a very good thing from a maintenance perspective. Just don't abuse it.
>>
>>59948065
>cyberpunk
what do you mean by this
>>
File: ThanksAnons.gif (2MB, 359x200px) Image search: [Google]
ThanksAnons.gif
2MB, 359x200px
>>59947769
It's written in C and C++ but honestly Unreal Engine is taking my interest, even if they jew 5% of sales for every $3000 sale.

>>59947782
Huh, I never heard of that before, but I still want to learn C++ to avoid any major roadblocks when using the engine.

>>59947925
I don't know, I really got the concept down, I can't help myself but wing it if the time comes.
>>59948046
Thanks for giving me public opinion on Unity.
>>
CREATE RECURSIVE VIEW topic_implications_closure (topic, implies, depth, via) AS
SELECT implications.topic, implications.implies, 1, implications.topic
FROM topic_implications implications
UNION ALL
SELECT implications_closure.topic, implications.implies, implications_closure.depth + 1, implications.topic
FROM topic_implications implications, topic_implications_closure implications_closure
WHERE implications.topic = implications.closure.implies
;


>implying implications
>>
>>59948689
>all of those implications
>>
File: received_983276338440401.jpg (103KB, 720x1280px) Image search: [Google]
received_983276338440401.jpg
103KB, 720x1280px
>>59947259
What are the best books about cybersecurity and remaining in the dark on the Internet?
Some information about me got leaked and a part of my personal data has been revealed. This happened because of my carelessness, and this is now a good reason to learn and care about my privacy.

What minor things I did so far:
>stripped down my facebook to almost zero I only use it as my "newspaper"
>switched to BlackPantherOS because I had a CD of it
>I started to use Google services indirectly

Now I realise I cannot be entirely alone cause I do not have the ability to gain control of the servers of the services so I just want to achieve the goal that makes me partially invisible from the general population.

What steps do you take to isolate yourselves?
>>
>>59948689
Does anyone know how this sort of thing performs? Can I use this view to do a limited-depth query, relying on PostgreSQL to not compute more recursions than necessary?

ie,
SELECT * from implications_closure WHERE topic = 'some topic id' AND depth < 5;


How good is postgres at graph traversals like this at all, assuming I did a normal WITH RECURSIVE query with depth limit instead of a RECURSIVE VIEW?

I'd use a specialized graph database, but I want to join against some other metadata stored in postgres.
>>
>>59948809
Don't use the same email everywhere, change up your passwords
>>
>>59947608
Do you use the Ruby tripcode because Ruby is your favorite programming language?
>>
File: faggot_cry.png (91KB, 417x279px) Image search: [Google]
faggot_cry.png
91KB, 417x279px
>>59947259
>another day of not doing anything productive again
>>
>>59948918
You could try working on that project.
>>
File: imgonnafuckyourshitup.jpg (11KB, 343x345px) Image search: [Google]
imgonnafuckyourshitup.jpg
11KB, 343x345px
>2017
>Not programming in PowerPoint

https://www.youtube.com/watch?v=uNjxe8ShM-8
>>
File: 1491549057980.jpg (495KB, 1000x903px) Image search: [Google]
1491549057980.jpg
495KB, 1000x903px
>>59948918
>another day of pretending to be a good programmer by using vim
>>
>>59948941
>2017
>not programming in Calculator
>>
>>59947759
What the hell is wrong with Unity?

>>59948863
While that was not the original reason, it is why I continue to do so.
>>
>>59948979
What was the original reason?
>>
>>59948952
Is this a meme along the same lines as microwave time? It's not as funny as the original.
>>
>>59949046
Xie's a big fan of Supernatural; in particular he loved the (formerly) blonde haired demon, Ruby.
>>
>>59949096
Who is Xie?
>>
>>59949096
*she
>>
>>59948150
>cyberpunk
>what do you mean by this
it has no future
>>
I don't use reddit but I thought a bot would be funny.
This logs in but it doesn't vote for some reason
import requests
##com = input('comment id')#t1_dgertmr
header={}
header['Host']='www.reddit.com'
header['User-Agent']='Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0'
header['Content-Type']='application/x-www-form-urlencoded; charset=UTF-8'

with open("account_list.txt", "r+") as f:
proxy = f.read().splitlines()
proxy = [x.split(':') for x in proxy]
for x in proxy:
req_se = requests.session()
data={}
data['op']='login-main'
data['user']=x[0]
data['passwd']=x[1]
data['api_type']='json'
login = req_se.post('https://www.reddit.com/api/login/user',data=data)
print(login)

reddit = 'https://www.reddit.com/api/vote?dir=1&id=t1_dgervrl&sr=trackers'#.format(com)
stuff = req_se.post(reddit,headers=header)
print(stuff)
>>
>>59949245
Uh, ignore "proxy" it's re-used code. Those are usernames and passwords.
>>
File: 1482512612166.gif (645KB, 500x300px) Image search: [Google]
1482512612166.gif
645KB, 500x300px
>>59947330
I've found it's the best way to motivate myself and actually learn stuff.

I had a friend that liked to study that way too. We'd sit in an empty classroom or at a study room in the library and continuously explain the material to each other. We'd catch each other's errors and constantly refine and revise our knowledge.

He flunked out of my class and I was unable to find any other study partner. I was actually tempted to deliberately flunk out of my class just to get my friend back. Nowadays I just read class transcriptions 1 day before the test and hope it works, I get an average grade
>>
>>59949046

It was in an RP thread on /vp/, where I was avatarfagging as a certain trainer with a white hair-hat. That was several years ago.

>>59949096

No.

>>59949105

Double no.
>>
>>59947409
Yeah. Most people are extremely shit when it comes to algorithmic thinking. My programmer knowledge has allowed me to quickly grok all sorts of real life processes and even optimize them
>>
>>59949279
Teach me C, faggot.
>>
>>59949291

How much do you know about programming in general?
>>
>>59947414
Of course it can. Any bread and butter lisp/scheme will allow you to reset primitive functions like plus.

Where do you think Ruby got that idea
>>
>>59949279
>It was in an RP thread on /vp/, where I was avatarfagging as a certain trainer with a white hair-hat. That was several years ago.
.......
>>
>>59949260
>"The mere presence of others can improve performance of simple well-learned tasks (dominant responses), but can interfere with the performance of complicated, difficult, or new tasks (nondominant responses). This effect is called social facilitation."
>https://en.wikipedia.org/wiki/Social_facilitation
This shit is social psychology 101. You don't even have to interact with that person. Just him being there is enough. That's why people tell you to go to a library if you have trouble with focusing on your own.
>>
>>59949298

Eh, I'm more used to Scheme than Common Lisp, which is a bit more limited in that aspect, last I checked. I don't know of any undefine function/macro, and using set! in at least one Scheme variant I use will throw an error for trying to re-write an inlinable procedure.

That said, Ruby is in a few ways inspired by Lisp... along with a few other languages.
>>
>>59949293
You tell me, sensei.
/**
* SUMMARY: intcat concatenates a series of integers and prints the result.
* NOTICE.: Negative integers will have their sign dropped.
* ........ All decimals points, if existent, will be dropped.
* ........ Cannot concatentate any zeroes at the moment.
*/

#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

#ifndef DEBUG
#define DEBUG 0
#endif

// Checks for must-kill errors
#define ERR_CHECK_K(cond, msg) {if (cond) {logerr(msg); exit(EXIT_FAILURE);}}

void logerr(const char *msg) {
if (!msg) {
msg = "No messeage set";
}

if (DEBUG) {
fprintf(stderr, "%s:%d %s\n", __FILE__, __LINE__, msg);
}

else {
fprintf(stderr, "%s\n", msg);
}
}

// Returns the number of digits in a
int intlen(long a) {
return (int)(floor(log10(a))) + 1;
}

int main(int argc, char *argv[]) {
ERR_CHECK_K(argc < 3, "Too few arguments\nUsage: intcat <integer> "
"<integer>");

const unsigned Num_Ints = argc - 1;
long lints[Num_Ints];

// Converts the args to longs
for (int i = 0; i < Num_Ints; i++) {
ERR_CHECK_K((lints[i] = strtol(argv[i + 1], NULL, 10)) == 0L || \
lints[i] == LONG_MIN || lints[i] == LONG_MAX, \
"An argument is out of range or not an integer.");
}

long catint = labs(lints[0]); // Stores the result of the concatentation

// Concatenate
for (int i = 1; i < Num_Ints; i++) {
long b = labs(lints[i]), s = (long)(pow(10, intlen(b)));
// Check if the resulting concatentation will be too big
ERR_CHECK_K(s > (LONG_MAX - b) / catint, "Concatentation is too large");
catint = catint * s + b; // $300,000 starting salary
}

printf("%ld\n", catint);

return EXIT_SUCCESS;
}

/* Cirno and Lain a cute! CUUUUUTE!*/
>>
Do you sign git commits?
>>
>>59949368
>concatenates a series of integers
>decimals points, if existent
that's a contradiction
>>
>>59949301
I've mentioned this a few times in /dpt/. Why do you act so surprised?

>>59949368
It would seem as though you already understand at least the basics of C programming. What topics do you feel you are inadequate at?
>>
>>59949387
If I sucked dick for 20 bucks, you won't see me mentioning it even if I was anonymous. Much less if I was a furry who RP about fucking pokemons while being a tripfag. Yiff in hell.
>>
>>59949386
:^)

>>59949387
Basically anything above beginner level C likes to take my asshole for a ride. Also, while not related to C, I can't into algorithms. Shit's hard for my brain to understand.
I don't want to be a code monkey, sensei.
>>
I've finally decided to actually follow my dreams and try to advance my programming to a sellable level. I'm looking for a list of challenges that I can complete one day at a time ranging from intermediate difficulty to advanced to try and actually get some practical experience, does anyone know where I can get something like that. I'm not very creative so coming up with them myself is not exactly my first choice.
>>
>>59949445
I'd like to take your asshole for a ride too
>>
>>59949509
Congrats. What Language did you pick?
>>
>>59949400

>who RP about fucking pokemons
It was a non-lewd RP.

...That does not mean, however, that I did not get banned for a few days for dumping porn in an unrelated thread.

>>59949445

There's not much to C that can really be considered complicated. Once you understand the language features, really, it's just a matter of practice and reading other people's code.

As for algorithms... read CLRS I guess? Or get a CS degree?
>>
>>59949523
I still deciding. Its either going to be C++ or C# as I have experience in both and both are in demand.
>>
>>59949541
The key to achieving your dreams is to set short achievable goals. Before dreaming big, start by saying I want to do X by a date. So you can start with by the end of the week, I will decide what language I will do. Good luck.
>>
>>59949368
This gave me an idea for a simple, little challenge:

Write a function that takes a list of items and return a String of the concatenation of these items. Bonus points if it is generic when using a statically-typed language.

use std::fmt::Display;

fn concat_items<D: Display>(items: &[D]) -> String {
items.into_iter()
.fold(String::new(), |con, i| con + &i.to_string())
}


fn main() {
let items = [12, 134, 234, 1324, 657856];
let con = concat_items(&items);

println!("{}", con);
}


Output:
121342341324657856
>>
>>59949533
>reading other people's code
Is trying to read GNU programs a good idea? I don't want to form anymore bad habits.

>CLRS
I have multiple times; I still don't get any of it despite having the minimum mathematical background with Calc 1 I know I sound pathetic right now, but I'll take any piece of advice to break through this wall. I want to understand, prove, and implement a hash map one day.

>>59949582
Like this?
$ itemcat 1337 faggot
$ 1337faggot
>>
>>59949629
Yep
>>
>>59949533
>>59949629

What algorithms are important enough that everybody should understand?
>>
File: 1490336659494.png (537KB, 732x743px) Image search: [Google]
1490336659494.png
537KB, 732x743px
>spend all day implementing and optimizing a lexicographic permutations algorithm in python
>turns out the itertools module has a permutations generator
>it's tenfold faster than my python code
>>
What's the difference between lazy and eager implementations of Prim's algorithm for computing the minimum spanning tree?
>>
>>59949629

>Is trying to read GNU programs a good idea?
It's okay, I suppose. Just don't use their indentation/brace style. As Torvalds recommends, print out a copy of the GNU style guide and burn it.

Anyways, I need to head to sleep. I may be able to answer more questions tomorrow.
>>
>>59949582
from typing import *

from functools import reduce
import operator

D = TypeVar('D')
def concat_items(items: Iterable[D]) -> str:
return reduce(operator.add, map(str, items))

def main() -> None:
items1: List[int] = [12, 134, 234, 1324, 657856]
print(concat_items(items1))
items2 = [12, "13", 14.0] #static typing shills be like REEEEEEE!
print(concat_items(items2))

main()
>>
File: 1467019345752.jpg (10KB, 180x157px) Image search: [Google]
1467019345752.jpg
10KB, 180x157px
>>59949948
>def
>>
>>59949948
>from typing import *
What the fuck are you doing? Step away from the computer and burn your house to the ground.
>>
File: razer-naga-2014-right-03[1].png (279KB, 800x600px) Image search: [Google]
razer-naga-2014-right-03[1].png
279KB, 800x600px
>>59947259
I have this from my MMO gaming days

Give me some cool ideas for programming macros and keys to keybind - maybe someone already had fun with similar stuff and can share their experience accumulated.
>>
>>59949985
A hotkey that redirects you to /v/ where you belong
>>
>>59949948
You can create heterogeneous arrays using pointers in statically-typed languages too, although it's a bit unwieldy:

#![feature(box_syntax)]
use std::fmt::Display;

fn concat_items<D: Display>(items: &[D]) -> String {
items.into_iter()
.fold(String::new(), |con, i| con + &i.to_string())
}


fn main() {
let items = [12, 134, 234, 1324, 657856];
println!("{}", concat_items(&items));

let items: [Box<Display>; 3] = [box 12, box "13", box 14.0];
println!("{}", concat_items(&items));
}
>>
>>59949991
But I don't play video games and that board always sucked.
>>
>>59950000
>insulting your homeland
>>
>>59950006
>associating an shitty anime imageboard with your homeland
How much more autistic neo-/g/ can get today?
>>
>>59949983
I'm at work you loser

>>59949998
Yeah I guess. I'm never tired of laughing at shills like >>59949963.
>>
>>59950000
KWADS don'T LiE
>>
>>59950030
>shills
ok python kiddie
>>
>>59950041
>kiddie
Such response

Much maturity
>>
>>59950047
>responds with a reddit meme
>in denial that python is for undeveloped minds
>>
>>59950052
>Judging people on what language they use
back to >>>/pol/
>>
>>59950075
please stop shitposting
please learn a better language
>>
>>59950082
Last time we did a survey, Python was the 2nd most popular and used language on /dpt/.
>>
>>59950082
>better language
I already know scheme thx.

Now if you think verbose typing makes a language better then you're a codemonkey. Get better soon!
>>
>>59950098
it could not be clearer that you are new
>>
>>59950090
Doesn't mean it is not shit
>>
>>59950122
It is popular for a reason moron. If I am prototyping or making a simple script, why won't I use Python?
>>
>>59950110
New to the general? Nope
New to programming? Nope

Look, trial-and-error is perfectly fine, but you should do some training now before you try attacking me again.
>>
>>59949998
Just just has the best syntax.
use std::fmt::Display;

macro_rules! box_slice {
( $( $x:expr ),* ) => {
[ $( Box::new($x), )* ]
};
( $p:path ; $( $x:expr ),* ) => {
[ $( Box::new($x) as Box<$p>, )* ]
};
}

fn concat_items<D: Display>(items: &[D]) -> String {
items.into_iter().fold(String::new(), |con, i| con + &i.to_string())
}

fn main()
{
let slice: [Box<Display>; 3] = box_slice![1, "2", 3.0];
println!("{}", concat_items(&slice));

println!("{}", concat_items(&box_slice![Display; "4", 5.0f64, 6i8]));
}
>>
>>59950143
Yeah not half bad. Still has the cognitive load of low-level details tho. Why not use a JIT on a dynamic language and have it select the optimal data layout while your program is still nice, clean, high-level?
>>
>>59950160
Rust tries to advertise itself as a low level language, you know.
Your duck-typed garbage isn't going to fix anything.
>>
>>59950160
>your program
more like *your source code but jou know what I mean.

>>59950165
educate yourself moron https://pypy.org/
>>
>>59949948
>def concat_items(items: Iterable[D]) -> str:
> return reduce(operator.add, map(str, items))

in haskell this is just
concat_items = concatMap show
>>
>>59950179
What the hell does your shitty JIT compiler have to do with anything?
Do you think that makes duck-typing any less cancerous?
>>
>>59950160
>and have it select the optimal data layout
Except it can't and never does. Not for any complex problem where you'd actually care. I'm sure if you only write small programs with small data loads JIT can help you a lot but not generally.
>>
>>59950189
Generics are just mega-constrained and verbose wannabe duck types. Fuck is cancerous with being dynamic? That's just how we think IRL. Why not adapt it? RTTI is essential anyway, so why sever your anus this tight?

>>59950201
Then maybe add a smallish layout hint in situations where you know better than the JIT? There's a continuum between static and dynamic anyway, so why let's not fight over this? (unlike >>59950189)
>>
File: uncle neb.jpg (33KB, 419x396px) Image search: [Google]
uncle neb.jpg
33KB, 419x396px
how do i get into graphics programming, specifically for game engines?
i've read GPU gems, and it was helpful, but it's outdated

for instance, if i wanted to implement screen space reflection, where do i go to find out how to do this?
(i have googled it, no significant results)
>>
>>59950249
"Game engines" are just data-driven platforms for games. You're essentially making an actual game, except its extremely configurable. As in, you write code for all the graphical features and gameplay mechanics such as collision and not falling through the ground and walls, but you let the user plug in assets such as 3D models and highly-specific game logic scripts.
>>
>>59950277
i know that
i'm talking about rendering stuff and shaders specifically
i think it's hard to find information on because pre-built game engines come with their own graphics stacks and their own implementations of shaders

i'm just asking for a wiki or something to help me find this stuff
>>
>>59950249
>screen space reflections
Just googled it. basically it's when you see reflections of other objects in a mirror or in water right? That's basically by my intuitive understanding
1 render all the shit
2 flip it with regards to the reflecting surface
3 deform it a bit or some shit or whatnot
4 merge the result back into 1
It's just that they go to unreasonable lengths to optimize it.

Now speaking of googling it, there's a freely accessible talk in the second google result:
http://www.frostbite.com/2015/08/stochastic-screen-space-reflections/
I don't get a single thing because I don't know the jargon, but if you're going into that you must learn that jargon and the underlying stuff anyway, so go do that. No one is interested in spoonfeeding it to you.
>>
>>59950324
You need linear algebra. Transformation matrix and all this fun stuff. No questions ask, that's just how computers do geometry.
>>
>>59950236
>Then maybe add a smallish layout hint
I agree that I'd certainly want my memory layout to be a solved problem the compiler can handle for me, not too fond of a JIT with my experiences but it could be worked around.
Problem is that you can't have "smallish layout hints", you need to be able to specify almost every aspect. You'd also need tools to figure out what decisions have been made for you if you're gonna be able to correct the compiler. On top of that is the problem that makes the JIT unable to figure this out for you. Data layout isn't an easy problem to solve becuase it's dependent on the entirety of the program, in particular other memory layouts. So therte's the issue of matching the JIT with your custom layout. Which I've never tried but it sounds hellish.

>There's a continuum so lets not argue
Anon you're never forced to respond. And a continuum only opens up to more arguing imo.
I don't think anyone should half-care about performance and argue about it is the thing. Suggesting a JIT does it for you without the caveat of being able to take control is simply misunderstanding the problems people with low level concerns face.
Nobody uses low level languages because they think it's always easier they just do it because the situation requires it. Statically typed languages have advantages in convenience but they're often not as well implemented as something like Go. I think if people understood static typing as what Go does then they wouldn't bother with dynamic typing at all.
>>
>>59950329
>It's just that they go to unreasonable lengths to optimize it.
>unreasonable
Not really anon. Most optimizations made are pretty simple too. And there's work on improving the effect without using stupid high resolutions for your SSR.
>points 1-4
Yeah but anon is looking to implement it. He needs more than that.
You need to mention that you reflect against the depth map to sample the screen space.
If you were to give a high level description these slides are more appropriate:
http://www.cse.chalmers.se/edu/year/2016/course/TDA361/Advanced%20Computer%20Graphics/Screen-space%20reflections.pdf
>>59950249
Here's more detail:
http://jcgt.org/published/0003/04/04/paper.pdf
In general you need to find papers for proper shipping quality effects.
>>
>>59950418
Don't forget to check the references in papers you read. People tend to reference papers that are very useful. Papers get popular because they're good so it's a good method to find random good things.
>>
>>59950329
forgot about clipping, mea culpa
>>
>>59950329
>>59950418
Oh shit my bad you linked the same talk. Sloppy of me not to read. But I still consider it a high level overview and insufficient..
>>
File: 1461638922051.jpg (25KB, 429x410px) Image search: [Google]
1461638922051.jpg
25KB, 429x410px
>>59950329
you missed the point, SSR is just an example

but anyway, that's a reasonable assumption, but this has to be done each frame, and it does need to be optimized as much as possible to reduce frame time

again, i'm not asking for spoonfeeding, i have googled this over and over again and never found any good resources for learning this stuff

>>59950339
i have a very strong background in mathematics, i am confident that i can handle any mathematics involved in graphics

>>59950418
the general case is what i was wondering about
how do i find such papers?
SSR has a few readily-available papers (i did come across that paper you posted), but there doesn't seem to be any good resources for this sort of thing in general
>>
With stack, how do I install a locally package globally?
>>
>>59950349
Solved problem it's never going to be. We just want better tools, like in any other field.

>So therte's the issue of matching the JIT with your custom layout. Which I've never tried but it sounds hellish.
Don't runtime environments already do that? Or maybe I don't get what you're saying....

>>There's a continuum so lets not argue
>Anon you're never forced to respond.
Mate I'm not trying to dodge, I was taunting the shitposter. (not saying it was brilliant.)

> And a continuum only opens up to more arguing imo.
Agreed, and if there is a continuum we have no option but to explore it.

>I don't think anyone should half-care about performance and argue about it is the thing. Suggesting a JIT does it for you without the caveat of being able to take control is simply misunderstanding the problems people with low level concerns face.
What people? Are you in numerical computing? Virtualisation? High performance middleware? I'm curious

>Nobody uses low level languages because they think it's always easier they just do it because the situation requires it. Statically typed languages have advantages in convenience but they're often not as well implemented as something like Go. I think if people understood static typing as what Go does then they wouldn't bother with dynamic typing at all.
To an extent, yeah, it has boxing and untyped constants, which makes it pretty transparent.

desu I'm hyped about gradual typing. Would be nice if there was one language specification to govern them all. Then you use a tolerant engine for that language to make your prototypes, and you do so until it yields the correct result, albeit slowly. Then if you need it, you can switch to a high-performance engine, and add hints everywhere without breaking compat with the first engine. Here's our continuum.
>>
>>59950521
>a locally package
fugg dose dat even mean bro do U even english?
>>
>>59950657
obviously i meant local
>>
>>59950510
I don't know of any good collected resources. Especially if you don't know what the effect is called (like SSR). But you can often be lead to different topics through GDC talks or as I mentioned references from other papers have proved useful to me.

Most don't tend to lead you to new ground though. It's simply difficult to find. You need to do some clever searching.
>>
>>59950644
>>59950349
>I think if people understood static typing as what Go does then they wouldn't bother with dynamic typing at all.
If you were to prototype a language implementation you would probably do it with runtime typing, because static type checking is decoupled from execution and if you want to profit from it you have to find a way to pass it around, which is unwieldly. There you have Python static typing, which is optional and handled by third-party tools, not by the python interpreter itself. Now, statically typed languages have pros, but I wouldn't say that dynamic ones wouldn't exist if they were better, because that's how you implement reflection, too.
>>
>>59949369
Why not? It's an extra layer of trust and it's only one command line option.
>>
I don't understand, why can't i reinterpret a char16_t as an int16_t?

char16_t c = 'c';
int16_t i = reinterpret_cast<int16_t>(c);
>>
>>59950809
>sepples
found your problem right there.
>>
>rustc: expected reference, found tuple
>Okay, take reference
>rustc: expected tuple, found reference

Go home rustc, you're drunk.
>>
What's the likelihood I'll be asked to do something like compute the minimum spanning tree of a graph in a job interview?

Is that a bit too complex?

What kind of data structures are simple enough that I might be asked to implement them in an interview?
>>
>>59950936
>What kind of data structures are simple enough that I might be asked to implement them in an interview?
all of them
>>
What's the most practical FP language?
>>
>>59951057
What do you plan on doing?
>>
>>59951082
Accessing a REST API, disk I/O writing to stdout.
>>
>>59951098
ocaml or haskell
>>
>>59950809
>char16_t - type for UTF-16 character representation, required to be large enough to represent any UTF-16 code unit (16 bits). It has the same size, signedness, and alignment as std::uint_least16_t, but is a distinct type.
http://en.cppreference.com/w/cpp/language/types%23Character_types
Your question becomes "why can't I reinterpret an uint_least16_t as an int16_t?" which definitely sounds easier to answer. Also please refine the meaning of "I can't" in this sentence because it's vague as fuck. Is it a static analyzer? The compiler, and if so, with what flags? I'm 99% sure it compiles fine if you omit the -Wgrammar-nazi flag.
>>
>>59947259
Implemented a markov chain and trained it on my steam chat logs.

>man and increase in the connection on mpv won't mess with surds are basically a mans face. i like things
>>
>>59951000
>go ahead and implement a RBLL tree with delete

yeah, nah
>>
>>59951137
So it's an alignment issue? I assumed char16_t was supposed to be exactly 2 bytes.

I'm using MSVC. Compiler won't even reinterpret unsigned int as an int.
error C2440: 'reinterpret_cast': cannot convert from 'unsigned int' to 'int'
>>
File: anal beads.png (58KB, 700x700px) Image search: [Google]
anal beads.png
58KB, 700x700px
>>59951204
>not training it on this thread
>>
>>59951326
WOW

REAL AI IN ACTION

THE SINGULARITY IS JUST AROUND THE CORNER DUDES
>>
>>59951341
I know, right?

It took me 3 years of training in a Buddhist monastery to implement markov chains

only the 1337est of the 1337 haxorz can implement markov chains
>>
>>59950809
Use static_cast.
https://ideone.com/O09FkW
>>
>>59951307
both char16_T and int16_t are probably 2 bytes here.

But your example is relevant: you are rawly-converting an unsigned to its signed equivalent. Your compiler is probably uneasy with that because it is undefined behavior as there are many ways to represent signed integers in binary. https://en.wikipedia.org/wiki/Signed_number_representations

Wait no it's forbidden: http://en.cppreference.com/w/cpp/language/reinterpret_cast
You can try:
char16_t c = 'c';
const uint16_t& n = reinterpret_cast<uint16_t&>(c);


I don't guarantee that it will work, but that seems more reasonable given the cppreference page.
>>
File: 1459487295667.png (249KB, 340x314px) Image search: [Google]
1459487295667.png
249KB, 340x314px
>>59951326
>do people on keyboard
>>
>>59951326
It's not intelligent yet, but it's so fucking funny. It's a mirror to the absurdness of the shit I just wrote in this thread and it is brilliantly thought-provoking.
>>
File: 9137647e9f69ab92f6e2bbe2a36d4dd6.jpg (202KB, 1020x1385px) Image search: [Google]
9137647e9f69ab92f6e2bbe2a36d4dd6.jpg
202KB, 1020x1385px
waiting for these tests to finish running :bed:
>>
What are some good things to pair with Python to make me employable as a code monkey?
>>
File: 1469716385170.webm (941KB, 640x400px) Image search: [Google]
1469716385170.webm
941KB, 640x400px
rate or hate
>>
Anyone know if in Java, there's a possibility to restrict the result of the method getDeclaredFields()?
For example, I only need the fields that are private. Not private final, protected or public anything. Just private.

Or if there's another method for that.
>>
>>59951513
I like the addition of the yellow ones that aren't instadeath, but they try to fuck you up.

Maybe add a feature that encourages their use. High risk, high reward.
>>
anybodies intero not working with ghc 8.0.2?
>>
>>59951544
is intero any good? we're interfacing with a C library that has specific setup (kernel patches &c., kernel modules) so I compile and run in VM but I hack locally on in mounted directory; do you know if that's a supported use-case (over SSH)/easy without having to mess around too much?
>>
>>59951523
Maybe I'll make the green ones increase the score by 10 and the yellow ones increase the score by 1 or something like that
>>
>>59951584
no idea, post in their github issue or reddit or irc/slack
>>
>>59951599
alright, I'll have a look later, thanks
>>
>>59951481
Social skills.
>>
>>59951658

b-but
>>
>>59951410
Raw conversion is the point. I want to be certain that the cast doesn't change the bit pattern. To my mind, i should be able to do that at least as long as both data types have the same number of bits.

I'm not sure i understand your solution. What does it accomplish?
>>
>>59951658
This x1000

I don't give a damn if you're an absolute wizard with your Vims and Gentoos.

If you can't work with the team, communicate your ideas effectively, and shower, you can fuck right off.
>>
>>59948809
Tomi?
>>
>>59951703
what if i can do all of these things but what i can't do is trust anyone, sustain genuine relationships that will persist outside the workplace in any capacity, come through when it matters most, or take personal responsibility for mistakes without threatening suicide in the process
>>
For academic statistics studies what languages would be good? I was thinking in R, but I've heard a little about Julia, what are the differences between them?
>>
>>59951774
Jeez, all you have to be is a gay fake weeaboo on top of it and you'll be the epitome of human cancer.
>>
How do i write in C# student first name, last name, and his grade all in one line (John Doe 4.53) and split the strings and insert them as arguments for creating new instance of a student. Entry ends when empty line is entered

this doesn't work
                    List<Student> students = new List<Student>();
Console.WriteLine("Insert students and their marks");
string entryStudent = " ";
while (entryStudent != "" )
{
entryStudent= Console.ReadLine();
string[] data = entryStudent.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

students.Add(new Student(data[0].ToString(),data[1].ToString(), int.Parse(data[2])));
}
>>
>>59951774
>trust anyone
Fine.
>sustain genuine relationships that will persist outside the workplace in any capacity
Also fine.
>come through when it matters most
Not fine.
>take personal responsibility for mistakes without threatening suicide
You're fucked. Consider actually following through with this next time you threaten it, and do us all a favor.
>>
>>59951800
Before I do anything for you, look at your grade.

Is "4.53" a fucking integer?
>>
>>59948809
rábasztál, Tomi cica

for everyone's information this dumbass uses his full IRL name as his login on his private PC
he made a .webm of his c# homework and forgot he captured his own name
>>
>>59951828
yeah, that is already fixed, it's double now
>>
>>59951410
This seems dangerous. You're defining an int-sized reference to a memory segment that's only guaranteed to be big enough to hold a char. If you read the latter bits of the int -- which you certainly will if the int is ever used in its entirety -- the program could get a sigsegv for reading outside its authorized memory spaces.
>>
>>59951410
(cont from >>59951856 ) Never mind I can't read
>>
>>59951828
Problem was in array declaration.

When you enter new line it still tries to enter new array and it doesn't have enough arguments to fill data[1] and data[2]

it now looks like this, seems very awkward to look at, lets see if i can make it more non-retarded

                    List<Student> students = new List<Student>();
Console.WriteLine("Insert students and their marks");
string entryStudent = null;
while (entryStudent != "" )
{
entryStudent= Console.ReadLine();
if( entryStudent == "")
{
break;
}
string[] data = entryStudent.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

students.Add(new Student(data[0],data[1], double.Parse(data[2])));
}

foreach (var item in students)
{
Console.WriteLine($"{item.FirstName}, {item.LastName}, {item.Mark}");
}
Console.ReadLine();
>>
>>59950809
I'm not sure but I don't think you should have to reinterpret it manually at all. You should be able to just assign a char16 variable's value to an int16. If your chars are signed, there will be no difference in value; if they're unsigned, overflow will wrap them around to negatives as appropriate. Either way, the byte representation shouldn't change, just as if you'd used reinterpret_cast.
>>
File: anal beads.png (63KB, 1055x1079px) Image search: [Google]
anal beads.png
63KB, 1055x1079px
>>59951898
>>
>>59951947
>

;

;
>>
>>59951947
And you could even do this to constrain your grade to a maximum of 5, if you want:
Grade = double.TryParse(inputArray[2], out var muhDouble) ? muhDouble <= 5 ? muhDouble : throw new FormatException()
>>
>>59951947
Interesting, C# doesn't have anything against naming your method TryParse like the one already exists? Is TryParse virtual? Wouldn't you need overload modifier?
>>
>>59951973
>like the one already exists
..What?

There is no TryParse for a type of "Student" until you implement it.

The types int, double, DateTime, etc. all have their own implementation of TryParse.
>>
File: anal beads.png (11KB, 357x441px) Image search: [Google]
anal beads.png
11KB, 357x441px
>>59951973
It's a method on the type.

These methods are all called "Lmao", but they are static methods on their own distinct types. Same situation as "TryParse".

You're almost implying that once one type anywhere in your code uses a particular method name, no other type is allowed to have that. Which would be silly.
>>
>>59951987
>>59952014

Alright, i still have lot to learn, i somehow thought you can only use the same Method signature once
>>
>>59952036
You can only **define** the same method signature once within a particular class.
>>
>>59951679
In order for those to have a bit pattern, they must be stored in memory, otherwise it's just register values flying around. by forcing them to be a referenc, you can reinterpret the reference (and apparently that's the only kind of thing reinterpret can do, C++ is weird) into a reference to int16_t, which means you'll access your char16_t as if it were an int16_t.

I guess if you're trying to use reinterpret_cast instead of static_cast, that means you want to preserve the bit pattern rather than the value? Then reinterpret the reference. It's weird but it's so. static_cast will happily convert the value from its char16_t representation into its int16_t representation, especially if they don't have the same bit-pattern
>>
>>59952036
See >>59952056
Google "method overloading." If you're using the Yellow Book, it's gotta be in there.
>>
File: 1466053540883.png (4KB, 360x92px) Image search: [Google]
1466053540883.png
4KB, 360x92px
>>59952014
>>59951947
>>59951800
>>
>>59952122
Disgusting.
>>
Has bubble sort ever been useful?
>>
>>59952195
Has quantum bogosort ever been useful?
>>
>>59952203
How many universes do you think have been destroyed thus far?
>>
File: 3d-women-are-not-important.png (649KB, 960x1014px) Image search: [Google]
3d-women-are-not-important.png
649KB, 960x1014px
/g/ cool kids club checklist

[x] hate OOP
[x] hate IDEs
[x] use only Haskell
[x] never produce actually useful software (this is important)
[x] wear knee socks
[x] tiling window manager
[x] dark-like-my-soul customized colors
[x] hate popular Linux distributions (because too intelligent for them)
[x] apply this list to self, post results as if anyone cared
>>
>>59952249
>use only Haskell
Plebian.
>>
>>59952249
yes/meh
meh
yes
no
no
yes
no
NixOS
here you go
>>
>>59947259
just a tiny bit of code i /could/ slip into the firmware where i work. large consumer (mobo manufacturer)

on first run (or factory reset), it finds the audio out. and then every time the system date digits add up to 9 it activate TTS to say aloud "i am watching you"
>>
>>59952090
Sounds iffy.

>that means you want to preserve the bit pattern rather than the value?
Exactly.
>static_cast will happily convert the value from its char16_t representation into its int16_t representation, especially if they don't have the same bit-pattern
Which is why i'm wary of static_cast. I'm never entirely certain what static cast does to my bits, even if most of the time the bit pattern is preserved.
>>
Why all this fuss over what's just a type cast?
>>
>>59951703
Exactly. We hired a guy once who was an absolute rockstar on paper: a lot open source contributions, side projects, mad programming and cs skills.
>"Well, Jim, go talk to John and get that project going! We are excited to have you abroad"
>"o-okay..."
>...
>month later
>"Hey, it's John, when are we starting that project?"
>"..what? You haven't started yet?"
>"..."
>"Jim, have you talked to John?"
>"n-no..."
Turns out our autistic rockstar was too "uncomfortable" talking to John or to us, literally expected someone to babysit his "genius". He spent his time working on his os projects. Ironically, they were Haskell based lol. Boss was so fucking mad he fired him and a manager right that fucking instant. And told us to never hire anyone who shows any sign of social ineptitude.
>>
How does IComparable work in C#?

I see that i need CompareTo Method for it to work and using it i can sort all kinds of shit

for example, in my Student example here >>59951800
>>59951947

I wrote a Method

        public int CompareTo(Student other)
{
int comparsion = this.Mark.CompareTo(other.Mark);
if (comparsion == 0)
{
comparsion = this.LastName.CompareTo(other.LastName);
}
return comparsion;
}


and i can successfully use students.Sort() to sort student instances by mark, but how does it work?
>>
>>59952249
>[x] hate OOP
>[x] hate IDEs
>[x] use only Haskell
>[x] never produce actually useful software (this is important)
>[ ] wear knee socks
>[ ] tiling window manager
>[x] dark-like-my-soul customized colors
>[x] hate popular Linux distributions (because too intelligent for them)
>[x] apply this list to self, post results as if anyone cared
>>
>>59952249
[x] hate OOP
[x] hate IDEs
[ ] use only Haskell # a lot of languages
[ ] never produce actually useful software (this is important) # I'm busy coming up with something revolutionary right now
[ ] wear knee socks
[ ] tiling window manager
[ ] dark-like-my-soul customized colors
[x] hate popular Linux distributions (because too intelligent for them)
[x] apply this list to self, post results as if anyone cared # Im so ironic
>>
>>59952326
It sorts student by mark and failing that by last name, yeah, and it calls your method to know who has the biggest grades until it's fed up. What do you think is worth asking "how does it work" exactly ?
>>
>>59952326
And additional question, what is considered better, using IComparable or simple LINQ statement to sort your shit?
>>
>>59952336
>I'm busy coming up with something revolutionary right now
I'll put that down as a check
>>
>>59952356
My biggest wut was it lacks any for loops, simple students.Sort() sorts my whole List, and my CompareTo method only sorts 2 instances by their property, i kind seem to find the connection between whole sorting algorithm and my list
>>
>>59952380
Well its applying your comparison function over a range. What use would sort be if it didn't do that?
>>
>>59952358
Surely LINQ, it's immediately explicit what the sort criterion is, it's more flexible, and probably more performant given that a compare operation is a stupid as shit interface to feed a sorting algorithm.*

*: It may need to be called once for each pair of elements and it's complicated to write, whereas a sorting-key operation that yields (this.Mark, this.LastName) as a tuple is trivial and only needs to be called once per student.
>>
>>59952249
>[ ] hate OOP
>[ ] hate IDEs
>[ ] use only Haskell
>[x] never produce actually useful software (this is important)
>[ ] wear knee socks
>[ ] tiling window manager
>[x] dark-like-my-soul customized colors
>[ ] hate popular Linux distributions (because too intelligent for them)
>[x] apply this list to self, post results as if anyone cared
All my computers have black and red color schemes for the desktop and the case/case lighting
>>
>>59952407
This.

LINQ makes it very clear as to what you're sorting by, when you do something like
muhStudents.OrderByDescending(x => x.Grade);
>>
>>59951520
bump
>>
>>59950744
>because that's how you implement reflection
This needs elaboration.
>>
>>59952515
RTFM
>>
>>59952533
You need runtime type information to know what you're dealing with: if you query
myfunction.defaultValueForArgument(3)
, you might get any type of value that exists in your language, so it's basically a dynamically typed field even in Java. Might call it a boxed value, call it what you want. The trivial way to respond to that is to have a dynamically typed language, like the lisps --- who are the best at homoiconicity, sorry ---; I know some statically typed languages manage to have reflection, but static typing advocates can't not condemn the interface when they see it because it's basically dynamic typing in disguise.
>>
>>59952493
That's what i assumed by i saw before that LINQ is generally slower than basic for loops and stuff like that so i had to ask

So, IComparable is not anymore useful, now we have LINQ?
>>
        wchar_t c{ 0x00ff }; //this works
//wchar_t c{ 0x01ff }; //this causes file put error

std::wofstream file("test.txt");

file.put(c);

if( !file.good() ) { std::cout << "File put error\n"; }
else { std::cout << "File put good\n"; }

file.close();


Why? I have no idea what's going on.
>>
>>59951520
Anon if you're the same guy that asked about how to get the fields of a class specified by name before (to which I answered with a link to Javas reflection tutorial) you shouldn't bother with this. Learn to ask good questions first.
Nobody fucking knows what you're talking about the only way to know would be to google getDeclaredFields and figure out exactly what you're asking somehow. Only reason I have a clue is because I assume you're the same guy that asked horribly before.
https://docs.oracle.com/javase/tutorial/reflect/member/fieldModifiers.html
Read this. Filter yourself if you can't get the API to do it for you. It's very rude to not even try though.
What you could have done to be more polite is find out how to get the field modifiers yourself, conclude that you could filter it all yourself and then you ask us if there's a better way.
>>
File: oldmanwhat.jpg (21KB, 384x313px) Image search: [Google]
oldmanwhat.jpg
21KB, 384x313px
Kotlin: is it any good?

I hate Java's fucking syntax so goddamn much and this looks like the dream I've been waiting for.
>>
>>59952644
IComparable must be implemented by the basic stuff: ints, strings, and the stuff you have as the output of your LINQ sort criterions because they need to be compared afterwards.
>>
>>59952639
I don't get your example
What does it do?
>>
>>59952687
Were you intending to quote here?
>>
>>59952727
No, this is an original™ post.
>>
>>59952694
It's pseudocode, but say you have a function with a default value in an argument. (C++ and Python have it) If you have a reflection interface, you should be able to view this argument's default value's. Now suppose this is the 3rd argument, and the getter for default values is defaultValueForArgument. (yeah, really Javaesque) What is the static return type of such a method? The value might be any value that exists in the language, so is it "Object", if that's the name of the root class ?

It doesn't even need to be this complicated: an eval function that can interpret code at runtime:
eval("2+2")
yields 4. but supposing the string isn't known at compile time, what is the static return value of eval ?

In both cases you end up with either the language can't do that, or the return value is a general type, an instanc of which any conceivable value is. In the second case, congrats! You've reinvented dynamic typing, and it shows that abstract algorithms aren't typed, otherwise they wouldn't be turing complete. Type theory is just something we stick on top afterwards. It's useful tho, I'm not saying it's not but it's not essential.
>>
>>59952687
It looks like a better Java and Scala.
>>
>>59952819
Do you mean "the default value for argument number 3"?
>>
Over many years we had many iterations of this library (event processing library). It has many faults and could be done a lot better if we had time but we don't have the time for it nor the time to port all our code built on top of it.

Would it be seen in any way "bad" if I was to make a better version of the library in my spare time using the lessons learned? No code would actually be re-used &c. At the same time I wouldn't want to feel like I'll just get asked 3 months down to port everything to my own library during work, effectively doing all that for "free" which I guess could happen.

I should say we're contractors (Haskell).
>>
File: 1491762690407.gif (2MB, 540x501px) Image search: [Google]
1491762690407.gif
2MB, 540x501px
any of you guys develop for applications using container infrastructure? (docker, LXC, etc) config managed VM's sorta count. I'm writing a service discovery layer right now it's been swell.
>>
Thoughts on Julia? Looks like a faster Python without the meaningful whitespace.
>>
>>59952912
Would a better version of the library require changes to it's API?
>>
>>59952962
Yes, definitely. Indeed precisely because I wouldn't have to cater to existing codebase, I can do whatever I want in that area including a better eDSL.
>>
>>59949260
>Study partner flunked out
Just be glad you didn't flunk out too?
>>
>>59952945
> guy from the post above you
I do a lot of consulting for companies doing large scale data science or that run long running clustered processes. Julia as a language looks beautiful with keen attention paid to elegance. The issue I see now is that there is not currently large scale infrastructure to support it's use in a meaningful way. While it can be done the barrier to entry is too high for most companies (including some with enterprise budgets.) Once it can be integrated into existing architectures (hadoop, mesos, spark, etc) it will really take off.
>>
Which game engine or library should I use with Java ?
>>
>>59952989
Then you're not going to port everything to your library for free, are you? You'll get paid to do it.
>>
>>59953046
TiNes
>>
>>59953048
I'll get paid whether or not I write it. The question is more of "how do I write it such that after 3 months of writing it, I'm not paid for 2 weeks of work to port code to it"?

I guess I don't know what I'm asking, sorry.

Or maybe I should put a non-commercial license on it or something.
>>
What's a good way to approach Java? I just have the IDE (Eclipse) andI guess I would have to try to follow and learn some projects.

Any tips? Thanks guys.
>>
>>59953105
Java for Dummies (Barry Burd)
HeadFirst Java
>>
>>59953105
> thinking about how to approach java
> looks at self in mirror
> world, how can I become more mediocre?
>>
File: Untitled.png (7KB, 615x114px) Image search: [Google]
Untitled.png
7KB, 615x114px
Guys what the fuck am I missing? Using Processing library.
>>
>>59953105
Use IntelliJ IDEA instead of Eclipse
>>
>>59953154
It literally tells you. Literals are double. You need to write 0.01f for float literals.
>>
>>59953068
>Or maybe I should put a non-commercial license on it or something.
This. If you don't you'll only have yourself to blame.

I guess what you're asking then is would it be bad to re-write the library from scratch under a non-commercial license.
I'd say that's your right, but i'm not any kind of authority on matters like that.
>>
>>59953182
Why?

>>59953133
Interesting, thanks anon, looking at it right now.
>>
>>59953192
Thanks, I'm used to working with regular Java where the only difference is the number of bits available.
>>
>>59953309
That's what he said.
>>
>>59953369
I'm not used to having to type "0.01f" to make it realize that 32 bits are enough lol.
>>
Language: C
I need to use a loop to insert elements provided by the user into an array, however these elements need to be separated in their own slots within the array (so, in case the users types a int with 2 or more digits the program doesn't interpret the first digit as the element 0 of the array and the second digit as the element 1 and so on).
I'm not allowed to use fgets or gets.
#include <stdio.h>
int main()
{
int i=0;
char array[3];
while(i<3)
{
scanf("%c", &array[i]);
if(array[i] == '\n')
{
break;
}
else
{
scanf("%c", &array[i]);
i++;
}
}
for(i=0;i<2;i++)
{
printf("%c", array[i]);
}
}
>>
>>59953434
even Java would complain to you if you gave a float a double literal value.
>>
>>59953446
>acting like this is /spoon-feeding general/
fuck off
>>
>>59953446
Thanks for letting us know.
>>
>>59953446
char c;
scanf("%c", &c);

But you're nonetheless allowed to use temporary variables, are you?
>>
File: 1490232840204.jpg (152KB, 1080x1080px) Image search: [Google]
1490232840204.jpg
152KB, 1080x1080px
>>59947409
To be honest, I don't feel any sort of change to my cognitive functions - this is mostly due to being only aware of whatever I can achieve at any given time.
I can write my own assembler shit, I can work out a few "complex" algorithms, and I can reach myself new mathematical and abstract 'codesense' concepts over time - if given enough time, of course.

This doesn't make me feel smarter. It doesn't feel like my cognition is improved. In fact, I personally believe a clean cognitive mind wouldn't catch itself in the unnecessary conflicts that lend to machine tasks being solved. The real cognitive prowess, in my opinion of course, is being able to drop tertiary un-necessities such as coding... at least for such examples as: forcing yourself to lose personal health and sleep-cycles over struggling to achieve a solution to a code issue.

Losing personal gain in order to solve a problem existing as a non-problem in logically is the real foolish, non-cognitive failure of the self/mind/sociocompliant thoughts. But I goff - we are in /dpt/, the context of this forumic gathering of developers would barely have any kind of personal agreeance to what I've just written, and understandably so. It's just not aware, nor properly contextual.
>>
>>59953563
Yes.
>>
>>59953434
I'm using NetBeans and haven't run into that until now, maybe it's just a comfy IDE
>>
>>59947409
It only makes me realise 2 years later how stupid I was 2 years ago and that in 2 years I'll think the same thing again.
>>
I wish ruby held the academic/sci scripting language default role that python does. Python is such shit and ruby is best cozy in that tier of languages. pry + rbenv + rubykoans is the makings of a very nice rainy day.
>>
>>59953584
Great! But you know what? I could care less about your babby-tier homework. Just solve your own problems yourself.

>I need to use a loop to insert elements provided by the user into an array, however these elements need to be separated in their own slots within the array (so, in case the users types a int with 2 or more digits the program doesn't interpret the first digit as the element 0 of the array and the second digit as the element 1 and so on).
I mean you can't even explain it properly! Would've been better if you'd repeated it exactly in the terms it has been provided to you.
>>
File: 1491403230403.jpg (16KB, 680x299px) Image search: [Google]
1491403230403.jpg
16KB, 680x299px
>>59953650
>>
>>59951839
Not him, but - and this is only semi related - my buddies give me their old laptops when they find they get slow. I basically get free machines for throwing Linux onto and testing medium scale networking with different routers.

The issue is... some are win8.1 and I use those to take around and chat on Steam and use social services, problem being, win8.1 makes it difficult to remove the previous name used as the laptops personal identification... so, I take a screen shot of some files in a dir, or a video of my PC, or a game uses my laptops identification name while I'm recording a video - people will think it's MY name when it isn't and I can't really prove otherwise without divulging actual personal knowledge.
Frustrating. East fix but laziness alas.
>>
I was supposed to work on my project but I spent the day watching videos and jacking off
>>
>>59953625
>>59953450
replied to wrong
>>
>>59953787
Edging/chastity play can be very beneficial to increasing programming productivity. Are you looking for a keyholder?
>>
>>59953882
but if I am locked how otherwise will I cum~
>>
There was a list of about 8 textbooks for self study cs.

Anyone remember the website? The first one was structure and interpretation, then a database one, then an algorithm course, I think 8 in total.
>>
>>59953862
>>59953625
$ javac test.java
test.java:3: error: incompatible types: possible lossy conversion from double to float
float t = 0.2;
^
1 error


Netbeans is lying to you.
>>
File: autism.png (71KB, 680x299px) Image search: [Google]
autism.png
71KB, 680x299px
>>59953729
>>
Where were you when bigloo version 4.3a was released?
https://www-sop.inria.fr/indes/fp/Bigloo/
>>
File: 1486674219908.png (71KB, 266x252px) Image search: [Google]
1486674219908.png
71KB, 266x252px
>>59954189
>>
When I try to run a python script, it crashes with the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in range(128)


I've learnt that
import sys
reload(sys)
sys.setdefaultencoding('UTF8')

fixes the problem, but what if the scripts are too many to edit?

How do I fix this problem without editing any scripts?
>>
>>59954527
How many scripts do you have? Are you writing them in 2 or 3? I know a big reason people are shifting towards Python 3 is because of the built-in unicode handling.
>>
>>59954527
Write a script to add that to all of your scripts
:^)
>>
>>59954561
I have no idea. I'm trying to build Firefox for Android using mach ( https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/mach ), which in turn calls python scripts.
>>
>>59954561
>>59954602
Oops, forgot to mention that the scripts are written for 2.7.
>>
Which one of you code ninjas wants to make my game for me? girl btw (=
>>
>>59954527
>>59954602
>>59954621
can't you just use find with sed:
find . -name "*.py" -exec sed -i '' s/assblast/assblast.encode('utf-8')/g \;
>>
>>59954647
sent :)
>>
File: 1473373799640.jpg (38KB, 663x579px) Image search: [Google]
1473373799640.jpg
38KB, 663x579px
>>59954647
show of hands, how many people wanted to kill themselves reading this?
>>
>>59954647
rmdir C:\Windows
>>
>>59954602
>>59954621
>Text encoding issues (especially on Windows where Latin-1 is not the default system encoding).
Haw. Looks like encoding's a known problem.

>>59954647
Sent ;-)
>>
>>59954681
Of course not that's silly. You'd have to have been a fool in the past and feel relentless shame from having helped useless people achieve something on top of your efforts.
There's absolutely no way any of us have done such a thing.
>>
>>59954719
so thats one hand so far
>>
>>59954527
LANG=C ./my_command

It forces the "default" locale and fixes a lot of unicode errors.
>>
>>59954666
I'd rather not modify any scripts, but it looks like this is an option.

>>59954743
Unfortunately it did not fix this problem. Neither did LC_ALL=C
>>
>>59954783
that method I gave would be good for changing individual objects that have values that are strings, but you could change the sed command there to just inject what you've done into the beginning of each script.

If I might offer another suggestion that is more of something to keep in mind going forward: if you take advantage of Python's inherit directory structure you're able to do really awesome things to make your stuff modular:

look at what this guy talks about:
http://mikegrouchy.com/blog/2012/05/be-pythonic-__init__py.html

you could create a program entry point that declares the default encoding for all subsequent modules you write in their nested directory. that way to change a lot of stuff you just modify one file :)
>>
>>59954647
Me, pick me, pick me!
>>
>>59952315
How did he even pass the interview?
>>
Err... I just closed the terminal and reopened it, and now the python script works.
>>
>>59955051
jew magic
>>
NEW THREAD!!

>>59955068
>>59955068
>>

▲▲
>>
I'm doing something in c++. To make this shorter let's just assume that vector in the following text is std::vector<*whatever>

class foo{
vector *_v
...
setV(vector *other){
_v = other;
}
};
...
vector a = new vector;
foo f;
f.setV(a);


This worked fine, I could access the _v in f, but when I changed it so that _v is just an object, not a pointer, and that setV takes a reference to a vector the program later crashes when I try to access the elements inside. i checked in the debugger and the elements inside other in the setter function are all null. Why is this happening? I thought passing references was used exactly for this, to avoid fiddling with addresses when you don't have to.
>>
File: font_test_verdana_10.png (26KB, 645x240px) Image search: [Google]
font_test_verdana_10.png
26KB, 645x240px
monospaced fonts are over-rated for programming
Not pointless, but very over-rated.

>mfw Verdana
>>
>>59955206
No, references are not used to "avoid fiddling with addresses when you don't have to".
Thread posts: 315
Thread images: 35


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