[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: 321
Thread images: 43

File: anime.png (786KB, 1000x1300px) Image search: [Google]
anime.png
786KB, 1000x1300px
What are you working on, /g/?


Previous Thread: >>58913043
>>
>>58918216
Learn Go
https://tour.golang.org
>>
>>58918238
>Go
No
>>
>>58918258
>No
Oh
>>
>>58918238
Should have been named Stop tbqh
>>
File: carlos.png (272KB, 560x560px) Image search: [Google]
carlos.png
272KB, 560x560px
>>58918282
kek
>>
>>58918216
Making my very first web project with Django.
>>
>>58918307
>>>/wdg/
not programming.
>>
>When it comes to code reuse, projects that used an object-oriented approach were able to take more than 70% of their code from previous projects. Subsequently, the projects that used functional design were able to take about 35 percent of their code from previous projects (McGarry, Waligora, and McDermott 1989).

OMG HOW ARE FUNCTIONALTARDS EVER GONNA RECOVER FROM THIS #REKKING?
>>
>>58918345
>1989
>>
>>58918345
I bet they think Lisp is FP
>>
>>58918345
>1989
>Implying that pure functions aren't the only truly reusable bit of code
>Implying that OOP and all of its statefulness is easily reusable
>>
>>58918345
Because when doing OOP you have to write so much boilerplate code.
Then when you make new project you can just reuse the boilerplate code.

Functional doesn't have this problem.
>>
>>58918345
10k line OOP project, 30% new = 3000 new lines to be written and tested

1k line FP project, 65% new = 650 new lines to be written and tested
>>
>>58918322
Oh, right, right, sorry.

I'm writing FizzBuzz in Brainfuck. There you go, now it's programming.
>>
I want to become a god at programming like you guys please teach me how!

It took me forever to understand and implement my own algorithms how did you guys get so good at it?
>>
>>58918429
Get a CS degree.
Learn C.
>>
>>58918429
learn Haskell
>>
>>58918429
>>58918238
>>
>>58918478
Don't do this.
>>
Is there good alternative to C? Something that has same kind of "stable" ABI as C which is easy to call from other languages?
>inb4 sepples
looking for good alternative.
>>
>>58918522
Java
>>
>>58918478
what are you talking about? why is there nothing on the left hand side?
>>
File: a-fs8.png (9KB, 350x252px) Image search: [Google]
a-fs8.png
9KB, 350x252px
Just tried this in the python console, and it works:

what's the purpose of this -> sign?

def test(str) -> None:
return str
>>
>>58918345
Why do you even care? There's a bunch of retards who are trying to use a non mainstream language as their social identity. No one will use Haskell in production for large scale frameworks except of some specific cases.
>>
>>58918522
>Something that has same kind of "stable" ABI as C which is easy to call from other languages?
No, not really.
>>
OOP isn't even that bad desu
>>
File: python.png (4KB, 230x50px) Image search: [Google]
python.png
4KB, 230x50px
>>58918542
It's a way to show what the return type of a function will be, as far as I can tell.
It doesn't seem to care if the actual return type is different as well.
>>
>>58918615
Neither is leukaemia, apparently.
>>
>>58918615
if "isn't even that bad" is defined as "it's straight up trash" then sure.
>>
>>58918619
>It doesn't seem to care if the actual return type is different as well
Python is such a lauching stock of programming languages.
>>
>>58918619
>Shows what the return type will be
>Doesn't actually care what the return type is
Weak typing is cancer
>>
>>58918652
>Python is such a lauching stock of programming languages.
not an argument.
>>
>>58918657
We were not arguing...
>>
File: 1453134663404.png (1MB, 1240x1080px) Image search: [Google]
1453134663404.png
1MB, 1240x1080px
>>58918619
>It doesn't seem to care if the actual return type is different as well.
>>
>>58918649
if it's straight up trash then how come most software companies all use OOP in medium to large scale producation checkmate all of /dpt/
>>
>>58918655
In Python you could say it's snake oil
>>
>>58918542
they're called type hints
you can also for example do
def f(a: str) -> int:
return len(a)
>>
>>58918542
>>58918681
I think they missed the point of why type annotations are better than comments.
>>
>>58918681
interesting.

bu this only works on python 3.x, right?
>>
>>58918686
Typechecking is oppressive
>>
>>58918652
>>58918655
>>58918665
>>> def a() -> list:
return "not a list"

>>> a()
"not a list"

Why is this allowed anywhere?
Why even bother if you're not gonna enforce your own rules?
>>
>>58918669
if the earth goes around the sun then why does everybody in the vatican believe the opposite checkmate galileo
>>
programming challenge

write Fizzbuzz in a purely object oriented way of programming
>>
Daily reminder that anime people are just bronies without the ponies
>>
Newb programmer here
In C++ I used have my setters return a bool, so I could do this
Person obj;

int age;

do {
std::cout << "Age: ";
std::cin >> age;
} while (obj.setAge(age));


But I'm currently learning C#, is there a way to do this?
>>
>>58918745
it should be while (!obj.setAge(age)), but wtv
>>
>>58918739
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>
@58918741
Daily reminder that plebbitors (you) aren't (a person) people and should fuck off back to their (your) subreddit.
>>
>>58918768
lmao why tho
>>
>>58918787
To illustrate the absurdity of "enterprise" coding practices.
>>
>>58918745
Should be the same way
public bool setAge(int age);
>>
Anyone has some intermediate projects or exercices to do for Java ?
I have nothing to do these times and I want to get better at it.

Or any small website ideas to do with Java EE ?
>>
>>58918741
So, nothing out of the ordinary?
>>
>>58918777
lol first anime degenerate spotted

>@
go back to twitter
>>
>>58918724
That's why type() exists you moron. Jesus you lazy compiler babbies need to get over yourselves.
>>
>>58918802
Is it okay to do that? Since C# has it's own ways of having setters and getters?
>>
File: 1468899863437.jpg (95KB, 394x404px) Image search: [Google]
1468899863437.jpg
95KB, 394x404px
>>58918724
Type hints are entirely meant to be ignored by the Python runtime, and are checked only by 3rd party tools like mypy and Pycharm's integrated checker.
>>
File: 1453458347_1442827910422.png (106KB, 683x470px) Image search: [Google]
1453458347_1442827910422.png
106KB, 683x470px
>>58918852
Oh right, it does
I have no idea then, try googling around for it
>>
File: 1402143399019.png (302KB, 1920x1080px) Image search: [Google]
1402143399019.png
302KB, 1920x1080px
>>58918827
>>
I think I have finish my twisty game. I don't see what to change.
>>
>>58918852
Who is going to stop you? C# method of getters and setters are just syntactic sugar you know.
>>
>>58918850
>write a function that says it returns x type
>it doesn't
>"hurr you're meant to check it yourself you idiot"
>>
File: 1480227650761.png (216KB, 400x470px) Image search: [Google]
1480227650761.png
216KB, 400x470px
>>58918872
Nice m8
>>
>>58918850
>type()
>not isinstance()
>>
>>58918871
>>58918886
Ok, thanks
>>
File: o(.png (98KB, 400x470px) Image search: [Google]
o(.png
98KB, 400x470px
>>58918896
your png is now optimized.
>>
File: 1480825427081.jpg (83KB, 788x685px) Image search: [Google]
1480825427081.jpg
83KB, 788x685px
>>58918827
>>58918872
>>58918896
https://better-dpt-roll.github.io/
>>
>>58918892
I fail to see how that shows anything except that the programmer needs to add type checking into the program.

>>58918905
The point being that there are ways to see what the type is so that you can adjust accordingly.
>>
>>58918872
rate my word counter
#include <stdio.h>

int main (int argc, char *argv[]) {
char *s = argv[1];
int spf = 0;
while(s && *s) if (*(s++) == ' ') spf++;
printf("words: %i\n", spf + 1);
return 0;
}
>>
>>58919061
try with
nigger               you         failed
>>
>>58919061
Might be able to shorten it with strtok()
>>
>>58919061
>"Hello World " is 3 words
>>
>>58919101
>>58919111
s/\s+/ /g stop being niggers
>>58919106
probs
>>
>>58919126
you're code is shit, you're the nigger
>>
>>58919134
do it better then
no haskell or lisp allowed
>>
rate my string reverser too niggers
#include <stdio.h>
#include <string.h>

int main (int argc, char *argv[]) {
int i = strlen(argv[1]);
char *c = (argv[1] + i) -1;
while(c && *c && c >= argv[1]) putchar(*(c--));
putchar('\n');
return 0;
}
>>
>>58919146
printf("words: %d\n", argc-1);
if the user grouped words with "", they obviously wanted it to count as one
>>
>>58919061
>>58919111
(define (word-count str)
(length (string-split str " ")))

(word-count "hello world! ") ;=> 2
>>
>>58919061
>>58919101
>>58919106
>>58919111
>>58919126
>>58919134
>>58919146
>>58919184
#include <stdio.h>
int a,b,c,d,e,f,g;
int main()
{
for (;f=getchar()+1;++a)
d-=(f==11?(f++,(d>e?e=d:d)):-1),
g=(f>33?b+=!g:0);
printf("%d\n", b);
return 0;
}
>>
public class ConsoleMain
{
public static void Main()
{
int line = 7;
int[] numbers = { 12, 21, 4, 9, 7, 8, 4, 13 };
PrintOver(numbers, line);
int sum = SumOver(numbers, line);
Console.WriteLine("The sum of numbers over " + line + " is: " + sum);
Console.ReadKey();
}
public static void PrintOver(int[] numbers, int line)
{

}
public static int SumOver(int[] numbers, int line)
{

}
}


I need to print all the numbers that are higher than 7 and then sum them together (C#). Please write it for me.

Thank you.
>>
File: 1474221441087.png (91KB, 620x600px) Image search: [Google]
1474221441087.png
91KB, 620x600px
superior C++ solution
#include <iostream>
#include <sstream>

int main(int argc, char **argv) {
if (argc < 1)
return 1;
std::stringstream ss(argv[1]);
std::string temp;
int i = -1;
do {
temp.clear();
i++;
ss >> temp;
} while (!temp.empty());
std::cout << "Word count: " << i << std::endl;
}
>>
File: 1479506268079.jpg (89KB, 1140x852px) Image search: [Google]
1479506268079.jpg
89KB, 1140x852px
Are pointers a meme? If so how would you rewrite this without a pointer?
func main() {
goku := &Saiyan{"Goku", 9000}
Super(goku)
fmt.Println(goku.Power)
}
func Super(s *Saiyan) {
s.Power += 10000
}

I want it to print 19000
>>
File: 1441684460338.jpg (92KB, 1280x720px) Image search: [Google]
1441684460338.jpg
92KB, 1280x720px
>>58919231
>>
Is there a hidden non-reddit version of this thread?
>>58919241
>Are x a meme?
Fuck off, stupid redditor.
>>
>>58919174
>>58919061
what's
c && *c
for? are you expecting it to become a null pointer?
>>
>>58919248
might be
>>
File: 1456616931245.jpg (26KB, 300x419px) Image search: [Google]
1456616931245.jpg
26KB, 300x419px
>>58919247
reddit reddit reddit reddit reddit reddit reddit reddit redditreddit reddit reddit reddit reddit
>>
>>58919212
>uninitialized global variables
>>
>>58919005
bookmarked
>>
I need help with c++ templates, it's driving me mad.
http://pastebin.com/vSW3BGyp
I wanted to pass the argument to print by reference rather than by value, but if I make the specialization use A& it calls the generic one instead.
Can anyone tell me if it's possible and if so how?
>>
>>58919273
>uninitialized global variables
No such thing, idiot.
All static and global variables are initialised to zero.
>>
>>58919263
>that reddit image coupled with a new file name
yup, that's a redditor. Back to your subreddit.
>>
>>58919273
it just works bro

you had to say something, didn't you?
>>
File: 1456740776958.png (812KB, 600x600px) Image search: [Google]
1456740776958.png
812KB, 600x600px
>>58919284
reddit reddit reddit reddit reddit reddit reddit reddit redditreddit reddit reddit reddit reddit reddit reddit reddit reddit reddit reddit reddit reddit redditreddit reddit reddit reddit reddit reddit reddit reddit reddit reddit reddit reddit reddit redditreddit reddit reddit reddit reddit
>>
>>58919061
You are like a babby. Watch this.
#word counter
def counter(string):
assert string != str, "This is not a string you faggot."
words = string.split(" ")
count = 0
for i in words:
if i != '':
count += 1
return count
>>
>>58919289
>that reddit image coupled with a new file name
yup, that's a redditor. Back to your subreddit.
>>
>>58919307
see >>58919299
>>
>>58919313
see>>58919307
>>
File: InDThisIsJust.png (6KB, 1024x768px) Image search: [Google]
InDThisIsJust.png
6KB, 1024x768px
git gud
>>
>>58919284
>>58919299
>>58919313
Stop feeding the troll, for fuck sake.

>>58919263
>>58919289
>>58919307
Kill yourself.
>>
File: 1455950055870.jpg (32KB, 300x470px) Image search: [Google]
1455950055870.jpg
32KB, 300x470px
>>58919345
kys back 2 reddit XD
>>
>>58919344
That's cheating. You are supposed to reinvent the wheel.
>>
>>58919216

Please help. ;_;
>>
@58919395
>>>/r/eddit
>>
>>58919358
I could, or I could show off the wonders of UFCS
>>
>>058919405
Does it hurt your safe place?
>>
>>58919344
>>58919295
>>58919061
This is clearly the most elegant, and correct solution:
#include <stdio.h>
#include <ctype.h>

int main(void)
{
int c;
int count = 0;
enum { IN, OUT } state = OUT;

while ((c = getchar()) != EOF) {
if (!isalnum(c)) {
state = OUT;
} else {
if (state == OUT)
++count;

state = IN;
}
}

printf("%d\n", count);
}
>>
>>58919396
well first of all your approach is wrong since you'll be doing the same work twice (selecting numbers over a line and doing something with them)
for maximum reuse, you'll want to write one function that takes the following arguments: a list, a function that decides whether an element of the list should be considered for the operation, and a function that performs some operation with the chosen numbers
>>
>>58919396
something like
see if it works
public class ConsoleMain
{
public static void Main()
{
int line = 7;
int[] numbers = { 12, 21, 4, 9, 7, 8, 4, 13 };
PrintOver(numbers, line);
int sum = SumOver(numbers, line);
Console.WriteLine("The sum of numbers over " + line + " is: " + sum);
Console.ReadKey();
}
public static void PrintOver(int[] numbers, int line)
{
for (int i = 0; i < numbers.length; i++) {
if (numbers[i] > line) {
Console.WriteLine(numbers[i]);
}
Console.WriteLine("\n")
}
}
public static int SumOver(int[] numbers, int line)
{
int count = 0
for (int i = 0; i < numbers.length; i++) {
if (numbers[i] > line) {
count+= numbers[i];
}
}
return count;
}
}


>>
rate my first c program
#include <stdio.h>
#define yes 1
#define no 0
pls_respond () {
char x;
scanf(" %c", &x);
switch(x){
case 'y':
case 'Y':
return yes;
case 'n':
case 'N':
return no;
default:
puts ("baka");
return pls_respond ();
}
}

main (){
int ok;
puts ("are u redditor? yn");
ok = pls_respond ();
if (ok == yes) goto ura_Fagget;
puts ("good");
puts ("do u like anime?");
ok = pls_respond ();
if (ok == no) goto ura_Fagget;
puts ("good!!!!!!!!!");
return 0;

ura_Fagget:
puts ("ur a fagg");
return 1;
}
>>
>>58918872
might as well roll.

>>58918852
You could use setters/getters but I think a method would be more appropriate here since you're doing some actual logic instead of just setting/getting.

properties are only really used as syntatic sugar to replace stuff like this:


//java style

private int _age = 0;

public int getAge() { return _age; };
public void setAge(int age) { _age = age; };

//with set/get property

public int Age { get; set; } = 0;



Or to create simple read-only calculated properties:

public bool IsOld
{
get
{
return (Age > 40);
}
}
>>
>>58919432
lol no
see >>58919212
>>
Haskell has a 400mb install, bloated af
>>
File: 1376908007763.png (133KB, 318x318px) Image search: [Google]
1376908007763.png
133KB, 318x318px
>>58919485
>lol
>>
File: tty.gif (23KB, 690x480px) Image search: [Google]
tty.gif
23KB, 690x480px
rate flag
>>
>>58919520
you forgot the open rectum and the dick on the flag m8
>>
File: 1271037108.png (137KB, 287x391px) Image search: [Google]
1271037108.png
137KB, 287x391px
yearly reminder that
int * ptr

>
int *ptr

>
int* ptr
>>
>>58919469

t4t
>>
>>58919565
#define int_ptr int*
int_ptr a, int_ptr b
>>
>>58919061
> ""
> words: 1

procedure Untitled is
subtype Letter is Character
with Static_Predicate => Letter in 'A'..'Z' | 'a'..'z';
S : String := "wew lad, why r you so stupid";
Count : Natural := 0;
Start : Natural;
begin
for I in S'Range loop
if S(I) in Letter then
Start := I;
Count := 1;
exit;
end if;
end loop;

for I in Start .. S'Last-1 loop
if S(I) not in Letter and then S(I+1) in Letter then
Count := Count + 1;
end if;
end loop;

Put_Line(Integer'Image(Count));
end Untitled;
>>
Are we being invaded?
>>
>>58919565
dumb animu poster
>>
>>58919621
>MOM
what
>REDDIT IS INVADING MUH 4 CHANS
>>
>>58919621
Nope. Usual posters are just autistic enough to reply to shitposts.
>>
What's the best way to learn modern C++, in /g/'s opinion?
I've only been learning basic stuff until now but I'm not sure where to look without ending up in deprecated crap.
>>
File: pQo7e8E.jpg (43KB, 514x536px) Image search: [Google]
pQo7e8E.jpg
43KB, 514x536px
Great thread lads
>>
>>58919681
Fuck you
>>
>>58918872
rollaroo
>>
>>58918441
>Get a CS degree.
Does it matter what school I go to or if I have prior programming experience?
>>
>>58919778
fuck, i can barely program, i dont even know where to start with this
>>
>>58919800
Literally babbys first emulator, it's fun though.
>>
ITT: Autistic weab against mildly autistics
>>
Look at this fucking thread. What room for intelligent discussion is there? Fucking none, just pseudo-intelligent quotes and "epic memes xD". It's sad to see MY imageboard - the one I BELONG TO - being overrun by such malignant SHITPOSTERS.
>>
>>58920126
>MY
You are not hiro
>>
Mind as well just delete the whole thread mods, there's no saving it
>>
File: 555.jpg (34KB, 338x305px) Image search: [Google]
555.jpg
34KB, 338x305px
>>58919273
>>
ayy
>>
File: 1476064392419.jpg (123KB, 456x369px) Image search: [Google]
1476064392419.jpg
123KB, 456x369px
I want to become a kernel developer, but I have no idea where to begin.

I have done user-level programming in C, and I made a CPU in logisim, and kernel design would supposedly reside in the middle but I have no idea where to start.

Could any linux kernel hackers point me to good learning material?
>>
>>58920282
>Could any linux kernel hackers point me to good learning material?
http://tldp.org/HOWTO/Module-HOWTO/

It's old as fuck though.
>>
>>58920294
I'll take a look, thanks.
>>
>>58920282
There's OSDev
The Little OS Book can be a good jump-off point
Reading 'Understanding the Linux Kernel' can give you some ideas
Also read up on the architecture you're developing for, the Intel Developer Manual is good if you're doing x86
>>
Hey I don't how helpful you guys will be but I've been scratching my head at this all day. I have an assigment for class (its c)

I have two String arrays and I'm trying to count the matching words I did this
for (i=0;i < *resumeCount;i++){
for(j=i; j < *resumeCount; j++){
if(strcmp(resumeWords[j],keyWords[i]) == 0)
match++;
}//end inner loop
}//end outer loop


My problem is that it only finds the first match and thats it.
>>
File: 1459224897392.jpg (356KB, 1280x720px) Image search: [Google]
1459224897392.jpg
356KB, 1280x720px
>>58920240
No, it isn't. Did you not read the conversation?
>>58920259
>You are not expected to.
Why did you post that then?
>Weebs are retarded and everyone knows it.
What's the matter, struck a nerve, did I?
>The one thing you need to understand is that you need to kill yourself.
Seriously, calm down. Do you need a glass of water or something?
>>58920277
It's actually quite nice.
>>
>>58920322
>>58920294
>>58920282
If you're interested in OS programming in general, you should rather start here though: http://wiki.osdev.org/Main_Page

The lowest threshold is probably to just make your own loadable kernel module and fiddle around with kprobe for example.
>>
If it's Linux then there is a book, "Linux kernel development 3rd edition" just grab a copy or libgen
>>
"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman
>>
>>58920366
>Richard Stallman
stopped reading right there.
also see >>58919405
>>
>>58920282
>>58920324
Oh wait, you want to develop for a kernel
Nevermind then, ignore me (Understanding the Linux Kernel might still be relevant though)
>>
I need to generate custom visual maps for my web application, what would I use to do this?
>>
>>58918238
I am.
seems good so far.
>can do webshit
>compiles to single binary
>built in code formatter

Why does everyone else use memes like nodejs or Java with its gradle/maven bullshit?
>>
>>58920324
>>58920379
>>58920338
I'm interested in OS programming in general, but I want to eventually work towards knowing the Linux kernel. Thanks for the resources, the osdev wiki and the Little OS book looks really good.
>>
File: chinese rady smilee food.gif (555KB, 139x140px) Image search: [Google]
chinese rady smilee food.gif
555KB, 139x140px
>>58920377
>Stopped reading at the end of the comment
>>
>>58920327
also how do you guys make your code look like this post>>58919611
>>
File: 1393383405215.jpg (152KB, 1920x1080px) Image search: [Google]
1393383405215.jpg
152KB, 1920x1080px
>>58920427
How would I know? I would have to read the whole fucking comment
>>
>>58920439
look ma' im spoonfeeding

   
>>
>>58920459
thx asshole
>>
>>58920442
By reading through the last token, you also read the EOF.

>>58920439
S E C R E T
E
C
R
E
T
>>
>>58920439
Just do
like this
>>
>>58920329
>>>/a/
>>
File: 1483502792169.png (191KB, 473x430px) Image search: [Google]
1483502792169.png
191KB, 473x430px
>>58920474
I actually lied a little. I stopped reading at "Richard Stallm"
>>
someone make me a multiplication table with while loop c#.
>>
>>58920507
So you read:
>The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages.
>>
>>58920512
createTable(12, 12); // implementation is closed-source
>>
>>58920517
No.
>"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallm
>>
>>58920555
Great
>>
>>58920562
What's so great about it?
>>
>>58920534
Damn propietary software opressing innocent developers again.
>>
>>58920568
lol
>>
>>58920474
>>58920487
>>58920459
<pre class="prettyprint prettyprinted">
FUCK YOU GUYS I"LL FIGURE THIS OUT
</pre>
>>
>>58920512
loop x 1 to 12
loop y 1 to 12
print x*y
print \n
>>
>>58920598
right-click page, view source

search for a square bracket
>>
>>58920568
You can add features at will.
For instance Scheme normally doesnt come with object orientation but you could add bonafide object orientation pretty easily
>>
do you guys even program anything useful?
>>
>switches to windows partition
>Recently Added: Candy Crush Soda Saga
How does anyone defend this
>>
>>58920700
Useful to me, or useful in general?
>>
>>58920706
both

Useful to you a tab management browser

useful to others whatever they find useful
>>
>>58920640
i wasn't asking about lisp though. i already know what's great about it.
>Scheme normally doesnt come with object orientation but you could add bonafide object orientation pretty easily
I wouldn't say that is necessarily a good thing. i would prefer a language smart enough to somehow physically harm the user if he attempts to do something like this.
>>
>>58920706
I've written lots of programs useful to me, alone.
I'm not trying to solve the world's problems most of the time.
>>
>>58920439
type code in brackets or hit alt-c if you have 4chanx
>>
File: 1486062934915.jpg (95KB, 420x595px) Image search: [Google]
1486062934915.jpg
95KB, 420x595px
>>58920439
 Being this new. 
>>
>>58920751
Accidentally replied to myself.
I meant to link >>58920731
>>
>>58920703
>year of 2017
>having a window partition
The closest I can bring myself to use windows is in a VM. And I haven't booted the VM snapshot for the last two years
>>
>>58920751
lets hear some useful ones to you
>>
>>58920778
its cool I'll figure it out
>>
>>58918872
rolling
>>
>>58920789
All of them are related to animu.
>Getting episodes off of Nyaa and downloading them from XDCC bots (I stayed in a place in university when torrenting was slow for some reason)
>Bash script to sort anime
>Bash script to fetch anime from my home server, and delete the torrent from rutorrent
>Program to list airing anime and add series to rutorrent's rss feed
>>
>>58920789
n line multi-threaded fizzbuzz
>>
>>58920832
fucking trees
re-rolling
>>
>>58918872
>>
>>58920857
>sorting algorithm

cool I did one yesterday.

; ds:si = array location
; cx = array length
sort_shit:
push cx
push si
shl cx, 1
mov di, si
add si, cx
sub si, 2
.a: xor bx, bx
mov ax, [di]
.b: cmp ax, [di+bx]
jbe @f
xchg ax, [di+bx]
mov [di], ax
@@: add bx, 2
cmp bx, cx
jne .b
add di, 2
sub cx, 2
cmp di, si
jne .a
pop si
pop cx
ret
>>
Here's to hoping someone can help me, I'm probably about to look like an idiot though....
I've been working on this unity game for a while now, and my biggest hurdle is an attack script. I've been fucking with it for weeks and have tried multiple different scripts. Here's my latest attempt at attack:http://pastebin.com/UUdA8wQH
and here's the health:
http://pastebin.com/B8WQTXR5
The debug on the attack script does work in telling me my distance, and the health script was able to automatically remove health at a certain interval. I'm sure there's some really obvious small thing i'm missing, but I just can't seem to get them to work together so when i press Z the health bar loses help.
tl;dr: I need help getting my attack script to actually take health from the health bar / work with the health script.
Thanks in advance for any help.
>>
Ever write something and think "I am going to have no idea how this works in a week".
>>
>>58920951
Comment it then
>>
File: 1486285916213.png (239KB, 632x472px) Image search: [Google]
1486285916213.png
239KB, 632x472px
>>58919520
scandy/10
>>
>>58920951
what language?
>>
File: 1483533362817.png (719KB, 1280x715px) Image search: [Google]
1483533362817.png
719KB, 1280x715px
>>58920972
sicp really is like anime.
>>
>>58919520
norge > sverige
>>
>>58920512
while (multiplicationTableNotDone())
keepMakingIt();
>>
>>58920968
There's really nothing to comment though, it's just using the same two functions over and over again to build up a list with a very specific structure from a numerical analysis algorithm I have to write.

>>58920976
Mathematica.
>>
C is deprecated and you can't prove me wrong.
>>
File: 1432259490310.jpg (68KB, 700x700px) Image search: [Google]
1432259490310.jpg
68KB, 700x700px
>>58918345
DELTE THIS
>>
>>58921029
For something to be deprecated, something else has to deprecate it.
Tell me, what deprecates C?
>>
>>58921036
C++
>>
File: dpt-poll.png (13KB, 660x249px) Image search: [Google]
dpt-poll.png
13KB, 660x249px
Reminder
>>
@58921044
You don't even deserve a (You) for that weak shit.
>>
@58921053
>voting
>>>/r/eddit
>>
File: norgeshjælpen.jpg (28KB, 327x427px) Image search: [Google]
norgeshjælpen.jpg
28KB, 327x427px
Verdens bedste land.

Sådan betegner de fleste nordmænd stolte deres latterlige olie-diktaturstat. For at få mad på bordet til jul, er millioner af nordmænd nodt til at stå i ko efter ribbenssteg helt fra slutningen af oktober som i Osttyskland under kommunismen.

Socialistregeringens fodevarekommissærer har nemlig besluttet, at uanset voldsom mangel på ribbenssteg, forbliver importskatten så hoj, at det ikke kan betale sig for danske slagterier bare at prove på at levere en enkelt lille ribbenssteg til fjeldlandet. Det fortalte slagterierne sidste år.

Da var der også fodevaremangel i Norge.

Ikke nok dermed. Der er også så voldsomt mangel på smor, at det nu handles på Den Sorte Bors til 600 kr pr. kg.!

I titusindevis af nordmænd er nodt til at rejse til nabolandene og KOBE MAD IND!

Norge = DDR!
>>
Got Stalin working. Compiles R4RS Scheme to executables which outperform idiomatic C by 1.5-2x.

Now I'm trying to user-defined disjoint types into it, using procedures for encapsulation.
>>
>>58921068
>which outperform idiomatic C by 1.5-2x
I'm going to need to see that.
>>
>>58921054
>t. butthurt C fag
>>
>>58921090
You seriously are stupid.
C++ is nowhere near a replacement for C. Not even close.
>>
>>58918345
That's because reusable code goes in libraries, not dirty copy & pasting
>>
>>58921099
What can C do that C++ can't?
>>
>>58921053
>voting four times in your own poll
>>
File: 1427399294688.jpg (134KB, 422x437px) Image search: [Google]
1427399294688.jpg
134KB, 422x437px
>tfw having to deal with verilog's garbage

my autism is FUCKING ACTIVATED

why is HDL so unintuitive
>>
>>58921101
This. C++ doesn't have shit on Haskell when it comes to library support.
>>
>>58921114
C enables an implementation to have a stable ABI.
It's actually possible to implement C with a reasonable amount of effort.
>>
>>58921120
>why is HDL so unintuitive
Because HDLs are not programming languages, and should never be thought of as one.
Throw your programming intuitions out of the window.
>>
>>58921085
https://justindomke.wordpress.com/2009/02/23/the-stalin-compiler/

I tried it, too, results weren't as good: only outperformed C by 50%.
>>
>>58921133
Name one (1) program that would require having a ""stable"" ABI.
>>
>>58921133
>blames C++ for GCC's failure to implement C++
Moot point, when was the last time the ABI changed anyway? Fifteen years ago?
>>
>>58918345
What were the premiere functional programming languages in 1989?
>>
>>58921143
int good_enough(double guess, double x){
if (abs(guess*guess-x)<.001)
return 1;
return 0;
}

as always, people writing language vs language benchmarks are complete retards.
>>
>>58921138
I'm trying my best, it's a very large change to my way of thinking.

I spent an hour debugging a really simple assignment because I didn't really understand what a nonblocking assignment does (still don't, really)
>>
>>58921161
>I want all my userland, my applications, my device drivers and all my shit to stop working next time a new version of my favourite operating system/desktop environment/whatever is released
>>
>>58921164
>when was the last time the ABI changed anyway
They did it a few years ago.


>>58921161
Any program that has plugins.
Any library.
Good luck trying to get code compiled with Microshit's compiler and GCC to link together.
>>
>>58921164
>when was the last time the ABI changed anyway? Fifteen years ago?
gcc 5 with c++11.
>>
>>58921120
Try VHDL.

The syntax is different enough that it kinda stops you thinking "oh this is just like C".

It's also incredibly harsh, and gives you the world's shittest compilation errors for stuff like missing commas.
>>
>>58921217
>>58921218
>They did it a few years ago.
Wow, twice in 25 years then. Big fucking whoop.

Still doesn't address my main point though:
>blaming GCC developers' incompetence on C++
>>
>>58921217
>>58921214
Is it C++ or the compiler's fault?
>>
>>58921197
I'm sure he is.

Regardless of the quality of the benchmark, you can't deny that Stalin is effective.
>>
>>58921133
I believe it's possible to write a C++ program such that it only exposes a C-type ABI
>>
>>58921244
Thanks for the tip, but I'm using it for a class and the professor requires all assignments to be done in Verilog
>>
>>58921271
So?
I could write a fucking program in Python that has a C ABI.
>>
>What are you working on, /g/?
Just finished a game of life implementation in 93 lines of Python.
>>
>>58921249
Why even use a language if all of its compilers are unstable trash?

That's like saying "haskell is good, it's just the GHC that sucks".

Who gives a fuck how """""great""""" a language is if every available compiler for it is trash?

Also, if every compiler is trash, chances are it is indeed the language that sucks, and not the people who can manage to make perfectly good compilers for most other languages.

8/10 made me reply.
>>
>>58921287
Nice, show it.
>>
>>58918739
interface FizzBuzzable {
public int value();
public String doFizzBuzz();
}
final class FizzBuzzableNumber implements FizzBuzzable {
private final int num;
public FizzBuzzableNumber(int n) { this.num = n; }
public final int value() { return this.num; }
public final String doFizzBuzz() { return new Integer(this.num).toString(); }
}
abstract class DivisibleNumber implements FizzBuzzable {
protected final FizzBuzzable original;
public DivisibleNumber(FizzBuzzable origin) { this.original = origin; }
public final int value() { return this.original.value(); }
public final String doFizzBuzz() {
String fizzBuzzed;
if (this.isDivisible())
fizzBuzzed = this.fizzBuzzing();
else
fizzBuzzed = this.original.doFizzBuzz();
return fizzBuzzed;
}
protected abstract boolean isDivisible();
protected abstract String fizzBuzzing();
}
final class NumberDivisibleByThree extends DivisibleNumber {
public NumberDivisibleByThree(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz"; }
protected final boolean isDivisible() { return ((this.value() % 3) == 0); }
}
final class NumberDivisibleByFive extends DivisibleNumber {
public NumberDivisibleByFive(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 5) == 0); }
}
final class NumberDivisibleByThreeAndFive extends DivisibleNumber {
public NumberDivisibleByThreeAndFive (FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 15) == 0); }
}

public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 100; ++i) {
System.out.print(new NumberDivisibleByThreeAndFive(new NumberDivisibleByFive(new NumberDivisibleByThree(new FizzBuzzableNumber(i)))).doFizzBuzz());
if (i < 100) System.out.print(", ");
}
}
}
>>
>>58918216
I'm experimenting with different types of neural network simulators.

