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

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: 328
Thread images: 42

File: z1-vb2.jpg (164KB, 797x594px) Image search: [Google]
z1-vb2.jpg
164KB, 797x594px
What are you working on /g/?

I need career advice. CS and machine learning kick my ass, but I am okay at software engineering. Should I become a web developer? Is it easier than being an Android/iOS developer? My university dropout friend did a bootcamp and now works in Vancouver as a webdev. He knows fuck all about data structures and algorithms. He was a math major.
>>
I want to create a text editor in n-curses, but I have a dumb question, would it be possible to dynamically create LaTeX-like formatting?

Like, when you finish typing
\lambda

or
 \frac{\partial u}{\partial t}
, it appears as a single character (as it would normally appear in a compiled TeX document), much like what Word does, but better.

What would some good books/resources be for this project?
>>
>CS kicks my ass
>Okay at software eng
No, you're okay at letting an IDE and Virtual Environment fix all your awful mistakes.
You should switch industries entirely.
>>
File: guileshell.png (149KB, 1600x900px) Image search: [Google]
guileshell.png
149KB, 1600x900px
>>59916171
How come you SICP-shilling disfunctional programming gentoomen use any operating system besides GuixSD ? It's pure and brackety for the whole family, and it respects your freedum. See pic related for LULz.
>>
>>59916171
>bootcamp
>works as a webdev
No, he works as an entry level """"UX""" and/or CSS monkey
>>
File: bigparek.png (515B, 18x41px) Image search: [Google]
bigparek.png
515B, 18x41px
>>59916221
In a terminal? That means you need the unicode math symbols, and a font that supports it.
https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode

You have the whole multi-character bracket thing that's supposed to line up (pic related) and such. I'd advise using maybe Python3, and don't bother about the editor first: just write a standalone "TeX to pretty terminal formula" renderer so it's easier to test, and then integrate it with something. Maybe you need some formal grammar training because this is a language to something-that's-almost-a-language converter, so yeah. Your book's title is Wikipedia.
>>
File: sample.png (1KB, 48x37px) Image search: [Google]
sample.png
1KB, 48x37px
>>59916221
>>59917698
Here's a quick and dirty proof-of-concept sample I hand-assembled with the big parens in https://en.wikipedia.org/wiki/Bracket#Encoding
  ⎛  ⎞
K ⎜E ⎟K
⎝ ⎠

looks like pic related in my terminal. (gnome-terminal with Schumacher Clean) Your results may vary. It seems like on my terminal you have to add a space after the wide characters such as K and ↪ because otherwise they overlap with the following character, but I can't tell if that's normal.
>>
Is Rust a meme ?
>>
>>59917801
>such as K and ↪
K was meant to be a double-stroke K (U+0001D542) in case you had a doubt. Yeah to sum up : read up about parsers and Unicode.
>>
>>59917801
>K ⎜E ⎟K
>>59917841
MAN fuck that shit! 4chan's converting U+0001D542 into a normal K like it even make sense bitch please! anyway, here's the sample in Base64:
ICDijpsgIOKOng0K8J2VgiDijpzwnZS8IOKOn/CdlYINCiAg4o6dICDijqANCg==

Just do the following on Lunix
base64 -d <<END
ICDijpsgIOKOng0K8J2VgiDijpzwnZS8IOKOn/CdlYINCiAg4o6dICDijqANCg==
END

or use google if not applicable. I even put CRLF line terminators just so it works on Wangblows.
>>
Thoughts on Go?
>>
>>59918179
I like the name. And the adorable little mascot

It's kind of dumb and unweildy though
>>
working on decentralized Internet TV.

I just finished a new storage model that catalogs data exported onto different locations. Also doing some general optimizations.

Im also looking into buying LTO 4 tapes and a drive to get at that $12/TB for long term storage.
>>
>>59918179
goroutines are ok
the rest is not
>>
File: golang.png (122KB, 324x365px) Image search: [Google]
golang.png
122KB, 324x365px
>>59918179
I'm not racist, but...
>>
hackernews trolled me into buying fastmail
>>
>>59917698
>>59917801
Thanks! This definitely looks like something I can do (eventually anyway... Kind of struggling my way through SICP atm).

I am kind of confused, though. When you say
>TeX to pretty terminal formula
Do you mean I should implement the text into strictly unicode symbols? Because I'm having a hard time wrapping my head on how I would do it to have something like \int^a_b using unicode.
>>
Just found out about this website:
http://rosalind.info/problems/locations/
and am doing some of the problems on there...

Dumb question (and this may just be XCode messing with me)

I have the following code:
#include <iostream>

using namespace std;
void solve(string& toProcess);

int main(int argc, const char * argv[])
{
//Sample Dataset:
string test = "AAAACCCGGT";
cout << test << endl;
solve(test);
return 0;
}

char complement(char input)
{
switch(input)
{
case('A'): return 'T';
case ('T'): return 'A';
case ('C'): return 'G';
case('G'): return 'C';
}
return ' ';
}

void solve(string& toProcess)
{
string toReverse = "";
for(char bp : toProcess)
{
toReverse += complement(bp);
}
cout << toReverse << endl;
for(int ind = toReverse.length()-1; ind >=0; ind--)
{
cout << ind<<endl;
cout << toReverse[ind] << '-'; //doesn't print unless I include the above statement
}
}


When I remove the "cout << ind << endl" part of the last for loop, nothing prints, but when I do, it prints both the number and the letter... What the hell?

Just tested this with g++ and it works fine... I think it's just XCode freaking out... What do?
>>
File: 1486045628177.png (127KB, 601x508px) Image search: [Google]
1486045628177.png
127KB, 601x508px
Programming is a terrible profession. For one, you are not respected at any normal company. You're known as 'IT' or 'tech' and everyone gossips about how disgusting everyone is in the department. Every day, some Alpha who probably does nothing at his job except get his secretary to suck his dick in his corner office cucks you into doing random bitch work, and then yells at you when it's not done by the deadline despite it being impossible to complete the work requested. Not only that, the code rarely works, your co-workers are smelly Indians brought in by Tata Consultancy and connive to replace your job at all times for half the salary, and the work never, ever ends. You pollute your body with sugar and toxins, deprive it of sleep, and let it rot while you sit the majority of the day, neglecting any healthy exercise, social interaction or life goal attainment. It's like a Postal worker, but coupled with feelings of patheticness, lonliness, helplessness, rage and total hopelessness.

Women, when they hear you are a programmer, instantly remove you from the potential pool of mates as they know your earning potential is maxed early and your career over at 35. They are also instantly disgusted by you. It is far better to tell a woman you are on welfare than to out yourself as a computer programmer. It's also highly embarrassing for a woman to date or be married to a programmer, as virtually everyone knows they are the grown up version of the hopeless virgin in high school. One who never really grew up and became normal and fit into society, but rather found an environment where he could escape the reality of his situation and be invisible, able to hide the toxic shame and utter humiliation that is the programmer.

After Dentists, programmers have the highest rates of mental disorders, especially depression and suicide.

Programmers, why haven't you taken the cyanide pill?
>>
>>59923435
I did. My body vomited it up.
>>
File: 1489067290431.jpg (47KB, 437x501px) Image search: [Google]
1489067290431.jpg
47KB, 437x501px
Am I 2dumb for haskell

digicount :: String -> Int -> Int
digicount [] y = y
digicount (x:xs) y
|xs == [] = y+1
|otherwise = digicount xs y+1

