[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: 316
Thread images: 38

What are you working on, /g/?

Old thread: >>61946541
>>
long time;

heeheheh
>>
def capitalizeAll(args: String*) = {
args.map { arg =>
arg.capitalize
}
}

scala> capitalizeAll("rarity", "applejack")
res2: Seq[String] = ArrayBuffer(Rarity, Applejack)
>>
>>61952116
What esoteric programming language is that?
>>
>>61952204
Scala
>>
>>61952024

hash table
>>
>>61952024
Something like this but in your fav lang instead:
use std::collections::HashMap;

const TEAM: &str = "seahawks 20, patriots 24
colts 45, broncos 17
browns 23, seahawks 16";

fn noob(contents: &str) -> HashMap<String, u64> {
let mut teams = HashMap::new();

for s in contents.lines().flat_map(|it| it.split(',')) {
let mut entry = s.trim().split_whitespace();
if let (Some(team), Some(won)) = (entry.next(), entry.next()) {
*teams.entry(team.into()).or_insert(0) += won.parse().unwrap_or(0);
}
}

teams
}

fn main() {
let teams = noob(TEAM);

println!("Unique teams: {}", teams.len());
println!("{:?}", teams);
}


Output:
Unique teams: 5
{"seahawks": 36, "patriots": 24, "broncos": 17, "colts": 45, "browns": 23}
>>
>>61952249
Oh wait, no need to allocate a string:
use std::collections::HashMap;

const TEAM: &str = "seahawks 20, patriots 24
colts 45, broncos 17
browns 23, seahawks 16";

fn noob(contents: &str) -> HashMap<&str, u64> {
let mut teams = HashMap::new();

for s in contents.lines().flat_map(|it| it.split(',')) {
let mut entry = s.trim().split_whitespace();
if let (Some(team), Some(won)) = (entry.next(), entry.next()) {
*teams.entry(team).or_insert(0) += won.parse().unwrap_or(0);
}
}

teams
}

fn main() {
let teams = noob(TEAM);

println!("Unique teams: {}", teams.len());
println!("{:?}", teams);
}
>>
>>61952249
>>61952275
What esoteric programming language is this?
>>
>>61952283
The death of C, Rust
>>
>>61952291
kek
>>
>>61952275
I wonder: why did they go for underscores instead of camelCase?
>>
File: 1499819727053.jpg (1MB, 2048x1536px) Image search: [Google]
1499819727053.jpg
1MB, 2048x1536px
How do you "professional documentation" for C++ code?
>>
File: think_python.jpg (32KB, 250x328px) Image search: [Google]
think_python.jpg
32KB, 250x328px
>>61952079
I'm learning python.
One chapter everyday.
>>
File: 1500849277357.jpg (5KB, 245x206px) Image search: [Google]
1500849277357.jpg
5KB, 245x206px
>>61952249

>rust
>>
>>61952322
To distinguish types from functions and variables, maybe?
Types and traits are PascalCase, functions and identifiers are snake_case by convention.
>>
I'm playing around with classes in Python, and I've ran into a problem. Could someone help?

class my_class:

def __init__(self, value):
self.value = value

def __add__(self, other):
return my_class(self.value + other)

def __repr__(self):
return "Object with value = {}".format(self.value)

def do_something(args):
args[0] += 1

a = my_class(1)
b = my_class(2)
c = my_class(3)

args = [a, b, c]

print("Before:", args)
do_something(args)
print("After: ", args)
print(a)


Basically, I wrote a class that is an integer and overrides the addition operator. I then wrote a function that took in a list of my_class objects and added one to the first object.

This is the output:

Before: [Object with value = 1, Object with value = 2, Object with value = 3]
After: [Object with value = 2, Object with value = 2, Object with value = 3]
Object with value = 1


This is correct and what I expected, except that I want the actual a to be updated, not just the a in the list. This is what I want to see:

Before: [Object with value = 1, Object with value = 2, Object with value = 3]
After: [Object with value = 2, Object with value = 2, Object with value = 3]
Object with value = 2


I'm kind of new to Python, anyone know how to get around this?
>>
>>61952379
But Types and Traits started with an uppercased character while functions and identifiers tart with a lowercased character.
>>
>>61952379
That's what i said, though.
>>
>>61952385
the problem is that your add function returns a NEW instance of your class. 'a' refers to the original instance.

you need to change your add function to modify the class itself rather than returning a new instance.

however this is bad coding practice that can lead to unwanted side effects, and what you should really do is change the last line to
print(args[0])
>>
File: 1502401486199.jpg (368KB, 894x894px) Image search: [Google]
1502401486199.jpg
368KB, 894x894px
>>61952348
https://youtu.be/rWaSo2usU4A
>>
>>61952433
Meant to
>>61952410
>>
>>61952457
Yeah, the add function creates a new instance of the class. I understand that python does this pass by object thing which makes the objects in the list not actually a, b, c.

However, let's suppose I need to use a, b, c later in the program, so a needs to be updated. I can do print(args[0]) to view the correct value, but I still need a to be 2... any ideas?

Also something like a = args[0] won't work because I don't necessarily know if I pass a, b, or c.
>>
>>61952587
maybe you should re-read my post anon
>>
>>61952628
I can't change the add function, I need to return a new instance because I want to assign other variables, like b = a + 1.
>>
Hey it's your beloved linux retard here.

I did apt install libglm-dev, which gave me the header files. How do I find out where the lib files are, and what they are called, so I can add them to -L and -l?
>>
>tfw no motivation to code AI anymore
I just want a funny party girl and to like new discoveries.
>>
>>61952024
Something like this
readTeams = do  
file <- readFile "teams.txt"
let teams = map words (concatMap (splitOn ",") (lines file))
return teams

main :: IO ()
main = do
teams <- readTeams
putStrLn ("Number of unique teams: " ++ (show (Set.size (Set.fromList teams))))
putStrLn (unlines (map show teams))


Output
Number of unique teams: 6
["seahawks","20"]
["patriots","24"]
["colts","45"]
["broncos","17"]
["browns","23"]
["seahawks","16"]
>>
>>61952113
length(dick);
WOOOOOOW
>>
>>61952782
What programming language esoteric is this?
>>
>>61952801
Java 8
>>
>>61952024
you fucking pleb, I told you to use LISP
>>
>>61952801
The birth of 1 Gb of garbage per second, Haskell.
>>
>>61952753
Oh, I think it's a header only library...
>>
File: Capture.png (88KB, 1026x348px) Image search: [Google]
Capture.png
88KB, 1026x348px
https://www.youtube.com/watch?v=R7EEoWg6Ekk

At what point do we stop
>>
>>61952291
Never checked out Rust, how sarcastic was that comment, or should i try some projects with Rust?
>>
>>61952827
>lisp
>not Malboge
>>
File: just_fuck_my_shit_up.jpg (2MB, 2480x1748px) Image search: [Google]
just_fuck_my_shit_up.jpg
2MB, 2480x1748px
>>61952079
Is defining one line functions in a header file bad practice?
Example:
int operator[](std::string s) { return get(s) ;}
[\code]
The constructor example
Hashtable(size_t size) {table.reserve(size);}
[\code]
>>
File: 1490236418206.png (66KB, 907x190px) Image search: [Google]
1490236418206.png
66KB, 907x190px
>>61952855
https://www.youtube.com/watch?v=uNjxe8ShM-8

We don't
>>
>>61952855
This is gonna be a fun listen.
>>
>>61952879
fix
int operator[](std::string s) { return get(s) ;}

Hashtable(size_t size) {table.reserve(size);}
>>
>>61952867
It's C but memory-safe without GC and with more functional stuff and a better type system
>>
File: 1502401195646.png (5KB, 577x35px) Image search: [Google]
1502401195646.png
5KB, 577x35px
>>61952855
>>61952881
https://sdleffler.github.io/RustTypeSystemTuringComplete/
>>
>>61952867
Never hurts to take a look at.
I wouldn't bother with it though.
>>
>>61952782

>6 unique teams

lel
>>
>>61952782
>>61952952
Oh shit, Hasklel confirmed for garbage
>>
File: 14837124418240.jpg (38KB, 717x224px) Image search: [Google]
14837124418240.jpg
38KB, 717x224px
>>61952855
>>
>>61952709
well idk anon. you can't maintain the reference AND return a new reference. maybe think of a different way to structure it.
>>
>>61952079
I'm learning C via pic related. Only other experience i have with programming is the two semesters of Java / intro to computer programming required by my major.
i'm really digging the language and this text but things started to get a bit confusing and the exercises a bit more challenging upon section 1.5 Character IO. I have progressed to 1.9, making sure to complete every exercise before advancing, but would like one of you to check my work on this one:
https://hastebin.com/comidelobu.cpp
Any bugs? Could it have been designed in a more logical or efficient manner? Any feedback would be appreciated.
Oh and it is Exercise 1-18: Write a program to remove trailing blanks and tabs from each line of input, and to delete entirely blank lines.
>>
>>61953054
don't accumulate all your output lines and print out one big string at the end
just read a line, remove trailing stuff, output line
>>
I just opened CTCI to prepare for fall internship interviews. I hope I'm not a brainlet
>>
>>61952952
fug, I assumed any duplicates would have the same number of wins. Now I see where the complexity comes from because you presumably need to add the wins together when there's duplicates Here we go:
readTeams :: IO (Map.Map String Int)
readTeams = do
file <- readFile "teams.txt"
let teams = map (words) (concatMap (splitOn ",") (lines file))
return (foldr (\[name, wins] -> Map.insertWith (+) name (read wins)) Map.empty teams)

main :: IO ()
main = do
teams <- readTeams
putStrLn ("Number of unique teams: " ++ (show (Map.size teams)))
putStrLn (show teams)

Output:
Number of unique teams: 5
fromList [("broncos",17),("browns",23),("colts",45),("patriots",24),("seahawks",36)]
>>
How do I into Android layouts, specifically constraints?
>>
>>61953155
ConstraintLayout is as cancerous as RelativeLayout. Stick with LinearLayout and FrameLayout.
>>
>>61953037
Yeah this is what I feared, I might do something fucky like pass a string containing my variables and then parsing that string to update them
>>
>>61953161
Tnx for actually answering!
Can any layout be converted to ConstraintLayout, but not vice versa?
>>
>>61953116
Thank you
>>
>>61953243
Most layouts can be converted to a single ConstraintLayout, yes. IIRC Android Studio is able to do this automatically.
>>
File: Betabrite[1].jpg (185KB, 800x418px) Image search: [Google]
Betabrite[1].jpg
185KB, 800x418px
>>61952079
Dot Net Core 2.0 was released a couple of days ago so I'm playing with it. Using C# to write a service that can control an old school LED message board through the serial port.
>>
Just got this email today:

>Thank you for applying to the programmer position.

>This company is a start-up and the pay would be $20k as well as a percentage of the company.

>It's a music app/website with several features such as a music player, interactive globe, and webcam/video.

>Are you comfortable programming an app and a website mostly by yourself and at the same time?

>Would you be open to moving to Seattle or regularly traveling to Seattle?
>>
>>61953300
>startup
>20k
constanza.webp
>>
>>61953300
>$20k
This is where I'd post a smug anime girl if I had them on my work PC
>>
>>61953300
>It's a music app/website with several features such as a music player, interactive globe, and webcam/video.
>pay would be $20k
>moving to Seattle
lmaooooo
>>
>tfw getting paid 24k
Fuck working
>>
File: 1481002018371.png (226KB, 331x418px) Image search: [Google]
1481002018371.png
226KB, 331x418px
>>61953300
>$20k
I'm a yuropoor and even I wouldn't accept that
>>
Do you listen to novice questions here?
Say I am using the gets() function in C.
In fact, I have two processes using it.
My problem is I want one to cancel when the other completes, or hell, just a timer to cancel the gets() call.
Is there a way to do this?
Also, yes, I know it says not to use gets() but I'm doing it anyway.
>>
>>61953300

There is a faggot somewhere who got an idea "dude what if like you could chat with people on a globe and music n shiet"
>>
>>61952385
def do_something(args):
return args[0] += 1

args[0] = do_something(args)

Im new to python to but maybe this is what you want?
>>
>>61953359
Where do you live? 24k can be a lot of money if you live in Thailand for instance.
>>
>>61953416
>Seattle, Thailand
>>
>>61952385
this would be trivial in C because POINTERS
>>
>>61953300
$2880/yearly beneath minimum wage assuming 40hr week. You would make more working at McDonald's.
>>
>>61953430
Iwas replying to the anon getting paid 24k, not the startup post.
>>
>>61953392
or on second thoughts, just update your do_something() to
do_something(args, index):
return args[index].add(1)

args[0] = do_something(args, 0)
args[1] = do_something(args, 1)

etc...
>>
>>61953300
guys he's obviously getting a sizable chunk of the company. dont you realize how large the market for listening to music while video chatting with people across the globe is?
>>
File: 1460865889154.gif (479KB, 434x444px) Image search: [Google]
1460865889154.gif
479KB, 434x444px
>>61953300
Hey you should take the job. As long as you get a BIG portion of the company. Play up your strengths in the interview(he wont know anything). Tell him you take his idea very seriously and want to be equal partners.

>"seriously" work on his code
>encourage him to spend money copy-writing and registering everything
>after one year tell him to give you another 20k or you will just give your 50% share to some venture capital firm for 100$.
>take the extra 20k
>sell half of your shares to the venture firm for 5$ and never show up again
40k plus 5$ plus 25% of his company for half working on personal projects for a year sound pretty good.
>>
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;

namespace Sports {
class Program {
static void Main(string[] args) {
var teams = new Dictionary<string,int>();
var input = "seahawks 20, patriots 24\ncolts 45, broncos 17\nbrowns 23, seahawks 16";
var matches = new Regex("(.+) (.+), (.+) (.+)").Matches(input);

foreach (var match in matches.Cast<Match>()) {
var team1 = match.Groups[1].Value;
var team2 = match.Groups[3].Value;
var points1 = int.Parse(match.Groups[2].Value);
var points2 = int.Parse(match.Groups[4].Value);

try { teams.Add(team1, 0); } catch { }
try { teams.Add(team2, 0); } catch { }

teams[team1] += points1 > points2 ? 1 : 0;
teams[team2] += points1 < points2 ? 1 : 0;
}

Debug.WriteLine("team count: " + teams.Count);
Debug.WriteLine("stats:");
foreach(var pair in teams) {
Debug.WriteLine(pair.Key + ": " + pair.Value);
}
}
}
}


C# master race
>>
>>61953373
add a setjmp before gets
send a signal to the other process when gets completes
in the signal handler, longjmp back before gets
use setjmp return value to figure out if your gets got cancelled and skip the gets if it was

it's also something usually advised against, so might fit your style
>>
>>61953620
Thanks for the reply.
That seems more complicated than it's worth.
I suppose I don't need to use gets(), but really anything that I can use to read stdin with a timeout.
>>
>>61953641
yeah, and it could well break horribly
I'd probably use some locking mechanism to control access to stdin, or have one process read stdin and send some of the data to the second one
>>
where should I set my GOROOT up to? same as GOPATH?
>>
>>61952116
>
scala> capitalizeAll("rarity", "applejack")

hidden power
>>
>>61953718
Same as GOFUCKYOURSELF
>>
>>61953735
die, you dumb cunt
>>
>>61953609
>empty catch blocks
>writing to Debug
>no type annotations
>regex
wew lad
>>
>>61953439
>You would make more working at McDonald's.
Yeah but you're not developing as a programmer and not advancing your programming career at McD

All I'm saying is that I'd work for free on certain projects (like many people do in free software)
>>
>>61953761
name one project you'd move to seattle and work for free for
>>
Hello my friends.

I am looking to learn C++ and need recommendations on what book to buy. Currently I have my eyes on this. I have programming experience but it's been a year since I've used Java. I understand this book is meant for beginners but since it's been a while I want to make sure I get something that will help me cover all my bases.

Should I get this?

Thanks in advance.
>>
>>61953792
VR waifu simulator.
>>
>>61953792
it's different for different people
>>
>>61953300
You should reply him that you feel absolutely insulted
>>
>>61953813
I have it, it's very good. It is on top of every list of recommended books to learn programming.
>>
>>61953863
I'm pulling the trigger 60 bucks on amazon

Thanks man
>>
>>61953854
Had a recruiter try to pitch "free popcorn" as a legit benefit of working for some code monkey zoo. People who fill these positions must have virtually no confidence.
>>
I have an idea for an Android app.
I also want to learn how to program in C++.

Would it be a good idea for a complete beginner to hit two birds with one stone and learn C++ by making the app?
Is it more complex than writing the code, saving it as an .apk, and then installing it on my phone?
>>
>>61953975
android runs Java, not C++
>>
File: 1468882928057.png (199KB, 439x392px) Image search: [Google]
1468882928057.png
199KB, 439x392px
Employed Haskell programmer reporting in
>>
File: 1502977644911.jpg (156KB, 430x720px) Image search: [Google]
1502977644911.jpg
156KB, 430x720px
>>61954147
>>
>>61954059
Java is the one that nobody likes but will most likely get you a job right?
Or is that just a meme?
>>
>>61954163
Yes.
>>
What are the absolute barebones basics you would need to implement on top of something like Chromium to make a minimally functional browser?

I'm sick of the lack of compelling alternatives currently on offer and was wondering how much time and effort it would take to get something very basic.

Do I have to implement all the complicated pain in the ass technologies in terms of the networking and security or does Chromium already take care of all of that hard work?
>>
>>61954163
I like Java.
>>
>>61954226
I'm so sorry
>>
>>61954224
Chromium is a fully fledged browser, just compile it.
Google just changed the logo and added their botnets.
>>
>>61954245
Name a better portable, statically typed garbage collected language with equivalent tooling.
>>
>>61954147
how the fuck do i get a haskell gig, i keep bidding on contracts but i always lose them to alpha nerds who have 10 times more experience than me
>>
File: 1447339752083.jpg (80KB, 531x505px) Image search: [Google]
1447339752083.jpg
80KB, 531x505px
Studying C++ here, coming from a C background.
void createMatrix(int **matrix, int lins, int cols) {
matrix = new int*[lins];
for (auto i = 0; i < cols; i++)
matrix[i] = new int[cols];

for (auto i = 0; i < lins; i++) {
for (auto j = 0; j < cols; j++) {
matrix[i][j] = 0;
}
}
}

void printMatrix(int **matrix, int lins, int cols) {
int i, j;
for (i = 0; i < lins; i++) {
for (j = 0; j < cols; j++) {
cout << matrix[i][j] << "|";
}
cout.put('\n');
}
}


If I execute printMatrix(...), I get a Segmentation Fault error. I'm pretty sure this happens because a matrix is created differently in C++. I believe that 'matrix' was created locally in createMatrix, and when I call the function to print it in main(), the elements are not recognized.

Any idea how can I fix this without having to create the matrix in main()? In C, I remember I could access the elements of an 1D/2D array even though it was created in another function because of muh pointers.
Before you ask, I need to use 'new'. And ignore the 'auto' bullshit.
>>
>>61954254
Well I'd really be using CEFSharp, if it's a fully fledged browser then I have very little control correct?

Seems like the browser market is shit for a good reason, making an alternative involves basically starting completely from scratch.
>>
>>61954281
Chromium is open source, just download the code and start hacking away.
>>
>>61954273
You're doing it wrong, yeah. If you do something like this.
int main()
{
int **matrix = nullptr;
createMatrix(matrix, 10, 10);
}

then the matrix variable which is local to main is not being updated. Maybe you want to return matrix from the createMatrix function? The way you're writing this isn't very C++, usually you would have a Matrix class, with a constructor rather than an init method.
>>
>>61954261
I'm surprised you want garbage collection
>>
>>61954273
you either allocate the space in main or return a pointer from create or pass an int*** so you can change the value of matrix in main by passing its address
>>
package main


import (
"fmt"
"io"
"os"
"path/filepath"
"golang.org/x/crypto/ssh/terminal"
)


Why do I need to 'go get' the crypto package, why doesn't it automatically install if you have to put the fucking url in anyway?
>>
>>61954273
Are you merely pretending to be retarded?
>>
>>61954408
I'm surprised you dont.
>>
I'm planning to buy The C Programming Language 2nd edition and Accelerated C++, are those good books?
>>
>>61954351
>>61954412
Yep, that was it. Thanks.

>The way you're writing this isn't very C++, usually you would have a Matrix class, with a constructor rather than an init method.

I know. Our professor is teaching us Data Structures in C++ to "give us the basics of a more modern language than C", he won't go into OOP though... which is fucking strange.

I'd be feeling better if he started the semester with C, not C++ desu
>>
>>61954445
It's f u n to manage your own.
>>
>>61954471
That's a retarded idea. in that case, don't feel bad about writing C-like C++. There shouldn't be much that throws you off apart from some minor changes related to typesafety.
>>
>>61954463
>I'm planning on buying K&R
Good luck finding a non-pajeet publishing of the book for less than $30. But yes, both of those are good.
>>
>>61954506
$50 for a paperback, yikes. you don't have to worry about a new edition coming out, i guess
>>
>>61954506
I'm getting them for $90 total, work offered to pay half the cost so I could improve my skills while not on paid hours.
>>
>>61954559
cheap deal for them
>>
Not sure if I should post it in the stupid questions thread or here but since there are more professional programmers here I'd ask here:

How much of the typical corporate bullshit (SJWs, pointless meetings, presentations etc) do you have to deal with as a programmer? I want to switch careers since I'm unhappy as a teacher but I truly hate the corporate culture.
>>
>>61954584
I wanted to learn anyway, and I imagine I can negotiate a raise with new skills. Everybody wins.
>>
File: dfsaafdfasd.jpg (6KB, 118x125px) Image search: [Google]
dfsaafdfasd.jpg
6KB, 118x125px
Just got rejected for a Conversion to Computer Science graduate degree
>>
>>61954618
>typical corporate bullshit
too fucking much

>(SJWs,
HR usually but otherwise not much

>pointless meetings,
tonnes

>presentations etc
hardly ever
>>
why does sicp cost over 50 bucks
>tfw can only read books if they're physical
>>
>>61954629
I mean, if you didn't care that it has a green cover instead, you can get the international version for like $10.
>>
>>61954631
Did you have shit math grades or something?
>>
>>61954631
converting from what?
>>
>>61954618
>SJWs
This is not a problem in the workplace, anyone who tries to tell you otherwise is a NEET

>pointless meetings
Get ready for lots of these

>presentations
Hasn't been a problem for me
>>
>>61954646
I paid ~R$110 for mine (~US$34). I still think the store had the price wrong for the book, because and checked in other sites and everything was R$200+. Guess I lucked out.
>>
>>61954675
No just a mediocre bachelors grade, not awful, just not great

>>61954683
Philosopy
>>
>>61954689
>because I
Forgot to add that it was apparently the only copy available.
>>
File: sicp.png (356KB, 1680x1050px) Image search: [Google]
sicp.png
356KB, 1680x1050px
>>61954646
reading a beautiful version of SICP tiled with Emacs is max /comfy/
>>
>>61954707
that is a big gap. have you talked to anyone in the desired department?
>>
>>61954735
I might just print out that version myself
>>
>>61954707
>just a mediocre bachelors grade
So like a C?

Can you at least try again? I didn't think it was that big of a deal to change your major
>>
>download app
>LICENSE.electron.txt

into the trash it goes
>>
>>61954745
are you planning on doing the exercises? if yes then wouldn't you find it more comfortable to have the exercises on the screen?
>>
>>61954735
Ugh...
>>
>>61954745
>tfw you don't have a laser printer so you can mass print all your favorite books

I have so many OSR books I'd love to have in physical print
>>
File: cry of the numale.png (397KB, 500x700px) Image search: [Google]
cry of the numale.png
397KB, 500x700px
>>61954775
>>
>>61954739
Its a program designed to train someone from any background. I covered some stuff on formal logic and abstract linguistics which translates over pretty well so there's even some subjects in STEM which are further away.

>>61954756
Yeah a C, was basically only like 5 percentage points from their desired threshold. And yeah I'm hoping I can look for some internships or whatever and try again with experience backing me up
>>
>>61954812
If you have gaps this small, it's better not to have them at all...
>>
>>61954813
i didn't think of that. my point was more that, at least in my field, the people you know and who are willing to vouch for you are everything
>>
>>61954775
what are you pointing out?
>>
>>61954836
>>61954829
>>
>>61954773
I would but I really have a hard time reading books or any kind of longer text on the computer, I honestly don't know why. It bothers me that much that I usually just get distracted after a mere few minutes
>>61954787
I know someone that works in an uni so I just borrow their printer for it, I think they don't keep track of who prints what. Already printed out Introduction to algorithms and had to make it 3 different parts because of how large it was
>>
>>61954829
>t. eyelet
I might remove the gaps from the bar though, I'll check what looks better
>>
>>61952079
this textbook is full of dull shit, I used it in graduate school
>>
>>61954862
Make them larger or just remove them completely. It's better for you.
>>
>>61954688
>This is not a problem in the workplace, anyone who tries to tell you otherwise is a NEET
Speak for yourself. We just had a "safe space gathering" scheduled after this weekend to "talk, process, and support each other."
>>
>>61954834
Ah I get you, nah, I had solid references but no contacts. I mean I'm a young nobody just breaking in
>>
>>61954889
i guess your setup might be different from what i'm used to, but if you're in the same physical location you might as well get in touch with a professor whose work looks interesting and go from there
>>
>>61954851
Damn that's lucky. At our Uni, you have to sign into the printer to use it. Everything's tracked.
>>
>>61954932
same here, but I don't anyone gives a shit
>>
>>61954471
>he won't go into OOP though
classes are OOP
>>
File: scrot.png (278KB, 1680x1050px) Image search: [Google]
scrot.png
278KB, 1680x1050px
>>61954876
actually I do like it more now, thanks anon
>>
>>61954813
That's really fucking weird. We had a normalfag transfer in from a Music major, so there's no real reason why they'd hold you back. Wherever you go to school sounds uptight.
>>
>>61954954
Good.
>>
>>61954909
When you say get in touch. You mean show interest, ask him about his work?
>>
>>61954878
It's probably location based.

My heart goes out to the ones stuck in Commiefornia
>>
>>61955048
What about your thoughts and prayers?
>>
>>61955064
I'll be sure to add them into it too. I'll have to ask the Big Man Upstairs for forgiveness soon. I haven't gotten a chance to have a good talk with him lately.

God bless, Anon.
>>
>>61955078
https://www.youtube.com/watch?v=T9SKkd79AjQ
>>
>>61954261
Python
>>
>>61955155
not statically typed
>>
>>61955107
I love how you can tell he's only got half or less of the audience laughing.
>>
>>61955166
D
>>
>>61954963
Huh, well I applied late, maybe thats all it came down to
>>
>>61955225
not well tooled
>>
How do I start contributing to open source projects? I learned some Python and I have no idea what to do with that knowledge or where to even start. ;_;
>>
Trying to learn me a haskell. Struggling with C interop.

How's this shite?

type Connection = Ptr ()

foreign import ccall "xcb_connect" c_xcb_connect
:: CString -> Ptr CInt -> IO Connection

connect :: Maybe String -> IO (Connection, Integer)
connect string =
let castStr Nothing = return nullPtr
castStr (Just str) = newCString str
in alloca $ \pointer -> do
cDisplay <- castStr string
conn <- c_xcb_connect (cDisplay) pointer
defaultScreen <- peek pointer
return (conn, toInteger defaultScreen)
>>
>>61955239
fuck off autist

write your own language
>>
>>61952322
Because camelCase is absolutely disgusting.
>>
>>61955277
why? Java already exists.
>>
>>61955262
>Make friends with a community doing a project you care about (as in join their forum or something)
>Ask if there's anything you can help, discuss your skill level with them
>Hopefully they don't laugh and can actually think of something
>Congratulations, you helped someone
>>
File: 1410716416995.jpg (114KB, 429x631px) Image search: [Google]
1410716416995.jpg
114KB, 429x631px
>>61955284
Preach it, brother
>>
>>61955288
then what's the problem?
stick with Java.
>>
>>61955316
There is no problem. Follow the conversation chain, buddy. I like Java.
>>
File: .jpg (72KB, 800x600px) Image search: [Google]
.jpg
72KB, 800x600px
I have a class BaseClass which do some stuff based on his static String1, String2, ..., StringN property and stores result in Dictionary. It works pretty well. Next, I need a class Class1 that inherits from BaseClass, but the only things that differ are StringN and Dictionary. Methods are exactly the same. How can I reach it? Basic inheritance doesn't work because results in BaseClass.Dictionary doesnt match the Class1.Dictionary and there is no way to transform it, so I can't make an explicit convertion.
Or maybe I just messed up with architecture?
>>
>>61954261
All joking apart, C#.
>Portable
Windows, Linux, Mac, iOS, Android. Check.
>Staticallytyped
Check
>Garbage Collected
Check
>Equivalent tooling
Check, at least on Windows. The Mac/Linux tooling is still decent though.
>>
Having to use reflection of any kind is a sign that either your language's type system is too weak or you have failed to use your language's type system effectively.
>>
>>61955349
Of course you messed up the architecture if you're considering inheritance.
Post the code.
>>
>>61953054
I think the biggest fuckup of every programming text is a complete lack of proper introduction to FILE I/O, early on. Because 99% of the time, that's what someone wants to do, and that will be the means for them to be working on a meaningful project as they learn. Most C++ and C texts tack on file I/O near the end, as an afterthought almost. Because after reading the whole text, it really isn't so novel and you understand what it actually "is". But nonetheless.

Try to get to a point where you can work with files and dynamic memory allocation properly, then continue learning.
>>
>>61955350
>Check, at least on Windows.
I use linux. Therefore its not portable.
>>
>>61955383
https://code.visualstudio.com/
Dipshit.
>>
>>61955368
You never heard of I/O redirection?
>>
>>61955383
http://www.monodevelop.com/
>>
Is modularity with java 9 going to make a big impact on the language.
>>
>>61955394
I don't understand what you mean by this, so possibly not.
>>
>>61955264
You might want to mess around with the inline-c library.
Maybe not if the C interop isn't too bad.

I'd align the <- since it makes it easier to read

>
let castStr Nothing = return nullPtr
castStr (Just str) = newCString str

You can do

castStr = maybe (return nullPtr) newCString

maybe pattern matches a Maybe, it takes a value in case it's Nothing, and a function to apply in case it's Just
>>
>>61955264
>>61955420
Oh, and you could also use a do block - specifically for the let.
This lets you avoid using "in", i.e.
do
let x = 3 -- no in required
asdf -- some monadic computation

example:

connect :: Maybe String -> IO (Connection, Integer)
connect string = do
let castStr = maybe (return nullPtr) newCString

alloca $ \pointer -> do
cDisplay <- castStr string
conn <- c_xcb_connect (cDisplay) pointer
defaultScreen <- peek pointer
return (conn, toInteger defaultScreen)
>>
Using MSYS2, in C++ I'm having difficulty with signal handling, still. SIGINT just locks up the terminal while it waits for the program to respond, or whatever it's doing, which it never does. It never even enters the signal handler. I knew it'd be difficult to implement signal handling that altered state on a per-class basis, but even doing it with globals, the result is the same.

Program is not threaded, so there's no asynchronous stuff going on. Happens even with trivial test cases. Anyone else experience this?
>>
>>61954735
sauce?
>>
>>61955494
no, post the actual code. I have no idea what you're trying to do.
>>
>>61955540
there's part of a url there. anyway, i'd already looked it up

http://sarabander.github.io/sicp/
>>
>>61952113
>signed int
nigger
>>
>>61955715
don't worry. i got one for you.

short dick;
>>
>>61955654
How the fuck do schemers loop if they don't have a loop macro.
>>
each function should be its own class
search your feelings, you know this to be true
>>
>>61955654
No pdf wtf.
>>
>>61955781
map is sufficient for all cases
>>
>>61955803
>map
what about shit that requires IO and state
>>
>>61955821
mapM
>>
>>61955828
>state
srs how do you get out of a sticky situation without return;
>>
>>61955351
A large majority of reflection problems can be solved at compile time with powerful-enough macros
>>
>>61955883
Precisely.
>>
Is there a language that is like haskell, except
>the default string type is not a list of integers
>there are no IO exceptions
>head has a signature of [a] :: Maybe a
?
>>
>>61955799
print and screen are very different. he has normal and pocket pdf versions here

https://github.com/sarabander

i think the font is linux libertine, which i quite like
>>
>>61955803
>>61955828
Sure thing, try implementing K-means or anything graph-related like BFS, vertex colouring, FFA, etc.
>>
>>61955732
lol
>>
>>61955732
i unfortunately i laughed
>>
How come SICP is written by academics who never built a real program in their lives?
>>
>>61955979
practitioners tend to write for absolute retards
>>
>>61955927
You write a recursion loop function over your data structure and then use that. Why would I want an overly complicated loop macro with too many bells and whistles and really shitty documentation?

The entire point of scheme is to be able to easily build all the abstractions your program will need, rather than having the abstractions provided to you. Thats why the scheme standards are so small.
>>
>>61956002
Lmao so you have to build everything from scratch everytime?
>>
>>61955979
that's what pajeets are for
>>
>>61956062
If youre using racket or chicken then there are lots of libraries so you might find what you're looking for, otherwise yeah you might have to write some code.
>>
I dont even know what im doing

int main(void)
{
int asdf;
printf ("type: ");
scanf ("%d", &asdf);
printf ("%d\n", asdf * 5);
}

why doesnt it ask for input when I compile it?
>>
>>61956136
Don't forget to #include <stdio.h>
>>
>>61956136
insert fflush(stdout); after the first printf
>>
>>61956136
Do a
system("pause")
before you end your program.
>>
File: 1460872018205.jpg (51KB, 435x571px) Image search: [Google]
1460872018205.jpg
51KB, 435x571px
>school starts again in a week
>forgot all my java shit I learned last semester
>need to study because going back to school, i remember all the concepts but not actually how to write the code
>just can't focus for whatever reason

I've been dealing with this for ages, how the fuck do I get my brain to stop being retarded
>>
btw, im compiling just using "gcc -o asdf asdf.c | ./asdf
>>61956153
what does it do? the book doesnt have that at all
also, it didnt work
>>61956175
is that from library other than stdio.h?
>>
>>61955799
>>61955897
also epub version
>>
>>61955856
give an example where you would need to return to get out of a sticky situation, I will (try) to tell you how I would do that in scheme
>>
>>61955781
you can always write a macro yourself
>>
>>61956225
kill your life
>>
>>61956274
too inefficient to implement with language
needs to be done in c
>>
File: Splash1-3.png (3MB, 1920x1080px) Image search: [Google]
Splash1-3.png
3MB, 1920x1080px
>>61956290
Im sorry m8, I legitimally don't know why it doesnt work and I don't want to skip any section of the book I can quite possibly understand. I've already googled it, but I can't get it to work even copypasting code.
enjoy yourself with this btw
>>
>>61956225
Hmm I thought that would be your problem ... when your printf(), it doesnt actually print it, it puts it in a "buffer" of things-waiting-to-be-printed. fflush forces the buffer to clear and everything in it to be actually printed immediately.
>>
>>61956198
Program something you want to program.
For me, that was applying math to problems, such as image compression, or solutions to the heat equation.
>>
>>61956253
IDK, something like #'reducing through a list and #'return 'ing after an accumulation of values yields some arbitrary value tha requires termination
>>
>>61956198
-Exercise
-Proper diet
-Eliminate exposure to pulsed fields at microwave frequencies. ie, cell phones, wifi, bluetooth, etc. You're screwing up your melatonin secretion, which affects free radical scavenging and overall hormone cycles. Increasing your blood brain barrier permeability, reducing dendritic arborization, and pretty much causing brain damage via aberrant L-type voltage gated calcium channel activation and subsequent peroxynitrite formation. Chronically elevated intracellular Ca2+ also fucks up neurotransmitter release patterns. Networks of cells are generally based around so-called "pacemaker" cells, and will resemble coupled oscillators. Calcium signalling is vital for a number of functions around this.

Also, have your thyroid function tested.
>>
>>61956253
Lisp isn't even functional.
>>
>>61956337
>too inefficient to implement with language
?
>>
>>61956225
>is that from library other than stdio.h?
It's from stdlib.h.
>>
>>61956422
do it through recursion and pass the accumulation so far with each recursive call, and start the function with an if that checks the accumulated value and stops the recursion if needed.
>>
>>61956459
I'm not very experienced, but I imagyne doing all that macro expansion at run time must be very time consuming.
Something like loop is very complex, has many tests (for keywords) and initialization.
>>
>>61955799
https://github.com/sarabander/sicp-pdf
>>
>>61956505
it does not happen at run time, they are expanded at compile time
>>
Large chains of well formed abstractions evaluated solely at compile time turn me on.
>>
>>61956565
do women not do it for you?
>>
>>61956422
let/ec
(define (andmap-with-fold f lst)
(let/ec escape
(foldr (λ (x z) (or (f x) (escape #f)) #t lst)))
>>
File: pellesc.png (13KB, 646x315px) Image search: [Google]
pellesc.png
13KB, 646x315px
So when I type something in Pelles C and it guesses what I was writing like pic related how do I confirm it so that Pelles inserts it?
>>
>>61956628
Oops should be foldl but otherwise the same
>>
>>61956643
btw continuations are MUCH more powerful than early return; from shitty imperative algol languages
>>
>electrical engineer
>applying for an internship related to java/android
>don't know shit about java/android
I feel like a human sized shitpost
>>
>>61956637
Tab or Enter?
>>
>>61956619
Women are partly evaluated at compile time, partly at runtime.

The ideal is to find a woman that meets both the hard underlying mechanical constants generated at compile time, and the structures that form from them at runtime. Unfortunately many women don't meet runtime checks.
>>
>>61956792
This is the least cringiest tech joke I've read in a while. Good job
>>
>>61956760
Just say you're willing to learn and I doubt they'll give a shit
>>
>can't understand 1.17 in sicp

is this really what square roots are? am I dumb?
>>
>>61956893
That uses newton's method or sth like that right?
>>
File: CtMInH8UIAAXdJt.jpg (68KB, 881x720px) Image search: [Google]
CtMInH8UIAAXdJt.jpg
68KB, 881x720px
For a university assignment I have to draw sections of an image in python and arrange them together through some code.

I also have autism. Just how inappropriate would it be to submit some ahegao face?
>>
>>61953852

> id different

maybe if you have a trust fund then working for free is fun...

Don't work for free on someone else's venture. if you're going to work for free, make it your own project. You can get by financially doing a million other things while you do it.
>>
File: 1501565485828.png (18KB, 701x701px) Image search: [Google]
1501565485828.png
18KB, 701x701px
>>61956975
>Just how inappropriate would it be to submit some ahegao face?
depending on the personality of whoever is going to grade your assignment, either it will change nothing, or you will be forever looked at strangely

also
>university assignment
>python
what the fug
>>
File: 1476683529342.gif (121KB, 300x168px) Image search: [Google]
1476683529342.gif
121KB, 300x168px
>>61956975
or a smug anime girl

Would they think I'm a pedophile?
>>
>>61952275
nice.
what are the rest of you waiting for?

https://doc.rust-lang.org/book/second-edition/
https://rustbyexample.com/

*not for the brainlets*
https://doc.rust-lang.org/nomicon/
>>
>>61954273

>matrix = new int*[lins];

Ok...
>>
>>61957029
they would find out you're a lewd loli.
>>
>>61957014
MIT teaches python, anon
>>
>>61956428
What am i supposed to do, sleep in a damn Faraday cage?
>>
>>61957046
>MIT teaches python, anon
i want off Mr. Bones Wild Ride
>>
>>61956975
Someone will smirk, someone will frown, and someone will raise a brow.

God's speed if you actually do it, though.
>>
>>61957060
do you not?
>>
File: 1361919562178.gif (756KB, 241x182px) Image search: [Google]
1361919562178.gif
756KB, 241x182px
>>61957014
I have to learn Python for a Data Structures class. Help.
>>
>>61954954
What text editor?
>>
File: 14939378037_bf4d915f47_b.jpg (195KB, 1024x576px) Image search: [Google]
14939378037_bf4d915f47_b.jpg
195KB, 1024x576px
>>61957087
it's easy as fuck.
>>
File: 19283859375.png (421KB, 2000x1359px) Image search: [Google]
19283859375.png
421KB, 2000x1359px
>>61957014
Intro to programming
>>
>>61957107
At least tell me this. Is there a way to create a linked list without OOP in Python?
>>
>>61956765
This
>>
>>61957060
How should I know? What it comes down to is that belief, and desire for ease, does not make actuality. The universe works how it works, there are mechanical rules you are slave to, and either you find a way to get away from it, or your state will be changed in accordance with the underlying logic that drives the universe. No different than wearing a raincoat to avoid a state change resulting in "wet". Avoiding wifi and cell phones avoids the state change resulting in "cancer and brain damage".

The world is pretty simple when you come to accept how simple it really is.
>>
>>61957122
is it required
a lot of times those sorts of courses can be skipped if you already know anything more complex than a fizzbuzz
>>
>>61956975
You mean copy every pixel from a a subrectangle in the image?
>>
>>61957127
why would you want to do that?
>>
>>61954273
why are you passing pointers as your function parameter?

Pointers are fucking disgusting, stick to [][]
>>
>>61957198
Because I fucking HATE Python OOP
>>
>>61957127
No
>>
>>61954769
Explain why please. Newfag here
>>
>>61957248
>[] in a function parameter
Absolute garbage style.
>>
>>61957248
>kodes with karlie
>>
>>61957257
Electron is a tool that lets you turn webdev apps into desktop apps. They're usually bloated and shitty because it's a fucking webdev app
>>
>>61957195
No.

Just recreate it with the basic functions of turtle in python. Probably get an image, turn it into a colored stencil then get correct measurements and angles to get the turtle to tediously recreate it.
>>
>>61957255
Is there a way to implement
a list in LISP?
>>
File: 1456109466359.jpg (161KB, 1890x1417px) Image search: [Google]
1456109466359.jpg
161KB, 1890x1417px
>>61957282
>Is there a way to implement
>a list in LISP?

>Lisp
>LISt-Processor

>Is there a way to implement
>a list in LISt-Processor?
>>
>>61957282
No.
Lisp does not have a sufficient type system.
>>
>>61957350
hahahahah lisplets btfo'd
>>
>>61957329
Lisp "Lists" are not real lists
>>
>>61957424
lisp isn't real
>>
>>61957424

(setq a-list
(list 1 2 3 4))

(nth a-list 3) ;; 4

(reverse a-list) ;; '(4 3 2 1)


?
>>
>>61957142
It was for me. Kinda wish I took it though because I'm too lazy to learn Python.
>>
>>61957424
this, it's just a chain of cons
there's no such thing as a list you fucking plebs
>>
What practical reasons are there to specify between a signed and unsigned int?
>>
>>61957122
why is she wearing something over panties?
>>
>>61957122
>posting that pic on /dpt/
asshole, im on nofap thats why I came to /g/
>>
File: cw.jpg (9KB, 225x225px) Image search: [Google]
cw.jpg
9KB, 225x225px
    printf("Time since failiure. Hours:");
scanf("&d", &hours);
printf("minutes:");
scanf("%d", &min);


it took me over 30 minutes to notice that I wrote & instead of % in ""&d", &hours". Fuck this gay shit. Why cant compiler detect this?
>>
>>61957718
How could it take you that long, you had to have figured out you did something wrong with your scan so why not just go through letter by letter?
>>
>>61957718
Rust doesn't have this problem.
>>
>>61957718
Syntax looks right, and the data types all match up, so why should the compiler give a shit?
>>
>>61957718
lol because you didn't ask it to baby.
>>
>>61957718
So what does this actually output, just "&d"?
>>
>>61957803
The interpreter obviously fails first, you fucking gay retard
>>
> its not a REAL list
haskell fags deserve their job absence
>>
>>61957718
stringly typed
>>
File: ret.png (79KB, 1124x662px) Image search: [Google]
ret.png
79KB, 1124x662px
>>61957803
You get this.
>>61957760
It was 2 am and my brain is half melted
>>
>>61952079
New thread: >>61957754
>>
>309
>>
>>61953718
GOPATH is where you'll be storing your projects.
GOROOT is where the go binaries and stuff are.
You shouldn't need to set GOROOT manually.
https://stackoverflow.com/questions/21001387/how-do-i-set-the-gopath-environment-variable-on-ubuntu-what-file-must-i-edit
>>
>>61956094
Biggest problem I have with Racket and Chicken is that they both suffer from that honeymoon period where people come in and are super productive at building shit, and then they go back to living an imperative life; quite a few libraries are threshed out but no longer worked on.
>>
>>61958738
This is known to be a problem with Lisp in general, since Lispers are generally enthusiastic and bright, but they usually only want to work on things that interest them, so as soon as they get 80% done with something, they move onto something else that is more interesting.
The core of Racket is very good IMO (and is actively being worked on), but the above happens a LOT with third party libraries.
>>
>>61953300
$20k? In Seattle?

That's fucking abhorrent. This company will hang itself in 6 months.
>>
cpp

why is it called
 long long 
?
Thread posts: 316
Thread images: 38


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