Does anyone know whether there is a name for hash algorithms which produce similar outputs for similar inputs? I know that is counter to how a "good" hash algorithm typically works, but I have an interesting idea that could use a hash algorithm which functions in that way.
>>
>>58921248
>blaming GCC developers' incompetence on C++
It was the C++'s standards committee incompetence.
>>
>>58921287
I managed to do that in 2 lines in python.
import game_of_life
game_of_life.run()
>>
>>58921287
>93 lines
post it and i will short it to 50 lines
>>
>>58921303
this gives me a programming boner finally good OOP code
>>
>>58921303
>OOP is good I swear
wew
>>
>>58921295
But clang is great, anon.
>>
>>58921287
That's kind of verbose. What approach did you take?
>>
>>58921295
>Why even use a language if all of its compilers are unstable trash?
>gcc
>all of its compilers

>C++'s abi has changed two times in 25 years
>unstable trash, the first time was for gcc 1.0

Opinionated as fuck.
>>
>>58921312
pleb. watch this
__import__('game_of_life').run()
>>
>>58921295
Why even use compiled languages if all the compilers are made by humans?
>>
>>58921322
The unstable ABI goes further than a single implementation.
Trying to get code to link between different C++ compilers is basically impossible.
>>
>>58920942
Don't mean to seem needy, but just sort of bumping in case this was just missed.
>>
>>58921319
non english guy here
how so you spell clang?