listtoone :: [Double] -> Double
listtoone (x:xs) = x

chartoint :: Char -> Double
chartoint word =
let wordinttup = [ ('1' , 1.0) , ('2' , 2.0) , ('3' , 3.0) , ('4' , 4.0) , ('5' , 5.0) , ('6' , 6.0) , ('7' , 7.0) , ('8' , 8.0) , ('9' , 9.0) , ('0' , 0.0) ]
in listtoone [ snd x | x <- wordinttup , word == fst x ]

stringtol :: String -> [Double]
stringtol [] = []
stringtol (x:xs)
|x == '.' = stringtol xs
|otherwise = chartoint x : stringtol xs

whsep :: String -> [Char]
whsep (x:xs)
|xs == [] = [x]
|x == '.' = []
|otherwise = x : whsep xs

dsep :: String -> Int -> [Char]
dsep (x:xs) s
|xs == [] = [x]
|x == '.' = dsep xs 1
|s == 0 = dsep xs 0
|s == 1 = x : dsep xs 1
|otherwise = dsep xs 0

listtonum :: (Eq a , Num a) => [a] -> a -> Int -> a
listtonum (x:xs) y z
|xs == [] = (x * (y ^ z))
|otherwise = (x * (y ^ z)) + (listtonum xs y (z-1))

listtonumd :: (Eq a , Num a) => [a] -> a -> Int -> Int -> a
listtonumd (x:xs) y z r
|z == r = x * y ^ r
|otherwise = (x * (y ^ r)) + (listtonumd xs y z (r+1))


stringtodig :: String -> Double
stringtodig s =
let wh = whsep s
d = if '.' `elem` s then dsep s 0 else ['0']
whcount = digicount wh 0
decicount = digicount d 0
whi = stringtol wh
di = stringtol d
in listtonum whi 10.0 (whcount-1) + listtonumd di 0.1 (decicount) 1


.
>>
>>59923435
https://stallman.org/articles/made-for-you.html
>>
>>59923635
>it will not compile it with strict C89.
yeah, just like variable declarations in for loop headers..
>>
>>59923323
You declare ind in the loop. The variables scope is the loop, you can't use it outside of the loop.
>>
>>59921765
nothing wrong with those declarations

but no seriously, don't fucking use VLAs. one day you'll blow the stack and you won't ever find out why. malloc the array instead.
>>
>>59923695
Think you forgot a quote my dude.
>>
>>59923710
yeah I clicked the wrong post somehow. was meant for >>59923674
>>
>>59916171
Try to get an internship. You'll be fine.
>>
>>59923687
Wait... am I using ind outside the loop?
It seems to be working fine with g++
>>
>>59923747
Oops, yeah, reading this on my phone is not the best.

>>59919074
>cache misses
Yeah, don't waste space, pack it with pragma pack, or keep it as a separate parallel data structure. Hiding the info in the pointer means extra operations to do an index. And unless you don't access the pointer very often, it becomes unneeded overhead.
>>
Rust, CL, or both?
>>
>>59916171
I work in web development. I'm self taught and do not work a meme SJW throwaway job.

Web application development and mobile application development are practically the same at this point. If you can do one you can do the other, once you learn how to use the tools.

If you don't *enjoy* whatever you're currently doing, try something else. Try developing a web app and see if it holds your interest. Join us at /wdg/ if you'd like more advice and/or support.
>>
>>59923815
A Rust compiler that uses CL to declare new syntax.
>>
>gcc7 when
>>
>>59923848
>Join us at /wdg/

Why the fuck would you say that? Do you really want the /dpt/ shitposters trolling your general?
>>
File: TUILib.webm (1MB, 1920x1080px) Image search: [Google]
TUILib.webm
1MB, 1920x1080px
>>59916171
I have just finished up all the backround work with my very own Text-Based User Interface library and now I can get to drawing and designing other TUIControls.

I'm writing this in C# which is a pain in the arse because you cannot draw pixels in a console window without making some extern calls, so I have to use the default measurment which includes "rows" and "cols" because Windows uses table layout for its Console windows.

Yes I know about ncurses I'm just having fun with this project it is so rewarding and fun to me.
>>
>>59923545
digicount :: String -> Int
digicount = digicount' 0 . read where
digicount' n x
| (x `div` 10) == 0 = n+1
| otherwise = digicount' (n+1) (x `div` 10)


And I was called "trash" last thread for some reason
>>
what am i doing wrong? i want it to print out true true true false

from LinkedList import *

x = LinkedList()
x.add(1)
x.add(2)
x.add(3)

print x.member(1)
print x.member(2)
print x.member(3)
print x.member(4)


class Node:
def __init__(self):
self.value = None
self.next = None
def member(self, v):
if self.value == v:
return True
elif self.next == None:
return False
else:
return self.next.member(v)

class LinkedList:
def __init__(self):
self.head = None
def add(self, v):
new_node = Node()
new_node.value = v
new_node.next = self.head
self.head = new_node
def member(self, v):
if self.head == None:
return False
else:
return self.head.member


:~/python-programs$ python Main.py 
<bound method Node.member of <LinkedList.Node instance at 0x7f76ba95e290>>
<bound method Node.member of <LinkedList.Node instance at 0x7f76ba95e290>>
<bound method Node.member of <LinkedList.Node instance at 0x7f76ba95e290>>
<bound method Node.member of <LinkedList.Node instance at 0x7f76ba95e290>>
<bound method Node.member of <LinkedList.Node instance at 0x7f76ba95e290>>
>>
>>59923934

Port it to .NET Core so it can be used between Windows and Linux.
>>
File: pondering-retard.jpg (16KB, 550x421px) Image search: [Google]
pondering-retard.jpg
16KB, 550x421px
>>59923545
>>59923954
Wait, if you can verify that the input string reads to an integer, then literally
digicount = length
>>
>>59924016
does python not allow recursion??? it looks like instead of evaluating the recursive call it's returning the method itself as the value of the method. there's got to be something i'm doing wrong here
>>
>>59923435
>For one, you are not respected at any normal company. You're known as 'IT' or 'tech' and everyone gossips about how disgusting everyone is in the department.
I'm in college. I'm disgusting (400lbs) but I'm going to strive to become less disgusting, while also continuing to hold a passion for programming.

>Every day, some Alpha who probably does nothing at his job except get his secretary to suck his dick in his corner office cucks you into doing random bitch work, and then yells at you when it's not done by the deadline despite it being impossible to complete the work requested.
Sounds kind of hot.

>Not only that, the code rarely works,
Speak for yourself.
>your co-workers are smelly Indians brought in by Tata Consultancy
Personally I don't think Indians smell bad.
>and connive to replace your job at all times for half the salary,
Nothing but far-right propaganda.
>and the work never, ever ends.
Doesn't matter, it's what I love.

>You pollute your body with sugar and toxins,
Been there, done that -- you can tell just from looking at me -- and I'm fucking done with it. I'll be subsisting on apples thank you very much.
>deprive it of sleep,
A little deprivation would serve me well.
>and let it rot while you sit the majority of the day, neglecting any healthy exercise,
Eh. There are ways around it. You can walk part of the way to work, exercise on your lunch break, stretch as needed, and if you prove yourself indispensable enough, you might be able to score permission for a standing desk. That's my plan, anyway. Though I'm not exactly known for my willpower.
>social interaction or life goal attainment
I despise social interaction, and as for life goal attainment, just having a job and my own place is a life goal for me in and of itself.
>It's like a Postal worker, but coupled with feelings of patheticness, lonliness, helplessness, rage and total hopelessness.
So in other words, nothing out of the ordinary for me. Small step in the right direction.
(cont)
>>
>>59924052
>What is mono
As long as it dosent use WPF or some obscure library it dosent matter if it is .NET Core or .NET Framework
>>
>>59924136
Lol? You are returning the member method and not a value?
>>
>>59923435
Yeah.

