[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: 314
Thread images: 30

File: timetocode.webm (2MB, 1152x648px) Image search: [Google]
timetocode.webm
2MB, 1152x648px
This is /dpt/, the best subreddit of /g/

Umaru-chan edition, the best of all editions.

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

code of conduct:
no racism
no insult
no sexual harassment
no gender discrimination

wat r u working on, anon-chan ?
>>
>>52598743
First for D
USE THE ROLLER GODDAMMIT
https://better-dpt-roll.github.io
>>
>>52598743
>wat r u working on, anon-chan ?
>>
Reminder: if it's not OCaml, it's shit!
>>
>>52598807
lrn2english, nigger.
>>
>>52598835
reminder: if haskell was created to fix some of its problems, then its shit
>>
>>52598874
>ocaml
>First appeared 1996; 20 years ago
>haskell
>First appeared 1990; 26 years ago
lel, k tard.
>>
>>52598861
I'm just putting up keywords...
>>
>>52598904
>oh camel
>not "oh cami"
you're a disgrace to my family
>>
did the codecademy git course, then fucked around with git to see how it works with github, pretty cool stuff.

made another account, forked one of my main account repos, submitted a pull request, then merged it from my main account
>>
>>52598874
But it wasn't. Haskell was an experiment in lazily-evaluated programming language. An experiment that failed miserably, too.
>>
>>52598925
uwotm8
>>
>>52598929
>>52598929
>>52598929
>>52598929
btw give me some "exercises" to do with git(hub)
>>
>>52598932
what do you mean?
I'm willing to jump band-wagons if you can explane why oh camel is better
pls, im just a noob; educate me
>>
>>52598743
Oh look, it's this faggot again
>>
File: minesweeper.jpg (56KB, 485x345px) Image search: [Google]
minesweeper.jpg
56KB, 485x345px
High-level programmer here, just finished another bleeding-edge project.
>>
>>52598743
Umaru is a stupid chink.
I wanna sex it because it's a girl.
>>
>>52598967
just drop FP altogether stupid cargo culter
>>
>>52599034
functional programming?
>>52599043
whats a cargo culter
I've heard it before in here
you the same shill?
>>
>>52599034
You are on the cusp of innovation
>>
>>52599063
that probably wasn't me

https://en.wikipedia.org/wiki/Cargo_cult

it's when you blindly follow something without understanding it so what you're doing is shit

like you can use "pure" functions within a normal program just fine, you don't need an entire paradigm where the entirety of your program is based around """"""""pure"""""""" functions where they aren't even really pure because you end up passing huge amounts of state to the functions through "monads" for the sole reason to be able to say that they are """"""""pure""""""""
>>
File: wig-wig.jpg (28KB, 294x365px) Image search: [Google]
wig-wig.jpg
28KB, 294x365px
>>52599040
How could you want to screw that? It looks like a fucking wig-wig.
>>
This is C for an Atmega328p compiled with AVR-GCC

any ideas why my ADC is giving garbage results? it's saving the right values for each axis, but they make very little sense.


#include <asf.h>
#include <avr/io.h>
#include <util/delay.h>
#include <stdint.h>
#include <math.h>
uint8_t AnalogVal = 0;
uint8_t isXaxis = 1;
uint16_t Yval;
uint16_t Xval;
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))


int main (void)
{

/* Insert system clock initialization code here (sysclk_init()). */
ADCSRA |= _BV(ACME);
ADMUX |= _BV(MUX2); // toggles between ADC4 and ADC5 instead of 0 and 1 now
ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0); // Set ADC prescaler to 128 - 125KHz sample rate @ 16MHz
DIDR0 = 48;
DDRC = 0x0F; // set PORTC (3-0) to outputs
ADCSRA |= (1 << ADEN); // Enable ADC
ADCSRA &= ~(1 << ADATE); // does not set ADC to Free-Running Mode


while(1)
{


ADMUX ^= (1 << 0);
ADCSRA |= (1 << ADSC);
while (ADCSRA & (1<<ADSC));
ADC = 0;

ADCSRA |= (1 << ADSC);
while (ADCSRA & (1<<ADSC));
isXaxis = CHECK_BIT(ADMUX,0);
AnalogVal = ADC;
ADC = 0;
//0100 ADC4
//0101 ADC5 (x axis)


if (isXaxis == 0)
{
Yval = AnalogVal;

}

if (isXaxis == 1)
{
Xval = AnalogVal;

}

}
return(0);
}

>>
>>52599147
No, it looks like a hairy onahole.
>>
>>52599040
>>52599147
>>52599168
>wanting to have sexual relations with a cartoon drawing
Full of normal people ITT
>>
>>52598967
As >>52598904
pointed out, haskell is older than ocaml, so clearly it can't have been made "to fix its flaws" (you could at least pretend the other way around). The point of haskell was to have a lazily-evaluated ML variant in the hopes to enable advanced optimization and programming techniques, providing much increased performance while also making it possible to program an idea "directly" instead of thinking about the difference between tractability and countability. It was a failure because default laziness has shown that it makes programming much harder since one cannot reason about resource consumption easily. One even has to have a shitload more tests to cover every possibility than in eager languages despite the advanced type system that haskell provides. Additionally, the available optimizations in some cases did not outweigh the loss of performance everywhere else (i.e. it is more common to want to evaluate something immediately than a long time in the future or even never).

OCaml's module system is something haskell will never have in a thousand years. it's absolutely fantastic. So is the object system (despite the fact that modules are so powerful they can take the role and often do), especially since it allows both row and column polymorphism as well as minimal-requirement type inference and pattern-matching, e.g. you can put any class (with no hierarchical relation) into a function that simply calls method some_method on that object so long as that method is implemented, and that fact is encoded via types.

