[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: 325
Thread images: 27

What are you working on, /g/?

Old thread: >>59098871
>>
>spend years evangelizing FP
>convinced myself the stupid endless debates (HURR U SHUD USE THE WORSE VERSION SO BEGINNERS CAN UNDERSTAND IT) will eventually be resolved correctly
>instead things just got worse

I don't want to do this any more. I'm tired. I want to spend time making things, not arguing with people who are butthurt about lenses or monad transformers.
>>
File: cute anime pic 0873.jpg (944KB, 1920x1693px) Image search: [Google]
cute anime pic 0873.jpg
944KB, 1920x1693px
Friendly reminder that malloc() returning null is an unrecoverable error!
>>
>>59104657
should
const int32 test;

since test is 0
>>
>>59104703
be a failure*
>>
>>59104668
Why don't you work for a company that uses FP?
>>
Is your code DISC PD2000-1 compliant?

>No valid date will cause any interruption in operations.
>Calculation of durations between, or the sequence of, pairs of dates will be correct whether any dates are in different centuries.
>In all interfaces and in all storage, the century must be unambiguous, either specified, or calculable by algorithm
>Year 2000 must be recognized as a leap year
>>
Refining my Numerai model.
>>
@59104695
you can try again later tho
>>
>>59104725
i just store all my dates as a 64-bit unix timestamp.
>>
>>59104695
Wrong
>>
hi /g/, I could use your expert advice.

Some time ago I wrote a cooperative multi threading library. I thought about imitating std::thread at first but couldn't wrap my head around it so I figured I'd just do my own thing.
task<std::string(std::deque<char>)> string_assembler = [](auto chars)
{
std::string str;
for (auto c : chars)
{
str += c;
scheduler::yield();
}
return str;
};
string_assembler->start({ 'H','e','l','l','o',',',' ','W','o','r','l','d','!' });

/* do_other_stuff_here(); */

if (string_assembler->try_await())
{
cout << string_assembler->await() << endl;
}

also did coroutines:
coroutine<char(std::string)> char_extractor = [](auto& self, auto str)
{
for (auto c : str) self.yield(c);
};
char_extractor->start("Hello, World!");

while (char_extractor->try_await())
{
cout << "\'" << char_extractor->await() << "\', ";
/* do_other_stuff_here(); */
}
cout << endl;


Do you guys think this syntax makes sense? should I try to adapt my library to std::thread style? is there any reason why std::thread is so overly complicated with its futures and promises and shit?
>>
File: 1472841246916.jpg (122KB, 1920x1080px) Image search: [Google]
1472841246916.jpg
122KB, 1920x1080px
>>59104695
No
>>
>>59104695
you can have a fallback solution depending on the application. you shouldn't spam malloc like a noob anyway just allocate everything at launch
>>
>>59104725
No requirement for leap seconds?
Leap seconds frequently causes crashes, when it's 23:59:60 on December 31st.
>>
File: 1486916586115.jpg (47KB, 600x291px) Image search: [Google]
1486916586115.jpg
47KB, 600x291px
Today I will remind them
>>
>>59104722
Because FP is not generally production-ready.

Note by FP I mean the pure, statically-typed kind. I don't know enough about modern lisps to be able to comment on them.
>>
>>59104695
I don't even know how to use malloc.
>>
>>59104772
There are a few financial companies that use Haskell as far as I know.

Scala jobs exist, too.
>>
>>59104760
Fuck off Aiju
>>
>>59104783
I've written a lot of Scala professionally. All I got from it was despair and a lot of time wasted waiting for the compiler.
>>
File: akari :(.jpg (308KB, 712x1134px) Image search: [Google]
akari :(.jpg
308KB, 712x1134px
defend this

main[-1u] = { 1 };
>>
>>59104695
dereferencing a null pointer is undefined behavior, never do it
>>
#define struct union
#define break
#define double float
#define M_PI 3.2f
#define floor ceil
#define true ((__LINE__&15)!=15)
>>
File: 1481664473008.png (175KB, 482x436px) Image search: [Google]
1481664473008.png
175KB, 482x436px
>>59104824
i can't
>>
>>59104827
lol, it's not undefined, dumb fuck, it simply crashes
jesus christ, these js cucks are taking over /g/
>>
>>59104397
was she hot?

Also, what did her butt smell like?
>>
>>59104824
not valid C
>>
>>59104851
>lol, it's not undefined, dumb fuck, it simply crashes
>even thought the standard says it's undefined
>I will now call everyone who is correct and has read his standard a js cuck xd
The irony
>>
>>59104851
'undefined behavior' means that the behavior is compiler and system dependent, as the NULL pointer could work(if you have some fucked memory mappings), or crash in whatever way mandated by the system, or do none of the above.
>>
>>59104864
wasn't talking about C tho
>>
>>59104880
>as the NULL pointer could work
lol no, do you even know anything about computers?
>>
>>59104851
Try it in kernel code, it won't crash unless you have fucked up segments.
>>
>>59104897
Do you? Very often, such as in x86, NULL is a valid address.
>>
File: karen haskell.png (818KB, 1280x719px) Image search: [Google]
karen haskell.png
818KB, 1280x719px
>>
>>59104897
yes, 0x0 is in fact, actually an address in memory, and without an OS, you can dereference this pointer to get the memory at 0x0.
>>
>>59104925
Haskell is dead.

Scala is dead.

OCaml is dead.

F# is dead.

Rust is dead.
>>
>>59104944
Haskell isn't dead tho
>>
I have taken the courses to understand all the fundamentals of programming loops, variables, if else statements, functions, etc but now I am having trouble making projects.

How does one go from beginner to intermediate to build projects and know what to do?
>>
>>59104897
do you not remember the string of privilege escalation CVEs a few years because linux will let you mmap NULL

http://blog.cr0.org/2009/08/linux-null-pointer-dereference-due-to.html
>>
>>59104944
D is dead
>>
>>59104962
Agreed.

>>59104948
Look at the state of it. If it's not dead then the kind thing to do would be to put it out of its misery.
>>
>>59104954
>How does one go from beginner to intermediate to build projects and know what to do?
Just do it
>>
>>59104954
autistically obsess about programming for a few years and you should be good to go
>>
>>59104944
Lisp is.. not deader than usual.
I WIN!
>>
>>59104905
lol, there's no malloc in kernel code, stop embarrassing yourself
>>59104924
>NULL is a valid address
it's not, idiot
>>
>>59105007
>lol, there's no malloc in kernel code, stop embarrassing yourself
We are talking about
>dereferencing a null pointer

Also, I do not know of many kernels that do not implement some form of malloc.

>>59105007
>it's not, idiot
It is in x86, can you disprove it?
>>
>>59104982
Lisp (well, Scheme) cannot die.
>>
Back again with this C++ question (Write a program that displays all the numbers from 0 to 200, six per line, that are divisible by 4 or 9, but not both. Numbers are separated by exactly one space.) Another anon helped me last thread, so far I have-
bool check(int x);

int main() {
int line = 0; // line counter
for (int counter = 0; counter <= 200; counter++) { // counter loop
if(check(counter))
cout << counter << ' ';
if (line < 6)
line++;
}

return 0;
}

bool check(int x) // I still don't understand bool very well but this works
{
return !(x % 4) ^ !(x % 9) && (x % 36); // check if the current iteration of counter is divisible by 9 or 4, then check both
}

I'm really struggling with getting the thing to only print 6 to a line. Can someone walk me through it? I don't know how to set up multiple checks in an if statement correctly (or any statement really).
>>
where are the C standard docs?
>>
>>59105033
And neither will Elisp, for better and worse
>>
>>59105043

You need

if (line % 6 == 0) cout << endl;
>>
>>59105049
http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=57853

usually people rely on just the drafts since they're free

https://webstore.iec.ch/publication/11917
>>
>>59105085
>== 0
>not using the aesthetic if (!(line % 6))
>>
>>59105030
>We are talking about
>>59104695
>malloc() returning null is an unrecoverable error
just how fucking retarded are you?
>>
>>59105059
It could be worse, emacs could have chosen JS.
>>
>>59105103
>giving a beginner aesthetic code rather than code that will visibly solve the problem
>>
>>59105085
Where do I put that? I'm still very new to loops and only know the basics. Can I just stack if statements inside one another? This is very confusing. Also I tried something like this earlier-
if ((line < 6) && (check(counter)))

but that seems to make it even worse and just printed seemingly random numbers.
>>
>>59105135
>not using ContT
>>
>>59105095
>you have to pay for the docs
how is this allowed?
>>
>>59105104
>>>59104827
>>dereferencing a null pointer is undefined behavior, never do it
>>>59104827
>lol, it's not undefined, dumb fuck, it simply crashes
>jesus christ, these js cucks are taking over /g/
I insist
>>
Im coding up a keylogger in java but Im not sure how to make it listen while in the background. Currently Im just using the Robot class to listen to keystrokes while the user is actively using the java program. I could see that working if it were included as part of a larger java program, but how could I create a keylogger that listens to the users keystrokes while not using the program? Is this possible in java?
>>
>>59105156
>standard
>hidden behind a paywall and some specific companies are allowed to contribute
how is that a standard?
>>
>>59105140
Just like this should do exactly what you want

int main() {
int line = 0; // line counter
for (int counter = 0; counter <= 200; counter++) { // counter loop
if(check(counter))
cout << counter << ' ';
if (line % 6 == 0) cout << endl;
line++;
}

return 0;
}

bool check(int x)
{
return !(x % 4) ^ !(x % 9) && (x % 36);
}
>>
File: dapper spj.jpg (126KB, 800x1200px) Image search: [Google]
dapper spj.jpg
126KB, 800x1200px
>>59105152
Who are you calling a cunt mate?
>>
>>59105174
Welcome to the wonderful world of industry standards.
>>
>>59105161
>I got rekt, better move goalposts
webshits should just gtfo
>>
>>59105156
Language designers don't make much money.
I think it's fair.
>>
>>59105193
Simon, I'm leaving you for Edwin, he's more... dependent
>>
>>59105156
Why doesn't Ada have this problem, eventhough it's also an ISO language?
>>
>>59105140
Also yes you can stack if statements, it's called nesting. You can do something like if (number == 3) { if (number % 3 == 0) { cout << "yes"; } else { cout << "no"; } }
>>
>>59105095
>non-free standards
fuckin DROPPED!
>>
File: Capture.jpg (125KB, 1810x955px) Image search: [Google]
Capture.jpg
125KB, 1810x955px
>>59105192
I tried this and pic related happened.
>>
>>59105206
Nope, the goalpost hasn't been moved, not by me at least.
No reason to be upset for getting btfo.
>>
>>59105133
Oh god now THAT would be nightmarish
>>
>>59105242
Why are you using MSVC?
>>
>>59105242
If this is homework you're going to fail the course. Put line++ inside the check if statement.
>>
>>59105210
1: ISO takes all the money
2: even if it did not, MS and the other companies do not really need money from a standard
3: they are not designing a language, they just fuck up an existing language.
>>
>>59105264
Because Programming Principles & Practices Using C++ told me to and I'm a beginner? Does it matter for this specific problem?
>>
>>59105242
>windows
get the fuck out, what are you even doing in /g/?
>>
>>59104944
You forgot c++, java and javascript ;)
>>
>>59105290
Not really, it just seemed a little overkill to me
>>
>>59105301
C++ is coming back to life.

Java is going steady.

JavaScript will unfortunately never die.
>>
>>59105300
haha us 4channelers, right?

haskell is the most productive language!
>>
>>59105242
>#include "R:\C++\std_lib_facilities.h"
this makes me feel uneasy
>>
I use C, C++ and Python most of the time.
I know LISP but I have no practical use for it.

Am I missing out by not using Go or Java at least once for a serious project?
>>
>>59105322
No.
>>
>>59105322
No.
>>
>>59105267
It isn't homework, I'm not currently in a course. I'm just trying to learn which is why I keep asking for a breakdown of what I'm doing wrong so I can learn properly.
Also I quite literally copy + pasted the code from >>59105192 , I didn't realize that you expected me to then change the code.

>>59105320
Yeah, it's from the book I'm working through, it's a header file that Bjarne Stroustrup wrote for his book I guess to make it easier for beginners. I can delete that and use a different library if it would help.
>>
>>59105242
Woops, it's because it's iterating line even if the number isn't valid.

This code works for me

#include <iostream>

using namespace std;

bool check(int x) {
return ((x % 4 == 0) || (x % 9 == 0)) && (x % 36 != 0);
}

int main()
{
int line = 0;
for (int i = 0; i <= 200; i++) {
if (check(i)) {
cout << i << ' ';
line++;
}

if (line == 6) {
cout << endl;
line = 1;
}
}

return 0;
}
>>
>>59105319
Kill yourself
>>
>>59105390
Haha yeah, get a rope and kill yourself!

We are kindred spirits, you and I.

>>59105301
Forgot C#, too. That language is DEAD.
>>
>>59105390
>muh linux
>muh haskell
kys
>>
>>59105353
No worries. Try thinking about how the program will run abstractly first and then implement the code. So write out the process in English, Get number, check it, if it fits criteria, print it and log that you've printed a(nother) number. If you've printed 6, print newline. Then do it all again with the next number. Understanding the process of a program before you make it is important.
>>
File: 1464789684680.png (344KB, 1200x800px) Image search: [Google]
1464789684680.png
344KB, 1200x800px
>>59105322

Not unless you want to ENTERPRISE
>>
File: Untitled-1.png (75KB, 500x890px) Image search: [Google]
Untitled-1.png
75KB, 500x890px
I've been sitting on this for the past 2 hours.
What is the attribute name of this icon's color? I am adding more icons next to it and I want to match the color of the theme, so I can't just hardcode it.
>>
>>59105471
colorDotHamburger
>>
>>59105365
Thank you, it works. If you don't mind I'm going to type out an explanation for myself of what's going on here so I understand it better. Correct me if I get anything wrong-
-initialized 'line' to 0
-for loop to count from 0 to 200, adding 1 to 'i' each time around
-if statement passes current iteration of i to check function
-- if it passes the checks, it gets printed, then a blank space
--and 1 is added to line
-then it repeats because it checks if line is == 6, and it isn't
-when it is, it ends the current line and sets 'line' back to 1

So I think what I was not understanding about if statements is that you can just put another if statement right after another one and it'll check the one below it once the first one is finished. I had been trying to add in else if and else and while statements and such to get it to work. To be honest I really wish this book had gone into much more detail on these loops, though I don't blame is, I think the author assumes the reader is taking a course and has a professor to ask questions to.

>>59105438
Thanks. Yeah I've been getting a little better at that. I clean up my posts a bit when I post code here but usually I leave comments for myself on almost every line of code because it helps me understand what's going on a bit better. Do you have any recommendations of sites or books that would help me practice loops and other beginner stuff? Reading through this book is great, but I think working through more practice problems such as this could really help me learn.
>>
>>59104982
CommonLisp will never die
>>
File: Untitled-1.png (24KB, 967x117px) Image search: [Google]
Untitled-1.png
24KB, 967x117px
>>59105500
nope
>>
>>59105527
Anon...
>>
>>59105534
I know, I'm a retard. I have never programmed android before. I wish this project was over already.
I am just trying find what is the source of color that hamburger menu icon is using.
>>
>>59105548
It's not a hamburger icon.

You've been rused.
>>
I have a non null terminated string in C. How do I make it null terminated?
>>
>>59105516
You've got it. Also for your understanding, "bool" is a type that basically just means true or false, similar to how an int is just a whole number. In the statement

return ((x % 4 == 0) || (x % 9 == 0)) && (x % 36 != 0);


|| means or, && means and.

If a number is divisible by 4 or 9, that's good, and if it's not divisible by 4 and 9 (36), it's good so return true. Otherwise it will return false if both of those conditions are not met.
>>
>>59105571
Add a '\0' to the end of it.
>>
>>59105571
Add a null terminator.
>>
>>59105007
>>NULL is a valid address
>it's not, idiot
0x00000000 is a valid address. It only segfaults because windows and all modern operating systems running in protected mode use something called a Global Descriptor Table. It basically restricts segments of memory to ring levels.
>>
>>59105579
>>59105580
what is the idomatic way to do so?
>>
>>59105471
https://material.io/guidelines/style/color.html
>>
why doesn't C++ enforce traits yet?
It is literally the only thing keeping it from being better than Rust
>>
>>59105607
x[i] = '\0';
>>
>>59104982
Lisp already won, then experienced a fall from grace. Still love it.
>>
>>59105607
#pragma
>>
>>59105575
Okay. So basically, a "bool" function does its thing and then just passes back either "it's true, go ahead and do whatever" or "it's false, don't do whatever"? He's [the author] slowly thrown in a bool here and there so far in the book but he hasn't spent much time going into detail yet on the actual uses...or maybe it's just a simple concept and I just wasn't getting it.
>>
>>59104743
bump for advice
>>
>>59105622
what are traits
>>
>>59104695
>using languages that don't take out their own trash
enjoy your babysitting job
>>
>>59105638
bool is a data type just like int; a bool function (called a method) just returns something that's specifically a bool type, so it will either give you true or false. But what you said about how it passes through the if statement is correct
>>
>>59105471
Alright I fucking found it already. I spotted it accidentally here: http://stackoverflow.com/questions/28219178/toolbar-icon-tinting-on-android
So basically the color I was looking for was:
?android:colorControlNormal
>>
>>59105656
A way of doing polymorphism that doesn't require virtual methods
>>
Why does no one talk about D? It looks incredible, like the best thing from every language, wtf. Low detailed works with great readability and memory safeness

Literally what is the catch??
>>
>>59105713
I bet you love the D
>>
>>59105638
Function are defined generally in the following format.

Return type, name, (arguments);
So if you want a function that simply adds 1 to an integer you do.
int addOne(int x){
return (x + 1);
}
//Yours returns a bool, is called check, accepts an int x.
bool check(int x);

Generally you make function to shorthand often used code.
>>
April is a smelly turd
>>
>>59105640
If other people are going to use your code then definitely go with std::thread, if not then stick with what you have if it works (i.e. is sufficiently fast, reliable and doesn't depend upon UB).

Still, you should probably get to grips with the threads related headers - they're actually very well-designed and std::promise, std::future are useful when you understand them.
>>
>>59105733
DOGGO DO A TRICK
>>
File: 100 crack fist of chen.jpg (17KB, 325x221px) Image search: [Google]
100 crack fist of chen.jpg
17KB, 325x221px
>>59105713
ANSWER
>>
>>59104743
>std
you can tell whoever made this was a virgin
>>
>>59105751
'no'
>>
>>59105800
kek
>>
>>59105809
Why are you here then? To post about your perpetually in-progress ML derivative some more?
>>
>>59105809
>'no'
I still don't understand this meme
>>
>>59105750
>finally someone replies
thanks anon.
I do plan to release it someday. no idea if anyone will ever use it though.
From what I can tell the whole future/promise thing is mainly to catch exceptions from threads right? I've never actually used it so I may be wrong. Anyway in my implementation, exceptions from child threads are rethrown from the await() function.
Also I don't think you can transfer ownership of a std::thread? task and coroutine in my library are actually wrappers around shared_ptr which seems more convenient to me. But then I don't know the whole design rationale behind std::thread.
>>
>>59105826
it's been dropped
>>
>>59105900
Then what are you doing these days? Chasing your tail? Is there any point in you having a trip now?
>>
>>59105908
lots of work, lots of school shit. recently attended a hackathon
>>
>>59105908
>Is there any point in you having a trip now?
has there ever been? :^)
>>
>>59105926
You're in school and you were trying to make your own OCaml? Talk about jumping in at the deep end.
>>
Here's an app idea for you:

Take photo of flower and compares to database and tells which flower and plant it is

You will get squillions off little old ladies
>>
>>59105941
easier than developing a C++
>>
>>59104695
//unbounded run-time, but guaranteed to return a pointer to a valid Widget!
Widget *newWidget() {
Widget *w;
while((w = malloc(sizeof(Widget))) = nullptr);
w.init();
return w;
}
>>
>>59104754
Allocating everything on the stack is a noobish thing to do, especially if the amount of storage needed can't be computed at compile time.
>>
>>59105897
Future and promise are essentially just tools allowing you to pass and receive variables between different threads. I guess you could use them to catch exceptions between threads, I don't tend to throw exceptions in a lot of my code (simulation code, so I avoid anything unnecessary) so haven't tried it.

Also std::thread ownership can indeed be transferred as they have a move-constructor for this purpose.
>>
have any of you guys ever made a lot of money programming something on your own?

I have only ever made a lot of money programming an entire ecommerce website for a client
>>
>>59105975
That's not what he meant. He means to allocate all the memory required at launch (using malloc), and just update your arrays via indexing in the main "running loop" of your program. This is actually very good practice as it improves performance significantly too by simply allocating big chunks of contiguous memory from the get-go.
>>
>>59104824
Pretty sure that's undefined behavior...

>>59104851
lolretard, it's undefined behavior because the Standard says the compiler can literally do anything. USUALLY it just emits code that literally it does what you wrote, and the operating system kills it, but the compiler is under no obligation to do anything.

>>59105007
This is about dereferencing null pointers, which can come from many things, not just a malloc failure. They're literally a built-in part of the language, provided in freestanding environments. NULL is a library macro, but any occurance of 0 in a pointer context in your code gets translated into whatever your system uses for the null pointer.

>>59105353
The issue isn't the header, it's the fact that you have it at an absolute address. Just put it in your project folder and use just the filename in the include statement.
>>
>>59104657

In openCL if I have 1 compute unit that means I have one work group correct?
>>
Why is STDIN_FILENO defined in stdio.h? According to stackoverflow, "stdin" is used for functions like fprintf(), while STDIN_FILENO is used for functions like write(). However, write() isn't a standard C function, it's part of the POSIX unistd.h, so why is STDIN_FILENO defined in a C standard library header rather than in unistd.h? Are there any standard C functions which can meaningfully take STDIN_FILENO as an argument?
>>
>>59105713
Because it's not shilled by Mozilla or Google, its adepts don't spam with "C PROGRAMMING MUST BE BANNED" threads, and so on.
>>
>>59105713
It labels itself as a System Programming language, but uses GC which was one of it's biggest mistakes
Not that I mind, I'd much rather use it over Java or C#
>>
>>59106278
Also, where is stdin declared? I can't find it anywhere in my stdio.h header, nor in any header which stdio.h includes.
>>
>>59106338
Why bother when you could just use OCaml? D may be a fine language, but it excels at nothing.
>>
>>59106368
I mean, why would I use OCaml instead? Switching to D was easy enough, and it has some great metaprogramming support (though I admittedly haven't gotten around to exploiting it yet).
>>
>>59106425
If you're using a GC language you don't care enough about performance that OCaml is ruled out, and OCaml is perhaps the most powerful language in that space without going into crazy monad purity land. You should go for the language that makes development easiest within the set of languages that satisfy your performance requirements.
>>
>>59106444
I'll check it out, but I already find D pretty painless to develop in.
>>
>>59106501
If D works for you then that's great.

I'm just a functional programming weenie.
>>
>>59106541
Everybody likes to rag on FP, but it has some cool ideas.
Pattern matching should be standard in every language
>>
is johnathan blows language any good
>>
File: 1465756055469.jpg (194KB, 814x723px) Image search: [Google]
1465756055469.jpg
194KB, 814x723px
>>59106278
>Why is STDIN_FILENO defined in stdio.h?
It isn't?
>>
serious question
will learning haskell make me better at c++?
>>
>>59106749
Nope.
>>
>>59106619
I don't get the coolness of pattern matching.
>>
apparently doing well at uni isn't enough to get me a job, i need to post things on github too, to show that i'm a real nerd. what do you put on github? i need something that looks good but won't take too much time...
>>
>>59106782
Try to achieve the same thing in Java.
>>
>>59106749
it will make you better at writing declarative stubs which will help you if you want a promotion so that instead of being a software developer you become a software architect, or so i hear
>>
>>59106787
If you're particularly passionate about a hobby project, you could binge code for a weekend
>>
>>59106787
other people can steal your shit if you put it on github
>>
>>59106833
Not if you GPL it.
>>
>>59106833
all my code is shit anyway so their loss
>>
>>59106853
if your code is shit, nobody will hire you
>>
>>59106874
>he actually believes this
:^)
>>
File: illya naruhodo.jpg (151KB, 1280x720px) Image search: [Google]
illya naruhodo.jpg
151KB, 1280x720px
>>59106787
Bump for answers
>>
>>59106883
millions of people are out there looking for programming jobs

why would someone hire a shittler
>>
>>59106749
It will probably land you a job in a McDonald's.
>>59106787
>think about a program that might be useful 4u
>kode it
>put it on gitscrub
There.
>>
can anyone here write pseudo code? whats the command to make a word uppercase in pseudocode?
>>
>>59107063
Caps lock?
>>
>>59106921
They will never look at your code. They don't care about your github projects.
>>
>>59107063
to_uppercase(word)
>>
>>59106749
not at all. in fact it will probably make you worse
>>
>>59106921
because almost everyone is shit and employers have to settle for casual normies
>>
>>59107063
if char > 96 && char < 123
char -= 32
>>
>>59107196
Kill you are self
>>
>>59106787
I put all my personal projects on my laptop and I show them off to managers you have to know how to market and sell yourself interviewing is all about sales how good are your people skills?

If you have no people skills learn it by interacting everyday in a retail setting each time you go to the grocery store talk to the cashiers
>>
>>59107063
pseudocode doesn't have a stringent syntax. just make something up like >>59107103
>>
>>59107063

an array of chars in which the index of a lower case char contains an uppercase char
>>
ideal lisp coding style/practices?
>>
Why the fuck does Rust not have a way of doing async io?
>>
wtf do i even work on im so bored and i want to learn languages
>>59107569
isn't that what Mio's for?
>>
>>59107649
>isn't that what Mio's for?

>isn't that what [insert 3rd party library here] is for?
>>
>>59106787
is doing well in uni honors enough?
>>
>>59107677
why the fuck should async IO be in the stdlib? Rust is a systems language not fucking Python
>>
>>59107725
I guess..

I just want a 'stable' solution that won't change overtime and isn't ran by poos. Like Posix' poll/select or Linux' epoll

is tokio any good?
>>
>>59107759
no clue, i've barely ever used Rust outside of like 3-4 tiny projects and following its development a little bit. Tokio seems pretty professional but i haven't heard much about it
>>
Im taking babby's first cs course, easy shit like convert seconds to hours minutes and seconds, stuff like that
Should I pick another language and do all the labs and projects in parallel in it for the exercise? Class is using java
>>
>>59107759
>relying on std libs for stability
lol, you should learn your lesson from C++
>>
so is Mio the Rust equivalent of epoll?
>>
i think im gonna try doing "hackathons" on my own time every week/every couple weeks when i have time to work on something and just coming up with an idea on the spot to make. could do like 1/2 in a week then 1/2 the next week. anyways, it seems like a great way to make a dent in my long list of languages/libraries to learn
>>
>>59107791
explain how the std libs in c++ aren't safe
>>
>>59107859
lol fucking normie

>let's take this guy's word for what constitutes a good/bad programming language
sad!
>>
File: wT2B85P2gd-8.png (8KB, 300x250px) Image search: [Google]
wT2B85P2gd-8.png
8KB, 300x250px
Whenever I want a define something like a vector or a hashmap in C++, my first instinct is to initialize it with as a pointer (using the "new" keyword), instead of just defining it like a normal variable.

I'm not sure why I'm doing this, maybe you help me figure out the reason? Also, is this not optimal, and if yes, why?
>>
When people say scripting/automation with python are you just calling libraries that just need input then they'll do everything for you? Like say a script that downloads something from a website everyday
>>
>>59107869
there's a reason I know more than you
>>
>>59107884
yes
like so
import schedule
import requests

URL = ''
def download():
req = requests.get(URL)
if req.status_code == 200:
pass

if __name__ == '__main__':
schedule.every().day.at("16:00").do(job)
>>
I'm new here
What's all this about socks?
>>
http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines

Just fuck my shit up senpai. The greatest argument against using C++ is the C++ language standard.
>>
>>59107927
computers communicate with each other using socks
>>
>>59107944
So is my computer the reason I'm a footfag?
>>
>>59107956
Depends, are you a computer?
>>
>>59107901
*tips*
>>
>>59107884
... yes and no.
Scripting or automation is when you use a programming/scripting language to perform tasks.
Like if you want trash bin on your computer be cleared every night, you write a script that does, either using a library that knows how to delete files from trash, or by writing that yourself somehow.
You can't make a program write or automate itself, or whatever you thought that meant.
>>
>>59107961
No, I just have autism
>>
>>59107873
you need to learn about the heap and the stack and when things go where. happy googling
>>
File: tumblr_ofryyks6HB1u0z65io1_500.png (249KB, 500x687px) Image search: [Google]
tumblr_ofryyks6HB1u0z65io1_500.png
249KB, 500x687px
>tfw cute socks
>freeBSD
>Terminix
>Rust
>CS major with grade 4.0
>UCfag
>traps are not gay
>girly songs
>>
>>59107922
That's so simple, I don't know why I have such a problem wrapping my head around python
>>
>>59107991
I tried googling it recently. It didn't really help me, as you can tell.
I got some of my questions answered, but I couldn't figure out if there are considerable performance penalties when using heap memory for things that could just as well be put on the stack instead.
>>
>>59108001
sounds like a comfy life anon

except for the girly songs, those suck, men are best at music
>>
In rust, there is no way for a a file to notify when it is ready to be read or written.

>"systems" "programming language"
>>
>>59108038
stack is much faster
>>
>>59108061
I'd like a girl singing to me though
>>
>>59104897
Of course the null pointer could work you fucking retard.
How do you think you access the first entry of the IVT in real mode?
>>
>>59108081
men growling is much better
>>
>>59108081
https://www.youtube.com/watch?v=H6a-kkTPJHY
>>59108089
https://www.youtube.com/watch?v=Z33ml_q9nvc
>>
>>59107965
*reddits*
>>
>>59108001
Off-topic, but I was unable to get past boot for the two variants of BSD I tried to install. I genuinely wanted to try it out, but either it or my hardware failed me.

So I went back to Debian, which is where I will stay until the end of time I guess.
>>
>>59104897
my.mixtape.moe/ucolyl.mp4
>>
>>59108119
https://www.youtube.com/watch?v=qXVxR9Hf0hs
>>
>>59106747
In MinGW's stdio.h it is.

>>59107063
for each character in word:
if character is lowercase:
replace character with its uppercase counterpart
>>
>>59108137
Gentoo is great for desktop usage, anon. Ignore the ebin memes about it being too complicated; it's just different in the same way going from Windows to Linux for the first time is different.
>>
>>59105043
How can you not understand bool? It's the simplest data type, it can either be true or false.
>>
I ran this to install Stack:

curl -sSL https://get.haskellstack.org/ | sh


and then I ran
stack ghc
stack setup


and holy hell does it take a fuck ton of time.

Does anyone know how much it downloads?

~
>>
>>59108162
ok, cool, what does gentoo have to do with either bsd or debian tho pham
>>
>>59108199
>curl pipe to sh
wew lad

Surely that thing is in a repo somewhere? Installing from a repo should always be preferred over manual installs.
>>
>>59108089
>>59108119
>>59108154
Not girly enough for me. I need girly songs to concentrate
Try these
https://www.youtube.com/watch?v=LSpgBv6EtyQ
https://www.youtube.com/watch?v=Ly7uj0JwgKg
>>
>>59108210
You were looking for a distro to use, and you said BSD wasn't working for you, and you went back to Debian. I'm recommending you try Gentoo, as it is also a Linux distribution like Debian but is also very different and worth trying like bsd.
>>
>>59108216
https://www.youtube.com/watch?v=sPqnxFgCrhg
>>
File: 1486700538771.png (511KB, 836x964px) Image search: [Google]
1486700538771.png
511KB, 836x964px
>>59108216
That's a web rendering engine I'm working on btw
>>
>>59108220
true enough -- i would like to get BSD working if possible, but it's an unnavigable wilderness to me.

gonna spin up gentoo and see what's what
>>
File: angry racoon.png (1MB, 1173x780px) Image search: [Google]
angry racoon.png
1MB, 1173x780px
I need something to work on to post on github because of what >>59106787 says

Any ideas? Everything I can ever think of is already done. Doesn't have to be complex can be simple and useful
>>
>>59108273
>already done
doesn't have to be original to be simple and useful either, friendo

don't let the pursuit of uniqueness paralyze you.
>>
>>59108119
>not shilling the best Rodan
https://www.youtube.com/watch?v=saveCsiabQ8
>>
>>59108216
You need some masculinity in you son

https://www.youtube.com/watch?v=HgYrRgIWkfI
>>
File: deep contemplation.png (392KB, 451x619px) Image search: [Google]
deep contemplation.png
392KB, 451x619px
>>59108291
What do you suggest?

Personally I'm a minimalist when it comes to everything, I don't use much, don't have hobbies and such... so naturally it's very hard to think of useful things even if they're already done.

Suggestions?
>>
>>59108199
It JUST stopped and now it's downloading ghc which is ~100MB.

>>59108309
Make a text editor in your language of choice.

I'm doing it in [spoiler] haskell
>>
>>59108309
just make apps for normies like me. take some app you already know about, think of a twist for it, then make it as simple as possible. e.g. instagram but for videos (Vine). then you can simplify it like => app where you can upload a video & tag it with hashtags/search for videos by hashtag
>>
>>59104954

Freecodecamp
>>
>>59108309
>trying to create something without any interest in what you're creating

You're either going to have to find something interesting that motivates you, or you're gonna have a bad time, friend.
>>
>>59108309
- build a CPU in VHDL
- write a basic kernel with paging
- reverse-engineer some malware samples and make a blog post about your findings
- write an IRC server in your favorite language
- make a programmable platformer game
>>
>>59108309
Well the general advice is to attempt to solve problems you encounter in the course of doing what you do, but since you don't do much this isn't much to go on.

Personally I gravitate toward data handling tools since the occasion for them comes up a lot in my job. Convert stuff from format A to format B. Scrape data from here and log it there.

But as >>59108356 says, the way you describe your 'minimalism' means that all this advice is going to be wasted on you and you will accomplish nothing.
>>
>>59108390
>>59108356
I'm actually on break and my final year of school doesnt start for about 2 weeks, I've always thought for at least 5 or 10 mins a day on what I could make thats simple and neat.jpg but I could never think of something.

In regards to course work, most of the stuff I do is theory based (have done little to no programming since my first year)

But yeah... just need something to capture my interest, I do read finance in my spare time and find it interesting but the programming aspect of those possibilities are way out of my scope (i.e tracking historical data, making graphs which can zoom and analyze data etc) but yeah if you have anything that comes to your mind do tell
>>
why is everyone here a noob at programming?
>>
>>59108468
if everything smells like shit you should check your shoe
>>
>>59108465
>possibilities are way out of my scope
Why are you planning to fail?
>>
>>59108485
that's how that personality type works, anon.
just let it be and don't waste your time
>>
If I work through sicp using clojure instead of lisp am I going to have a bad time?
>>
>>59108465
How do you think people get good or start anon, there's not a book of programmer secrets or some course material people just magically learn and start programming good things with. You use a library to do the zooming and graphics of the data so you can worry about the math behind it, you put the backbone into your app and you put that on your github as a specific-purpose solution. If you encounter a problem, then solve it. You're not going to get anywhere avoiding problems.
>>
>>59108514
I don't think it's a "personality type" problem. I used to think the same way, but then I stopped and actually tried and did things I thought were out of my scope.
No surprise to anybody, you can achieve things you never thought were possible when you try. "80% of success is just showing up" and all that.
>>
>>59108485
What do you mean?

What I meant was, where I live (New Zealand), obtaining market information is extremely complicated and painful, its just diminishing returns in respect to my efforts. Our market regulator (NZX) doesn't have an API and suggests we go to "data vendors" which distribute this information - in getting that information you have to file paperwork or something and they charge you a fee per 50,000 queries or something like that.

Ive looked into it, its a waste of time

>>59108528
Yeah I know, but in reference to above I just need to find something that doesn't involve real life problems and I can just "start right on it", I just need to find something I really enjoy that I can work on
>>
>>59108549
Dude, you're not even going to find something you enjoy since you're not really looking, just typing up more reasons why you can't look at certain areas. Also NZ here also, where you studying? Doing CS at Otago in a couple years myself.
>>
>>59108549
>obtaining market information is extremely complicated and painful

What a terrific excuse, anon. It'll get you far.
>>
>>59108527
"no"

I'm using racket.

Alternatively, download drracket and the sicp-lang package for maximum compatibililty.
>>
>>59108549
Make an online shitposting board, it'll help everyone.

Look up overboard or whatever it's called, it has a list of every online weeb board implementation.

There's even a ~250 LOC haskell version.
>>
>>59108571
You're probably right, I need to start looking actively, I've honestly tried to think of applications for things I enjoy, anime, piano music, but I can't really think of what to do, im not very creative unfortunately, if you have any past projects mind sharing? may catch my interest.

University of Auckland

>>59108579
I'm being whole heartedly honest, not just the self defeatist logic to excuse myself from doing any work, it literally is a bad place to start, I need to find something more sensible
>>
>>59108625
To be honest I hardly finish anything since I do it for the process and not the end result. I finished a fishbot for WoW that listens using Window's coreaudio API but I did it in C# because winforms so it turned out to be documentation hell just doing something simple like marshalling the integers returned from the managed C++ backend code to be 32 bit on 32 bit systems. That kind of thing is what I do, just pick something I want or need and dive into it regardless of how difficult I think it's going to be. I made a music sorter that created directories and moved shit based off of id3 tags, which I initally tried in C. I thought it would be about a 5 min project but I ended up having encoding issues and learned a whole host of things about unicode then as well.
>>
>>59108675
Oh cool.

In regards to the botting thing for WoW, I actually find that quite interesting, I always wondered if I could create an undetectable bot that operates by keystrokes.

But don't games automatically shut down their client if they notice a process is hooked onto it or memory is being read?

How did you manage to "read" data (like interactable objects such as monster spawns, npcs) without any knowledge of being a game developer for the actual game?

Might try make something like this
>>
MineSweeper in Java

public class Minesweeper { 
public static void main(String[] args) {
int m = Integer.parseInt(args[0]);
int n = Integer.parseInt(args[1]);
double p = Double.parseDouble(args[2]);

// game grid is [1..m][1..n], border is used to handle boundary cases
boolean[][] bombs = new boolean[m+2][n+2];
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
bombs[i][j] = (Math.random() < p);

// print game
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++)
if (bombs[i][j]) System.out.print("* ");
else System.out.print(". ");
System.out.println();
}

// sol[i][j] = # bombs adjacent to cell (i, j)
int[][] sol = new int[m+2][n+2];
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
// (ii, jj) indexes neighboring cells
for (int ii = i - 1; ii <= i + 1; ii++)
for (int jj = j - 1; jj <= j + 1; jj++)
if (bombs[ii][jj]) sol[i][j]++;

// print solution
System.out.println();
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
if (bombs[i][j]) System.out.print("* ");
else System.out.print(sol[i][j] + " ");
}
System.out.println();
}

}
}
>>
>>59108756
Yes, the game does detect that, I didn't inject any memory at all. I dunno if you've played WoW but fishing basically requires you to equip a pole, press a hotkey and it throws a bobber into the water. Then it splashes and you click it for a fish. The cast time is fixed, 24 seconds, so the technique was basically to use Windows' APIs to scroll across the screen and detect a cursor change, then wait for a fish and click to loot it, then recast and repeat. No injection required, but it does mean you can't use your PC, not even for music, while you do it.