That's why I went to med school instead despite being a programmer since I was 14.
>>
>>59924195
how do i get it to evaluate it then?
>>
>>59923815
Both.
>>
File: 1490497641868.png (29KB, 209x250px) Image search: [Google]
1490497641868.png
29KB, 209x250px
>yfw python literally doesn't even allow recursion
>>
>>59924016
print("true true true false")
>>
>>59923435 (cont from >>59924162 )
>Women, when they hear you are a programmer, instantly remove you from the potential pool of mates
I'm gay.
>as they know your earning potential is maxed early and your career over at 35.
Not if you use the basic financial security you achieve by having a steady career at first to then go on and independently vend software.
>They are also instantly disgusted by you. It is far better to tell a woman you are on welfare than to out yourself as a computer programmer. It's also highly embarrassing for a woman to date or be married to a programmer, as virtually everyone knows they are the grown up version of the hopeless virgin in high school.
I'm gay
>One who never really grew up and became normal and fit into society,
It's my dad's fault, he's the one who fucked me
>but rather found an environment where he could escape the reality of his situation and be invisible,
Do you really blame me? Why shouldn't I have wanted to escape and be invisible? Wouldn't you have wanted the same if you'd been raped?
>able to hide the toxic shame and utter humiliation that is the programmer.
No. The programmer is not the toxic shame and utter humiliation. The shame and humiliation is who I am underneath the programmer. The programmer is the one disfigured arm clawing its way up from the depths. The programmer in me is what's slowly dragging me to self acceptance and self actuation.

>After Dentists, programmers have the highest rates of mental disorders, especially depression and suicide.
I have autism, depression, PTSD, and I self harm. Bu do you see me giving up?
>Programmers, why haven't you taken the cyanide pill?
I said do you fucking see me giving up? I don't OWN a cyanide pill. I don't NEED one. Every day I'm in the continuing process of rising ABOVE the need.
>>
>>59924016
ah nvm i see it, typo where i forgot to to self.head.member(v) in the linked list function
>>
>>59924202
You call self.head.member instead of returning it? Also, I don't like your naming and the fact that you use the same name in both of your data stractures. It's bad practice.
>>
>>59923435
It depends on the company.

I had a job where programmers quite literally bullied system administrators, finance and accounting gals and guys. Sarcastic remarks, witty attitude, shitty income for everyone except developers. Leaders & programmers first, everyone else - second class citizens.
>>
>>59924343
Why not? They are the ones that do the work and everyone else is really there only for support...
>>
>>59924016
You really don't need member as a method of both Node and LinkedList, or to have it be recursive.
class LinkedList:
...
def member(self, v):
if self.head == None:
return False
else:
t = self.head
while(t != None):
if t.value == v:
return True
t = t.next
return False
>>
Anyone tried to compile Qt 5.8 on windows with visual studio 2015 recently?
I don't know what they did but i can't fucking get it to work, the more i try the more errors i get and now i'm stuck with randoms U1095.
Meanwhile after a quick try qt 5.6 compile flawlessly, only problem is i forgot to build it in debug mode too so i'll have to waste another hour redo the process.
>>
why is it returning this error?
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int check_double(char *str);

int main()
{
puts(check_double("5.9e36") ? "valid" : "invalid");

return 0;
}

int check_double(char *str)
{
int errno = 0;
char *e = NULL;
char *res = str;

long double n = strtold(res, &e);

return e && *e == 0 && !errno &&
n >= 1e-324 && n <= 1e309;
}

>warning: magnitude of floating-point constant too small for type 'double'; minimum is 4.9406564584124654E-324
>warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308
>warning: implicit conversion increases floating-point precision: 'double' to 'long double'
>warning: implicit conversion increases floating-point precision: 'double' to 'long double
>>
>>59924382
don't have the time to not think recursively, sorry man. to intelligent to do something like the way you did it
>>
>>59924395
Holy fuck, like read the goddamn error messages you posted...
>>
>>59924424
i don't see where the error is.

i'm using long double not double.
>>
>>59924450
I'm making a program that manages text files with c++, do I need to worry about read/write permission for my program? It works fine on my computer but I don't want to to throw errors or just not work.
>>
>>59924396
you don't even have to not think recursively, you can literally just write one generic variadic tree type and one generic depth first search method accepting other procedures as arguments and you can use this skeleton to trivially iterativize any recursive function
>>
>>59924452
>floating point constant
So, let me ask, what is 1e309?
>>
File: sasuke_deformed.jpg (36KB, 459x488px) Image search: [Google]
sasuke_deformed.jpg
36KB, 459x488px
I'm trying to implement the Kosaraju-Sharir algorithm for detecting strongly-connected components in a digraph. Part of this algorithm involves doing a topological sort on a reversed copy of the graph. This is where my issue arises.

I've performed tests with topological sorting on a directed acyclic graph by following a video tutorial. As it's implemented with depth-first search, the order in which vertices are recursively visited is dependent on how they appear within the linked-lists that store this information. The post-reverse order array produced by the instructor's topological sort differed from my own due to this variance, but my array still was validly topologically sorted.

Unfortunately, this isn't holding true for my implementation of the Kosaraju-Sharir algorithm. My topological sort result differs from the instructor's, and this time it matters -- it causes the algorithm to incorrectly identify strongly connected components.

I'm not sure if anything can really be done about this. It all seems dependent on the somewhat arbitrary representation of adjacent vertices within the graph's array of linked-lists, and that's not really something I can directly control.

Any ideas?
>>
>>59924117
I wanted to use as little inbuilt functions as plausible
>>
>>59924494
but i'm supposed to check if the double passed as parameter is bigger than 1e-324 and less than 1e309
( n >= 1e-324 && n <= 1e309;)
>>
>>59924395
>>59924452

Hmmmm
n <= 1e309 ...
...maximum is 1.7976931348623157E+308
>>
>>59924468
Yeah it's somewhat important to know if you can save or not.
>>
>>59924497
https://pastebin.com/raw/gPpuMZDe
>>
>>59924521
Maybe you should stop using inbuilt types

data Nat = Zero | Successor Nat
data Char = A | B | C {-todo-} | N0 | N1 | N2 {-todo-} deriving (Eq, Ord, Enum)

data String = Null | Cons Char String
>>
>>59924533
Read the error messages again, what are the limits for a double? And are your values those limits? Also, don't presume EVER that long double is capable of storing a value larger than a double. So systems just don't have that, and I'm not sure if libgcc provides such emulation.
>>
File: 1481544286460.png (78KB, 1349x695px) Image search: [Google]
1481544286460.png
78KB, 1349x695px
>>59924577
I havent read lyah that far yet
But thanks for the tip
>>
>>59924533
Use DBL_MAX and DBL_MIN.
>>
>>59924612
>>59924658
>>59924536
still getting 2 errors.

according to this link http://www.cafeaulait.org/course/week2/02.html the values for double range in java are:
8 bytes IEEE 754. Covers a range from 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative).
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int check_double(char *str);

int main()
{
puts(check_double("5.9e36") ? "valid" : "invalid");

return 0;
}