It additionally features the best garbage collector of any language out there, with extremely low latency and high responsiveness. Moreover, it is precise, m&s generational, unlike the garbage most other languages are using, which is usually based on the boehm gc. This too is something haskellers could only get in their dreams.

Also, indentation has no semantic meaning, unlike in haskell.
>>
>>52599152
>if (isXaxis == 1)
Your CHECK_BIT doesn't behave the way you think it does.

Do this instead
#define CHECK_BIT(val, pos) !!((val) & (1 << (pos)))
>>
>>52599131
seems I'm a cargo culter
btw, I don't even care about purity, I only care about the part about expressing your program as just a function comprised of expressions
but anyways, you seem to know what you're talking about (FP), so I take you were a culter too and dumped the paradigm?
>>
>>52599230
>>52599152
Although I doubt that's your real issue, as retrieving position 0 should make it either 0 or 1.
>>
>>52599223
So... Haskell is like the opposite of C (at least ideologically)?

>>52599197
>not wanting to sex cartoon drawings
>>
>>52599260
Hakell wanted the speed of C with the power of ML-family languages (i.e. as high level as possible programming).
C wants you to make a thousand backdoors for the NSA without knowing it.
>>
>>52599292
>Hakell wanted the speed of C
'wanted' being the keyword there
>>
>>52599260
I want to sex people that dress up in costumes pretending to look like cartoon drawings, but not the cartoon drawings themselves.
>>
>>52599327
What's wrong with you.
>>
>>52599314
Yeah, but only because it failed dramatically.
>>
>>52599356
I have a meta-fetish
>>
/g/entoomans

I am doing stuff with files in C. I need a way to replace characters in a file with other characters.

Dear{recipName},

I understand that we haven’t spoken since I ran away with {friend}...

But I thought you should know that we have a son.

His name is {sonName}. He has your {feature}.

Sincerely,
{sendName}


I need to replace what is inside the curly brackets. What is the best way to get to the curly brackets? A string function? A for loop? My program reads line by line so far.
>>
>>52599292
Is C not secure because it's too basic?
>>
>>52599370
well when you put it that way it doesn't sound so bad..
>>
>>52599418
while(getc(file)!='{')
>>
>>52599418
C is a poor choice for this problem.

Do it with a state machine
>>
is this the correct git workflow?

>fork someone's repo
>clone that fork to your pc
>make changes
>submit pull request from github website
>>
>>52599441
*fgetc
>>
>>52599421
Basically, yes. The type system is too simplistic to encode any information that can be used to provide safety, there are no bounds checks, failure is completely silent almost always, and the inbuilt tools only operate on the most elementary kinds of data.
>>
>>52599452
*github workflow
'fork' is a made up by GitCuck.
>>
>>52599452
No

clone repo
make changes
make diff
send diff as patch to the original repo owner
>>
>>52599478
ahh, where can i read about this in detail?
>>
>>52599230
>>52599250

I just got my friend to look at it and I was saving a 16 bit value in an 8 bit value
>>
>>52599475
>being this ignorant
>still spouting retardation all over the place like it's truth
>>
>>52599465
ok so now when I get there how do I take the characters between the curly brackets?
>>
>>52599583
Stop being retarded.
>>
>>52599583
fscanf
>>
>>52599223
Could you explain ML modules to an experienced haskeller?

Also I don't believe in structural typing, but that's another topic.
>>
>>52599633
>I don't believe in structural typing
I am not sorry for you that you are retarded.
ML != ocaml.
https://realworldocaml.org/v1/en/html/functors.html and the next chapter.
>>
>>52599633
>I don't believe in structural typing
i can assure you anon, it is a very real thing.
>>
>>52599712
>I am not sorry for you that you are retarded.
Why?

>ML != ocaml
I don't know much about ML/Ocaml themselves, that's why I'm asking. Also, if I were willing to understand them in detail I would have read that myself already. I was just asking about a brief comparison.

>>52599745
I don't think structural typing is the right way to do it, ok?

For instance, I could have a couple of functions named as you require but not satisfying some compatibility requirements. The structural constraint does not capture that: having the same representation does not mean that they have the same meaning.

Again, it's more of a matter of personal preference (some people even program in dynamically typed languages)
>>
>>52599895
>some people even program in dynamically typed languages
*shudders*
>>
>>52599223
>It additionally features the best garbage collector of any language out there
>still not multicore
??
>>
>>52599895
>I could have a couple of functions named as you require but not satisfying some compatibility requirements
I have no idea what you're talking about.

Structural typing is just a tool, you don't have to use it. Can you really not appreciate the use of it in certain situations?
>>
>>52599989
ocaml is multicore now
>>
Fuck Prolog.
>>
File: 1451751832808.png (17KB, 418x359px) Image search: [Google]
1451751832808.png
17KB, 418x359px
>>52600149
It was bound to happen
>>
>>52600014
I think explicitly giving instances of typeclasses is a better idea.

Let's say you have:
class Semigroup a where
-- By giving instances, you are asserting that
-- (a <> b) <> c == a <> (b <> c)
(<>) :: a -> a -> a


There are loads of functions like
m -> m -> m
out there that aren't associative. What I'm saying, is that explicitly stating that
instance Semigroup YourType where (<>) = whateverFunc

is better than just writing something like (invented syntax)
type Semigroup = { (<>) :: m -> m -> m }
>>
>>52600037
I don't see it. Where's the news for this?
>>
>>52600186
Don't know. But it's been part of the main release since Jan 1st
>>
>>52600181
False.
>>
>>52600186
https://github.com/ocamllabs/ocaml-multicore
>>
>>52600279
Nothing indicates that it's been merged into the official release.
>>
>>52598743
>calling threads subreddits
>being a hamsterposter
>>>/out/
>>
>>52598743
Why do i keep getting syntax errors?