like, "see"lang?
>>
>>58921249
C++11 made a breaking implementation change to std::string and std::list - as in something that was previously allowed was made not allowed.
>>
>>58921331
>Trying to get code to link between different C++ compilers is basically impossible.
I have no problems linking between llvm/clang and GCC.

If you're using MSVC, then it's your own fault because MSVC is deliberately incompatible with other compilers.
>>
>>58921335
It's pronounced "clang", like the onomatopoeia.
>>
>>58921335
hard c, like klang
>>
>>58921303
Stop, I'm still slightly nauseous from last night
>>
>>58921335
No, like cluh-nnnng.
>>
>>58921331
>>58921349
Also,

What the fuck kind of system setup are you using if you frequently have to compile using one compiler suite and link using another compiler suite????

That sounds like a made-up scenario, anon.
>>
>>58921322
>>58921319
They all work fine on their own, just try to mix between them, see what happens.
>>
>>58921352
>>58921353
thanks

sounds weird though.

i've always pronounced like "see"lang
>>
>>58921335
"clan"-"gee"
>>
>>58921349
>I have no problems linking between llvm/clang and GCC.
That's only because Clang++ deliberately tried to follow GCC, because they're trying to be a drop-in replacement.
I should have qualified my statement better. I was specifically talking about MSVC.
>>
>>58918872
Rollan
>>
>>58921372
See >>58921370 and >>58921349