int check_double(char *str)
{
int errno = 0;
char *e = NULL;
char *res = str;

long double MIN = 4.94065645841246544e-324; // min value for double in java
long double MAX = 1.79769313486231570e+308; // max value for double in java
long double n = strtold(res, &e);

return e && *e == 0 && !errno && n >= MIN && n <= MAX;
}


>warning: implicit conversion increases floating-point precision: 'double' to 'long double'
>warning: implicit conversion increases floating-point precision: 'double' to 'long double'
>>
>>59924699
>the values for double range in java are
excuse me what

... i say
you do realize this is c right
>>
>>59924716
Yes i know this is C.
i have to check if the string passed as parameter fits in a Java double.
>>
>>59916171
Quick question. I've been learning Python for about a month and a half. Is it a bad idea to switch to C++? Is it really that hard? Any other language recommendations? I just want to make my own roguelike
>>
File: 1492077641232.png (354KB, 589x442px) Image search: [Google]
1492077641232.png
354KB, 589x442px
>>59916171
Making baby steps into 8x86, using emu8086 to learn the basics atm. Learned to use the int21h=0ah interrupt to read a buffered string.
Yet I can't wrap my head around the following code [as in: why it doesnt work]:

charscan db 0h;
//skipping the stuff that's working
mov cx, bx ; BX holds the address for the buffered string
add cx, 2 ;moving it to the first char of the input
mov charscan, [cx]


By my current understanding of 8x86, the last line should copy the contents of the address stored in CX into the charscan variable.
>BUT I GET THIS ERROR:
wrong parameters: MOV charscan, [cx]
probably no zero prefix for hex; or no 'h' suffix; or wrong addressing; or undefined var: [cx]
>>
>>59924735
What on God's green earth...

Use DBL_MIN and DBL_MAX. They are in limits.h.
>>
File: .png (579KB, 781x739px) Image search: [Google]
.png
579KB, 781x739px
>>59924250
>mfw you literally don't even need it
>>
>>59924769
Hey mate.

i already told i have to check for Java doubles not C doubles.
>>
>>59924497
As long as the topological sort is valid, the algorithm should work. Do you have a simple example of a graph if fails on? Also, your C++ code is kinda brutally Cish lol.
>>
File: memeteamdreammachine.png (556KB, 781x739px) Image search: [Google]
memeteamdreammachine.png
556KB, 781x739px
>>59924791
>mfw i steal a meme
>>
>>59924808
They are the same thing dummy.
https://en.wikipedia.org/wiki/IEEE_floating_point

Please do research before starting a project from now on.
>>
>>59924744
Why does that picture exist?
Why does the fact that horses don't eat through the ass need to be explained?
>>
ML family vs Lisp family
>>
>>59924852
No
>>
>>59924840
Yes?

Proof
>>59924808
>>
Are programming bois richs?
>>
>>59924852
Lisp+ML.
>>
>>59924839
so i doesn't my program work see >>59924699

can't fit a double inside a long double?
>>
>>59924852
>Montague vs Capulet
>>
>>59924888
Yes, but your values are outside what a double can hold, hence the promotion. Which is what we've been telling you...

Also, as another anon mentioned long double and double can be the same type, not all systems have a floating point type larger than 64 bits, hence the warning.
>>
in c# does it make sense to split up methods in two if you can use input from the 1st to call the 2nd?

what I'm trying to do is

private void btn_Click(){
validate();
}

private void validate(){
for (textbox in panel)
{
validate(textbox)
}
}

private void validate(textbox)
{
blah
}


the actual code is going through a bunch of panels with different amounts of textboxes so its a bit longer. Its easier for me to read though if I split it
>>
>>59924839
>They are the same thing dummy.
They are not. IEEE is relaxed standard.
>>59924735
>fits in a Java double.
Read JVM specification to find out the limits.
>>
File: 1485162494153.gif (1MB, 320x240px) Image search: [Google]
1485162494153.gif
1MB, 320x240px
>>59916171
Is YouCompleteMe supposed to work on library functions like printf etc?
For some reason it only gives me completion for shit I've already typed in a given file.
>>
>>59924982
> MAX_VALUE = 0x1.fffffffffffffP+1023
The same as C's double, who woulda thunk it?
>>
>>59924928
>Yes, but your values are outside what a double can hold, hence the promotion. Which is what we've been telling you...
?

but i'm storing it in a long double not double.

long double MIN = 4.94065645841246544e-324;
^
>>
>>59924945
You should split functions up based on re-usability and legibility.
If you think you'll use validate(textbox) elsewhere, or it's a particularly long method, then yes.

But if they're both relatively short and one-context use, then you should combine them
>>
>>59924740
One very important thing you need to know about C++ if you plan on switching to it.

Consider the following Python:
class exampleclass:
# methods and such

def instantiate_exampleclass():
x = exampleclass()

instantiate_exampleclass()
exit()

What happens to x? It gets created, and then the function returns, and then what happens to it? You can't get to it, so it's as good as gone, right?

This is a principle called garbage collection, implemented in most modern programming languages. If data is as good as gone, an internal language procedure called the garbage collector is invoked to make sure it *actually* becomes gone.

Now here's what you need to know about C++: it doesn't do that.

Consider:
class exampleclass {
// methods and such
};

void instantiate_exampleclass() {
exampleclass* x = new exampleclass();
}

int main() {
instantiate_exampleclass();
return 0;
}

In this code, the instance of exampleclass to which x is a reference gets trapped in memory forever when that reference is lost. Nothing is running behind the scenes waiting to come along and clean it up. It's become what's called a memory leak. When memory leaks accumulate, they can clog up the RAM segment your program is using, causing your program's performance to quickly degrade.

The usual way around memory leaks is the 'delete' keyword.

'Delete' is the opposite of 'new': if you obtain a reference to a newly created class instance using 'new', you have to at some point purge that instance from your program's memory using 'delete'. But be careful: if you use 'delete' on a reference to an instance while other references to that instance still exist, accessing the instance through those references becomes undefined behavior and might crash your program -- or worse, you might successfully access the instance, but find the integrity of its data damaged, causing the code that handles that data to run off the rails.
>>
I must say
C hash is a brettty comfy programming language.
>>
>>59925051
You don't understand how literals work. Literals have a predefined type. floating-point literals have type double, you need to cast them. Try,
long double MIN = (long double)4.94065645841246544e-324;

Also, as several anons pointed out, java doubles and C doubles have the same limits, use the predefined limits. Also, what you are trying to do is fundamentally flawed. What happens if someone gives a value that is outside even a long double's? There is a second argument to strtod, look into that.
>>
>>59921765
Are minorities posting about "social justice" simply lobbying for their own interests? "My tweets are a mix of golang posts and shilling for myself."
>>
I've tracked the bug. For some reason, it'll work if the reverse post-order array returned by my topological sort is reversed. This bears a bit more investigation, but is definitely fixable.

>>59924574
Thanks for the help.

>>59924815
Ah, that's not my code. I'm implementing this shit in JS like a true scrub.
>>
>>59925159
>What happens if someone gives a value that is outside even a long double's?
I'm only checking if a number fits in a double. nothing more.

if it doesn't fit, i throw an error.

i was only getting warnings compiling with the -Weverything flag, btw.

-Wall doesn't catch it.
>>
>>59923928
Couldn't hurt, wdg is pretty desolate.
>>
>>59923435
nice pasta
>>
>>59925219
Yeah -Weverything marks implicit type promotions as warnings, -Wall doesn't because your sanity is key.