#!/usr/bin/env python2

# Linux user & Developer presents: Rock, Paper, scissors: The Video game

import random
import time

rock = 1
paper = 2
scissors = 3

names = { rock : "Rock", paper: "Paper", scissors: "Scissors" }
rules = { rock: scissors, paper: rock, scissors: paper }


player_score = 0
computer_score = 0

def start () :
print "Let's Play a game of Rock, Paper,Scissors."
while game () :
pass
scores ()

def game() :
player = move()
computer = random.randint (1, 3)
result (player, computer)
return play_again()

def move() :
while True:
print
player = raw_input("Rock = 1\nPaper = 2\nScissors = 3\nMake a move: ")
try:
player = int(player)
if player in (1,2,3) :
return player
except ValueError:
pass
print "nigger I didn't understand that. please enter 1,2 or 3."

def result (player, computer

time.sleep (1)
print "2..."
print "3!"
time.sleep (0.5)
print "Computer threw {0}!".format(names[computer])
global player_score, computer_score
if player == computer:
print "Tie game."
else:
if rules[player] == computer:
print "Your Victory has been assured."
player_score += 1
else:
print "The jew laughs as you realise your shekels are gone."
computer_score += 1

def play_again():
answer ) raw_input ("Would you like to gayme again? y/n: ")
if answer in ("y", "Y", "yes", "Yes", "of course!") :
return answer
else:
print "Thank you very much for gayming my gayme . see you next time faggot!"

def scores() :
global player_score, computer_score
print "HIGH SCORES"
print "Player: ", player_score
print "Computer: ", copmuter_score


if __name__ == "__main__":
start ()
>>
Camel and OCaml are the best cigarettes and programming language, respectively.
>>
>>52600258
Why?
>>
>>52600317
Doesn't python literally tell you the line number of it? It's your result function.
>>
>>52600317
holy fuck just look at the terminal you are compiling it on
>>
File: 1451883202449.gif (4MB, 540x303px) Image search: [Google]
1451883202449.gif
4MB, 540x303px
FUCK

The Android references are ridiculously outdated/inconsistent, one page says to code a button one way, the next has a completely different way

How the fuck are we supposed to develop for this shit? Now I know why Applecunts are always laughing at us.
>>
>>52600317
while game():
pass

that makes no sense...
or is it just me?
>>
>>52600353
>>52600361
It shouldnt fucking give me a syntax error there i dindu nuffin wrong

File "game.py", line 45
time.sleep (1)
^
SyntaxError: invalid syntax
>>
>>52600442
That means you should look right above it to see what made that line invalid. Did you miss the answer I gave you?
>>
>>52600317
that's seriously fucked up
>>
>>52600442
How does this even look remotely okay
>>
>>52600442
You did something wrong, faggot

You used UTF-8 without declaring the file encoding as UTF-8
>>
>>52600431
wat?
>>
>>52600510
>>52600361
>>52600353
>>52600528
>>52600467
Stop responding to redditards already. When will you learn that all you're doing by responding is inviting them over?
>>
>>52600442
>>52600467
python error messages everyone
>>
>>52600431
Android is a clusterfuck, especially for low level development.
Last I checked, the officially documented way to get/check USB host permissions takes you 7 indents deep from the parent class declaration.

You get used to the bullshit eventually I guess.
>When in doubt, make more classes
>>
>>52600540
>reddittards
Fuck off you delusional faggot, i've never been on reddit
>>52600528
I figured it out now, thanks
>>52600510
>>
>>52600574
>i've never been on reddit
Not him, but you meme like one. Step up your banter and meme levels and maybe we'll believe you
>>
Do you think we could get TeX for /g/?

Algorithms are used a lot in computer science, it would be nice if we could write them using TeX.
>>
>>52600431
>Motion events are always delivered to views as a consistent stream of events. What constitutes a consistent stream varies depending on the type of device. For touch events, consistency implies that pointers go down one at a time, move around as a group and then go up one at a time or are canceled.

>While the framework tries to deliver consistent streams of motion events to views, it cannot guarantee it. Some events may be dropped or modified by containing views in the application before they are delivered thereby making the stream of events inconsistent. Views should always be prepared to handle ACTION_CANCEL and should tolerate anomalous situations such as receiving a new ACTION_DOWN without first having received an ACTION_UP for the prior gesture.

>Motion events are always delivered to views as a consistent stream of events.
>While the framework tries to deliver consistent streams of motion events to views, it cannot guarantee it.
>>
>>52600599
What's TeX?
>>
>>52600599
If you email neo-moot he might enable it. It's actually worth a shot.
>>
>>52600636
You're too young to understand.
>>
>>52600574
>I've never been on reddit
b-but you program like you do
>>
>>52600297
https://sympa.inria.fr/sympa/arc/caml-list/2015-05/msg00034.html

"As for the next major release, it will include a number of new
features (including, if all goes well, support for multicore). It will
be released some time around the end of this year."
>>
>>52600621
wait i think i've finally understood what it's talking about

like it delivers motion events consistently to your app, but views inside your app might fuck it up
>>
>>52600651
Has he learned English yet, or do you have to write it in broken Japanese English so he'll understand?
>>
In what language are memes programmed?
>>
>>52600701
TrumpScript
>>
>>52600599
how about no
>>
>>52600701
node js
>>
>>52600701
ArnoldC.