compile with GCC link with LLVM/Clang => just works

compile with LLVM/Clang link with GCC => just works if you provide the right flags to Clang
>>
File: d6f.jpg (28KB, 600x579px) Image search: [Google]
d6f.jpg
28KB, 600x579px
>>58921372
>if you try to attach a triangular shape to a squared hole it won't fit
>>
>>58921303
why is this such confusing code
>>
>>58921370
Have you EVER has to use a library before?
Maybe you've only done it on GNU/Linux, where it's actually pretty easy, but on the winmeme, you'll be downloading shit from the libraries website, and they are always forced to have a "MSCV version" and a "GCC version".
Worst of all is a case where there is only 1 version, and it's for the one you're not using.
That's really why I avoid Windows and C++.
>>
>>58921397
Because it's overengineered.
>>
>>58921378
>bawwwww my Microsoft[tm] product is incompatible with open source products

Why would anyone be surprised by this?

https://docs.google.com/file/d/0B0WqhA1J6gDrQzhqeXRYOFEyZGs/edit
>>
>>58921388
>>58921395
http://www.mingw.org/wiki/Interoperability_of_Libraries_Created_by_Different_Compiler_Brands

I guess DLLs not working is just par for the course if you wanna use C++.
>>
>>58921402
See >>58921414

Your argument is essentially that C++ is shit because MSVC is a steaming pile of garbage.