>if it doesn't fit, i throw an error.
How will you know it won't fit? If a value that exceeds the limits of a long double is put into strtold the result is HUGE_VAL and errno is set to ERANGE which is easy to check, but if there is an underflow error, the result is 0 and errno may or may not be set. If you want to be thorough, you'll have to test your implementation of strtold and if it doesn't set errno to ERANGE after a fault, do manual underflow checking...
>>
>>59925085
Thanks m8, simple explanation, now I understand what people mean when they talk about garbage collection. I see how that could get confusing with complex programs. I hope switching to c++ will instill a more in depth understanding of programming and make me stronger overall.
>>
I wasn't sure if my Haskell post should be here or in a new thread, but decided to make it a new thread. Please respond.

>>59925035
>>59925035
>>
>>59924744
Ok so I fixed it with an ugly workaround:
mov al, [bx]
mov charscan, al


Now theres another error:
char db 0h
charscan db 0h
//again skipping the working stuff
cmp char, charscan ;WHY GOD WHY :c
Last line is being an asshole
>>
>>59925017
please respond.
>>
>>59925334
>How will you know it won't fit?
?
because it fails in the condition
... n >= MIN && n <= MAX


and thus the whole return statement returns 0
puts(check_double("5.9e3600000") ? "valid" : "invalid");


returns invalid
>>
>>59925386
kek

that's what most text editors do

go for an IDE or something

or install more plugins
>>
>>59925423
Did you not read the rest? Whatever, it should work 99% of the time as it was originally. Warnings can be ignored btw.
>>
>>59925369
fucks sake apparently
cmp mem, mem  //=BAD
//while all the following are good
cmp reg, reg
cmp reg, mem
cmp mem, reg
cmp reg, immediate data
cmp mem, immediate data
cmp eax/ax/al, immediate data


Hope this helps another poor soul out.
>>
>>59925363
My biggest problem is the type system and the resulting error message when done wrong. Holy shit, even oracle bone script is more accessible.
>>
>>59925466
Yeah, imagine if Haskell had Elm-tier error messages even for the most complex types. Are OCaml, Scala or F# any better at error reporting?
>>
>>59925512
>Are OCaml, Scala or F# any better at error reporting?
I have no idea. It cannot be any worse than Haskell error messages.
>>
>>59925452
yeah i read.

but i doesn't cause me problems so fuck it
>>
>>59924250
>recursion

I hope you don't actively use it, because that's very pajeet
>>
>>59925386
It doesn't automatically complete C code. You have to press ctrl-space or ctrl-n.
>>
>>59925611
Ah, yes I just found out.
It's slow as all hell when using opengl though.
>>
>>59925660
That's the reason why it doesn't do it automatically. There's a lot of stuff in libraries and C has no namespaces, classes or anything like that to reasonably limit possible completions.
>>
File: SchoolGirl.png (37KB, 967x582px) Image search: [Google]
SchoolGirl.png
37KB, 967x582px
>current year
>he doesn't program school girls
>>
>>59916171
is it standard to always use smart pointers in c++ now?
>>
>>59923811
I'm tempted to use it but it looks incredibly messy considering these were simplified examples and probably doesn't serve me in any substantial way.