It isn't my idea but taken from another fishbot, but it's shit, not developed anymore and wouldn't work on the older versions of WoW due to the nature of it reading the cursor. So I used newer .NET functions to instead take a screenshot around the cursor and check the colour of it compared to the blue in the water.
>>
>>59108792
Ohh, so basically a macro script? I've done this when I was a kid for a game, was loads of fun, but there were unavoidable errors/bugs that would always be present due to the nature of doing something like this with a macro script.

But yeah, if it were perfect you'd need to hook onto the client process, else your computer might lag and you may misclick then end up somewhere else not doing the task at hand if you dont keep checking up on it.

Although there are some ways to minimize errors like this (putting very long sleep delays) which cut into exp farming time
>>
>>59108468
4chan is generally fucking cancer and there is no way a seasoned programmer is going to have a meaningful discussion about programming here (not that they need to gossip about things like a bitch). noobs can at least learn basic things in here.
>>
>>59108792
Now that I think of it, do you think it'd be easy to make a bot in runescape? After all, all you're doing is attaching to the chrome.exe process which means you should be able to read into the runescape game pretty easily I suppose?

Kinda hard to say though, haven't played games for a long time
>>
>>59108830
Yeah, it was in winforms, c#, .net stack, used coreaudio through user32 dll so I wouldn't quite call it a "script". I did a bit of multithreading so as to not block the GUI and ended up with a pretty simple state machine of sorts. It did end up quite buggy, worked perfectly for me, but I shilled it on my github on /vg/ and got an email back a week later basically saying in nicer terms that it was a buggy piece of shit and hardly worked ever, so that sucked. But it's something on my github that has code, so I'm happy with it.