I have 0 sympathy for you and your argument is completely irrelevant.
>>
>>58921321
>That's kind of verbose. What approach did you take?
A naive one. Not going to post it as I know it can be improved a lot.
>>
>>58921370
Aren't a lot of libraries distributed in binary form? If they're compiled with a different compiler than the one your own project uses, you're going to need to rebuild the libraries from source.
>>
>>58921423
>>58921402
>>58921378
>Windows is shit, WinAPI is shit, Microsoft is shit, MSVC is shit
>"it's C++'s fault!!!!"

Winbabby delusions
>>
>>58921377
>zip disquette tier
>>
>>58921434
Yes I know it's fucking garbage, but it's the language that enabled that shit. Also, there are also more compilers than just those 3. They probably all have the same linking issues.
You then contrast that to C, where it's trivial to mix shit.
>>
>>58921434
N O T   P O R T A B L E
>>
File: JpPHm3h.jpg (43KB, 554x664px) Image search: [Google]
JpPHm3h.jpg
43KB, 554x664px
Currently attempting to write an algorithm based on this research paper:
https://arxiv.org/pdf/1310.6753v1.pdf

Basically, I'm going to be using graphs to find who someone's significant other might be ("Given the user's neighborhood, the set of all friends and links among them, how accurately can we identify the relationship partner using the structural information one?")