If C++ was better at allowing you to integrate new features in the language you could probably do this with no programmer overhead.
>>
File: 20170411_171110.png (145KB, 500x489px) Image search: [Google]
20170411_171110.png
145KB, 500x489px
/dpt/ why do people still learn c++ it is so slimy
>mfw you walk right by me not knowing that i'm a c++ coder
>>
>>59925017
Most of these have a setup step and a basic mode. Clang complete has you specify a list of include folders which it parses for you and then (it seems to) limit what it can suggest based on your includes. They're never just right though. And as always they don't let you autocomplete of initial types. I want something that lets me type
_(variableOfTypeInt,

and have it suggest all functions taking an int as the first argument. It's so much better than completing based on the name when you're using your own structs.
>>
>>59925798
that u baklava?
>>
is there any point learning TCL?
>>
>>59926548
Its the best language for GUI applications on Linux.
>>
With the MVVM pattern and WPF, if I have properties that are controls in the View Model or Model am I using the pattern wrong?

Say my Model has a property which is a RichTextBox. My View has its data context set to the ViewModel and binds the Model's RichTextBox to a ContentControl in the XAML.

The Model/ViewModel are still unaware of the View's existence so this should be okay, right
>>
>>59926803
>OOP
Why don't we ban this bigotry?
>>
What good alternatives are there to /dpt/? General programming chats.
>>
>>59927375
There are none.
>>
where did you guys find your current jobs?

im graduating with a CS degree in 2 weeks, from a pretty average state university. my uni has a "jobs" portal but theres like 3 CS jobs on it dating back to january. where do people find the low-key employers that are hiring that arent huge names like MS, etc?
>>
Can someone who knows how to use Python explain how I can find a pokemon from this link? It says "card" has a property called "name". Not sure how it works though.

https://github.com/PokemonTCG/pokemon-tcg-sdk-python
>>
>>59927580
what do you mean?
>>
>>59927580
Here you go:
from pokemontcgsdk import Card
from pokemontcgsdk import Set
from pokemontcgsdk import Type
from pokemontcgsdk import Supertype
from pokemontcgsdk import Subtype

card = Card.find('xy1-1')
print( card.name)

#Some notes:
"""
-Use python 3 (Make sure you install using pip3 install pokemontcgsdk)
-run as "python3 name.py"
"""
>>
is there another way of writing this?

 static List<Integer> function(int[] array) {
List<Integer> list = new ArrayList<Integer>();
for(int i : array)
list.add(i);
return list;
}
>>
>>59927818
It looks like you're returning a copy of the list.

A suggestion would be to initialize list to the size of array, so that you don't have to continuously keep expanding the array (which adds a wee bit of overhead) if you know the size.
>>
>look up how to do x^y in x87 asm
>holy shit is it really that complicated?
>wonder how gcc does it
>int main() { pow(1,2); }
>disassemble
>shit nests like 10+ function calls deep
>still haven't found the part where it does the computation
>>
>>59927721
is it possible in Card.find('xy1-1') to be replaced with the pokemon name instead? Cause I have no idea what xy1 means. :/
>>
>>59927457
You had to spend the last 3-2 years of college talking to people, networking, contributing to projects.

The networking part is disgusting and people think this is an acceptable behaviour like we were in the 60-80's and the job pool for CS jobs still consisted of working for the government or with your friends in a garage, sadly there's nothing to be done about it.

Go after teachers, colleagues, try to contribute to an open source github and start collecting acquaintances otherwise you're out of luck.
>>
>>59923435
>Women, when they hear you are a programmer, instantly remove you from the potential pool of mates as they know your earning potential is maxed early and your career over at 35.
lmao retard

if you're confident, fit, and socially adept, hearing "I'm in software engineering" makes plenty of women wet instantly because what that translates in their heads to is "I will provide financial security, and I have some level of intelligence instantly provable, which means I will likely be at least decent at managing my finances and allowing you to retire early and become a stay at home mother or housewife, as well as giving me the option to do flexible work where I have time off"
>>
>tfw desktop support drone
>tfw good at job but hate it
>tfw opportunity for well paying position but would rather go work in a warehouse or something
but i have alot of debt to pay off, which would be better sooner than later, so the dilemma of money vs happiness.
>>
>>59926567
kek no, I just made a thing that dumps some hex and coverts it do binary file, probably all anti-viruses would categorize it as a threat, even if what it dumps is harmless.
>>
>>59926581
If you are going to do a lot of work in an application that embeds it, like Vivado. Outside of that I've never seen it been used outside of that...
>>
>>59928100
Always pick happiness.
Always. I was an intern at one of the big investment banks for 6 months and despite being paid close to 5 figures for being an intern, those were the most miserable days of my life.
>>
>>59928567
>those were the most miserable days of my life.
story pls?
>>
>>59928567
>5 figures

you mean 6 figures? 5 figures is just 10,000+ ?
>>
>>59928588
What is there to explain?
I got up at 8. Reach work at 9. Knocked off at 1 am. Reached home at 2. Slept. Repeated that for 6 days in a week. By Sunday, I am too exhausted to do anything meaningful so I just slept in.
>>
>>59928614
you worked 9 am to 1 am?

the fuck
>>
>>59928599
They paid me 8000 per month. As an intern. People there earn 5 figure pay per month easily. The job is really fucking shit tho. High stress. I think 80% of the works there are on some kind of amphetamine to cope.
>>
>>59928626
9 pm to 1 am, you need to add those
>>
>>59928640
ah i see you meant month

most of the times when people say they make "X figures" they mean annual gross. like if i make 100k a year id say "i make 6 figures"
>>
meant to reply to

>>59928648
>>
>>59928640
>They paid me 8000 per month.
europe or USA?

Also, what did you as a programmer did?
>>
>>59928626
http://www.askivy.net/articles/investment-banking/investment-banking-lifestyle/working-hours-in-investment-banking

I thought this was common knowledge?
>>
>>59928661
I am a programmer by hobby. Not by trade or discipline.

>>59928657
I only said that because I was an intern and it was only 6 months. I don't think interns announce their pay annually.
>>
>>59928685
>I am a programmer by hobby. Not by trade or discipline.
so what did you do at the bank?!
>>
>>59928697
hobby
>>
>>59928614
>code
>sleep
>repeat
Damn, that sounds like a dream.
>>
>>59928713
what
>>
>>59928697
Plenty. Help build financial models. Help with junior analyst. Coffee runs. Paperwork for the deals. Benchmarking. Comps. Mostly the more menial task as I am the intern but these menial task often take the longest to accomplish.

Like
>Can you sort through 10 years worth of information to find X
>>
>>59928723
I don't code for a living. I code as a hobby. My degree is in business and finances. Although I am not working in a bank right now.
>>
>>59928758
god damn
>>
I wrote a lib that depends on literally 50 other libs to be passed on the command line when compiling a program using it, even though the program itself doesn't directly use the 50 other libs. How do I statically build my 50 other libs into my lib, so that I don't have to specify the 50 libs when compiling a program using my lib?
>>
>>59928774
linux or windows, faggot
>>
>>59928771
Well the thing is you don't have to pick all money or all happiness for a job but I can safely say that despite me doing a job which pays less in a year what it does working those 6 months as an intern, I am way way way more satisfied with my current situation
>>
>>59928789
Linux, obviously.
>>
>>59928806
>obviously
What did he mean by that, my good /dpt/ folk?
>>
>>59928799
you didn't answer if it was in Europe or USA
>>
>>59928806
A static library is just an archive of .o object files. Extract them with ar and pack them back into one big library.
>>
>>59928827
EU
>>
>>59928843
nice. for 8K a month it must be germany or Switzerland or something like that

t. living in a poor country in EU
>>
File: 289259965242408960.png (7KB, 112x112px) Image search: [Google]
289259965242408960.png
7KB, 112x112px
>>59928841
>pack the entire LLVM and Clang infrastructure into a single archive

I'm ok with this.
Any pointer on how to do this efficiently with CMake?
>>
>>59928869
google link libraries with cmake

good luck kek
>>
>>59928867
Its bongland
>>
What are some "essential" projects like writing a compiler?
>>
>wake up
>it's 201x
>people make webapps as desktop apps
>unsarcastically stuffing whole browser
I don't know how I feel about this.
>>
>>59929052
FizzBuzz
>>
>>59929066
>unsarcastically
>>
>>59929052
Some all primes over 2 million.
>>
>>59929133
Did you just use beach wreck ignition to write a fucking 4chan post?
>>
>>59929152
WHY YES
>>
MSYS2 with mingw tools vs. Cygwin?
>>
>>59917514
no CD image
>>
>>59929220
Do you just want to program? MSYS2
>>
>>59929220
Cygwin
>>
File: 1487132388736.jpg (23KB, 299x299px) Image search: [Google]
1487132388736.jpg
23KB, 299x299px
>practicing for interview
>>
>>59925017
Is she autistic?
>>
File: fucking_kinshi.jpg (80KB, 441x343px) Image search: [Google]
fucking_kinshi.jpg
80KB, 441x343px
>>59916171
>have two pieces of code that work fine individually by themselves
>stop working when I combine them
YOU CAN'T MAKE THIS SHIT UP SENPAITACHI
>>
>>59925017
Just copy paste all the builtins at top of file in a comment.
>>
File: just end me.jpg (42KB, 439x702px) Image search: [Google]
just end me.jpg
42KB, 439x702px
>ld -r a.o b.o -o c.o


Works fine.

>ld main.o -lalib -o executable


Works fine

>ld -r a.o -lalib -o c.o
ld: cannot find -lalib


What the fuck, why?
>>
what's faster, modulo or bit masking? asking for hash table implementation. also, what hashing function's generally the best for hash tables?
>>
>>59929622
>it's not worse than newfags talking normally in greentext
>>
>>59929652
>did you even read
>do you understand irony
>>
wish shitposters would get banned already
>>
>>59916171
>What are you working on /g/?

The next big thing! We're disrupting markets, and we only need to capture 1% to make it big. We don't make any money yet, but we'll pay you in references and experience.
>>
>>59929622
>Implying implications that greentext is actually used for quoting
>>
going through cracking the coding interview in python. p comf
>>
>>59930042
Want a partner?
>>
>>59930171
>Implying I am quoting anyone
>>
>>59930118
already got a large lass i lay with every now and i'm waiting until i got a career and all that to get serious about looking for someone so i'm alright
>>
>>59930231
I meant for doing problems from that book in python, I'm doing same thing.
>>
>>59930249
oh, well i'm not encountering any trouble now if i do i'd probably just post about them. python seems like a really good language for this type of thing (coming up with really quick solutions). what part are you on? i just started chapter 1 problems a few minutes ago, just finished check Permutation a microsecond ago
>>
Seems like a pain in the ass setting up an environment for C development on Windows. Should I just dev on Linux and crosscompile?
>>
>>59930320
>Implying greentext isn't use as the implication functions
>Implying you can stop me
>>
>>59930309
I would encourage working in Linux if you're a C programmer. With that said, it's really easy to set up the proper environment for C programming on Windows; just install MSYS2.
>>
File: 1438825787728.jpg (122KB, 1114x1043px) Image search: [Google]
1438825787728.jpg
122KB, 1114x1043px
>>59930330
Really though, who are you quoting?
>>
>>59930284
I've been skipping around mostly.
>>
>>59930357
>Implying I am quoting
>>
>>59930309
cygwin works 4me
>>
File: 1456319096539.jpg (341KB, 634x707px) Image search: [Google]
1456319096539.jpg
341KB, 634x707px
>>59930365
The use of ">" as a way to denote a quote has existed long before 4chan even existed; as such its meaning and intended use are implicit.
>>
>>59930401
>Implying
>>
>>59917810
no (unironically)
>>
>>59930401
>tfw you've officially baked some pasta
It's not a good feel.
>>
>>59918179
GO -- away
>>
File: 1457485501435.jpg (83KB, 551x511px) Image search: [Google]
1457485501435.jpg
83KB, 551x511px
>>59930414
Are you just quoting yourself now? I'm confused!

>>59930431
Who said this and why are you quoting it?
>>
>>59930455
>Implying implication of quotations
>>
File: 1458856826359.png (435KB, 750x564px) Image search: [Google]
1458856826359.png
435KB, 750x564px
>>59930474
Quote properly next time, please.
>>
>>59930401
">" can also mean "is greater than", "becomes/goes to", "terminate [HT|X]ML tag", or "shift right one half-bit".
>>
can people start reporting "who are you quoting" posters, thanks
>>
>>59930501
Indeed, but all of those are binary functions, so it wouldn't type check. And HTML stuff doesn't belong in this thread.
>>
how do linux programs pass parameters? eg ls -l, how does it take the l and make it list as a list?
>>
>only Wordpress theme I can find that isn't garbage is retired
>can't do basic things like change the header image
How do I make it usable again?
Like, the biggest concern I have so far is being able to change the header image, there isn't a menu for it but I'd like to make one.
>>
>>59930640
WordPress is honestly the shitest website builder
>>
>>59930640
Whom quotest thou?
>>
>>59930640
Who are you quoting?
>>
>>59930631
i think they're all written in C, so the same way a C program takes arguments
>>
I can't give up yet
>>
>>59930716
What are u doing
>>
>>59930736
i need to figure out the architecture of this god damned CPU so i can rip it apart and utilize it for my needs
>>
>>59930749
Why not just rip it apart and check the marking yourself
>>
>>59930749
i bought a smartphone from tracfone for $100, spent a week with their indian customer support trying to get it to registered but i'm just going to have to go to AT&T and get a normal phone. might try to make this thing a mobile shell so i can RP as a cyberpunk, don't know anything about jail breaking tho. no other use for the thing, not worth reselling
>>
>>59930774
I ripped the phone apart
I got to the CPU. That's the only way I actually managed to FIND the CPU's name, nothing was found on the internet. It only had "Qualcomm qsc6270" written on it, iirc

>>59930780
Aha! That's the exact reason I want to toy with this phone. Cyberpunk aesthetic. I actually have experience in cracking firmware too-- but really, there's shit-all I can do if I haven't got the slightest clue of the instruction set for the CPU I'm working with.
Eventually, this thing will receive busybox implanted directly to it.
>>
>>59930838
No data sheet on that model?
You are better off calling Qualcomm or their reseller than bugging a service rep of Samsung who is most likely offshored and has no idea what you want.
>>
File: snek.jpg (137KB, 873x1170px) Image search: [Google]
snek.jpg
137KB, 873x1170px
love her so much, she's so easy
>>
File: file.png (5KB, 138x169px) Image search: [Google]
file.png
5KB, 138x169px
>>59930862
I have the datasheet. Also, emailed qualcomm. ALSO, ended the discussion with the rep politely, and closed it.
Blech
>>
>>59930919
Wait so if you have the datasheet what was the problem all along?
>>
File: 1444975704671.jpg (1MB, 813x1185px) Image search: [Google]
1444975704671.jpg
1MB, 813x1185px
I'm building a flight controller for a drone for a project in my Micro-controllers class. We're using the TM4C123GH6PM and pretty much buying all of the other components for the drone. I've been messing around with getting RTC values to calculate the time between loop iterations for a PID algorithm and I'm curious; is there a better way than using the hibernate modules? I'm not sure if there are any repercussions to using that or if it's the right thing to use for a drone project. I guess I'm just not sure whether or not you can use the hibernate module in RTC mode without actually puting the Tiva in hibernate mode.
>>
File: file.png (156KB, 1264x605px) Image search: [Google]
file.png
156KB, 1264x605px
>>59930934
Apologies. That thing I showed wasn't actually the datasheet, THIS was (at least the circuitry page?)

Can I find out anything from this? It didn't say anything of instructionset / arch. What should I be looking for?
>>
>>59930957
Wow. It says ARM9 right there.
Fuck me
>>
>>59930968
glad to be of help lad
>>
File: 1362960884712.png (102KB, 241x228px) Image search: [Google]
1362960884712.png
102KB, 241x228px
>show up for a job interview
>they bring out a laptop and a projector
>ask you to write a program to sum all prime numbers under 2 million
>using vim
>>
>>59930972
Thanks - for getting me to look at that again. God, I would have been so stuck if it weren't for you getting me to re check my data I already had
>>
>>59930968
>>59930957
Lmao. Happens to the best of us.
>>
File: 1477009662111.jpg (62KB, 840x544px) Image search: [Google]
1477009662111.jpg
62KB, 840x544px
>>59930980
>tfw would pass this interview b/c i take /g/ memes to heart irl
>>
>>59930993
Then you should know that the sum of all prime numbers under 2 million is undefined ;^)
>>
>>59931017
not sure what you're getting at
>>
>>59931025
It's impossible to sum all prime numbers under 2 million. It'll just crash with an error saying undefined.
>>
>>59931062
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
if(argc != 2){
printf("Argument required\n");
return 1;
}

