[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: 318
Thread images: 24

File: himegoto.jpg (407KB, 600x800px) Image search: [Google]
himegoto.jpg
407KB, 600x800px
old thread: >>56044388

What are you working on, /g/?
>>
Hime is the best OP
>>
>>56048452
Messing with scala, its actually pretty good
>>
>>56048466
Are you using it as a better Java or a worse Haskell?
>>
What are some programming searches that give you unexpected predictive results?
>>
>>56048481
Both desu haha tho its much much much better java.
>>
File: guira.png (56KB, 400x402px) Image search: [Google]
guira.png
56KB, 400x402px
>>56048452
https://github.com/ii8/guira

rate my program /dpt/
>>
C++ is a beautiful multi-paradigm language
>>
8th for Go is best language

>>56048452
kys
>>
>Groovy, Coffeescript, F#, Less, D, Rust, Ruby, Clojure, Elixir, Sass, Typescript, etc.
Why.
Do these languages seriously have something that absolutely no other language has? Why do they exist?
>>
>>56048450
Gotcha. Like I said, this part of the data is most likely going to change at a glacial pace, but I think I'll just keep trying to understand data binding just so it's one less thing I have to worry about.
>>
>>56048524
>Call of duty, Battlefield, Arma, Overwatch
Why.
Do these games seriously have something that absolutely no other game has? Why do they even exist?
>>
>>56048452
kill yourself
>>
>>56048524
http://www.tiobe.com/tiobe-index/

almost no one even uses them, they're just hipster fag memes
>>
>>56048563
Also a valid question, though i guess those games still have some sort of """story""" so once you've played one you could be compelled to play another. But yeah, why indeed.
>>
>>56048587
I was badly trying to illustrate a point which is now lost to me
>>
>>56048524
Rust does, but yes, some of these seem totally unnecessary, just like pic related

https://www.gitbook.com/book/cheddar/docs/details

Seriously what is the point??? what should I drop the safety of a well established language for?
>>
>>56048625
it doesn't take much effort to make a shitlang, people make them for the learning experience or they hope it will get them rich if people start using it
>>
File: cheddar.png (107KB, 7426x1571px) Image search: [Google]
cheddar.png
107KB, 7426x1571px
>>56048625
Were did the damn pic go?
>>
>>56048652
like malbolge
>>
>>56048652
Oh man I hate print being anything besides a goddamn function SO. MUCH.
>>
>>56048145
>>56048376
that's not working, it did once, adding two numbers together, but not any more. o t
>>
>>56048524
D's supposed to be a more modern replacement for C++. One thing it has got going over other languages is its metaprogramming capabilities, with mixins, static if, template constraints.
>>
>>56048754
> static if

why do you need a hack like this if you have metaprogramming
>>
>>56048803
How the hell is that a hack?
>>
Let's say I wanted to write a forum software.
Would I leave my CGI script at the root of the website and have all URL queries, such as /g/thread/52676882 be tokenized within the CGI script?

Or am I going about this all wrong?
>>
>>56048832
is D metaprogramming handled at compile-time?

Lisp has proper metaprogramming and you don't need a "static if", you just evaluate an if-expression (or any other kind of expression) at compile-time.

e.g.
;; dumb example 
(defmacro macro-fib (n)
;; whoa, static-if!
(if (< n 2)
n
`(+ (macro-fib ,(- n 2))
(macro-fibs ,(- n 1)))))

(mac-fibs 8)

;; expands to

(+ (+ (+ (+ 0 1) (+ 1 (+ 0 1))) (+ (+ 1 (+ 0 1)) (+ (+ 0 1) (+ 1 (+ 0 1)))))
(+ (+ (+ 1 (+ 0 1)) (+ (+ 0 1) (+ 1 (+ 0 1))))
(+ (+ (+ 0 1) (+ 1 (+ 0 1)))
(+ (+ 1 (+ 0 1)) (+ (+ 0 1) (+ 1 (+ 0 1)))))))
>>
Dark C++ show me the dark metaprogramming
>>
any opengl or graphics bros out there. Trying to make a model viewer for a particular file format but for some reason I cant calculate the final position of the vertices properly. I know what the final position is, but it doesnt make sense given the weights and bone matrices.
>>
>>56048959
Not him but D's static if is something like pre-processor directives in C and C++ to control compile time conditions. If you're looking for something equalivent to your code then you can use a mixin to generate a chunk of string and have it interpreted as an actual piece of code. Unless I misunderstand what you're discussing here because I've not followed the discussion.
>>
>>56048959
Yes, it's for compile-time
Like a better C/C++ preprocessor
https://dlang.org/spec/version.html#staticif

More on the mixins if you want to see that
https://dlang.org/mixin.html
>>
Go is the worst language if you use it I hope you like writing the same code over and over again because it doesn't allow for literally any kind of abstraction, it's almost like it was designed for people who aren't capable of using a normal programming language.
>>
>>56049052
just saying that needing a special 'static-if' makes it seem like you've got a hamstringed metaprogramming system.
>>
>>56049065
That reminds me a few threads ago someone mentioned the Zebra Puzzle and I looked up solutions on Rosetta Code, both Go and C were pretty damn disgusting compared to other solutions.
>>
>>56049071
>hamstringed
hamstrung
>>
File: Screenshot_2016-08-12_21-28-48.png (7KB, 1225x621px) Image search: [Google]
Screenshot_2016-08-12_21-28-48.png
7KB, 1225x621px
>>56048497
>try in the browser
>weeb shit
>nothing works

pottery
>>
#include <stdio.h>
#include <ctype.h>

void remove_spaces (char* restrict str_trimmed, const char* restrict str_untrimmed)
{
while (*str_untrimmed != '\0')
{
if(isalpha(*str_untrimmed))
{
*str_trimmed = tolower(*str_untrimmed);
str_trimmed++;
}
str_untrimmed++;
}
*str_trimmed = '\0';
}

int main()
{
char str_untrimmed[] = "A Toyota! Race fast, safe car! A Toyota!";
char str_trimmed[sizeof(str_untrimmed)];
int x, y, size;
x = y = size = 0;

remove_spaces(str_trimmed, str_untrimmed);


while (str_trimmed[size] != '\0'){
size++;
}

if (size % 2 != 0){

int unevenHalf = (size - 1) / 2;

for (x, y = size - 1; x <= unevenHalf, y >= unevenHalf; x++, y--){
if (str_trimmed[x] != str_trimmed[y]){
printf("%s is not a palindrome. \n", str_untrimmed);
break;
}
if (x == unevenHalf){
printf("%s is a palindrome. \n", str_untrimmed);
}
}

}
else{

int evenHalf = size / 2;

for (x, y = size - 1; x < evenHalf, y > evenHalf; x++, y--){
if (str_trimmed[x] != str_trimmed[y]){
printf("%s is not a palindrome. \n", str_untrimmed);
break;
}
if (x == evenHalf){
printf("%s is a palindrome. \n", str_untrimmed);
}
}
}

return 0;
}


What should I try next?
>>
>>56049078
C has an excuse in that it was designed multiple decades ago, before we knew any better.
>>
>>56047003
;; no recursion
(defun print-nodes-cps (tree)
(labels ((func (node cont)
(if (node-p node)
(with-slots (val left right) node
(print val)
(lambda () (func left
(lambda () (func right cont)))))
(progn (print node) cont))))
(let ((cont (func tree (lambda ()))))
(loop while cont do
(setf cont (funcall cont))))))

CL-USER> (print-nodes-cps
(make-node :val :a
:left (make-node :val :b :left :c :right :d)
:right :e))

:A
:B
:C
:D
:E
NIL
>>
>>56049065
By the way, I'm not saying you're incapable if you use it, but you should know that it's an insult to your intelligence. You might be okay with that.
>>
>>56049065
>google
i swear google, microsoft and apple are fucking shit at programming and language/api design
>>
>>56049093
True, I guess my point is that Go was designed, among others, by Rob Pike, and the solution does not look any better, as if they disregarded all the research and decided to create a language that does not improve nothing aside from providing green threads OOTB.
>>
>>56049091
It works lad.

try typing in a query
>>
>>56049091
It's fine though?
>>
>>56048720
ctrl+meta+x will print it to the minibuffer/echo area
>>
>>56049092
// check if string is palindrome
int isStrPalindrome(char *str)
{
int i,j;
for (i = 0, j = strlen(str) - 1; i < j; i++, j--)
if (str[i] != str[j])
return 0;
return 1;
}

>>
File: lol.png (11KB, 1041x490px) Image search: [Google]
lol.png
11KB, 1041x490px
>>56049121
>>56049138
>>
>>56049114
Rob Pike on go:

>The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt.

Wow, Google sure has a lot of faith in its developers, you know, the company that only hires the best and brightest.
>>
>>56049164
It only does one year on the website because otherwise people might write queries that fill their ram with dates.

It also does only days on the website. not hours and minutes.

try
> (month (or mar jul dec) (day fri))
> (week (eq (mod n 3) 0))
>>
>>56049092
utherly overcomplicated

>>56049146
good idea, should have used a while loop instead
skiping ' ', '!', ','
because of "A Toyota! Race fast, safe car! A Toyota!"
>>
>>56049168
>So, the language that we give them has to be easy for them to understand and easy to adopt
this isn't just useful for junior devs, though.
in fact, most devs aren't researchers, and the current languages at the front of research aren't yet particularly useful for anything practical (and their communities make the exact mistake that go is attempting to prevent its junior devs from making: premature and excessive abstraction).
>>
>>56049290
go is terrible shit
https://github.com/robpike/filter
>>
>>56049168
>the company that only hires the best and brightest
that's a meme, they're not looking for the best and brightest people, they're looking for normies who will fit in with their company culture
>>
File: 1461528655252.png (378KB, 1450x1080px) Image search: [Google]
1461528655252.png
378KB, 1450x1080px
when you guys have an idea for a program, or software to write, or even tackling one of the many programming challenges that get posted on here daily, how do you handle implementation? I mean, how do you decide what data structures to use, what algorithms will be useful, what patterns could come into play, etc...

is it something you should know in the planning / idea / design phase? or is it something that you think of as you are coding it?

I'm always worried that I'll try one of these challenges, and I'll end up getting it to work, but in a really hacked together, inefficient sort of way. Am I really learning anything by doing that?
>>
>>56049404
"company culture" is the biggest cancer meme
>>
>>56049320
your provided link is confirming my argument.
a statically typed language that provides the tools for easily implementing map/filter/reduce also provides the tools for people to quickly go batshit with abstraction (especially with types).
go makes it hard to abstract a lot.
this means more code duplication, but also more explicitness and less premature abstraction.
i'd argue that overall it's nicer for maintainers to read more explicit code (as they don't have to learn layers on top of layers of abstraction for every single thing and every single dev working on the project), but more annoying for devs to write the code.
haskell is one of the most powerful of the more popular statically typed languages, and it suffers from extreme amounts of premature abstraction.
go certainly isn't as fun to write as haskell, lisp or even python, but i'd argue that maintaining a go is quite a bit easier.
>>
I just finished the Rust tutorial. I haven't used it yet, but it looks much better designed than Go. My biggest problem with Go is the boiler plate error handling. The Rust Result type looks much more interesting.
>>
>>56049404
>they're looking for normies who will fit in with their company culture

uh oh...somebody failed the interview
>>
>>56049492
no i don't think they even if they're hiring devs where i live, i just read it on stackoverflow
>>
>>56049482
>I'm literally retarded but I think I'll be ok
>>
>>56049514
and i wouldn't even want to work for google, maybe at some cooler place like the VR dept at valve and only if i got a fat ass salary, otherwise i'd just stick to my own shit
>>
File: lol.png (911KB, 1920x1080px) Image search: [Google]
lol.png
911KB, 1920x1080px
>>56049164
>>
installing MIt-Scheme.
The installation went smoothly
but When I type
 mit-scheme 
into the terminal I come across this error
 mit-scheme: can't find a readable default option --band.
searched for file all.com in these directories:
/usr/local/lib/mit-scheme-x86-84 [/code
I'm not really sure what to do to rectify this error. Can someone please help.
>>
>>56049481
> more code is easier to maintain
>>
>>56049535
Disliking boilerplate code makes me retarded?
>>
>>56049575
your reading comprehension skills are pretty bad, anon
>>
>>56049587
There really is no difference between an option type and returning two variables.

Both are effective replacements for exceptions everywhere.
>>
>>56049660
>make a different but equivalent syntax for exceptions
>call it an effective replacement
>>
>>56049660
It's hard to test the cause of the error in Go. You either have to use sentinel errors or wrap the errors in your own container. It feels like error codes in C, which are bad for general use.
>>
>>56049697
they're not equivalent to exceptions, neither of them
only once you introduce monadic control flow to option types they become similar to exceptions, and even then, in the case of monadic option types they're still different from most exception implementations in the regard that they're actually explicit at compile time
it's debatable whether monadic control flow is a good thing in imperative languages, as it usually hides some sort of information that might be important for the reader.
>>
>>56049652
nope, just saying that code duplication goes against maintainability, as does improper or insufficient abstraction.

trying to improve maintainability by not allowing abstraction is extremely retarded, for so many reasons that i'm not even sure where to begin.
>>
>/dpt/ tells me that webdev is babby shit
>go into webdev
>within 1 year, working with streaming replication on data clusters, optimizing hive jobs and working out tricky release strategies
you lied /dpt/, I never asked for this
>>
>>56049756
in both rust and go, if you want errors to both carry a context and be distinguishable in regards to their nature, you need to define an error type that contains that context.
in go you use a type assertion switch to unwrap the error into its concrete context type at runtime, while rust allows you to do this at compile time via pattern matching.
that's the only difference.
as go has no generics (which yields the advantages and disadvantages i mentioned at >>56049481) pattern matching wouldn't make much sense either.
both implementations (and exceptions as well) have a hard time when hand crafted context should get added at every layer, effectively resulting in a chain of errors, with each layer still being identifiable.
>>
>>56049788
if you really believe that every dev should strive to achieve maximum DRYness then i feel sorry for your coworkers.
sometimes, duplication is better than abstraction.
this is a well known fact.
pushing a principle to its limits won't get you anywhere.
some opinions on this by other people to back up my argument:
http://www.johndcook.com/blog/2012/01/09/holographic-source-code/
https://twitter.com/ID_AA_Carmack/status/753745532619665408
http://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction
>>
>>56049884
there are varying difficulty levels in web dev, but all this large-scale data transfer stuff just seems boring to me
>>
i want to call a python script in my terminal, to do something to a couple files

how do i apply this script to every file, except .png images?

something like
python override.py *.jpg *.jpeg ??
>>
>>56049942
python override.py *.jpg *.jpeg ^*.png
>>
>>56049936
i'm not advocating removing all redundancy from your code, that's improper abstraction as well (unless you're code golfing)
>>
ITT: go babbies defend their language giving them carpal tunnel
>>
>>56050246
>muh html
>>
>>56050246
>muh lambdas
>>
>>56050207
alright, the general statement
>code duplication goes against maintainability
made it seem like you were.

go doesn't *prevent* abstraction, it just makes some kinds of abstraction harder, trying to push people more towards the optimum from the other side of the spectrum.
if people still persist on prematurely abstracting, even with those limitations, then the result will be incredibly ugly.
i haven't seen any cases in go projects where this was an actual issue, though.
people don't abstract that much and many people have found that to be more readable.

by the way, C attempts that in some ways as well, but fails in other regards with this approach, so there are still more opportunities to fuck things up (macros, for instance).
>>
>>56050246
buttmad carpaltunnelfag detected
>>
>>56050313
>if people still persist on prematurely abstracting, even with those limitations, then the result will be incredibly ugly.

Languages can't prevent "premature abstraction", they either allow certain abstractions or do not (or only in a ad-hoc interpretive manner).

Go does not allow certain abstractions even whey they are determined to not be premature.
>>
>>56050313
Code duplication DOES go against maintainability. I should never have to repeat myself to the compiler.

There is no such thing as premature abstraction. The more abstract your code, the easier it is to reason about. I can tell you what
hurr :: forall a b. a -> b -> a
does, but not what
durr :: Int -> String -> Int
does. Go does indeed prevent this sort of abstraction.
>>
>>56050313
>it just makes some kinds of abstraction harder
Not him, but the lack of generics prevents you from reusing your data structures.
>>
>>56049457
>I'm always worried that I'll try one of these challenges, and I'll end up getting it to work, but in a really hacked together, inefficient sort of way. Am I really learning anything by doing that?

Well yeah I think so. When I do these it's usually pretty ugly. Hacky and inefficient is what learning looks like. It could, be that you're trying to find a workaround using only what you already know, but ideally it should be difficult enough that you have to learn at last one new thing to make it work. The next step is to clean it up or look at how others have solved it.

If your program is super clean and perfect first try, it's probably because you did something you're already really comfortable with and therefore learned nothing. Rolling btw.
>>
I've been working on CS50 Problem Set 1 and my code for the greedy script where you are supposed to find whats the least amount of change you could give back to someone has been giving me weird results like putting in .41 gives you 3 when it should be 4. I've tried a lot, but I can't get it to work

#include <stdio.h>
#include <cs50.h>
#include <math.h>

int main(void)
{
// variables
int coins = 0;
float owed;
float quarters = 0.25;
float dime = 0.1;
float nickle = 0.05;
float penny = 0.01;

// Get change
printf("How much change is owed?\n");
owed = GetFloat ();

// Math
while (owed >= quarters)
{
owed = owed - quarters;
coins++;
}
while (owed >= dime)
{
owed = owed - dime;
coins++;
}
while (owed >= nickle)
{
owed = owed - nickle;
coins++;
}
while (owed >= penny)
{
owed = owed - penny;
coins++;
}

// Print the number of coins needed
printf("%i\n", coins);
}
>>
>>56050387
It has built in data structures that are generic. (YES, THE LANGUAGE HAS GENERICS, BUT YOU'RE NOT ALLOWED TO USE THEM ARRRGRARBL) I hope you never need one that they didn't include!
>>
>>56050430
If it helps, I believe something is wrong when using pennies, but I can't figure it out
>>
>>56050454
>float
use integers
>>
>>56050378
i guess i'll agree with you on that.
there are some areas, especially in regards to types, where it's a lot easier to go overboard with abstraction than say through functions alone, and you don't notice as quickly, though.
iirc reputable fp people like erik meijer have started doubting the benefits of generics as well.
that being said, go made the argument about duplication and explicitness over abstraction more popular again (i know that sicp mentions it as well), so that's a good thing.
stuff like gofmt and other parts of the tooling are also pretty awesome, and i hope other new languages adopt some ideas from that.
the same goes for the gc.
build speed is also a good thing, in addition to the entire argument about abstraction.
>>
>>56050448
>I hope you never need one that they didn't include!
Yeah, who cares about binary search trees when you can just use hash maps :^)
>>
File: bait.png (73KB, 622x626px) Image search: [Google]
bait.png
73KB, 622x626px
>>56050430
>currency
>floats
>>
>>56050513
Erik is just butthurt because he didn't get his way regarding Foldable/Traversable being added to the prelude. "It makes teaching Haskell harder!" Use a different prelude then, dumbass.

Generics are useful for a lot more than just containers, especially when paired with typeclasses.
>>
>>56050384
>The more abstract your code, the easier it is to reason about
would you say the same about abstract factory factories in java, or is that somehow a special exception to your magical and absolute rule?
what about c++, where most users use different subsets of the language, resulting in a mess when many people work together?
in fact, what about haskell, which suffers from the same problem but at a way greater scale? the last time i checked different people were handling errors in 10 different ways, and that's just error handling!
i don't think i've talked to a haskeller irl before that wasn't complaining about working with the code of other people that use a completly different set of abstraction than them.
maybe you're the first one?
>>
>>56050566
>he doesn't know that currency floats

top pleb
>>
>>56050597
Yes, I would. If something takes an abstract factory, then in a perfect world you know it doesn't depend on any details of concrete implementations. Unfortunately Java allows you to circumvent its generics with instanceof and reflection.
>>
File: m8.jpg (95KB, 935x1024px) Image search: [Google]
m8.jpg
95KB, 935x1024px
>mit-scheme is looking for all.com file in the wrong place
>can use .emacs file to change this
>.emacs file is nowhere to be found
welp
>>
>>56050684
>Yes, I would
i rest my case then
>>
>>56050713
It should be in your $HOME
>>
>>56050731
What case? That you prefer code duplication?

Abstract factories are no different in philosophy to writing a Haskell function that uses a generic monad transformer stack.
>>
>>56050393
sort of basic, reroll

windchillUSA <- function(temp=NA,wind=NA){
if(is.na(temp)){
cat("Enter Temperature (F):")
temp <- as.numeric(readLines(n=1))
}
if(is.na(wind)){
cat("Enter Wind Speed (mph):")
wind <- as.numeric(readLines(n=1))
}
WC <- 35.74 + 0.6215*temp - 35.75*wind^0.16 + 0.4275*temp*wind^0.16
WC <- round(WC,1)
cat("Wind Chill is", WC, "degrees", sep=" ")
}


# output:
# > windchillUSA(45,10)
# Wind Chill is 39.8 degrees
# > windchillUSA()
# Enter Temperature (F):
# 45
# Enter Wind Speed (mph):
# 10
# Wind Chill is 39.8 degrees
>>
>>56048452
I want to do some gamedev for fun but I can't decide on a language.

I know Java best when it comes to GUIs and graphics etc. but I hate the language.
I like Racket but I've never done anything with graphics in it before.
I love Haskell but game development is much harder in it.
I like Python but I feel like I'll spend more time on learning the framework than doing actual game programming.

Also rate my code: https://github.com/Wysaard/fucked-up/blob/master/fucked-up.c https://github.com/Wysaard/braiell/blob/master/Main.hs
>>
>>56050742
it's not
~/.emacs brings up nothing
~/.emacs.d brings something up
and doing ls -a only lists the emacs.d
which is just a directory
ctrl+h, v with "user-init-file is a variable defined in ‘C source code’." yields back the result ""/home/.emacs""
it's truly fucked bruh
>>
>>56049457
>I'm always worried that I'll try one of these challenges, and I'll end up getting it to work, but in a really hacked together, inefficient sort of way. Am I really learning anything by doing that?

You'll learn from the criticism. Only problem is that on 4chan you don't know whether you're talking to an expert or an imbecile.
>>
Sorry to bother you programmers-sama, but I have a question, maybe you could help me. Consider a situation where you don't have a lot of time and you're already middle-aged but want to change careers. What would be the safest and fastest way to go? What branch/language should I learn by myself?
>>
>>56050774
do you think the same goes for user interfaces? that a user interface (e.g. a CLI interface) without any duplication is better than a user interface with some duplication?
what about natural language, would it be easier to understand if we defined a load of "language macros" that people will have to remember when speaking? use acronyms for everything i'd otherwise have to repeat in some way?
>>
>>56050853
Irrelevant. We're talking about writing code here.
>>
>>56050810
I wanna do some gamedev for fun too, but I have no idea what to make.
Anyway, about languages, despite hating Java as a language too, I personally found it good for getting something up and running quickly.
>>
>>56050842
you have to give more info.

what current field are you in? is it related to programming ?
>>
>>56050853
> what about natural language, would it be easier to understand if we defined a load of "language macros" that people will have to remember when speaking?

this is what happens already though
slang and new words are created all the time
>>
>Bought C++ Primer from Amazon
>50 pages in
>mind is blown
>not comprehending it yet
>can do simple input and output but thats it

Should I continue? What does the future hold for me? Programming is hard, bros.
>>
>>56050824
~/.emacs.d should have an init.el file which is roughly the same as a ~/.emacs file
>>
>>56050430
Try using doubles, floats are really imprecise. They're mostly useful for when you need to approximate decimal values.
>>
>>56050885
code, something being read, is in that regard not any different from a user interface or natural language.
if you don't think it'd be a good idea for things like language or prose, why would it be a good idea for code, something else that is to be read and understood, just like prose?
sure, if you're arguing that the only thing to read your code is the compiler, then that's correct, but that isn't the reality.
>>
What's the easiest way to load/save two lists with a single file in C#?
>>
>>56049457
how do you decide what data structures to use, what algorithms will be useful, what patterns could come into play, etc...

Try to reduce to program to certain pieces, look at the necessary things to do and what's most efficient. It's kinda an abstract notion but it hard to explain globally. There are just some general rules (lots of insertion, no random access needed = linked list; lots of random access, no insertion = array, some random access, some insertion: hash table / tree / some ad-hoc implementation of an arraylist)
>>
>>56050899
Not at all. Starting from scratch.
>>
>>56050935
but that file is empty...shouldn't it be filled with the defauls?
>>
>>56050936
doubles are still imprecise, not sure if they're TOO imprecise for this specific task, but for currency you should definitely use integers
>>
>>56050924
>Should I continue?
Of course.
>What does the future hold for me?
No idea.
>Programming is hard
It can be. What're you struggling on, anon?
>>
>>56050952
i'd guess that the defaults are just built-into emacs, what are you trying to do?
>>
>>56050917
yeah, but there is still a lot of duplication, because getting rid of all the duplication would be horrendous
language changes over time, that's normal.
things get slang words and abbreviations when they are duplicated a lot, just like in code, when it makes sense to abstract something when it is duplicated a lot, as opposed to just once.
>>
>>56050952
>>56050935
no wait, no that's a seperate file
the only things listed are
auto-save-list
and
ede-projects.el
NO init.el file
>>
>>56050842
Anything that you like to work with? As in, are you interested in mobile, web, networking, 3d graphics, etc. Or whatever is easy and fast to get into?
>>
>>56050888
Yeah that's the appeal of it to me. I know that I can at least implement a proper game engine quite quickly. As far as ideas go: I'm going to try making something roguelike, but also with some arpg elements. I also have an idea for a story but I'm a bad writer so I'll have to figure that out.
>>
>>56050948
how old are you, if you don't mind asking?
>>
>>56050842
Python is a good first language. If you want graphics on your screen fast, Java can be very nice.

In the end though, your language of choice will depend heavily on what you're going to do. For example: if you're gonna do web make sure you know JS and PHP, maybe Python if you want to work at a younger company. However, if you're not gonna do web, learning those languages (except for Python) is 100% a waste of time, nobody likes JS but it's popular in web, and PHP is only useful in web.
>>
>>56050982
Just the fastest and most efficient way honestly.
>>
>>56050566
>>56050936
Sorry, the problem set says to use floats, so I did
>>
>>56050810
I started learning pygame yesterday following this:
http://inventwithpython.com/chapter17.html
tutorial and wrote my own little space invaders like game.
>>
>>56050853
> would it be easier to understand if we defined a load of "language macros" that people will have to remember when speaking? use acronyms for everything i'd otherwise have to repeat in some way?

That's exactly what's happening on the internet though. The sheer amount of internet slang and abbreviations that are constantly being invented is staggering.
>>
>>56051033
Thanks. Maybe Python is a good option then.

Kinda unrelated but is cybersecurity hard and how would you start learning for this?
>>
>>56050971
I'm trying to follow
>https://groups.csail.mit.edu/mac/users/gjs/6.945/dont-panic/
but there is a section
about replacing lines of the .emacs config
and mine is missing.
also
>>56050975
>>
>>56050936
Actually it would be better to use ints. Doubles are more precise than ints, but you'll just end up being a quadrillionth off instead of a billionth (metaphorically of course). Just save the amount of cents instead.
>>
>>56051083
that just means to paste that code in and replace the paths with where scheme is installed
>>
>>56051064
still not enough to avoid complete duplication, though.
it doesn't even remotely reach the point of "abstracting every single duplication" as mentioned by that other anon.
also, having read a lot of ee-related specs in my life time, those sometimes go overboard with "abstraction" in language.
i'm fine with some clear definitions at the start of a paper (note: sensible abstraction), but those go completly overboard sometimes, and i gotta spend ages looking shit up
>>
>>56051061
Did a little debugging, on my PC actleast the penny while isn't firing.

This is obviously because of a rounding error. This is why you don't use float for money.
>>
>>56051113
The problem set says to use floats, so I did
>>
>>56051087
What about decimal?
>>
>>56051053
All right so, the fastest way I've seen someone get into coding is with JavaScript.

The reason for this is that it's a very simple language to learn and get into, though it does have some obscure things and very retarded design decisions at some parts, but nothing that you can't learn or that will affect you as you work your way through the language.

You can learn it in about 1 week and start to do something with it.

It also has a ton of demand for web, and some for backend shit with NodeJS. It pays anywhere from decent to stupidly high depending on where you look.

The BAD thing about it is that whatever you learn in JS will not translate to most other languages. If you want to get into C++, C#, Ruby, Python, etc. later, you will be learning almost everything from scratch. If you learn one of those languages first, most concepts will apply to all object oriented programming languages later, and JS will look like a toy language by comparison.

If you're looking for a job, check out job positions in your areas of interest so you can get a better idea.
>>
>>56051124
I understand that but the use of floats is actually what's causing your problem. Whoever set the problem up is an idiot.
>>
>>56048497
nice anon! good lanfuage choice too
>>
File: 911.png (1MB, 940x524px) Image search: [Google]
911.png
1MB, 940x524px
>>56051096
ffs, I'm retarded, thanks dude
>>
>>56049457
> I'll end up getting it to work, but in a really hacked together, inefficient sort of way

Just make it somehow work and then work on making it better. Rewrite the code to be cleaner, optimize shit, think of how you could've done certain things better and do them.
>>
>>56051124
You could "fix" it by adding .001 to the initial owed amount.
>>
>>56051308
If your teacher has a problem with this call him a faggot in front of the rest of the class.
>>
>>56049884
>implying people in /dpt/ have ever had a job as programmers
>>
i was starting to like the "comfiness" of mathematica but now it's failing on what looks like a perfectly sensible function definition+call with no error message except it just spits back the input. kill yourselves dynamic lang shitters
>>
Wanted to learn flex & bison so I implemented a simple scripting language.

a = 7;
b = 3;
c = a + b;

print (string) ((int) "67" + c) + " is the answer desu";


./interpreter test.fs
77 is the answer desu


Pretty fun, maybe I'll implement flow control statements next.
>>
>>56051477
Does it have Pi types yet?
>>
>>56051483
What are Pi types?
Why should it have it?
>>
>>56048521
>>56048566
>kill yourself
I already did thanks. You're talking to ghost now. Ask me programming-related stuff.
>>
>>56051463
so it worked at first with implicit multi-arg conversion to vector but then with the EXACT SAME function definition suddenly i need the curly braces... ridiculous
>>
>>56051495
A type that depends on a term

Ï€.F(x)
x:t

https://en.wikipedia.org/wiki/Dependent_type
>>
how do i get good ideas for programming projects?
i feel like i'm capable of making some cool stuff, just don't know what that cool stuff is yet
>>
how do you average two integers in Go?
>>
>>56051148
Thanks brother.

Do you guys have recs free sites for learning Python? I already found Freecodecamp for JS.
>>
>>56051589
Useless and stupid.
>>
>>56051615
C++ almost has them
>>
>>56051622
And?
>>
>>56051622
C++ is shit outside of one or two useful additions.
>>
>>56051630

std::array<T, N> for instance
the second parameter is a term
>>
I want to learn a functional programming language. What does /g/ recommend and what are some classic problems one would solve functionally? (actual use cases, no recursive fibonacci shit)
>>
>>56051744
javascript
>>
would you accept this solution? it looks very hacked away

// Program to reverse the digits of a number
#include <stdio.h>
int main (void)
{
int number, right_digit;

printf ("Enter your number.\n");
scanf ("%i", &number);

while ( number != 0 ) {
right_digit = number % 10;
printf ("%i", right_digit);
number = number / 10;
}

printf ("\n");

return 0;
}
>>
>>56051744
Haskell
>>
Do I need a degree
>>
>>56051816
if you're not retarded, you don't need a degree
if you're retarded, a degree won't help you
>>
>>56051788
>%i
>not %d

>printf ("\n");
>not puts("")

> number = number / 10;
>not number /= 10
>>
>>56051842
Define retardation in this case
>>
File: 1426548231392.png (141KB, 800x600px) Image search: [Google]
1426548231392.png
141KB, 800x600px
>>56051853
basically if you're not interested enough to seek out knowledge on your own and are unable to 'git gud'
>>
>>56051755
shiggy
>>
>>56051845
I meant the algorithm: what if my input is 0, or 0.435?
>>
>>56051816

Do you like debt?
Lots of debt?
>>
>guide says what make command to use
>doens't tell you what directory to use it in
fucking christ
>>
>>56051919
Seems like the easiest solution to me is to just check if it's a valid number first, then read it as a string instead. Then just print the chars in reverse order.
>>
>>56051940
>americucks and their retarded student loan system
thank god i don't live in that shit country
>>
>>56051876
Fair enough
>>
>>56051919
your program doesn't handle floats

you can check how many digits a number has by doing
#include <math.h>

abs(floor(log10(number)))+1)


only simple solution is: convert your number to string, reverse the string, and convert the string to number again.
>>
>>56051959
even if it's free and/or someone pays you you still have living expenses and you're spending a lot of your time and energy on it
>>
>>56051788
rate mine

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

/* program to reverse the digits of a number */

int main(void)
{
int a = 12345678;
int b = log10(a) + 1;
char *c = malloc(sizeof(char) * b + 1);
sprintf(c, "%d", a);
while (b--)
putchar(*(c+b));
return 0;
}
>>
>>56051845
>puts("")
>not putchar('\n')
>>
>>56052059
>writing more code to do the same
>>
>>56052045
>you still have living expenses
i have those anyway whether i'm at college or not

>you're spending a lot of your time and energy on it
and i get a quality education out of it
seems pretty fair to me
>>
>>56052058
>sizeof(char)
>No free
>Using the heap at all
>>
>>56052058
>doesn't check the return value of malloc
kek
>>
>>56051592
no one
I knew it, /dpt/ is a bunch of college kids.
>>
>>56051876
Rate my X.

void printX(int lines){
for(int i = -lines/2;i<=lines/2;i++){
if(!i){
for(int j = 0;j<lines/2;j++)
putchar(' ');
putchar('*');
} else {
for(int j = 0;j<lines/2-abs(i);j++)
putchar(' ');
putchar('*');
for(int j = 0;j<abs(i*2)-1;j++)
putchar(' ');
putchar('*');
}
putchar('\n');
}
}
>>
>>56052110
We've established this before, it is not possible to average integers
>>
>>56052182
see >>56052110
>>
File: aspnetnomvc5.png (93KB, 2000x661px) Image search: [Google]
aspnetnomvc5.png
93KB, 2000x661px
I'm trying to get my development environment set up. I want to mess around with C# MVC 5 so I installed Visual Studio and went to select an ASP.NET project and there's supposed to be an MVC 5 option but all I have is stuff for MVC 4.

Pic related is what I've got and the project type I picked. Anyone faced a similar problem?
>>
>>56052210
Yo mama
>>
rate my averaging machine
#include <stdio.h>

main()
{
float n=7, tn=8;
float c = (n+tn)/2;
printf("%.1f\n", c);


return 0;
}
>>
File: mvc5option.png (212KB, 722x637px) Image search: [Google]
mvc5option.png
212KB, 722x637px
>>56052232

This is what I'm supposed to see.
>>
>>56052110
why would we know go without having to look up the syntax
>>
>>56052232
never used it but on the main window there's a drop down to select .NET framework version. Could that have anything to do with it?
>>
>>56052243
doesn't work
>>
>>56052258
>>56052232
no one here uses windows my man
>>
>>56052277
most of us do
>>
>>56049065
Go is good if you are a large team

functional languages are good if you are < 10 people
>>
>>56052275

I thought that might be it as well, sadly all the options give me the same result.
>>
>>56052296
that's not true
>>
>>56052112
i don't like the special case for i = 0
otherwise it looks ok although i prefer the one with just a nested loop where you choose the character based on if the variables fit the lines' mathematical equations like y == x etc
>>
>>56052296
two thirds use linux according to a strawpoll we had a while ago
>>
>>56049320
>reflection
kek
>>
>>56052362
>a while ago
exactly
this is r/g/ now
>>
>>56052269
https://tour.golang.org
you can learn it in less than 1 hour
>>
File: 1442758241336.jpg (182KB, 978x655px) Image search: [Google]
1442758241336.jpg
182KB, 978x655px
>>56052530
>go
>>
File: 820afc0402.png (22KB, 468x305px) Image search: [Google]
820afc0402.png
22KB, 468x305px
>>56052258
Apparently you need to install the templates.
>>
>>56052706
>I refuse to learn something that would take me less than one hour because of ideological reasons
ok m8
>>
>>56052763
More like
>I refuse to waste time learning something to complete an arbitrary challenge
>>
does java have Constraint polymorphism?
>>
>>56052723

I wish it was that simple. I'm using VS 2015, not 2012. I tried that last night and apparently VS 2015 is supposed to have this built in so that tool doesn't work for it.
>>
>>56052846
http://stackoverflow.com/a/37160167/3583241 ?
>>
File: Untitled.png (55KB, 852x562px) Image search: [Google]
Untitled.png
55KB, 852x562px
Strategy game
>>
>>56052909
webm of gameplay?
looks neat
>>
>>56052930
No real game yet. Started as side project not that long ago, am trying to nail down map generation atm.
>>
File: 4s4life.png (7KB, 411x181px)
4s4life.png
7KB, 411x181px
>>56052892

I already have that installed =/. This is driving me nuts. It all works just fine at work for me.

I'm not sure if it matters, but I have these numbers (in pic attached) in the top right of each icon except for the Azure Mobile Service one which shows C# and I'm not sure why. I haven't been able to google it effectively.
>>
>>56052987
Well, that's suck. IIRC I have seen you posting your problem several days ago, might be worth posting your question on SO.
>>
>>56052964
What kind of noise are you using?
>>
>>56053011

Yeah that was me heh. I'll probably have to do that. I'm gonna try uninstalling it and starting from scratch and hoping that that'll clear up whatever the hell it is. I'll post up in here if I can get it working.
>>
>>56053041
Perlin
>>
>>56053011

Ok so I found this:

https://docs.asp.net/en/latest/

Saying that ASP.NET MVC 5 has been rewritten as ASP.NET Core 1.0. But then I saw this:

http://www.hanselman.com/blog/ASPNET5IsDeadIntroducingASPNETCore10AndNETCore10.aspx

Saying that 1.0 doesn't have all of the same features etc. So I have no fucking clue what's going on.
>>
What fucking dialect of BASIC is this?
http://www.filfre.net/misc/oregon1975.bas
>>
Hello I am trying to implement something like video related to do some blurs to a image but I'm not quite sure on a few things.

First I'm using the python image Lib to get the pixel RGB value. This value is formatted like (255,255,255) but in the video they are working with a singular value. what kind of magic can I do to get to something like that.

Second do my kernels have to be 3x3 blocks or can they be 10x10 or even larger?

Video:
https://www.youtube.com/watch?v=C_zFhWdM4ic
>>
>>56053282
>This value is formatted like (255,255,255) but in the video they are working with a singular value
Just do each of the RGB values separately. The video probably used 1 so that people could get the point easier.
>Second do my kernels have to be 3x3 blocks or can they be 10x10 or even larger?
They can be larger. Larger blocks will give you more of a blur.
>>
File: 2016-08-12-214939_1600x900_scrot.png (153KB, 1600x900px) Image search: [Google]
2016-08-12-214939_1600x900_scrot.png
153KB, 1600x900px
output and code for reference.
http://pastebin.com/7RMaXi4A
>>
>>56053195

http://www.jes.com/pb/

I can bet that it was done in a pick dialect of basic.
>>
>>56053299
that makes sense thanks senpai.
>>
File: KNK11_7.png (86KB, 708x151px) Image search: [Google]
KNK11_7.png
86KB, 708x151px
How good is this solution? It's shorter than a lot I've seen online but I'm sure I've fucked up somewhere. Seems to work for every day/year I've thrown at it so far though.

void split_date(int day_of_year, int year, int *month, int *day){
int end[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int i;

if(year % 4 == 0)
end[2] = 29;

for(i = 1; i <= 12; i++){
if(day_of_year - end[i] > 0){
day_of_year -= end[i];
*month = i + 1;
}
}

*day = day_of_year;
}

>>
>>56053377
Seems good, this was mine two years ago:
void split_date(int day_of_year, int year, int *month, int *day)
{
/* mixed vars */
bool leap_year = false, feb = false;
int i;
/* array for the months */
int calculate_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 31, 31, 30 ,31};


/* check if leap year */
if (((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
{
leap_year = true;
}

/* calculate how many days could fit in exacts months, the remainder will by the days */
for (i = 0; i < 12 && day_of_year >= calculate_month[i]; i++)
{
if (leap_year == true && day_of_year >= (calculate_month[i] + 1) && i == 1)
{
day_of_year -= 29;
feb = true;
} else if (day_of_year >= calculate_month[i])
{
day_of_year -= calculate_month[i];
}
}

/* add one to i, since array's index start at 0 and store it by the pointer */
*month = i; /* not needed to increase, ?! */
/* store the remainder days, which they can't fit in a complete month */
/* first check if day_of_year is not 0, if is 0 add the corresponding days of the actual month */
if (day_of_year != 0)
{
*day = day_of_year;
*month += 1;
} else if (feb == true && i == 1)
{
*day = 29;
} else
{
*day = calculate_month[i - 1];
}

}
>>
>>56053341
ask Double D
>>
>>56053657
the fucking nerd is banging that trailer trash skank with the blue hair. Oh how times have changed.
>>
>>56053657
>>56053688
what
>>
Are file extensions case sensitive?
>>
>>56053768
It was a cartoon in the 90s about three friends named ed they where always trying to save up money to buy jawbrakers
>>
>>56053802
Depends, NTFS is insensitive, most other fs's are.
>>
Been a while since I last messed with lisp so I'm doing sicp again to get comfortable.

#lang sicp
(define (sqrt-iter guess x)
(if (good-enough? guess x)
guess
(sqrt-iter (improve guess x)
x)))
(define (improve guess x)
(average guess (/ x guess)))

(define (average x y)
(/ (+ x y) 2))

(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))

(define (square x)
(* x x))

(define (sqrt x)
(sqrt-iter 1.0 x))



Using racket so I don't have to screw around with too much.
>>
>WPF has no built in open directory dialog

Is Microsoft literally retarded?
>>
>>56053377
You need to expand your leap check.

It should be something like

if(year%4==0 && year%100!=0 || year%400==0)
>>
>>56053539
Your coding style...

/*returns 0*/
return 0;
>>
>>56053927
could be confusing if you don't know what return means
>>
>>56053935
return :: (Monad m) => a -> m a
>>
>>56054040
Sorry Anon, but you appear to be using a meme language.
>>
C++ question.

I have a pointer to an object. One of it's class members is a ponter to another object, a vector. What syntax do I use to access an index of that vector?

(*obj1).(*obj2)[3] doesn't work.
obj1->(*obj2)[3] doesn't work.
What is the correct syntax? I want to access it using the array syntax because it's faster.
>>
>>56054130
I don't use C++ but have you tried obj1->obj2[3]. The array syntax should tell it that the thing in question is a pointer.
>>
So out of practice with lisp it's not even funny. Any tips to improve the formatting?

#lang racket

(define (sqrt x)

(define (square x)

(define (double x)
(+ x x))

(exp (double (log x))))

(define (good-enough? guess)
(< (abs (- (square guess) x)) 0.001))

(define (improve guess)
(define (average x y)
(/ (+ x y) 2))
(average guess (/ x guess)))

(define (sqrt-iter guess)
(if (good-enough? guess)
guess
(sqrt-iter (improve guess))))

(sqrt-iter 1.0))
>>
an upperclassman told me I should learn python for my algorithms class. As it stands right now my best language is C++ so I'd be doing the class in that, but I'm sure it'd be very difficult; especially if hand-written data structures were involved. is there any merit to what he says? do you recommend another language? I think I can use any language.
>>
>>56053927
That was when I started learning programming, I still like to comment my code (maybe a bit more than necessary) but now I keep comments at function definition level mostly.
>>
>>56054183
C#
>>
I'm more interested in the pic than the thread.

Call me /g/.
>>
>>56054173
Don't use lisp.
>>
>>56054183
Do you understand how pointers work?
If so, just use C++.
>>
>>56054192
I know C# already but I don't use Windows so no VS. I'd prefer something I can use with emacs and terminal in linux; unless you have a particular reason why you'd recommend C#
>>
>>56054205
Well I've been using C++ since I was 13 so I think I do.
>>
>>56054183
Why not wait and see how hard the class is?
>>
>>56054229
Jesus christ, that sounds horrible.
>>
>>56054229
If you're that confident in your C++ skills, why do you think the class would be hard using C++?
>>
>>56054209
>I know C#!
>doesn't know about .NET Core

Why would you tell lies on the internet?
>>
>>56054163
That doesn't work I don't think? Because I need to dereference obj2 as well. My problem is even more complex, because it's a 2d vector, a vector of vectors.

I found the solution though.
(*obj1->obj2)[3]
>>
>>56054204

Compelling argument anon. Why exactly shouldn't I start playing around with lisp / scheme again for hobby projects?
>>
>>56054254
What the fuck is .net core? I use mono to run Chashtag application on Linux right now, but if .net core has all the shit I need and isn't as much of a bloated heap of shit I'll switch to that instead.
>>
An instagram dataminer
>>
An instagram dataminer named

InstaMine!
>>
>>56054401
>What the fuck is .net core?

Why don't you look that shit up?
>>
>>56054435
Too fucking lazy brah, I've been vegging out at work for 12 hours now and I don't want to use Google anymore.
>>
>>56054444
What's your Linux distro?
>>
>>56054484
Gentoo.
>>
>>56054444
nice quads
>>
Fucking christ familias, I got it working for one second and then I decided to change the code to make it more readable and now it's completely broken.

http://pastebin.com/jEN3MckR

Well aware that the size parameter is redundant btw familias, it's gone in the version of the program I have on my PC but I couldn't be assed to make a new Pastebin.

The issue seems to lie in the for loop inside of the initialPurchase function. no matter what iteration of the loop it's on, a[i] never evaluates to anything other than a[0] until the last iteration of the loop, where it'll all of a sudden prompt the user to buy their misc supplies and then goto reset because it'd be impossible to spend less then 700 if you're not buying anything but oxen.
>>
>>56054577
ohgod

Don't use goto.

Honestly there is so much wrong with that code I don't even know where to begin senpai.
>>
>>56054619
Given the fucked up number of indentations that code has goto was actually a good idea.
>>
>>56051606
The first website I learned javascript/python on was codeacademy, it has guided tutorials where you pretty much program on rails, which to me is its weakness, but it's good for beginners
>>
>>56054577
>Using a GOTO

GOTO GTFO
>>
>>56054619
>>56054665
>mindlessly parroting memes
Goto was literally the most readable option.
>>
I want Dijkstra to leave
>>
>>56054577
I mean no offense man, I understand everyone has to start somewhere. The code I wrote when I was first starting to learn to code was really awful.

But this is like bait tier levels of bad. I honestly don't even know if you're serious, or if you just put together something so awful as a joke.

I mean, I've never, ever ever seen someone use a do-while loop irl. Or goto. And why use if/else inside a for loop? If you remove the for loop AND the if/elses, and just have each do-while loop one after the other, your code would do the exact same thing.

>>56054696
>readable
>that code
>>
>>56054696
>>56054709
Look at you trying to talk shit when your ass can't even write a simple loop properly
>>
>>56054696
I'm not even lying, that is literally the worst code I have ever seen in my entire life. Don't try and talk about memes when you write at the level of a 10 year old.

Go back to scratch.
>>
>>56054728
How can someone know who Djikstra is, and write code like that?

It's bait.
>>
>>56054715
>>56054728
>>56054740
I just started programming less than a month ago, s-sorry if it's not up to your standards senpais.

I'm definitely open to suggestions thogh, and if my code is so incomprehensible that you don't even know where to start then I could explain what I intended for it to do step by step if it meant being a better programmer.
>>
>>56054254
I mean I've used it at work and we certainly were not using Linux there. I found the language kind of boring and didn't do much with it at home.
>>
>>56054577
Couple things friend.

Don't use bool in C, lowest level of memory you can address in C is 8 bits unless you use bit fields. In C always use char in place of bool.

Don't use goto.

Finally the reason your logic is failing is you're comparing the values of the elements in the array, not the indexes themselves.

It should be if(i==ANIMALS).
>>
>>56054253
>>56054253
sometimes even then there are easier ways
>>
>>56054785
I understand each step of it. I know how all the structures work. But you've combined them in such a confusing and redundant way.

To start with, that for loop and those if else statements are redundant. Your code would have exactly the same effect if it were just one do-while loop after the other.

Also, why do-while? I have personally never used a do-while loop, they are confusing and weird. Would be much simpler as a while loop.
>>
So I've created an Android game app, and the game play and menu screen layout is copied from another app.

The game play I've copied is the way the character jumps, and the way the platforms and obstacles spawn.

Everything else is different, and I've written all of the code myself.

Can they get me removed from the Play store? Or will I be fine?
>>
Do the programmers here who learned diy, how long did it take before you got a job? How did you justify your skills?
>>
>>56054876
Depends, did you decompile and steal their source? Or did you just imitate the look a bit. As long as you aren't using trademarks or copyrighted names, you should be fine.

Not familiar with the Play store myself, but isn't it rife with clones anyway?
>>
>>56049884
>working with streaming replication on data clusters, optimizing hive jobs and working out tricky release strategies

You're not a web developer, you fucking moron.
>>
>>56050521

I hope this is sarcasm.
>>
>>56054910
I learned on my own for a year, did one year at a university and then got offered a job. At uni we mainly focused on OOP concepts, which I hadn't really done much of on my own, these were super useful when working, learn them.

I was working there for an internship over the summer at first, so I guess I proved myself by being competent and productive during that time. Didn't really prove anything to get the internship, just said "Yes, I can program".
>>
>>56054964

Do you recommend any books on programming? Not any specific language but methodology in general? I only Java and a few libraries. I always find myself asking myself how. I don't think it's a lack of Java knowledge, but a lack of OOP and general programming methodology knowledge.
>>
>>56054981
you trying to get recommended SICP?
>>
File: iaf9aa093f.jpg (16KB, 450x325px) Image search: [Google]
iaf9aa093f.jpg
16KB, 450x325px
>>56051755
> Suggests javascript as a functional programming language to learn
>>
>>56054824
I have an #ifndef in the header file that defines bool as an int8_t, is there still good reason to use a char instead? (believe chars are the same size on most systems, and the stdint library is ANSI standard)

You're completely right about the logic of my code though, forgot to assign the value of moneySpent to the element in the array addressed by the if/elif statement so every element has a value of zero. Therefore every element in the array is equal to one another so the first if statement always evaluates to true.

>>56054833
I d-don't know why I use do-while familia. Is there a neater way to keep pestering the user for input if they enter something unreasonable?
>>
>>56054912
I imitated the look. I haven't even downloaded their APK.
There's only 2 randomly generated walls, 2 randomly generated cubes, and a diamond.

But I used tracing paper on my phone screen to compare both apps until I got the spawning exactly the same.

I guess I shouldn't have to worry, as you're correct that there are a ridiculous amount of clones
>>
I don't get how one is supposed to cross-compile using the cross packages from some random ubuntu PPA....
has anyone used this shit? how the fuck do you compile mips shit from amd64???
>>
>>56054760
>otherwise it looks ok although i prefer the one with just a nested loop where you choose the character based on if the variables fit the lines' mathematical equations like y == x etc

You would be amazed at what happens when someone who has a degree in math decides to go to grad school for computer science.
>>
>>56055013
>I have an #ifndef in the header file that defines bool as an int8_t, is there still good reason to use a char instead?

Not really, so long as they aren't the bool type that was included with the 1999 standard.
>>
>>56055053
http://wiki.osdev.org/GCC_Cross-Compiler
>>
>>56055001
>SICP

Full of autism, but good read.

>We are about to study the idea of a computational process. Computational processes are abstract beings that inhabit computers. As they evolve, processes manipulate other abstract things called data. The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells.

lmao
>>
>>56054981
How much oop have you done? Once I had a general understanding of how oop works in Java, I just started reading about different design patterns. And writing applications that used them.
If you want a book that's really great (but Java specific), check out "Thinking in Java". It covers a large amount of the useful stuff in the api, and uses good Java programming practice.
Didn't really read any book specifically other than that though.
Playing around with C# isn't a bad idea either, as lot's of Java skills carry over. Lot's of companies are using C# for crud business applications, so saying "Yes I know C#", even when most of your knowledge is in Java, is a good idea.

>>56055001
Fuck SICP. If you wanna do academia for compsci, go ahead, great book as an intro. But to actually go out and get a real job? Nope. It's also sorely lacking in any kind of object oriented stuff.
>>
>>56055013
I don't know if it makes any difference in how terrible my code is in general, but I'm trying to stay as true (functionally speaking) to this >>56053195 as possible.

Would appreciate any and all constructive criticism you still have (though I would really appreciate if you reimplemented the function in a more sane way so I'd know how somebody who isn't me or Pajeet would do it)
>>
>>56055013
Just use a while.

while(moneyToSpend < 200 || moneyToSpend > 300) {
// Your stuff here
}


Do guaruntees that the loop will happen at least once, even if the condition is not fulfilled.
>>
Bump limit reached, new thread!

>>56055124
>>56055124
>>56055124
>>
>>56055130
Wow, how about no
Dumbass
>>
>>56055107
If you are trying to stay true to that code, all you are going to do is translate that logic into C. It will be longer and more complex than necessary, but I guess it's doable.

If you want to do it well though, try and rewrite it in C without using goto. You should be able to use C concepts (if/else, loops, etc) to do everything in that code without using goto.
>>
>>56055130
fuck of
>>
>>56055076
you don't know how many times I've tried this...
no, this won't work.
>>
NEW THREAD!!! (AT 310 POSTS!)

>>56055170
>>56055170
>>
>>56055124
>>56055124
>>56055124
Welcome!
>>
>>56055210
>before bump limit
>pedo in OP
>not even related to programming
>didn't even use the proper subject
yeah, nah
>>
>>56055223
Lol, nice lies you fucktard, I'm going to the real thread.

>>56055124
>>
>>56055274
Everything I said is true
Garbage thread desu
>>
>>56055288
HAHAHAHAHAHAHAHAHAHAHAHA

>>56055188
HahahahahahahahaHAHAHAHAHAHAHAHAHAHAHA
>>
>>56048524
Can't speak for most of those, but since Clojure is a Lisp dialect it's probably got some redeeming feature
Thread posts: 318
Thread images: 24


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