I was planning on using python (because there are a lot libraries like "requests" that would make my job easier), but I feel like C++ is better suited for this.

What are some good HTTP libraries (like requests for python) that could help me parse through the information on someone's fb?
pic unrelated
>>
>>58921453
>Aren't a lot of libraries distributed in binary form?
What libraries?

>If they're compiled with a different compiler than the one your own project uses, you're going to need to rebuild the libraries from source.
They're usually compiled with multiple compilers anyway, but still see >>58921388

It just fucking works.
>>
>>58921423
Not a C/C++ developer here. I develop in Delphi. But I make industrial automation software and I have to use DLLs from third-parties compiled with different compilers all the time to control various devices and pieces of equipment. Never had a problem, just always follow the docs.
>>
>>58921019
Version two is a lot more readable.
>>
>>58921476
>contrast that to C, where it's trivial to mix shit.

Try linking code compiled with GCC using MSVC or vice versa. It's not fucking possible.
>>
>>58919216
            var value = 7;
var numbers = new[] { 12, 21, 4, 9, 7, 8, 4, 13 }.Where(n => n > value).ToList();
numbers.ForEach(Console.WriteLine);
Console.WriteLine($"The sum of numbers over {value} is: {numbers.Sum()}");


Fucking pajeets, teaching you outdated C#
>>
>>58921465
>Winbabby