int bound;
int* primes;

if ((bound = atoi(argv[1])) <= 0) return 1;
if ((primes = calloc(bound, sizeof(int))) == NULL) return 1;
primes[0] = 1;
primes[1] = 1;
int count = 2;
while(count < bound)
{
for(int multiples = count*count; multiples < bound; multiples += count)
{
primes[multiples] = 1;
}
for(int newCount = (count+1); newCount <= bound; newCount++) // set the new count to the next unmarked number
{
if(newCount == bound) count = bound; // there were no unmarked numbers remaining
if(primes[newCount] == 0) // an unmarked number was found
{
count = newCount;
newCount = bound;
}
}
}
unsigned long long sum = 0;
for(int sumCount = 0; sumCount < bound; sumCount++)
{
if(primes[sumCount] == 0)
{
sum += sumCount;
}
}
printf("%llu\n", sum);
return 0;
}
>>
>>59931076
>atoi
Step it up senpai
>>
File: 1491951981595.jpg (150KB, 672x1000px) Image search: [Google]
1491951981595.jpg
150KB, 672x1000px
>>59931062
>i couldn't do something after thinking about it for a few hours, so it's impossible
>>
>>59931076
There are 39 errors in that program. See if you can find them.
>>
>>59931130
autism
>>
>>59931130
if you're the guy who thinks it's not possible, then you're probably compiling it wrong. use gcc -std=c11. sum of all primes is definitely computable, it's a stupid thing to say otherwise. if you're just some nerd talking about imperfections you see i don't really care
>>
>>59931130
retard
>>
>>59930980
>>59930993
>>59931110
Who said this though?
>>
Getters and setters are for faggots right?
>>
>>59931300
Strictly adhering to standards are for large team projects where you can't trust Pajeet over in India to not fuck up everything he touches.

If you're writing a tiny program, by yourself, then do whatever you want.
>>
File: 1483520391703.jpg (95KB, 676x676px) Image search: [Google]
1483520391703.jpg
95KB, 676x676px
Writing a Rust compiler in Scratch.
>>
>>59931130
I found 5
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
if(argc != 2){
printf("Argument required\n");
return 1;
}

