[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: 324
Thread images: 26

File: sexual experiments lain.jpg (45KB, 640x480px) Image search: [Google]
sexual experiments lain.jpg
45KB, 640x480px
Daily Programming Thread
What are you working on /g/?

Last thread >>56154748
>>
>>56161932
First for D
>>
>>56161932
>printf
>>
>>56161871
Real thread made 3 minutes before this
>>
File: 1461713939491.png (161KB, 500x255px) Image search: [Google]
1461713939491.png
161KB, 500x255px
Why do people make DSLs instead of just using Scheme?
>>
>>56162008
>3 minutes before this
1: 3 minutes before this the last thread was not over the bump limit
2: It was not linked in the last thread, DPTs are a linked list thus this is the only valid one.
>>
File: 1471628914.png (70KB, 655x499px) Image search: [Google]
1471628914.png
70KB, 655x499px
Python
>Python is dynamically but strongly typed

is that a correct way to think about it?

http://www.voidspace.org.uk/python/articles/duck_typing.shtml
>>
>>56161932
I think I'm ready to start learning a second language.

Is Javascript really as bad as people make it out to be?

Do I need it for jobs?
>>
File: coding is hard :(.png (761KB, 1205x1643px) Image search: [Google]
coding is hard :(.png
761KB, 1205x1643px
EVERYONE SHOULD LEARN TO CODE!
GIRL POWER!
>>
>>56162035
It's a linked list, just no doubly linked
>>
File: MTE5NTU2MzE2NjYxNTE1Nzg3.jpg (180KB, 1200x1200px) Image search: [Google]
MTE5NTU2MzE2NjYxNTE1Nzg3.jpg
180KB, 1200x1200px
>>56162049
You give me an anecdote and I give you one
>>
>>56162083
ok but she made cobol
>>
>>56162057
The new thread should link to the old and the old thread should link to the new. Seems like a double linked list to me.
In the past we had it so only the last thread needed to link to the new one but the double-linked system is better. However we never had it so only the new thread linked to the old one.
>>
>posting in retarded threads

>>56161481
>>56161481
>>56161481
is the real new thread
>>
>>56162037
It's difficult to distinguish between dynamically and statically typed languages nowadays. What some people might consider as dynamic typing might actually be a union that changes from a preselected range of types in the runtime. C and many statically typed languages have unions and could easily do that, it's just with more syntactic sugar.
>>
>>56162118
1: Your thread was made long before the bump limit
2: It was not linked in the last thread, DPTs are a linked list thus this is the only valid one.
>>
>>56162016
because Scheme is good for making DSLs
>>
>>56162037
Sounds more like a technicality.

I would not consider it a strongly typed language, even though it may technically be one, much the same as I do not consider a cucumber a fruit when I'm cooking.
>>
>>56162037
In an offtopic note: https://github.com/python/typing/issues/258
>>
File: 1468521957025.jpg (19KB, 583x429px) Image search: [Google]
1468521957025.jpg
19KB, 583x429px
Guess i'll post it here too

currently working on a project, and for the first time im trying to make an accompanying design document to help me stay organized and not have tiny snippets of notes everywhere.
So far this is what i have in the design doc:
>Definitions relating to project domain
>Project goals
>Software description
>list of ux elements
>criteria for completion
>milestones

So far this is all great and has helped me stay more focused and organized, but it doesn't really go into the code(classes,hierarchies,functions), so i find myself going back to my same old disorganized way.

How would i go about documenting the code?
>>
>>56162188
Write out EXACTLY what you need data-wise. Translate that to small lines/snippets of pseudocode.
>>
>>56162188
Personally, I find the Agile design to be great when I'm trying to determine actual tasks that need to be done.

The basic structure is:
Feature
User Story
Task

A feature is a particular function your software should perform, while user stories make up the various possible and desired interactions with the software (both from admin and user perspective), and each "story" can be broken out into specific tasks (the actual code you'll write).
>>
>>56162244
Sounds like some faggy bay area coder meme.
>>
>>56162365
It probably DID come from those bay area faggots, but it has to be one of the few things they did right.
>>
Can __builtin_apply and the rest of the extensions here https://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html be used instead of libffi?
>>
>>56162049

Women. Not even once.
>>
apply :: f -> [a] -> b
apply f args =
...


fill in this definition
>>
>>56161932
I once took an intro programming crouse in japan where we submitted by printing our code out on paper.
>>
File: shifting gears.jpg (381KB, 600x722px) Image search: [Google]
shifting gears.jpg
381KB, 600x722px
I think I want to learn R.

Anyone ever work with it?
>>
File: IMG-20160330-WA0000.jpg (21KB, 553x119px) Image search: [Google]
IMG-20160330-WA0000.jpg
21KB, 553x119px
>>56162403
Dunno. Tbh I feel that I could RTFM them right now while knowing nothing about them, get what both of them are for, and decide if it's close enough. That would make me feel good about showing off by answering some anon's question on an ephemeral medium, but if I'm able to, why aren't you?

TL;DR: why do you need to ask?
>>
>>56162521
wot
>>
>>56162544
i took an intro to C++ course once where the chapter tests, midterms and the final had you writing out entire programs on paper.

Compiler error = fail.
>>
>>56162562
how would you write apply in haskell
lisp can do it just fine
>>
>>56162106
So?
And Ada Lovelace was the first programmer.

(not the same anon by the way)
>>
>>56162609
no she wasn't

stop regurgitating feminist propaganda
>>
>>56162621
It's not even feminist propaganda. She literally predates feminism and so does the evidence. Not even the feminists can turn back time to change it.
>>
>>56162653
>evidence
But none of that stuff ever happened.
>>
>>56162653
> All but one of the programs cited in her notes had been prepared by Babbage from three to seven years earlier. The exception was prepared by Babbage for her, although she did detect a 'bug' in it. Not only is there no evidence that Ada ever prepared a program for the Analytical Engine, but her correspondence with Babbage shows that she did not have the knowledge to do so.[73]
>>
Fuck iterations.

Program against sets.
>>
>>56162700
how do you do anything with sets without iteration (^:
>>
>>56162712
I'll let the machine do the iteration.

The programmers job is merely to define the sets.
>>
>>56162550
yeah, its power is in the packages

learn how to work with them too
>>
>>56162791
I want to be able to use R practically, and I already know how to program.

Any particular book you would recommend?
>>
>>56162680
Anon-kun we know you are quoting conservapedia
>>
>>56162811
they way I learned it myself I wouldn't recommend for everybody, I read a very information dense tutorial/ebook from cover to cover

I don't know which book is best
>>
Has anyone here ever had experience sourcing the S-Boxes for Serpent?

I can only find optimised code for them but no specifications. DES came with it's 'supplementary material', and AES has similar, but Serpent has no such content that I have found thus far. I've read it's papers and submissions, but beyond code there is no definition or specification for any of them. I have a feeling there is a document I have missed or something. Please help.
>>
File: anal beads.png (7KB, 486x161px) Image search: [Google]
anal beads.png
7KB, 486x161px
Why do the rows get xbox hueg when one element is wider?
>>
>>56162829
http://ed-thelen.org/comp-hist/CBC-Ch-02.pdf
Sentence is along the page break from p88 to p89.
>>
>>56162929
Probably for alignment
>>
I need some help I am fetching information from json and printing it to console as well as to a file.

but in printing it to console I have this error:
Traceback (most recent call last):
File "Threadmon.py", line 34, in <module>
text_file.write(json[j]['threads'][i]['com'])
UnicodeEncodeError: 'cp932' codec can't encode character '\xe9' in position 687: illegal multibyte sequence


I am only just really starting out with python and this is something of a beginner project.
I am accessing json data and every time a post has Japanese in it, it throws an error, I am not sure how to deal with this.
I know my CMD is code page 932 but It has never problems deal with Japanese before and still doesn't outside of this error apparently.
I assume that one requesting the json data it gets encoded into the wrong type? or that write() assumes it is a certain type?
>>
How bad is this for an "infinite calculations calculator"? This was my first hometask.

#include <stdio.h>
#include <stdlib.h>

int main()
{
int inival, nextval, negnextval, dispresvaladd, calcresvaladd, dispresvalcon, calcresvalcon, dispresvalmul, calcresvalmul, dispresvaldiv, calcresvaldiv;

printf("Input your initial value ");
scanf("%d", &inival);

calcresvaladd=inival;
calcresvalcon=inival;
calcresvalmul=inival;
calcresvaldiv=inival;

loop:

printf("\nThank you. Now input your next value. Input zero to crash this plane with no survivors.\n");
scanf("%d",&nextval);

negnextval=-nextval;

dispresvaladd=calcresvaladd;
calcresvaladd=calcresvaladd+nextval;
printf("\n%d%+d=%d",dispresvaladd,nextval,calcresvaladd);

dispresvalcon=calcresvalcon;
calcresvalcon=calcresvalcon-nextval;
printf("\n%d%+d=%d",dispresvalcon,negnextval,calcresvalcon);

dispresvalmul=calcresvalmul;
calcresvalmul=calcresvalmul*nextval;
printf("\n%d*%d=%d",dispresvalmul,nextval,calcresvalmul);

dispresvaldiv=calcresvaldiv;
calcresvaldiv=calcresvaldiv/nextval;
printf("\n%d/%d=%d",dispresvaldiv,nextval,calcresvaldiv);

goto loop;

system("PAUSE");
return 0;
}
>>
>>56163049
>
  loop: ...  goto loop;


What the fuck.
>>
>>56163082
I haven't been taught any other way to cycle, I'm sorry. I did leave inputting zero as an option to stop the loop.
>>
>>56163049
>>56163092
use a while statement
>>
>>56163049
>those variable names
>goto loop instead of while(1)
>system("PAUSE")
>my eyes
>>
>>56163109
I promised my teacher not to use the things he hasn't told us of. He told us of the "goto" command in the context of "never do this", so it's not his fault
>>
>>56163049
Pretty much as bad as it gets, which has me wondering if this was carefully crafted for fat stacks of (You)s
>>
>>56163027
post the entire code block. most likely, you're opening the file with the wrong encoding.
>>
>>56162521
apply _ _ = undefined

is the only """"valid"""" answer
>>
>>56163164
import urllib.request
import json
import webbrowser

text_file = open("index.html", "w")
i = 0
j = 0
request = urllib.request.Request('http://a.4cdn.org/a/catalog.json')
response = urllib.request.urlopen(request).read().decode('utf-8')
json = json.loads(response)
threads = len(json[0]['threads'])
pages = len(json)
text_file.write("<html>")
text_file.write("<title>/a/ Catalog Python</title>")
text_file.write("<h1>/a/ Catalog Python<h1>")
text_file.write("<body bgcolor=\"#EEF2FF\">")
text_file.write("<table border=\"1\">")
print(" Fetching json from /a/ @ 4chan")
while j < pages:
text_file.write("<tr>")
while i < threads:
if 'tim' not in json[j]['threads'][i]:
text_file.write("<td><img src=\"http://s.4cdn.org/image/filedeleted-res.gif\">")
else:
print ("tim images parsed: "+str(json[j]['threads'][i]['tim'])+"s.jpg")
text_file.write("<td><img src=\"http://i.4cdn.org/a/"+str(json[j]['threads'][i]['tim'])+"s.jpg\">")
text_file.write("<br>")
text_file.write("Thread: <a href='http://boards.4chan.org/a/thread/"+str(json[j]['threads'][i]['no'])+"'>"+str(json[j]['threads'][i]['no'])+"</a><br>")
if 'sub' in json[j]['threads'][i]:
print("Thread title: "+str(json[j]['threads'][i]['sub']))
text_file.write("<h4>"+str(json[j]['threads'][i]['sub'])+"</h4>")
else:
print("Thread OP: "+str(json[j]['threads'][i]['com']))
text_file.write(json[j]['threads'][i]['com'])
i+=1
text_file.write("</td>")
text_file.write("</tr>")
j+=1
i=0
text_file.write("</table>")
text_file.write("</html>")
text_file.close()
print(" ")
print(" Number of Pages: "+str(pages)+". Number of threads: "+str(threads)+".")
print(" 4chan JSON fetched and written to index.html")
new = 2
url = "file:///F:/Programming/python/web/index.html"
webbrowser.open(url,new=new)
>>
i'm learning c++ as a hobby, and thinking to learn another language. what language should i focus, after c++?
>>
>>56163212
You should've started with C
>>
>>56163212
BASIC and MIPS
>>
>>56163212
c# or java
>>
>>56163212
Java or C#.

Maybe even Javascript if you want to go full employable.
>>
>>56163212
Haskell
>>
>>56163212
but instead of learning another language improve your c++ skills. c++ is a very powerfull programming language
>>
>Scalars, or individual numbers, do not really exist in R. As mentioned earlier,
what appear to be individual numbers are actually one-element vectors.

I'm okay with this.
>>
>>56163196
I'm not really sure why your interpreter is trying to write with the encoding cp932. Try opening the text file with:

text_file = open('index.html', 'w', encoding='utf-8')
>>
>>56163333
that's the same as with APL, J, etc.
>>
>>56162555
Don't talk if you do not know the topic.
>>
>>56163212
BCPL

Its what I use at work and its great! They want to start porting things to Java but im like, nuuh.
>>
>>56163374
doesn't matter, it's being written fine
he's printing it to the console, except he's using windows so he has CMD which is from the stone age
http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how/
>>
>>56163049
you should
just
maybe
kys?

and include conio.h
>>
>>56163508
whats conio.h?
>>
a header of c xD >>56163521
>>
>>56163481
oh right - I've never had to worry about that.
>>
>>56162521
In LISP's case the function is actually:
apply :: ([Dynamic] -> Dynamic) -> [Dynamic] -> Dynamic
apply f args = f args
Which is of course perfectly valid Haskell.
>>
>>56163748
Hurr. I think I forgot my / in the end code tag.

It looks like a vestige of /prog/. Makes me nostalgic.
>>
>>56162037

>(or hopefully her)
>>
Is it considered bad form to write Python scripts using a lot of subprocess.run() to basically substitute Bash scripts?

I don't want to learn proper Bash scripting and I want to write a few convenience tools.
>>
>>56161867
Reposting in the interest of readability.

Tilde is an assertion that types are equal. (a ~ b) is read "type
a unifies with type b," so a and b may be substituted for one another.

Begin with unknown universal types for each subexpression.
f x = f (f x)
f x = (f :: a) ((f :: b) (x :: c) :: d) :: e

Like terms f unify, a ~ b:
f x = (f :: a) ((f :: a) (x :: c) :: d) :: e 

Observe the inner subexpression:
((f :: a) (x :: c) :: d)

We see f applied to x, so it must be a function of x's type with the given
result type, i.e. a ~ (c -> d)
f x = (f :: c->d) ((f :: c->d) (x :: c) :: d) :: e

Now ignore the inner expression, but for its overall type:
f x = (f :: c->d) (_ :: d) :: e

We see f applied to an argument of type d, so c ~ d:
f x = (f :: d->d) (_ :: d) :: e

We have already proved that (f :: d -> d), but for the sake of
completeness we see that the overall result type also unifies with f's
domain, i.e. d ~ e, given the final typechecked expression:
f x = (f::d->d) ((f::d->d) (x::d) :: d) :: d
>>
>>56162016
Because they have working brains
>>
>>56163846
No, there is nothing wrong with that. Really is no reason to use bash especially since most distros have Python included.
>>
>>56163867
And since the thread is deleted and rbt seems down, the post in question said something like this:

Prelude> :t let f x = f (f x) in f
let f x = f (f x) in f :: t -> t

>Haskellfags will defend this
>>
>>56162521
apply f args = f <*> args
>>
>>56163961
monomorphism
>>
whats better, a function that:
>returns an error code and does a side effect
>raises an exception if needed but is otherwise pure
>is 100% pure and exceptions are disabled during compilation
>>
>>56163995
use pure functions with monads
>>
>>56163968
That doesn't have the same type either.
 apply :: Applicative f => f (a -> b) -> f a -> f b


>>56163978
t -> t is clearly not monomorphic. What are you even saying? I already gave the typechecking proof that f :: t -> t, and it has nothing to do with the monomorphism restriction, if that's what you're trying to say.
>>
>>56164026
apply f arg = purge f <*> arg
>>
>>56163995
>is 100% pure and exceptions are disabled during compilation
This. Exceptions and side-effects should be avoided.

retval, error = function(input)
>>
>>56164050
fuck
*pure
>>
anyone here ever written any video game bots before?
id like to knock one up in a platform agnostic language like python, but as far as i can see the only library for manipulating the mouse and keyboard is windows only.

ideally id like to write it in something fairly high level, so i dont have to piss about with needless OOP and low level shit
>>
>>56163783
/prog/ still exists
>>
>>56163995
last one
just use Maybe for possible error
Either when you want more info
>>
>>56164095
https://github.com/PyUserInput/PyUserInput

caveat: no keyboard input on macOS
>>
>>56163995
Reverse the order and you have them ranked by best to worst.
Exceptions suck, but a sufficiently smart / paranoid compiler knows if you forgot to handle them all and can force you to (or at least raise a warning).

I'm not always 100% against side effects, but I don't want them happening during errors.
>>
too many hasklelfags
>>
File: STRENGTH THROUGH PURITY.png (36KB, 2000x1412px) Image search: [Google]
STRENGTH THROUGH PURITY.png
36KB, 2000x1412px
>>56164209
never too many
>>
>>56164209
I see you like your languages like you like your waifus
Impure
>>
>>56164243
>>56164358
>evaluating the same thing twice
What happened to call by need?
>>
C++ question.

Why does this work fine:
std::time_t seconds(uptime);


But when using an initializer list like this, I get a conversion narrowin warning?
std::time_t seconds{uptime};
>>
>>56164372
Memoizing eval'd thunks is not the same thing as common subexpression elimination, which you can't do completely unless you want programs of infinite size.
>>
>>56164400
typedef /* unspecified */ time_t;

>unspecified type
it may not be a bare integer on your system
>>
>>56164546
I do realize that, I just would like to know why it does not throw a warning in the first case, but does throw a warning on the second case even though both snippets are built on the same system, compiler, and using the same flags. Is there any reason why the initializer list would throw a warning but a regular object initialization not?
>>
>>56163995
d) Takes a continuation for success and a continuation for failure.
>>
>>56164605
Algebraic effects are good for this.
>>
Classes are such fucking bullshit. I hate programming. What retard invented this dumb shit?
>>
>>56164743
What's the problem buddy? You simply define a set of common functions and variables that define a class which then you turn into instances.
>>
>>56164743
Bjarne invented C in 1922
>>
>>56164785
But why do they each have their own variables? How do I get the other variables?
>>
>>56164570
type time_t struct { butts string, lolcode int, in_time int};

time_t constructor(in_time int) {
return time_t {"idk", 1, in_time}
}


>why it does not throw a warning in the first case
because you used time_t's constructor correctly

>but does throw a warning on the second case
Probably because you tried to shove an int into a struct you don't know the fields of. In the case of the above example type, you tried to put an integer into a string field.
>>
>>56164743
>>56164799
Learn the difference between "class" and "object".
>>
>>56164812
I know the difference, but what I'm saying is why the fuck do they exist at all? Why can't I just get the variables when I ask for them instead of jumping through a dozen hoops?
>>
>>56164842
Get what variables?
>>
>>56164799
Percisely because they're "instances" with common "interface".

Take this C code:

struct Person {
int age;
int height;
};

struct Person *person_create()
{
return malloc(sizeof(struct Person *));
}

void person_delete(struct Person *person)
{
free(person);
person = NULL;
}

int person_get_age(struct Person *person)
{
return person->age;
}

void person_set_age(struct Person *person, int age)
{
person->age = age;
}

struct Person *joe = person_create();
person_set_age(joe, 15);

struct Person *alice = person_create();
person_set_age(alice, 10);

fprintf(stdout, "Joe is %d, Alice is %d.\n", person_get_age(joe), person_get_age(alice));

person_delete(joe);
person_delete(alice)l


Now, in OOP terms it's something like this:
struct Person
{
int age;
int height;

const int getAge() const { return age; }
const int getHeight() const { return height; }

void setAge(const int age) { this->age = age; }
void setHeight(const int height) { this->height = height; }

Person(): age{0}, height{0} { }
};

Person *joe = new Person;
joe->setAge(15);

Person *alice = new Person;
alice->setAge(10);

fprintf(stdout, "Joe is %d, Alice is %d.\n", joe->getAge(), alice->getAge());

delete joe;
delete alice;


Thus why they "do not share the variables", if you want to share a variable, you need to make it static.
>>
>>56164842
Either make them public or expose them through getters. Not exactly a dozen hoops.
>>
>>56162126
and the type of the union is what? -- a union!

your post has a lot of disinfo in it. it's extremely easy to distinguish statically typed versus dynamically typed languages.

most commonly, dynamically typed languages can have variables declared with no type. this is because they are dynamic.
>>
>>56164875
Untyped =/= dynamic

Dynamic types can be recovered with static types if you have dependent pairs and RTTI.
>>
>>56164875
>dynamically typed languages can have variables declared with no type
dynamic typing != implicit typing

>and the type of the union is what? -- a union!
And this is wrong, it shows that the type of the variable is one of the listed types.
>>
can your language do this
>>
whats the best ganoo text editor that isnt vim, emacs, nano, ed, doesnt include half of chrome, doesnt require gnome desktop to be installed, and doesnt fucking crash every time i open a file dialog? im fucking tired of having to jump through hoops just to fucking write some code and have basic features like bracket insertion, autocomplete, autoindentation, and syntax highlighting
>>
>>56164802
>Probably because you tried to shove an int into a struct you don't know the fields of. In the case of the above example type, you tried to put an integer into a string field.

I don't think that's the case. It still calls time_t constructor with int paremeter when invoked through an initializer list. To further debunk that statement, it returns the correct output when invoked through initializer list - that wouldn't be the case had the string been initalized instead. I'm looking around and it seems that the standard explicitly states that a warning (diagnostic message) should be issued when a value is downcasted in an intiailizer list, but no mention of it when using a regular constructor syntax. Unless I'm misunderstanding what they just quoted from the standard.
>>
>>56164916
what's static linking?
>>
>>56164916
Statically link the whole standard library?
>>
>>56164916
>1.2M
no
>>
>>56164926
Kate
>>
>>56164899
>dynamic typing != implicit typing
yes it is.

>>56164893
>Untyped =/= dynamic
no one cares about the underlying nature of the language. the point of dynamic types is that you don't need to worry about manually declaring whatever type it might be. when the language can do it itself at compile time
>>
>>56164916
$ echo -e 'package main\nfunc main(){\n\tprintln("hello world!")\n}' > hello.go
$ go build -ldflags '-s' hello.go
$ du -h hello
616K hello
$ ldd ./hello
not a dynamic executable
$ ./hello
hello world!
>>
>>56164977
thats exactly the fucking editor that keeps fucking crashing on me
>>
>>56164986
Untyped =/= dynamic =/= implicit/inferred
>>
>>56164986
>Haskell/ML/Ocaml are dynamic typed
Ok, you have proven yourself to be a retard.
>>
>>56164991
Works on my machine, post whatever error you get when running it from the console.
>>
>>56165004
yeah, this was my whole point. any language where you're typing out the type, e.g. Integer, is one that is statically typed.
>>
>>56164959
>tfw hate that haskell binaries are big
srs, st the simple terminal or whatever, is like 160 kilobytes
wtf?
I wonder how big is bspwm
>>
File: Screenshot_2016-08-19_16-14-08.png (565KB, 1031x511px) Image search: [Google]
Screenshot_2016-08-19_16-14-08.png
565KB, 1031x511px
>>56164916
>>56164989
We comparing Hello World sizes here or what?
>>
File: 1461444393999.gif (2MB, 320x180px) Image search: [Google]
1461444393999.gif
2MB, 320x180px
>>56165032
>>
Does /g/ qualify?

//check to see if the customer qualifies for a special interest rate
#include <iostream>
using namespace std;

int main()
{
char employed,
graduate;

cout << "Are you currently employed? (y/n) ";
cin >> employed;
cout << "Are you a graduate? (y/n) ";
cin >> graduate;

if (employed == 'y' && graduate == 'y')
{
cout << "Congratulations, you qualify for the\n"
<< "special interest rate.";
}
else if (employed == 'y' && graduate == 'n')
{
cout << "Sorry, you must be a graduate.";
}
else if (employed == 'n' && graduate == 'y')
{
cout << "Sorry you must be employed.";
}
else if (employed == 'n' && graduate == 'n')
{
cout << "You must be employed and have graduated\n"
<< "to qualify for the special interest rate";
}
else
cout << "Invalid entry, try again.";


}
>>
>>56165029
id rather not have to wait 10 fucking minutes for the program to die
>>
>>56164991
WORKSFORME

>>56165039
hey chris, use du -b instead of du -h
>>
>>56165032
You don't know what you are talking about.
>>
Best way in Java to match together 3-4 types of data that rely uppon each other, without changing the classes themselves?

e.g. 3 zoos, 5 animals in first zoo, 4 in 2nd, 1 in 3rd, and then each animal has some nickname, maybe add something else.

I realise something like this should be handled by classes, whole point of OOP, but outside of messing with classes, how to handle this?

Only idea I have so far is one HashMap to match Zoos with list of Animals, and then another HashMap which contains all Animals matched with their nicknames, new information would complicate this even further.
>>
>>56165064
>>56165041
>C is dynamically typed
wew these fuckin academics thinking they know shit
>>
File: Screenshot_2016-08-19_16-17-31.png (27KB, 649x31px) Image search: [Google]
Screenshot_2016-08-19_16-17-31.png
27KB, 649x31px
>>56165062
>>
>>56165052
You can just kill it.

>>56165078
Ehm, dude, we never said that, are you dense?
>>
>>56165078
Who are you quoting?
>>
>>56165090
>>56165088
both of u nerds who don't konw shit about programming, probably fell for the CS meme shit ur spouting shit about haskell
>>
>>56165070
Just store them together in pairs?
>>
>>56165088
you think i havent tried that? i dont know what the fucks going on, but sigkill doesnt kill it
>>
>>56165098
>u
>ur
ah, the pretending to be retarded thing again
>>
>>56165112
you're an idiot who doesn't know shit about typing?
happy?
>>
>>56162126
>What some people might consider as dynamic typing might actually be a union that changes from a preselected range of types in the runtime.
those are literally the same thing
>>
>>56165105
You make no sense, you said it crashes, not freezes

>but sigkill doesnt kill it
You are doing something wrong then.

You can't get help if you do not post what it says at the console.
>>
>>56165122
Dynamic type means ANY type.

>>56165119
If you have to write the type, it's manifest typing. You can have static typing that is not manifest, but it never makes sense to have manifest dynamic typing and certainly not with no types at all.
>>
>>56165152
i dont want help with it, i just want an alternative
>>
File: ENOUGH.jpg (29KB, 412x430px) Image search: [Google]
ENOUGH.jpg
29KB, 412x430px
QUICK, MAKE A GUESS A NUMBER PROGRAM IN YOUR FAVORITE LANGUAGE

THE USER MUST INPUT UNTIL HE GUESSES
EVERYTIME HE INPUTS, YOU HELP THE USER BY GIVING HINTS (I.E. HIGHER | LOWER)
WHEN HE GUESSES RIGHT, YOU TELL THE USER HOW MANY INPUTS HE GAVE
I.E GUESSES: 9

DO IT OR STABBY WILL COME
>>
>>56165119
Bitch please, I have a BA, MSci and Phd on type theory. Thus, as you can see, I am a qualified type theorist. I am at the top of my field as I have published over 300 papers on type theory. Moreover I teach in one of the most prestigious universities in the world. You little commoner do not have the brains, nor the knowledge, nor the money to ever become half as qualified in type theory as I am.
>>
>>56165209
Just kill me, I don't feel like doing anything right now
>>
>>56165104
What you mean, in pairs?

HashMap within a HashMap?
>>
>>56165257
Well, do you really need to be able to look up a list of animals by zoo or a nickname by animal? Or can you simply store/pass/whatever the zoo and its animals together?
>>
>>56165224
I FUCKIN STABBED YOU
DIE, SCUM
>>
how the fuck do you rotate a list of tuples in python?
a = [(195, 89, 89), (255, 255, 255), (255, 255, 255),
(195, 89, 89), (255, 255, 255), (195, 89, 89),
(195, 89, 89), (255, 255, 255), (255, 255, 255),
(195, 89, 89), (195, 89, 89), (255, 255, 255),
(195, 89, 89), (255, 255, 255), (255, 255, 255),
(195, 89, 89)
]

b = zip(*a[::-1])

outputs:
b = [(195, 255, 255, 195, 255, 195, 195, 255, 255, 195, 195, 255, 195, 255, 255, 195),
(89, 255, 255, 89, 255, 89, 89, 255, 255, 89, 89, 255, 89, 255, 255, 89),
(89, 255, 255, 89, 255, 89, 89, 255, 255, 89, 89, 255, 89, 255, 255, 89)
]



as you can see i doesn't maintain the order

a is a list of tuples (3 each)
b is a list of tuples (16 each) instead of 3
>>
>>56165284
It's a group project and so far my job is to store this info somewhere, it will be used in the future by something.

And no, the zoo cannot 'contain' animals in the OOP sense, an outside class has to keep track of them both.
>>
>>56165209
#!/usr/bin/env python
import random
number = random.randint(0, 100)
print('Guess the number between 1 and 100')
userInput = None
while userInput != number:
userInput = int(input('Your guess> '))
print('Higher' if userInput < number else 'Lower' if userInput > number else 'DING DING got it right')
>>
>>56165318
what do you mean by rotate?
like
a = (1,2,3)
rotated = (2,3,1) or (3,1,2)

?
>>
>>56165209
Int answer=7
Int counter = 1
While(guess!=answer)
Scanf guess
If (guess>7)
Printf too much
Else if (guess<7)
Printf too low
Else if (guess==7)
Printf you got it on the %dth try, counter
Counter++
>>
>>56165343
[x] stab
>>
>>56165329
class ZooWithAnimals {
Zoo zoo;
List<Animal> animals;
}

???
>>
>>56165332
rotate 90 degrees:
like this
zip(*[(195, 89, 89), (255, 255, 255), (255, 255, 255)])


output
[(195, 255, 255), (89, 255, 255), (89, 255, 255)]
>>
>>56165209
STABBY PLS GO AWAY AND STAY AWAY

math.randomseed(os.time())
local number = math.random(100)
local choice = 0
local guesses = 0

while not choice or choice ~= number do
choice = tonumber(io.read())
if not choice then
print('Please enter a valid number.')
elseif choice < number then
print('The number is higher.')
elseif choice > number then
print('The number is lower.')
end

guesses = guesses + 1
end

print(('Correct! It took you %d guesses.'):format(guesses))
>>
>>56165209
int target = new Random().Next(1,11);
int tries = 0;
while(true)
{
Write("Make a guess: ");
int guess = 0;
if (int.TryParse(ReadLine(), out guess))
{
tries++;
if (guess == target)
break;
else
WriteLine(guess > target ? "Lower" : "Higher");
}
else
WriteLine("Invalid Input");

}
WriteLine($"Congratulations - You won with {tries} guesses.");
ReadKey();


Hastily thrown together.
>>
>>56165377
>>56165390
>>56165330
shitty langs
>>
>>56165418
shitty taste
>>
>>56165365
so, change the two second items of the first tuple with the first of the two remaining tuples?

i.e
rotate [ (a,b,c),(d,e,f),(g,h,i) ] == [ (a,d,g),(b,e,f),(c,h,i) ]
>>
>>56165431
It's about facts, not taste.
>>
>>56161932
Gotta start relearning some Java because I'm going to be a lab assistant for one of the beginner IT courses. The lab itself is basically going to be two hours of me and a grad student helping a bunch of students figure out why their program for the lab assignment isn't working, so nothing super demanding.
>>
>>56165209
I haven't learned about for loops or while statements so I cannot do what you asked, sorry
>>
>>56165209
(defun guess-num ()
(let ((num (random 100))
(num-inputs 0))
(loop do
(format t "guess a number ")
(let ((guess (read)))
(incf num-inputs)
(cond
((> guess num) (format t "lower!~%"))
((< guess num) (format t "higher!~%"))
(t (format t "Guessed correctly with ~a inputs!~%" num-inputs)
(loop-finish)))))))
>>
>>56165418
hot pinion
>>
>>56165444
rotate 90 degrees clockwise
zip(*[(1,2,3), (4,5,6), (7,8,9)])


output
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
>>
>>56163212
>after c++
kek
>>
>>56165478
oh, I see, I think I understand
and oyu want this done in terms of 3
>>
>>56163212
Learn Rust instead of C++. It's better than C++ for all the same reasons that each iteration of C++ is better than the last.
>>
File: 1463593292471.jpg (143KB, 800x857px) Image search: [Google]
1463593292471.jpg
143KB, 800x857px
So I'm scraping a website that is aids infested autism, and I would like some help with writing a regex for this shit.

On good days, the text I'm looking for will look like this:
"Payout: 15.210 USD"


But sometimes, it can look like this:
"Payout: 15</span><span class="W">.210 USD"


And sometimes even:
"Payout: 15.210</span><span class="W">USD"

I'm not sure if the tags are the same each time it happens, but probably not.

How do I safely extract the payout without all the shit tags cucking my shit?
>>
>>56165494

well the solution is using zip(*your_list_here), but if you have a list with a lot of tuples, it doesn't work somehow
>>
So, K&R or Allman?
>>
>>56163212
C++ is like quicksand

there's no after C++ if you try to master C++, so get out while you still can and become employable with normal languages
>>
>>56165519
> regex
just use a peg or something and skip tags
>>
>>56165519
Just remove "</span><span class="W">" from the string if it exists, what do you need regex for?
>>
>>56165519
Use a library that's designed for parsing HTML rather than nigger parsing with regex and then extract the raw value with stripped tags. If you're using Python then just use BeautifulSoup, otherwise I don't know but regex is never the answer for parsing HTML.
>>
>>56165519
you haven't said what website, or what language/libraries
you also haven't said what you've tried/where you're stuck
>>
>>56165363
Yeah that's what I suggested doing since it's the OOP approach and I'll probably go with something like that, ty
>>
>>56165519
Why the fuck wouldn't you just strip tags out of whatever you're scraping first?

Once you've used the tags to locate things you no longer need them.
>>
>>56165607
It's not the OOP approach, it's the straightforward approach I was saying all along but in Javaese because you don't seem to understand what a "pair" is.
>>
>>56165209
#include <stdio.h>
#include <stdlib.h>

int main()
{
srand(420);
int num = rand();
int count = 0;
int guess = 0;
while(num)
{
int guess;
scanf("%d", &guess);
if(guess > num)
puts("Too high\n");
else if(guess < num)
puts("Too low\n");
else
{
printf("Correct in %d guesses\n", count);
num = 0;
}
count++;
}
return 0;
}
>>
>>56165627
What is this cancerous indenting lmao
>>
File: disgusting.jpg (75KB, 450x450px) Image search: [Google]
disgusting.jpg
75KB, 450x450px
>>56165627
>That indenting
>>
>>56165659
#include <stdio.h>
#include <stdlib.h>

int main()
{
srand(420);
int num = rand();
int count = 0;
int guess = 0;
while (num)
{int guess;
scanf("%d", &guess);
if (guess > num)
{
puts("Too high\n");}
else if (guess < num)
{
puts("Too low\n");
}
else
{
printf("Correct in %d guesses\n", count);
num = 0;
}
count++;}
return 0;
}
>>
>>56165209
loop():-
Num is rand(10),
Count is 0,
take_input(Num, Count),
write("it took you"), write(Count), write("tries"), nl,
loop().

take_input(Num, Count):-
write("enter a number between 0 and 10"), nl,
read(Input),
process_input(Num, Input).

take_input(Num, Count):-
Count1 is Count+1,
take_input(Num, Count1).

process_input(Num, Input):-
Num = Input,
write("correct!"), nl.

process_input(Num, Input):-
Num > Input,
write("its higher"), nl,
fail.

process_input(Num, Input):-
num < input,
write("its lower"), nl,
fail.
>>
File: cmd_2016-08-19_17-59-52.png (12KB, 960x480px) Image search: [Google]
cmd_2016-08-19_17-59-52.png
12KB, 960x480px
>>56165209
#include <iostream>
#include <random>

int generate_random_number()
{
std::random_device r;
std::mt19937 m(r());
std::uniform_int_distribution<int> uid(0, 100);
return uid(m);
}

int main(int argc, char *argv[])
{
int actual = generate_random_number(), guess;
char choice;
bool play_again = true;
while (play_again) {
do {
std::cout << "Enter guess: ";
std::cin >> guess;
if (actual > guess) {
std::cout << "Higher!\n";
}
else if (actual < guess) {
std::cout << "Lower!\n";
}
} while (guess != actual);
std::cout << "Correct!\n";
std::cout << "Play again? (y/n) ";
std::cin >> choice;
if (choice == 'y') {
actual = generate_random_number();
}
else if (choice == 'n') {
play_again = false;
}
}
return 0;
}
>>
>>56165627
>just guess a number between 0 and RAND_MAX

are you fucking kidding me
>>
>>56165599
Isn't regex pretty much the same in all languages?
Right now I just have:
"Payout: ([\d\.]+) USD"


>>56165611
>>56165594
Stripping all tags out seems like a really time consuming and messy way of solving the problem. I can't use the tags to find shit, because they're all span tags that are almost exacly identical. Right now I'm using the regex to find and extract the payout, so if there is tags in the middle of it, it won't find it.
>>
>>56162047
Newfag here. Can anyone answer this?
>>
>>56165783
What language are you using?

If you're using C# you should be using the AngleSharp lib where you can use CSS selectors and make your life much easier.
>>
>>56165783
that regex won't match anything until you strip the tags
>>
>>56165817
Learn C. If you already know C, then learn Haskell and buy into the functional meme (it'll make you a better C programmer).
>>
>>56165209
import System.Random

main = do
putStr $ "guess a number between " ++ show rng ++ ": "
fst . randomR rng <$> newStdGen >>= loop 0
where rng = (1,1000)

loop c n = do
i <- read <$> getLine :: IO Int
if i==n then putStrLn $ "you win\nguesses: " ++ show c
else if (i<n)
then write "higher: "
else write "lower: "
where write s = putStr s >> loop (c+1) n
>>
>>56165831
how was the day, in the freedom land?
>>
>>56165880
how do you know where I live?
>>
>>56165893
Americans are really retarded
>>
>>56166043
>be europoor
>get butthurt at America over nothing
evrytiem
>>
>>56166111
>being retarded for no reason
>hurr durr he is butthurt

lol
>>
>>56166130
>say the truth
>doubles down on the butthurt
lmao
>>
>>56165511
>Rust
You're still at it.
>>
>>56166164
>being this butthurt
kek
>>
>>56166176
At what?
>>
>>56166179
>projecting your butthurt onto me
lel
>>
>>56166190
Shilling your vaporware language.
>>
>>56166194
>still asspained
ayy
>>
>>56166221
>bootybothered
wew
>>
>>56166238
>still aggrieved

can't make this up
>>
>>56166216
What's vaporware about it?
>>
>>56166267
>still derriere-decimated
Amazing
>>
>>56166286
>being this patootie perturbed
lmao
>>
>>56166311
>He is this rump-ravaged
How does he do it?
>>
CHALLENGE OF THE THREAD

Write a pseudo-random number generator
>>
>>56166336
>still scorned about it
Lol
>>
How do you motivate yourself once you solved the core problem?

I spent the last weeks reverse engineering and my motivation dropped to 0 after the proof of concept. But I have to write an article now, polish the code etc... ZERO MOTIVATION
I hate this
This is why most of my projects are never finished
Polish is boring and tedious
>>
I keep hearing about it, but I see nothing on it. What exactly is raycasting? I'm not talking about Wolfenstein 3D or DOOM, i'm talking about scanning nearest points to an entity.

Like in a 2D plane, there's the x axis and the y axis. What I assume is that at the beginning of the logic loop I go through the entities and scan their nearest points.

I would also assume you handle them individually per axis.

So in a 2D tile based game, when moving on the x-axis, you scan in the direction you are heading, but narrowing down your scan range to columns your entity intersects with.

Is this correct?

Also what is fixed-point and how do I do that?
>>
>>56166429
>Polish is boring and tedious
do you prefer russian?
>>
>>56162811
http://www.studytrails.com/blog/15-page-tutorial-for-r/
to get the broad overview, then it depends on what you want to do with R
i also went through a tutorial book front-to-back because i wanted to use it for ML book was
O'Reilly's Machine Learning for Hackers
>>
In school I learned a lot of C++ and had to use it in a lot of my classes but for some reason we never learned modern C++ (like C++11, auto, the constructs formatting things). Is there any way to learn that stuff really fast, because I'm afraid I'll apply to jobs with my antiquated knowledge.

I'm looking at code for things I want to do like flight simulators (in C++11) and I understand like 50% of the format. How do I get it naturally?
>>
>>56161932
> ¥n
Damn you SHIFT-JIS!
>>
>>56166282
It's a language for writing vaporware.
>>
>>56166583
How do you figure?
>>
Stupid question, i have a program to do for school and its the first time ive used java in 3 months.
Why do i have a syntax error here
>>
>>56166868
howling
>>
>>56166868
I mean why do i have errors on lines 10 13 14

(i fixed the missing ; )
>>
>>56166902
Fix your brackets.
>>
>>56166868
seems like it's the first time you're doing programming as well
>>
File: 1278464583633.jpg (33KB, 405x297px) Image search: [Google]
1278464583633.jpg
33KB, 405x297px
>>56166868
>>
File: csgrad.png (77KB, 694x801px) Image search: [Google]
csgrad.png
77KB, 694x801px
>>56166929
public static void main(String[] args) {
Void Fraction;
}
>>
>not hosting your business homepage on Tor
>>
>>56166868
press Ctrl+Shift+F and you should be able to see the problem.
>>
>>56166868

Because you can't program for shit
>>
>>56165209
import random

random.seed() #Probably don't need this

num = random.randint(1, 100)
count = 0

while True:
guess = int(raw_input("Pick a number between 1 and 100: "))
count = count + 1
if guess < num:
print "Too low!"
elif guess > num:
print "Too high!"
else:
break
print "Congrats, you've guessed the number! It took you " + count + " tries."
>>
Is the autist throwing tantrums over interpreters throwing a type error still here?
>>
So now that school is starting I guess we can expect all these new programmer posts asking about what while statements and using if else to make boolean variables
>>
>>56167207
>So now that school is starting
It doesn't, we have more than a month left.
>>
>>56167230
Not for those of us on the semester system

I start next Wednesday
>>
File: CS Graduate.png (61KB, 459x475px) Image search: [Google]
CS Graduate.png
61KB, 459x475px
i have solved fizzbuzz, r8 my solution

Console.WriteLine("1");
Console.WriteLine("2");
Console.WriteLine("fizz");
Console.WriteLine("4");
Console.WriteLine("buzz");
Console.WriteLine("fizz");
Console.WriteLine("7");
Console.WriteLine("8");
Console.WriteLine("fizz");
Console.WriteLine("buzz");
Console.WriteLine("11");
Console.WriteLine("fizz");
Console.WriteLine("13");
Console.WriteLine("14");
Console.ReadLine();
Console.WriteLine("fizz buzz");
Console.WriteLine("16");
Console.WriteLine("17");
Console.WriteLine("fizz");
Console.WriteLine("19");
Console.WriteLine("buzz");
Console.WriteLine("fizz");
Console.WriteLine("22");
Console.WriteLine("23");
Console.WriteLine("fizz");
Console.WriteLine("buzz");
Console.WriteLine("26");
Console.WriteLine("fizz");
Console.WriteLine("28");
Console.WriteLine("29");
Console.WriteLine("fizz buzz");
Console.WriteLine("31");
Console.WriteLine("32");
Console.WriteLine("fizz");
Console.WriteLine("34");
Console.WriteLine("buzz");
Console.WriteLine("fizz");
Console.WriteLine("37");
Console.WriteLine("38");
Console.WriteLine("fizz");
Console.WriteLine("buzz");
Console.WriteLine("41");
Console.WriteLine("fizz");
Console.WriteLine("43");
Console.WriteLine("44");
Console.WriteLine("fizz buzz");
Console.WriteLine("46");
Console.WriteLine("47");
Console.WriteLine("fizz");
Console.WriteLine("49");
Console.WriteLine("buzz");
Console.WriteLine("fizz");
Console.WriteLine("52");
Console.WriteLine("53");
Console.WriteLine("fizz");
Console.WriteLine("54");
Console.WriteLine("buzz");
Console.WriteLine("fizz");
Console.WriteLine("57");
Console.WriteLine("58");
Console.WriteLine("fizz");
Console.WriteLine("fizz buzz");
Console.WriteLine("61");
Console.WriteLine("62");
Console.WriteLine("fizz");
Console.WriteLine("64");
Console.WriteLine("buzz");
Console.ReadLine();
>>
>>56165209
import random

def guess():
n=random.randint(0,1000)
count=0
while True:
guess=float(input("Enter your guess:\n"))
count+=1
if guess==n:
print("Correct, no of guesses: %i" %count)
break
elif guess<n:
print("too low, try again")
elif guess>n:
print("too high, try again")
>>
>>56167255
Hahahahahhaha, fucking homos.
Do you have general edu as well?
>>
>>56166868
This is too good

>just installed ubuntu 5 minutes ago
>src/default package
>names his scanner numerator, while capitalizing his variables
>0 indentation

Take a course first please and spare us of your horrible, horrible code until it is finished
>>
>>56167302
4 upper div babe
3 in my major and one just for fun
>>
>>56161932
how does memory adressing working assembly work in two sentences ?

if my cpu only talks in 32/64 bit instructions how can I tell the cpu to move value in 0x000001 to 0xffff32 I'd need at least 64 bits for a 32 bit cpu, wouldnt I ?
>>
>>56167293
oops, float(input...) should be int(input...)
>>
>>56167333
wat
>>
>>56167303
thats not how you encourage people, he obviously does not know what he's doing wrong or its bait in which case: fuck me, I fell for it again
>>
>>56167333
push eax
mov eax, [0x000001]
mov [0xffff32], eax
pop eax
>>
>>56167398
if its not too much, how does this "get processed" by the CPU, obviously it cant take more than 64 bit "words" can it, where am I wrong here ?
>>
Why would anyone use Javascript when Typescript exists?
>>
>>56167465
Why would anyone use *script when Emscripten exists?
>>
>>56167424
It don't really understand what you mean, but neither
0x000001
, nor
0xffff32
are 64bit, or 32bit for that matter, though since you use them as memory addresses they are interpreted to 32bit or 64bit addresses depending on your cpu.

The snippet I posted does this:
Pushes eax on the stack, to store any data there, this is not necessary if you know what's in eax, and whatever it is can be thrown away.
Moves whatever the memory location
0x000001
contains into eax.
Moves what has been put into eax into memory location
0xffff32
.
These two moves are necessary, since you cant move data directly from one memory location to another.
Pops the old eax value of the stack and back into eax, i.e. restoring eax.
>>
>>56167533
thanks for the write up, I just randomly chose those values, also im sorry I could probably read it up somewhere but eax works in this case as our cache right ?

also, when I run multiple programs and they each use the 0x000001 adress where they store something, wouldnt it totally fuck up the whole process (or computer for that matter), or is it the OS's job to manage the memory ?
>>
>>56167591
>also, when I run multiple programs and they each use the 0x000001 adress where they store something, wouldnt it totally fuck up the whole process (or computer for that matter), or is it the OS's job to manage the memory ?

No, see https://en.wikipedia.org/wiki/Virtual_memory
>>
I'm learning C++ and made a simple converter program using just if/else statements

http://pastebin.com/43FWvmbh
>>
>>56167606
cool to find out that on the same note this is how paging works, thanks for the link and all the answers
>>
>>56167632
>http://pastebin.com/43FWvmbh
>nested ifs forever is some sort of accomplishment
why
>>
File: dsadasdsa.png (62KB, 459x475px) Image search: [Google]
dsadasdsa.png
62KB, 459x475px
How do I get past this feeling?
>>
>>56168024
there there is no meme degree (except liberal arts, jk), you should be proud of yourself and every achievement you make, do something and overcome yourself, I believe in you

also I always remember the saying I once heard "plus est en vous" which means something like, theres more in you ( than you think)
>>
>>56162016
Because making a DSL is fun as shit.
>>
>>56168057
ty anon
>>
>>56168057
so le inspiring ecks dee
>>
Just finished a Python script that downloads all the images from a persons profile.
>>
>try to learn programming
>all the beginner stuff is so boring that i just lose all interest because none of it can really be turned into something useful
kill me
>>
>>56168441
>>projecting your insecurities this hard

wew lad you dont set the bar too high do you ?
>>
working on an Android game which I'm hoping to release by next month. I've really realized how hard it is to plan out architecture (for OOP at least) so that it'd extensible once you hit the 2k lines of code
>>
>>56168469
On Instagram*
>>
>>56168490
You need decoupling and cohesion. Objects are a tool that can accomplish this, not a silver bullet.
>>
>>56168475
define "beginner stuff" and define "something useful"

Useful programs tend to be a whole bunch of beginner stuff tied together.
>>
>>56163212
Racket or Common Lisp
>>
>>56168506
Yup, I'm learning though, as I refactor it. I've got maybe over 25 classes.
>>
>>56168519
idk maybe i'm not looking at the right resources. i fell for the reading books meme and i'm bored to death. youtube videos seem a bit more faster paced for the beginner stuff so i'll start there instead for now.
>>
>>56168010
Never said it was.
>>
>>56165221
>do not have the brains
>>
How would one manipulate a file in c++

For example add/remove/sort strings
>>
>>56168715
Read to memory, process, write to file
>>
>>56168729
Can you give an example? For instance I want to add the letter A to an empty file
>>
What language for first time, I have shell scripting experience
>>
>>56168738
http://www.cplusplus.com/doc/tutorial/files/
>>
>>56168738
http://www.cplusplus.com/reference/cstdio/fopen/
>>
I have a math / code question.

In my application, I have a graphic effect of a line that is initially straight as an image. The user can use a finger gesture. I want to basically have the image come on screen and be rotated so that the line follows the finger gesture (front finger start point to finger end point). After that, the image is made invisible and its rotation is reset until the user does it again.

What's the math formula for pulling this off?
>>
>>56168800
Killing yourself is the correct formula for this one
source: personal experience
>>
>>56162609
>>56162653
https://en.wikipedia.org/wiki/Ada_Lovelace#Controversy_over_extent_of_contributions
>>
>>56168840
It cant be that bad
>>
>>56168842
>Dorothy K. Stein regards Lovelace's notes as "more a reflection of the mathematical uncertainty of the author, the political purposes of the inventor, and, above all, of the social and cultural context in which it was written, than a blueprint for a scientific development".
So she was the SJW tech blogger of her day?
>>
>>56168855
Do you have experience with any language?
>>
>>56168866
I work with C++/ C#
>>
>>56162811
all the top books are free online if u google them

what 'practical' purposes do you want ot use it for?

I use it for data analysis, regression, etc, but there are a lot of different uses for it.
>>
>>56168877
With what library are you going to do that?
>>
>>56168915
Why is that necessary? I'm mostly manipulating the quaternion rotation of a 2d image
>>
>>56168946
>quaternion rotation of a 2d image
>quaternion
>2d
>>
>>56168946
lmao I don't know what are you talking about
>>
>>56168957
The fuck else you want me to call it? Just rotation? Does that make your autism feel better?
>>
>>56168800
arctan
>>
>>56168966
I'm remarking that quaternions are for 3D rotation (and uniform scaling). 2D rotation is an angle, 2D rotation and uniform scaling is a complex number.
>>
>>56168989
I'm well aware, but throughout my career, we use quaternion rotations as a term most of the time cause we're usually using 2d images inside a 3d environment.
>>
Can this be refactored? It's supposed to be like a Fibonacci generator that takes 3 numbers instead of 2.

def tribonacci(sig, n):
if n < 3:
return sig[0:n]
else:
a = 0
while a < (n - 3):
sig.append(sig[a] + sig[a+1] + sig[a+2])
a += 1
return sig


a signature of [1,1,1] to 10 would be [1,1,1,3,5,9,17,31,57,105]
>>
>>56169029
>python
>>
>>56169095
>newfag uses newfag language
>being a retarded shitposter
>>
>>56169095
my lang > ur lang
ur lang A SHIT
A SHIIIIIIIIIIIT
>>
>>56169104
You could have started with C. You deserve it.
>>
What is the best C build system?
>>
Hey guys, trying to think of a way to better use pipes

currently i have two programs, you can assume these programs both repeat so its essentially: write, read, write, read continuously

one: opens pipe for writing -> writes some commands -> closes
second: opens pipes for writing -> reads while fgets isn't null -> closes

the problem is that the reader gets all of the commands in the pipe from the start of runtime instead of just the NEW commands. So how do i make a new file every time and overwrite the old one?
>>
>>56165209
#lang racket/base

(define (guesser)
(define answer (random 10))
(let loop ([guesses 1])
(display "Enter a number: ")
(define guess (read))
(cond [(= guess answer) (printf "Correct! You guessed ~a times!\n" guesses)]
[(< guess answer) (displayln "Answer is higher.") (loop (+ guesses 1))]
[(> guess answer) (displayln "Answer is lower.") (loop (+ guesses 1))])))
>>
C#
using System;
namespace TheGame
{
public class MainProgram
{
private static int guesses;
static void Main()
{
bool gameover = false;
Random rnd = new Random();
int theNumberToGuess = rnd.Next(01, 100);
guesses = 0;
string inValue = string.Empty;
Console.WriteLine("Guess the number");
while (gameover != true)
{
inValue = Console.ReadLine();
if (ParseAndCompare(guesses, inValue, theNumberToGuess) == false)
{
Console.WriteLine("Current tries:" + guesses);
}
else
{
gameover = true;
}
}
Console.Clear();
Console.WriteLine("You won! The number was "+theNumberToGuess+"\n and you guessed a total of "+guesses+" times!");
Console.ReadKey();
}
static bool ParseAndCompare(int _guesses, string _inputString, int _inputNumberToGuess)
{
int parsedInput = 0;
if (int.TryParse(_inputString, out parsedInput) == false)
{
Console.WriteLine("Invalid input, bruh.");
}
else
{
if (parsedInput > 0 && parsedInput < 101)
{
if (_inputNumberToGuess == parsedInput)
{
return true;
}
else if (parsedInput < _inputNumberToGuess)
{
Console.WriteLine("Guess Higher");
}
else if (parsedInput > _inputNumberToGuess)
{
Console.WriteLine("Guess Lower");
}
guesses++;
}
}

return false;
}
}
}
>>
>>56165209
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(){
srand(time(NULL));
int guess, guesses = 0, number = rand()%100+1;

do{
printf("Enter a guess between 1-100: ");
scanf("%d", &guess);
guesses++;
if(guess==number)
printf("You got it right, it took you %d guesses!\n",guesses);
else
printf("Sorry, that's too %s.\n", guess>number? "high":"low");
}while(guess!=number);

return 0;
}
>>
>>56169496
That's fuck ugly.
>>
>>56169001
>throughout my career

>posting on 4chan
>having a job

Pick one
>>
>>56168479
>just b urself
>>
>>56165209
(do ((num (random 100))
(guess (progn (princ "\nguess number:") (read))
(progn (princ "\nguess number:") (read)))
(count 0 (1+ count)))
((= guess num) (format t "~%correct, took you ~D tries" count))
(if (< guess num)
(princ "\nlolnope, too low")
(princ "\nlolnope, too high")))
>>
NEW THREAD
>>56169685
>>56169685
>>56169685
Thread posts: 324
Thread images: 26


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