Are you fucking dense, this is more of a problem for people developing on decent systems but trying to target windows when compiling.

You have to jump through all these extra hoops if you want to use C++ is this way.
>>
>>58921480
interesting.

is this a college assignment or are you working on this standalone?

maybe

>http://cpp-netlib.org/
>>
>>58921505
damn you can simply things like that?

how great is C#?
>>
>>58921277
Could you moderate your language please
>>
>>58921538
Not better than C++.
>>
>>58921513
See >>58921485

Funny how normal people are able to do it without any problems, but you pretend that this is some strange issue that makes it impossible to do C++ development.
>>
>>58921556
As someone who mainly uses C#, I honestly would switch to C++ in a heart beat, if it supported the fat arrow notation and had faster compile times.

Better project structure would also be nice.
>>
>>58921572
What do you mean by normal people?
>>
>>58921528
I'm working on this standalone!

I want to have a decent shot of eventually getting research gigs (or a better shot at getting a job at a good tech company) and so thought working on a project would help my application/resume.

I'll look into cpp-netlib! Thanks!
>>
>>58921495
Pretty sure it works if they both use ANSI C without extensions. The problem with C++ is that it has name mangling, and name mangling conventions aren't standardized across compilers. So different compilers will generate different symbols for "function named foo taking two 32-bit signed integer arguments and returning a 32-bit signed integer". But with pure C, symbol naming is trivial and standardized, because there's no overloading, and thus no name mangling.
>>
>>58921584
Do it, you won't look back.
>>
>>58921572
When did I say it's impossible?