>>52600691
If you post in English with machine translated moon at the bottom that should be good enough. You're going to do it?
>>
>>52600671
>facebook image
>s-stuttering
Y-you too
>>
what's the worst language besides python, php and javascript?
>>
>>52600672
That's talking about 4.03, right? Current release seems to be 4.02.3.
>>
>>52600840
"Rust".unwrap.().to_string().unwrap()
>>
>>52600840
C
>>
>>52600802
you have now clearly demonstrated you lack of knowledge of the meme lingo, please leave this thread before you embarrass yourself more
>>
File: hh.png (2MB, 1920x1080px) Image search: [Google]
hh.png
2MB, 1920x1080px
>>52600720
Why not?
>>
>>52600884
a board can only have one of spoiler/code/tex and /g/ is mostly about consumerism and programming, not math stuff
>>
>>52600802
can't believe you failed the ironic meme
>>
>>52600884
>shitshitbearshit
>>>/tumblr/
>>
>>52600912
>a board can only have one of spoiler/code/tex
False.
>>
>>52600884
No one's ever using math in those threads.
>>
>>52600935
proof?
>>
>>52600840
Java
>>
>>52600912
Algorithms are a big part of computer science and programming.

>>52600950
Because people usually explain their algorithm in code since we don't have a neat way to write maths.
>>
>>52600985
lol xd
>>
progress on my scraper

>>52600339
Hello
>>
>>52600840
C++ and Java
notably the biggest meme languages too
>>
>>52600997
pseudocode or prose is usually how programmers express algorithms. tex is only useful for math expressions and people can still write pow() etc.
>>
>>52601002
>even subtly defending Java
>>
>>52600997
>Because people usually explain their algorithm in code since we don't have a neat way to write maths.
I don't think that's the reason.
>>
>>52601027
or actual code, not just pseudocode
>>
>>52601023
C++ and java are literally the best* languages though

*depending on your use case
>>
A TeX tag would lead to more abuse than it would actually contribute to discussion
>>
File: ree.png (447KB, 567x748px) Image search: [Google]
ree.png
447KB, 567x748px
I like the idea of TeX on /g/.

We should all whine about it on /qa/, that's how I got cuck removed from the filter.
>>
>>52601087
this post was actually made

someone actually typed it
>>
Working on a self-service/management portal frontend for an LDAP directory server.
>>
TeX sounds like a neat idea actually.

>>52601091
Anon, please, /sci/ manages just fine.
>>
>>52598743
Fuck off, this OP is so reddit it hurts. Go fuck a nigger elsewhere.
>>
working on a dinky little program that parses through a config file, replaces a string (in this case my background) with another string passed as a command line argument, and saves it to a temp file for a script to deal with

at this point i'm sucking dick for beer money. didn't comment anything and have no clue what i was thinking when i was writing the bulk of it last night
>>
File: 1430853197680.png (331KB, 474x432px) Image search: [Google]
1430853197680.png
331KB, 474x432px
>>52601123
ok so there are no conceivable use cases for some of the most widely adopted languages in the industry, and python/haskell/C# are infinitely better
>>
/g/ would benefit more from spoiler images than TeX.
That's how immature /g/ is.
>>
>>52601198
>C#
I forgot about this meme
>fedora pic
>literally
No offense pal, but you need to step up your memes and banter, what you're posting is years old, did you get them from facebook?
>>
>>52601214
There's no logical reason for spoilers, anon.

TeX would actually be relevant to /g/.
>>
File: uuu.png (1KB, 259x48px) Image search: [Google]
uuu.png
1KB, 259x48px
Fuck TeX. It's hard enough to read code let alone math.

I mean seriously, how is anyone supposed to understand something like pic related?
>>
>>52601361
You forgot 1u. Still, it's a big sigma.
>>
>>52601361
that's fucking crystal clear

perhaps you're just retarded
>>
How do I install OCaml on Windows?
>>
File: 1425429412322.gif (141KB, 287x344px) Image search: [Google]
1425429412322.gif
141KB, 287x344px
>>52601217
>>
>>52601387
you don't
>>
>>52601361
I have problem reading complex math as well, but that shit is trivial.
>>
>>52601382
>i find something easier than someone else does
>they must be retarded!
this is why we shouldn't let college kids vote
>>
>>52601387
Install opam, and then do use opam switch. It will install ocaml for you and it allows you to manage ocaml versions easily, so it's more convenient. Also, install core and utop. Use coretop as the repl instead of ocaml or utop.
>>
just started learning python and came to a bit of a problem.
I have a text file in a form of:
thing1 thingy1
thing2 thingy2
thing3 thingy3
thing4 thingy2
etc

and about like 80 entries like this, with 8 things. Meaning I have similar entries. I have to return the number of individual combinations and also just print them. I succeeded in printing them, meaning program prints only one copy of individual combination. I don't have any ideas how to print the number of their occurence though.
>>
>>52601401
You're essentially saying that because you think 1+1 is hard, it is universally true that it's hard and you're clearly a genius and nobody can understand such complexity.
>>
>>52601361
you joking me lad?

you've got basic numbers and a sigma sign
>>
>>52601382
What does the funny shaped E mean?
>>
>>52601214
worrying about being "mature" doesn't make you mature
>>
>>52601428
It's actually an M rotated 90 degrees counter clockwise.
>>
How the fuck am I supposed to capture the STDOUT/STDERR in C#?

No matter which Stackoverflow or other tutorial I follow, I get the very same issue ALL the time.

Additional information: StandardOut has not been redirected or the process hasn't started yet.


My code (CURRENTLY):
var process = new Process();
var startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;

process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;

startInfo.FileName = "cmd.exe";
process.StartInfo = startInfo;
process.Start();
String output = process.StandardOutput.ReadToEnd();