I have no clue how runescape works, I played it way way back about a decade ago for a while, got lured out to some place from the GE with promises of armor trimming and got killed, then gave up.
>>
>>59104783
mostly ocaml, look at Jane street
>>
File: 1486768280446.png (99KB, 435x512px) Image search: [Google]
1486768280446.png
99KB, 435x512px
#include <stdio.h>

int main()
{
printf("Hello, world!");

return 0;
}


THE POWER
>>
>>59109503
C TRULY IS THE BEST
>>
>>59109503
>No trailing newline
Please, anon.
>>
>>59109503
>not int main(void)
trash
>>
>>59109503
>not implementing printf yourself
Absolute rubbish lad
>>
Should I learn java, C# or C++?
>>
>>59109618
D: None of the above.
>>
>>59109618
Use whatever you want.
>>
>>59109623
>>59109632
>>59109503
>>59109519
>>59109539
>>59109560
>>59109611
love this board
>>
>>59109503
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
size_t i = 0;
int c = 0;
signed char t[] = { 0x48, 0x1D, 0x07, 0x00, 0x03, -0x43, -0x0C, 0x37, 0x18, 0x03, -0x6, -0x8, -0x43, -0x17, 0, 0x30, 0x24, -0x35 };
while(i < 18) {
c += t[i++];
putchar(c);
}
return(EXIT_SUCCESS);
}
>>
File: 1486761115237.gif (299KB, 500x373px) Image search: [Google]
1486761115237.gif
299KB, 500x373px
>>59109760
>>
I'm learning Java. What little project could I contribute to? Debugging easy bugs etc. ?
>>
File: 1487221094986.jpg (70KB, 1403x1050px) Image search: [Google]
1487221094986.jpg
70KB, 1403x1050px
>>59109760
>>59109760
>bytes represented in negative hexadecimal
>>
>>59109760
>using parentheses with return
dropped
>>
>>59105960
>=
>>
>>59109852
javac
>>
>>59109760
>int main(void)
kys
>>
>>59110134
Nobody wants to kiss you
>>
>>59110162
HaHAHaaHA epic roast m8 xD
>>
File: 1486087811340.jpg (31KB, 438x428px) Image search: [Google]
1486087811340.jpg
31KB, 438x428px
Which lisp dialect should I learn?
>>
Is there a reason you wouldn't use a vector/extendable array-based implementation of a binary heap?
>>
>>59110187
No, not really.
>>
>>59110173
you shouldn't learn lisp
>>
Wew, this sounds not too complicated, but I don't know where to start.
If 1st jan was a Monday, then we should atleast start with a offset of 6, r-r-rite?
Then just get the multiples and compare to beginning of the months, rite?
>>
>>59110198
Did I ask whether or not I should learn lisp?
>>
>>59110209
Did I ask what you asked?
>>
>>59110206
import java.util.GregorianCalendar
>>
>>59110206
Start by working out how many days there are in total, making sure to deal with leap years properly.
>>
>>59110216
I bet python has such a library, too, but that is way to easy
>>
>>59110214
Did I ask you to ask about what I asked?
>>
>>59110261
Yes, you did
>>
>>59110206
The C fags literally could not comprehend how to solve this problem here
Learn OOP guys
>>
>>59110375
You sure are projecting a lot.
Nobody even brought up C.
>>
>>59110382
Projecting? It's just refreshing to be able to look at a problem once in a while and know that all those C fags on /dpt/, if they even had the ability to write C code, would produce a nonsense spaghetti piece of shit and call it superior to the OO code in any other language that's a fraction of the length, completely logical, and 100 times easier
>>
>>59110416
You don't really need OOP for this problem though.
>>
>>59110416
So just because someone hasn't posted a solution in C, it means that nobody can do it in C, and that C is ill-suited for the problem?
Are you fucking stupid? Did it ever occur to your that people just don't give a fuck about some silly project-euler problem, or whatever it is?
>>
>>59110427
>>59110458
ah yes here they are
>>
>>59110375
>Learn OOP guys
Never. I have promised to never touch that piece of shit.
>>
>>59110499
kys yourself my man
>>
>>59110500
It's really not bad at all for big projects, but for a lot of stuff you don't need it
>>
>>59110500
You've made the right choice
>>
>>59110500
>tfw to smart for OOP
>>
With the whole CloudFlare debacle going on, this idea popped into my mind of writing a command line tool that would let you quickly and painlessly change passwords on popular websites

All you'd have to do is type something like "passchanger hackernews username old_password new_password" and be done with it, instead of going on each website individually, looking for the option buried who knows where

I don't actually have the time to do it and maintain it 2bh, so I'm just throwing it out here, hoping someone else could pick it up

What do you think?
>>
>>59110563
LastPass provides something similar desu
>>
>>59110571
Wtf i said desu, not desu
>>
>>59110580
Lurk more, newfag.
>>
>>59110584
This website suck baka
>>
>>59110534
It's straight up garbage. The size of the project plays absolutely no role here.
>>
New thread:
>>59110597
>>59110597
>>59110597
>>
>>59110592
Leave then. You won't be missed.
>>
>>59105708
What is a virtual method?
>>
What's the best method for getting console input in C++? I usually do
string etc_string;
getline(cin, etc_string);
//parse etc_string

And have a specific parser depending on what I need to do/the string is.
>>
>>59112263
>C++
stopped reading right there
Thread posts: 325
Thread images: 27


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