int bound;
int* primes;

//>atoi
if ((bound = atoi(argv[1])) <= 0) return 1;
//>bound=zero is acceptable?
if ((primes = calloc(bound, sizeof(int))) == NULL) return 1;

//>didn't check if bound was even > 1
primes[0] = 1;
primes[1] = 1;
int count = 2;
while(count < bound)
{
//count can = INT_MAX. count*count will overflow
for(int multiples = count*count; multiples < bound; multiples += count)
{
primes[multiples] = 1;
}
for(int newCount = (count+1); newCount <= bound; newCount++)
{
if(newCount == bound) count = bound;
//newCount can = bound
if(primes[newCount] == 0)
{
count = newCount;
newCount = bound;
}
}
}
unsigned long long sum = 0;
for(int sumCount = 0; sumCount < bound; sumCount++)
{
if(primes[sumCount] == 0)
{
sum += sumCount;
}
}
printf("%llu\n", sum);
return 0;
}
>>
>>59931422
what books should i read to learn how to make a compiler FOR Rust
>>
>>59931461
Practical Common Lisp
>>
>>59931461
Homotopy Type Theory: Univalent Foundations of Mathematics
>>
>>59931461
the same as for every other compiler: the dragon book
>>
>>59931515
This post couldn't be more retarded.
>>
>error compiling program
>would you like to run last successful build

Why is that even such an important option that VS would ask you every time there's an error compiling? I mean, if my program isn't even compiling I'd think I'd want to take care of that first in virtually every situation...
>>
>>59930640
plz
>>
>>59931517
what ? the dragon book is basically the intro to compilers book
>>
>>59931551
Not only is it garbage, but it's not "for every other compiler".
I can see why someone from your """country""" would think otherwise.
>>
>>59931565
and which country would that be ?
>>
>>59931597
I said """country""", not 'country'.
>>
>>59925041
There is no C's double fuckwit unless you can find it in the standard.
>>
>>59931612
Are you drunk?
>>
>>59931457
Not errors
>>
Are blank lines in code considered bad? I tend to use them a lot for readability.
>>
>>59931824
two of them cause out of bounds errors and the others make the program undefined
>>
>>59931814
You annoy me.
>>
http://www.erlang-factory.com/upload/presentations/395/ErlangandFirst-PersonShooters.pdf
>>
>>59931858
Theres unintelligent inputs the program doesnt work on yes. No errors in compilation tho and it works for. My uses. Shit on the guy who said its an impossible problem not me
>>
>>59931938
Anything Erlang can handle you can do in C or any other native language with a little effort put into developing the right framework.

There's nothing wrong with Erlang, and the fact that the VM is already there and well tested obviously saves you development time, but the retards who think that it's doing something magical that can't be achieved in other languages are annoying.
>>
>>59931961
>It works some of the time ;)
>>
>>59932156
Who said that?
>>
>>59932224
He did
>>
>>59932235
You can't quote something which hasn't been said before.
>>
>>59932245
>Telling people what they can't do
>>
>>59932262
Quoting something which hasn't been said yet is impossible by definition.
>>
>>59932283
Might as well be using the term "thought crimes". You're disgusting.
>>
>>59916171
Bootcamp teach u how to code they are awesome, i went to 1 n can code bettee thn most g in less thn a year, coding is so fukin izi for me but u have to put the time n get ur degree first n go to a good bootcamp n ur gurantee n 100k a year job


Also i have a lenovo y50 can i install sierraOS in it?
>>
What is the most autism friendly language?
I mean the high functioning kind, so no Java and other crap.
>>
>>59932533
>Autism
>Friendly
What is the driest liquid?
>>
>>59932533
machine language
>>
>>59932533
pure mathematics
>>
>>59932533
Idris, or Haskell if you're a pussy.
>>
>>59932634
>using a language with barely any libraries, no package manager, awful in-built packages, slow programs, ...
>>
>>59932688
So, autism?
>>
>wasting time learning or even using anything besides C++

lol
>>
>>59932714
>not using your own language with literally no libraries, no package manager or even packages, no IO
>>
>>59932634
>Idris
I definitely like the syntax more.
>Haskell if you're a pussy
Explain?

>>59932731
This is what I'm currently doing, but I want to use something else on the side.
>>
>>59932752
> Explain?
Haskell lacks dependent types and the entire proofing thing, it's easier to comprehend.
>>
>>59932777
Also has amazing type inference.

One thing dependent types are really good for though is type checkers
>>
File: 1458857490601.png (315KB, 530x580px) Image search: [Google]
1458857490601.png
315KB, 530x580px
>>59932777
Basically it's for retards then?
>>
>>59932796
It's for practical use
>>
>>59932795
>type inference
You should be writing plebeian dynamic garbage if you don't even know what types you want to work with.
>>59932804
How can a language be for "practical use"?
>>
>>59932796
No, it's for normal people.
>>
File: 1456148873144.png (743KB, 1384x1496px) Image search: [Google]
1456148873144.png
743KB, 1384x1496px
>>59932814
So in other words for retards?
>>
>>59932795
>One thing dependent types are really good for though is type checkers
Can I somehow write my type checker in Idris and everything else in Haskell? I would like to write everything in Idris if possible, but I don't think it has REPL and parsing libraries.
>>
>>59932853
You'd have to FFI through C
>>
>>59932853
It has both tho.
>>
>>59932863
Links? What about LLVM?
>>
Have you ever done this with a boy?
>>
>>59932873
Don't you know how to goolge?
http://docs.idris-lang.org/en/latest/reference/repl.html
https://github.com/ziman/lightyear
>>
File: Screenshot_2016-10-19-03-22-07.png (2MB, 1357x1972px) Image search: [Google]
Screenshot_2016-10-19-03-22-07.png
2MB, 1357x1972px
>>59932882
>>
File: portfolio.jpg (15KB, 477x139px) Image search: [Google]
portfolio.jpg
15KB, 477x139px
Need some help. I have a portfolio, which is a list of dictionaries, such that

portfolio = ({'stock':'PG', 'shares':'10, ...), ...}

(see pic related) and I want a function that merges all stocks of the same name together. On my site, people may buy the same stock multiple times in different quantities, but I want them to be displayed all together, aggregated. Doing this in python, btw.
>>
>>59932894
>Don't you know how to goolge?
I don't (I had an injury of sorts), but you apparently don't know how to read. That REPL is written in Haskell, and I heavily implied "Idris REPL library" in my post.
>>
File: thanksintellisense.png (46KB, 2016x150px) Image search: [Google]
thanksintellisense.png
46KB, 2016x150px
>>
>>59932931
Use pandas
Or if you are feeling fanciful you can use OOP
>>
>>59924271
haha fag
>>
>>59932963
isn't there a simple way to do it, without installing libraries and stuff? I'm looking for some nested for-loops, but I can't seem to find the right way...
>>
>>59933029
You are using python. The simple way to to use python is

>Run into problem
>Import solution

Why are you fucking around with nested for loops when panda is meant for databases exactly like the situation you have stated.
>>
I'm making my first program I'm gonna make public through my repository. Up until now I've never thought about licensing. I mean I know of the GPL, the MIT, apache and so on, but I don't know which one to choose.
Should I just stick to GPL? How different are the other non copyright licenses from it?
>>
>>59932954
>blaming intellisense for C++ problems
>>
New thread:
>>59933073
>>59933073
>>59933073
>>
>>59925186
Yes.
Thread posts: 328
Thread images: 42


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