process.WaitForExit();


But I tried to use StreamReader's.
I tried to use the other method which uses the "=>" operator. But nothing.
>>
>>52601428
It's a greek capital letter Sigma, which stands for Sum (from k=0 up to infinity)
>>
File: 111.gif (5KB, 350x350px) Image search: [Google]
111.gif
5KB, 350x350px
>>52601428
sum symbol
>>
>>52601419
that's actually close to the exact opposite of what i'm saying. the actual point had nothing to do with the actual math, but more to do with the arrogance and lack of perspective of young, turd sucking fuckboys.
>>
>>52601428
sum sign, bottom is starting condition, top is end

it's like a for loop
>>
>>52601405
But opam doesn't support Windows.
>>
>>52601428
sum

in this case it's the sum of 1 / (2^k + 1) for all k integers from 0 to infinity
>>
Hey /g/, starting tomorrow, I will begin learning Java. Do you have any tip on how I can get used to the language easier? So far, I've programmed in C++, Python 2.7 and C#.
>>
>>52601445
Actually it's a W rotated 90 degrees clockwise.
>>
>>52601484
But a W is just an M rotated 180 degrees.
>>
>>52601482
Use an IDE. You will miss Visual Studio.
>>
>>52601455
>>52601456
>>52601467
>>52601478
I see, so it's like a function in programming.

What happens if I put a string into it?
>>
>>52601463
The actual math was on the same level as 1+1. The only one with arrogance and lack of perspective is you. You are quite literally retarded.
>>
>>52601482
It's literally C#.
Instead of "NuGet", you have "Maven".
Use IntelliJ IDEA. (Or whatever else, I like this one.)

Uhm... use Apache's libraries.
Use libraries whenever you can.

Most online tutorials can be outdated.
Java 7 and Java 8 fixed a lot of shit, like you can read files with one line, etc.
Stuff can be auto-closed with try (..), etc.

If you want to do GUI, use SWT+JFace.
You have to test it on all platforms, but it's fast and native.

Swing is cross-platform but ugly and slow.