Just because you can do something, doesn't mean you should be content with the fact it is way more complicated than it should be "because reasons".

Devs have to maintain twice as many libraries, and do double the testing to make sure their shit works. It's not a problem for users because cucked C++ devs spend all their lives helping them.
>>
>c++ doesn't have params

just lol m8
>>
Is Firefox really in the hands of incompetent Rust programmers?

Which browser is the best for security?
>>
>>58921623
Who are you quoting?
>>
>>58921591
>What do you mean by normal people?
Developers and programmers

>>58921606
>Pretty sure it works if they both use ANSI C without extensions
I dare you to try it, anon.

>The problem with C++ is that it has name mangling, and name mangling conventions aren't standardized across compilers. So different compilers will generate different symbols for "function named foo taking two 32-bit signed integer arguments and returning a 32-bit signed integer".
Yes, but somehow clang and gcc are able to interoperate.

In addition to the fact that you can simply just expose a C ABI, which most people do when they write shared libraries (aka DLLs)
>>
>>58921630
ebelhard
>>
>>58921630
ur mum
>>
>>58921623
Like C# params? If that's the case, isn't this what variadic templates are for?
>>
>>58921654
>wanting more codebase pollution
>>
>>58921635
>In addition to the fact that you can simply just expose a C ABI

Of course you can, but then your library has to only use C features.
If you can simplify the interface to only use C features, may as well do the same to the whole project :^)

C++ only works when you beat it with a hammer enough that it resembles the language it was meant to replace and move on from in the first place.
>>
>>58921630
john travolta
>>
>>58921630
you're waifu
>>
what's the point of even writing code when there is already a library or module for everything you could ever want?
>>
I want to work but i cant because i need to find how to make my touchpad and fonts work on arch linux
>>
>>58921717
exactly!

so much this! OMG for real
>>
New thread

>>58921723

>>58921723

>>58921723
>>
>>58920700
No I just like to argue about what language is best and shitpost code examples.
>>
>>58920951
Only if it's abstract bullshite I'll never comprehend.
>>
>>58920700
I gave up on that a long time ago.
>>
>>58921717
what's the point of even living when people have already done everything you could ever want?
>>
>>58920700
I don't have to, it's just a hobby
>>
>>58921244
Kek, this. VHDL compilers have absolutely atrocious error messages.
>>
>>58922059
what the fuck
>>

// Restaurant Bill.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

using namespace std;


int main()
{
double mCharge = 44.50;
double tax = mCharge * .0675;
double tip = (tax + mCharge) * .15;
double total = mCharge + tax + tip;

cout << "Meal charge: " << mCharge << endl;
cout << "Tax: " << tax << endl;
cout << "Tip at 15%: " << tip << endl;
cout << "Total cost to you: " << total << endl;

system("pause");
return 0;
}




How do I set the precision of the numbers to be 2 decimal places?
>>
File: 1482803313099.jpg (575KB, 2048x1371px) Image search: [Google]
1482803313099.jpg
575KB, 2048x1371px
>>58918216
>Be me today
>Try to launch useful shell from inside a program
>Can't do it
>Realize that this whole time I didn't have root access

Guess I forgot to.....check my privilege
Thread posts: 321
Thread images: 43


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