That's it.
>>
>>52601482
Java is pretty much C# with less features, and a few broken features. Think of it as C# if C# was in a really bad car accident.
>>
>>52601503
There are no strings in math (unless you're working with words in free groups)
>>
>>52601503
that doesn't make any sense

a sum of string ?
>>
>>52601474
>https://www.typerex.org/ocpwin.html
??????????????????????????
Straight from their website.
>>
>>52601326
Animu.

>>52601443
Never argued I was mature.
>>
>>52601527
meh, as a Java dev, this was true until Java 7.
but it's fixed now, very few features are missing now.

and it works on all platforms, you cannot ignore that.
I do love C# though. Hnnnggggg.
But, Java pays better.
>>
File: that means you.jpg (196KB, 396x598px) Image search: [Google]
that means you.jpg
196KB, 396x598px
>they think python is a decent language
>>
>>52601520
>proving my point
if i have to point it out, there are (a huge amount of) incredibly intelligent people whose education never consisted of math. trying to equate lack of knowledge to mental retardation is either self-serving or ignorant.
>>
>>52601492
No, a M is just an W rotated 180 degrees
>>
>>52601499
I downloaded Eclipse, since pretty much every Java programmer I've known uses it.

>>52601523
Got it. I'll give IntelliJ IDEA a shot, as well.

>>52601527
Well, at least I will have a basic idea of how it works.
>>
>>52601565
Nobody ever taught that notation to me. It's literally a google search away
>>
>>52601565
Found the inbred, ladies and gents!
>>
>>52601560
fine, what's your pet language?

for an imperative language python is pretty decent
>>
>>52601591
now you're just being obstinate.
>>
>>52601565
for(int i = 0; i < 10; ++i) {
print("nigger");
}


>I mean seriously, how is anyone supposed to understand something like this?
>>
>>52601601
C++, nim and ocaml are the only good languages

If you don't use these you should kill yourself
>>
>>52601590
People prefer Eclipse, but it's got some steep leaning curve.
Addons can be outdated too (ok, most of the time).

But it's lean and very extendable.
I worked with Eclipse at job, it was... ok.
Senior Java guy frowned when I mentioned NetBeans.

Honestly, I think NetBeans is more beginner friendly.
(After IntelliJ.)

Welp, at least you have choices here.
>>
>>52598743
I just see a sliding potato human

How is there an industry of cartoons full of potatoes acting like human beings
>>
>>52601612
>>52601600
excuse me while i bask in your opposition to my logically sound but unpopular statement
>>
>>52601620
netbeans might be a bit more beginner friendly but eclipse is superior imo
>>
>>52601619
>nim
More like meme amiright
>>
>>52601546
That isn't opam.
>>
>>52601620
True. I've heard of NetBeans, but I've never heard of IntelliJ before.
>>
>>52601627
they are made for autistic people.

>>52601636
yeah, exactly.
but if he is new, NetBeans should be able to cover his ass.
>>
>>52601601
OCaml is the only good language.
Nim is a travesty, one struggles to even call it a language, let alone good. C++ is good due to its speed (equal or faster than C in most cases), low-level primitives and high-level abstractions. It is however a gigantic mess due to years of trying to tack on more and more stuff while remaining compatible.
>>
>>52601448
bump

just want to show the output in a textbox...
>>
>>52601627
developmentally disabled manchildren like to live vicariously through a 3 year old girl with severe ADD that gets everything handed to her on a silver platter
>>
>>52601638
>opam isn't opam
10/10 logic would respond to again.
>>
File: saddle up.jpg (123KB, 1920x1080px) Image search: [Google]
saddle up.jpg
123KB, 1920x1080px
>>52601659
anon lets drive into the sunset and leave these plebs behind
>>
>>52601689
Thought you'd never ask. Buckle up, buckaroo!
>>
>>52601619
>C++
you fucking kidding me?
it is the very definition of a kitchen sink language

wait are you trolling?
>>
So is this basically what the funny shaped E does?

function E() {
var sum = 0;
for(var i = 0; i < arguments.length; i++) {
sum += arguments[i];
}
return sum;
}

E(3, 6, 4)
>>
>>52601725
It's called a sigma and yes, it just adds things together.
>>
>>52601719
it is a kitchen sink language

it's still better than half the shit people use
>>
>>52601679
Are you blind? You linked to something called OCPWin, not opam.
>>
>>52601725
>>52601741
btw "sigma" is a Greek "s," it stands for "sum"
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is okay


Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>
>>52601725
Actually...

function sum(start, end, f) {
var res = 0

for (var i = start; i < end; i++)
res += f(i);

return res;
}
>>
>>52601725
more like

function E(var start, var end, function expr) {
var sum = 0;
for(var i = start; i <= end; ++i) {
sum += expr(i);
}
return sum;
}

E(0, 10, func("x * x - 2 * x"))
>>
>>52601725
I think you can use the actual 'Σ' symbol in JavaScript.

I'm not sure what the best practises police would say about that though.
>>
>>52601725
n(n+1)/2 = O(1), musch nicer closed form for summing this particular obe

so guys i did sicp, some math after, and now learning about algs, but i intuitively want to write them recursively, but since python doesn't do tco it's only token functions i'm writing as they can't handle inputs larger than the recursion limit

what are some general tips in substituting recursions with iterations
i was thinking using
>>
File: this guy.jpg (76KB, 1280x720px) Image search: [Google]
this guy.jpg
76KB, 1280x720px
>>52601799
>he doesn't have greek and latin keyboards
>>
>>52601751
Fucking inbreds, they're everywhere!
>>
>>52601846
Why would you resort to name calling instead of just admitting your mistake? It's pathetic.
>>
Im learning how to handle graphs in Python. My script solves those puzzles with buckets that have different capacities (like the one in the movie "Die Hard III"), and you have to pour water from one bucket to another to get a certain amount of water in certain buckets.
It works great, except that the graph size grows exponentially with the number of buckets. But it doesn't really matter, since all of those puzzles for manual solving I know solutions to have at most 4 buckets.

While writing the mentioned script I got a little curious: Lets say I have two data structures, one is a dictionary containing a graph called "G", and the second is a queue with nodes from that graph called "Q". Suppose I don't want to have hard copies of nodes from G in Q, because that might be a waste of memory. In C/C++ I would just use pointers/references in both G and Q to some list of nodes N. In Python I could use an additional dictionary "N" with lightweight keys to store the nodes. But is it the right way? Isn't there a way to handle pointers in Python? Or there is, but I should avoid them?
>>
>>52601927
>python

I'm sorry but you have no dignity, let alone competence
>>
File: WnTGg.jpg (57KB, 663x898px) Image search: [Google]
WnTGg.jpg
57KB, 663x898px
foreach (var node1 in tree.nodes)
{
foreach (var node2 in node1.nodes)
{
foreach (var node3 in node2.nodes)
{
foreach (var node4 in node3.nodes)
{
foreach (var node 5 in node4.nodes)
{
// some bullshit
}
}
}
}
}


>my sides when I saw something like this in production code
>>
>>52601927
watch this if you haven't already

https://www.youtube.com/watch?v=0Oef3MHYEC0

and don't use python you shitter
>>
File: dinosaur.gif (34KB, 100x100px) Image search: [Google]
dinosaur.gif
34KB, 100x100px
python knowers halp with >>52601413
>>
>>52601960
>>52601995
So what else do you suggest?
>>
>>52601927
how did you solve the 2 bucket ones
did you use euclid's algorithm

i thought it's pretty efficient for 2 buckets, so why wouldn't one be able to generalize it for 4 buckets, somehow
>>
>>52598743
Fuck off.
>>
>>52602060
Well, my problem is similar but not exactly the same. I can't spill any water and I can't draw it from anywhere else.
>>
>>52598807
I was also working with latex. It's a horrible language that needs to be reworked... but it's still not as horrible as java.
>>
>>52601413
If you use a set, you can just print it's len().
>>
>>52601771
Thanks, finally
A code is usually something hidden and hard to understand ▪~▪
>>
>>52598835
put that on your resume and see what happens
>>
How do I learn math so I actually understand it?
>>
>>52602471
you must keep playing vidya games
>>
>>52602213
Just to note:
LaTeX is a markup language -- and a good one
Java is a multi-purpose programming language -- and an ugly one
>>
>>52602471
What math are you having trouble with senpai?
>>
>>52602529
Calculus, I'm just applying algorithms to shit but I don't know what I'm actually doing and why it's useful
>>
>>52602447
I got hired with a starting salary of $120k.
>>
>>52602550
It gets useful and interesting at university. It is stupid at high school.
>>
>>52602471
first you must understand what math actually is

https://www.maa.org/external_archive/devlin/LockhartsLament.pdf
>>
>ocaml
>let rec
>no pattern matching directly in parameters
>obnoxious double semicolon
Are you ocaml shills fucking kidding? Please shill something less retarded
>>
>>52602471
Khan academy is good for maths.
>>
>>52602471
stop being retarded
>>
>>52602471
If it's for your class, then you have to actually sit and study for once. Remember, math is unforgiving - if you skipped something it will come back at you and bite you in the ass. That's probably the reason why you don't get it.
So say hello to hemorrhoids and backtracking to the material from middle school you were too cool for.
>>
Most of my ideas these days come from reading papers. Latest project is implementing the WOOT algorithm (https://hal.inria.fr/inria-00071240/document) in js_of_ocaml just for the sake of it.
>>
What does that mean:
Repertoire2.java:20: error: no suitable method found for get(Contact)
System.out.println(cont.get(p).toString());
^
method List.get(int) is not applicable
(argument mismatch; Contact cannot be converted to int)
method AbstractList.get(int) is not applicable
(argument mismatch; Contact cannot be converted to int)
method ArrayList.get(int) is not applicable
(argument mismatch; Contact cannot be converted to int)
1 error


I don't understand

Here's the method I wan to make

public void afficheContact()
{
for(Contact p:cont)
{
System.out.println(cont.get(p).toString());
}
}
>>
>>52603241
Seems pretty clear to me.
>>
>>52603241
No suitable method found for get(Contact)
>>
>>52603241
Can you read? The get method only accepts an int, you are trying to convert p, which is type "Contact", to int, which is not possible.
>>
>>52601984
what do you suggest then?
>>
>>52603323
:^)
f = flat_map(e => e.nodes)
nodes_in_5 = f(f(f(f(f(f(tree)))))
// do shit with nodes_in_5
>>
>>52603439
lisper pls
>>
>>52603492
>lisp
>>
>>52603515
it's a meme you dip
>>
>>52603556
I was meming too :^^^)
>>
>>52601984
let traversal = let t = nodes.traverse in t.t.t.t.t
in traversal (some bullshit) tree
>>
>>52603515
If it has more than two closing parentheses, it's Lisp
>>
>>52602675
>no pattern matching directly in parameters
Except there is, if you mean something like
let (Nigger x) = kill x
let {git; gud} = git+gud


>obnoxious double semicolon
That's only for the repl, to differentiate between a statement with spaces in it and with end-of-form.
>>
File: 3pfnu4F.png (9KB, 277x197px) Image search: [Google]
3pfnu4F.png
9KB, 277x197px
r8 my project: https://github.com/rzumer/Webbum
>webm for retards doesn't even support multiple video streams
>>
>>52603736
>angle 1
does anything in the world actually use that?

>webm for retards doesn't even support multiple video streams
That's because it's deliberately simple.
>>
>>52603736
nice.

how long do you program?

did you follow any documentation to do this this project?
>>
>>52603809
It is more challenging than you may think to juggle between streams. But it's not very useful to be fair, just wanted to play around with it

>>52603819
3+ years of school in computer science and a couple of internships, but it is the first thing I am doing in my free time (except tiny javascript apps)
I used documentation for ffmpeg, vp8, libav, and dug through the code for libav to figure out some implementation of the library. And of course qt documentation and a lot of google. But I didn't write/follow specs or anything if that is what you mean.
>>
>>52603906
>just wanted to play around with it
fair enough. Impressive work.
>>
File: Slithering-Camel.jpg (189KB, 529x370px) Image search: [Google]
Slithering-Camel.jpg
189KB, 529x370px
>>52598743
so when did the python bad, ocaml good meme start?
>>
>>52604767
since the creation of those languages.
>>
>>52604767
they're two unrelated memes

the python bad one is the objective truth
>>
im rlly a noob; i just started learning programming with python and all and it is a bit confusing for me.
>>
File: large_TorvaldsOregon.jpg (56KB, 453x294px) Image search: [Google]
large_TorvaldsOregon.jpg
56KB, 453x294px
>>52598743
>code of conduct:
I lost it
>>
i keep getting seg faults when the program reads in the end of the file. Strtok is being stupid idk what to do.

void readData(FILE * in)
{
char buffer[MAX];
printf("buffer?\n");
char* delim1 = "=";
char* delim2 = "\n";
while(getLine(in, buffer) != NULL)
{
printf("%s\n", getLine(in, buffer));
printf("buffer:%s\n", buffer);
printf("setting key.\n");
char* key = strtok(buffer, delim1);
printf("%s\n", key);
printf("setting val.\n");
char* val = strtok(NULL, delim2);
printf("%s\n", val);
printf("%s\n", getLine(in, buffer));
setValue(key, val);

}
fclose(in);
printf("done.\n");
}


this is the file I am trying to split up.

recipName=Fork
friend=Cup
sonName=Spork
feature=hair
sendName=Spoon


It seems as if it interprets the last line as just sendName by itself and then it can't do anything after so it sef faults.
>>
>>52598743
>using atom for D
>the D syntax highlighting is third party and shit
>atom uses like 300-350mb of ram on fuck all
>get KWrite
>D support is built in and better, and the editor uses 90mb of ram
jaysus what have I been doing with my life?
>>
What is everything wrong with vba?
In which ways is it worse than python?
>>
>>52604767
At the beginning of time.
>>
>>52605358
Now switch to vim (or gvim if you're a faggot).
>>
>>52605050
>Strtok is being stupid
A library function that has existed longer than you is "being stupid"?
urge to help subsided
>>
>>52598743
>wat r u working on, anon-chan ?
Currently writing a GIMP script that hopefully eliminates the noise out of that particular camera's night shots.
>>
>>52598743
>code of conduct
Literally reddit tier
>>
>>52605438
or emacs if you're a programming literate
>>
>>52605478
thats the joke anon
>>
>>52605385
Wait, there's something worse than python?
>>
>>52605573
Yeah, the newest version of Python.
>>
File: fag.webm (3MB, 800x384px) Image search: [Google]
fag.webm
3MB, 800x384px
r8 my fag calculator
>>
How do you save something in Java?

I started learning not too long ago and I'm trying to make an android application that saves some text.

Here's what I have so far.
String filename = "myfile";
String output = MyActivity.EXTRA_MESSAGE + MyActivity.EXTRA_DATE;
FileOutputStream outputStream;

try{
outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(output.getBytes());
outputStream.close();
}


It keeps giving me a "java.io.fileNotFoundException" or a "java.io.IOException"

All I'm trying to do is save the String output so I can bring it up later on.
>>
>>52605831
Also, I've looked everywhere I could to try and find a solution, but everything I try still gives back the same result.
>>
>>52605573
python3 pip3.2 pip3.4 python3.2 python5.6 python 7.43BETA
>>
>>52605789
AIDS/10
>>
post your inventions https://www.chromeexperiments.com/experiment/quantum-computing-playground
>>
>>52604943
learn java instead, it's more structured

https://docs.oracle.com/javase/tutorial/
>>
>>52605890
This. It's the most accessible programming language. If you can't program in the proficiently within a week you might as well just give up.
>>
Why should I not use OOP guys, I was scolded for programming like that earlier?
>>
File: d.jpg (2MB, 1776x2333px) Image search: [Google]
d.jpg
2MB, 1776x2333px
>>52605789
Pretty gay
>>52605831
>Java IO
>>
>>52605831
File file = new File(filename);
PrintWriter pr = new PrintWriter(file);
pr.println("niggers");
pr.close();
>>
>>52605050
Why is your while loop calling getLine 3 times per iteration? Since your file only has 5 lines, it seems like the first iteration of the loop will get the first three lines. Then the second iteration will get the next two lines, and the third call to getLine would fail or return garbage or something (assuming getLine is something you wrote but haven't included the code for).
>>
> learning Java for a few months
> made good progress
> out of nowhere nothing makes sense in my cold
> "why did I do that >"
> "what does that mean"
> can't do shit I've done before

Is my brain tired or what ? I can't even understand some basic shit even when I know I got it a few weeks ago.
>>
>>52605870
is that a 10/10?

>>52605953
> pretty gay
r u gay m8?
>>
>>52606030
You need a braindump or a blog.

Gotchas and ahas should be recorded

for you and others
>>
>>52606030
> learning
> for a few months
You really learn how to program after years of experience, not your faggy studies and fag meme projects, start a project on your own and go to the end.
>>
File: Screenshot (4).png (11KB, 566x195px) Image search: [Google]
Screenshot (4).png
11KB, 566x195px
>>52605978
I'm still getting "java.io.fileNotfound exception"

WTF am I doing wrong
>>
>has e, pi, ln, ^
better-than-most-windows-ones-tier
>>
>>52605831
Read the fucking android documentation you turbonerd.
There are about 5 different ways to open files depending on exactly what you want to do with it.
>>
>>52606118
post the full stack trace
>>
>>52606133
meant for the effeminate calc >>52605789
>>
>>52606118
if (!file.exists())
f.createNewFile();
>>
New thread, early but reddit-free edition:


>>52606188

>>52606188

>>52606188
>>
>>52606144
I read everything I could find on data saving. Every way I tried gave me the same error.
>>52606160
Where do you get the full stack trace?
>>
>>52606217
No, you didn't. Read the documentation:
http://developer.android.com/training/basics/data-storage/files.html

Android is a jew when it comes to permissions. Bring your shekels and ask nicely first.
>>
>>52606280
It literally says.. and I copy and pasted:
"You don’t need any permissions to save files on the internal storage. Your application always has permission to read and write files in its internal storage directory."
>>
>>52601023
Why is c++ bad?
>>
>>52601725
>>52601781
>>52601788
(defun sigma (i n func &optional (sum 0))
(if (> i n)
sum
(sigma (1+ i) n func (+ (funcall func i) sum))))
>>
File: 1449150664715.png (196KB, 485x409px) Image search: [Google]
1449150664715.png
196KB, 485x409px
Anyone has a book or link with exercices or mini-project for Java with progressive difficulty ?

I'm searching for such a thing but I only find tutorial or guides with tons of theories and 4 or 5 exercices.
>>
>>52606413
http://it-ebooks.info/book/1290/
>>
>>52606337
I said read it, not skim it you daft cunt.
Specifically look at what comes after the try block.
The error isn't that you're getting an IO exception, it's that you're not fucking handling it.

Even if you don't do anything in the catch block (like in the example), it needs to be caught because java™ just werks®
>>
>>52606423
Not him but noice
>>
>>52606431
I figured out my issue. I was placing it outside of the subclass when it should have been inside.
Now I know for next time.
>>
How into C#, programming newfriend here
>>
>>52606702
Heads First: C#
>>
>>52600317
>python 2
there's your problem
>>
>>52601097
cuck
>>
>>52606907
Wow they really did remove it, fucking faggots.
Did they remove the others too? baka desu senpai
>>
>>52601478
Okay, so how could that possibly equal 0.2645?
I don't understand.
>>
File: 1452927038765.png (984KB, 1920x1080px) Image search: [Google]
1452927038765.png
984KB, 1920x1080px
I do Java.
>inb4 Java
I just made an IRC bot, give me another idea for a project.
>>
>>52607086
Make an x86 emulator.
>>
File: 1447755081947.jpg (12KB, 250x250px) Image search: [Google]
1447755081947.jpg
12KB, 250x250px
>>52607161
pls no
I wouldn't be able to figure that out for the life of me.
>>
>>52605789
jesus fuck bro, are you really so proud of your calculator that you have to post it every time?
>>
>>52606973
it actually looks incorrect unless it's some sort of high level math that's beyond me
>>
>>52598807
Which font anon?
Thread posts: 314
Thread images: 30


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