[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: 34

File: 1480956343871.jpg (675KB, 940x822px) Image search: [Google]
1480956343871.jpg
675KB, 940x822px
What are you working on, /g/?

Old thread: >>58079752
>>
>>58084335
First for D
>>
And we have the parallel functional programming thread:

>>58076404
>>
>can never think of things to code
>mfw never going to improve
What do?
>>
>>58084397
Do something else. You obviously not cut for "coding" let along programming.
>>
File: pokerhud.png (379KB, 610x596px) Image search: [Google]
pokerhud.png
379KB, 610x596px
>>58084335
Writing a poker hud for puzzle pirates... Logging the network events to a file, by using aspectj to recompile the jar, intercepting the event receiver's method calls after they've been serialized. Writing the parsing and HUD logic in Haskell. Fun! I guess I really want to beat little kids at poker.
>>
>>58084413
Shut up mom
>>
>>58084397
>>can never think of things to code
I have to opposite of this problem.
There are shit loads of things I want to program. The only problem is the things I want to program are usually very difficult.
>>
Do you ever get used to the betrayal of your forefathers?
Having to code in the bastardised American version of English feels dirty.
>Color, gray etc
>>
bumping from old thread

I downloaded a pack of 2800 files and for whatever reason the owner titled them in the format "XXXX - " and I need a basic script to rename all of them, I don't know much code, I tried this
@echo off 
setlocal enableextensions enabledelayedexpansion
for %%i in (*)
do (set name=%%i && ren "!name!" "!name:~7!")
endlocal


but it didn't work out. Can you guys help me out?
>>
>>58084487
Yeah, it's pretty shit.
When I get to name shit myself, I always use the correct spelling.
>>
File: wallhaven-343721.jpg (343KB, 1890x1541px) Image search: [Google]
wallhaven-343721.jpg
343KB, 1890x1541px
>>58084487
Deal with it britbong
>>
>>58084499
I just saved an image as grayDiamond.png. I feel like there are maggots eating me away inside, but having to edit, recompile and read error messages because I'm flicking between languages doesn't seem worth it.
>>
Working on a TCP and UDP server framework and client library, pretty small, made a quick TCP chat server using it like so (using telnet as the client):
#include <stdio.h>
#include "TCPServer.h"

#define BUFLEN 1024

int onConnect(UserSet users, int userID, void *parameters) {
char buffer[BUFLEN];
int i;

snprintf(buffer, BUFLEN, "Welcome to the chat!\nYou are user %d\n", userID);
TCPSend(userID, buffer, strlen(buffer));

sprintf(buffer, "%d has joined the room\n", userID);
for_each_user(i, users) {
if (i != userID) {
TCPSend(i, buffer, strlen(buffer));
}
}

return 0;
}

int onDisconnect(UserSet users, int userID, void *parameters) {
char buffer[BUFLEN];
int i;

sprintf(buffer, "%d has left the room\n", userID);

for_each_user(i, users) {
if (i != userID) {
TCPSend(i, buffer, strlen(buffer));
}
}
return 0;
}

int onReceive(UserSet users, int userID, const char *message, int len, void *parameters) {
int i;
char buffer[BUFLEN];

snprintf(buffer, BUFLEN, "%d: ", userID);
strncat(buffer, message, len);

for_each_user(i, users) {
if (i != userID) {
TCPSend(i, buffer, strlen(buffer));
}
}

return 0;
}

int main(int argc, char **argv) {
if (argc != 2) {
printf("usage: %s <port number>", argv[0]);
return 127;
}

TCPServerController *chatController = MakeTCPServerController(
onConnect, onDisconnect, onReceive
);

RunTCPServer(chatController, argv[i], NULL);
return 0;
}
>>
>>58084487
Having to code in the bastardised English version of German feels dirty.
>>
>>58084651
>gendered nouns
>3 genders on top of that
>>
File: 1482198277.png (2KB, 232x103px) Image search: [Google]
1482198277.png
2KB, 232x103px
>>58084335
im making a bbs/tribal wars text telnet game in c.
I have the logo done
>>
File: barb.png (750KB, 1096x607px) Image search: [Google]
barb.png
750KB, 1096x607px
Oops, responded to old thread. Refactored my convolutions to be arbitrary (instead of fixed 3x3). This is noisy barb with a 5x5 smoothing kernel and 83.3 divisor.
>>
File: 1459001051258.gif (957KB, 500x418px) Image search: [Google]
1459001051258.gif
957KB, 500x418px
so i tried my hand at making blackjack after seeing it on that big challenge list
 
import random
suits = ["spades", "diamonds", "clubs", "hearts",]
Ace, Jack, Queen, King = 11, 10, 10, 10
cards = [Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King]
random.shuffle(cards)
playerScore = 0
playerCards = []
dealerScore = 0
dealerCards = []

def scoreCompare():
print "dealer has a total of " + str(dealerScore)
print dealerCards
print "you have a total of " + str(playerScore)
print playerCards
if playerScore > dealerScore:
print "you win!"
elif playerScore < dealerScore:
print "you lose!"
else:
print "it's a tie!"

card1 = cards.pop()
playerCards.append(card1)
card2 = cards.pop()
playerCards.append(card2)
playerScore += card1 + card2
print "You have " + str(playerScore)
print playerCards

dealerCard1 = cards.pop()
dealerCards.append(dealerCard1)
dealerCard2 = cards.pop()
dealerCards.append(dealerCard2)
dealerScore += dealerCard1 + dealerCard2
print "dealer has " + str(dealerCard1)


while True:
if Ace in playerCards and playerScore > 21:
Ace = 1
playerScore = playerScore - 10
print "the ace is getting changed to a value of one so you now have " + str(playerScore)
elif playerScore > 21:
print "You bust! You lose!"
break
answer = raw_input("will you hit or stay? ")
if answer == "hit":
newCard = cards.pop()
print "you hit " + str(newCard)
playerCards.append(newCard)
playerScore = newCard + playerScore
print "you now have a total of " + str(playerScore)
elif answer == "stay":
while True:
if dealerScore < 17:
dealerNewCard = cards.pop()
dealerCards.append(dealerNewCard)
dealerScore = dealerNewCard + dealerScore
elif dealerScore > 21:
print "dealer hits " + str(dealerScore)
print "Dealer busts! You win by default."
break
elif dealerScore >= 17:
scoreCompare()
break
break

it functions properly, but obviously it still needs some work to be done.
>>
>>58084685
looks good senpai!
>>
>>58084706

thanks, fambly. I still need to port all these filters to my new program, though, which will allow plugins.
>>
>>58084685

Why is she wearing a hijab?
>>
>>58084742
it's a durag
>>
>>58084742

She is a modest woman.
>>
>>58084651
Surely you aren't implying that English descended directly from German
>>
File: sad yui.jpg (28KB, 467x700px) Image search: [Google]
sad yui.jpg
28KB, 467x700px
>spend all night working on project
>go to bed
>dream about me sitting at my computer working on project
>oh shit i'm so productive i improved so many things
>wake up
>dream version of project was just different enough to prevent any progress from being copied over to your IRL one

Why can't I just dream about being an anime girl like everyone else?
>>
>>58084680
repo? Sounds great.
>>
>>58084769
lucid dream, it's pretty easy
>>
I aspire to be a code monkey. Why do I need to learn calculus
>>
>>58084695
namely, I want to be able to tie each card to a suit, and I want face cards to print their name instead of their number value. i.e 'ace' instead of 11.
is there a way I could maybe divide the 'cards' list into 4 sub lists. for each suit and just print the name of the sub list from which i pulled the value as a way of tying the cards to a suit?
>>
>>58084783

Then how would you know Big O notation?
>>
>>58084783
Calculus relies heavily on limits, which are used all the time in CS. One example is in algorithmic complexity like >>58084843 brings up. It's also got direct applications which I suppose makes it easier to understand for those who aren't so mathematically inclined.

Linear algebra is another field you see in CS and it, too, uses concepts important in CS (set theory, algorithms and theorem proving) while still being fairly grounded.
>>
math is for fags
>>
>>58084880
Then you'd love maths.
>>
>>58084880
t. hick
>>
>>58084880
>programming without maths

Made me think...
>>
>>58084870
>>58084843
Did you see:

>I aspire to be a code monkey.

Those things are useless when all you do is glue frameworks together and do simple CRUD
>>
>>58084882
>>58084889
>>58084932

Thanks for responding.
>>
>>58084980
Well thankfully most places you go CS is still about more than just producing mindless code monkeys. Suffer through it and you'll come out all the better for it, maybe you can even hope for a promotion some day.
>>
>>58084994
Here's my plan:

1.) Get internship
2.) Be code monkey
3.) stop programming before I'm 30
4.) Become a manager
5.) Forget about programming forever
6.) Make 6 figures bossing around code monkeys

College is way too expensive to teach me stuff that is only useful in academic environments.
>>
>>58084630

> Not typedef'ing the function results to create a consistent error handling.
>>
>>58084397
Project Euler offers some nice puzzles to solve in the language of your choice
>>
>>58085024
Planning on having them return #define'd values for errors, no reason to typedef
this was just the first test
>>
>>58085020
I have made this possible. After all, there is a reason for why I'm typing this from hell.

On the other hand I got promoted down here, so I don't know. It probably has to do with my other achievements like nuking the japos.
>>
>>58084753
I do imply.
>>
>want to find more discussion about F#/FSharp on /g/ and decide to check the archives
>nothing found because the RBT archives don't allow you to search with # character apparently
this sucks.
>>
>>58085092

Is there no ability to escape the character?
>>
>>58085129
I would check but, 4chan archives being what they are, the search backend is down.
>>
>>58085090
You'd be wrong then
Germanic != German
>>
>>58084695

I had a hell of a bad time with blackjack
http://pastebin.com/XumRvRh5

I had more fun with tick-tac-toe though
http://pastebin.com/G9nRi5E9

now im trying to write a rpg, got map movement down pat, in and out of buildings, talking to people framework(shadowrun snes style), and almost got battles bug free, and Im and realizing this project is going to go on for ever, as I so far I only have two buildings, one guy to talk to and fight, and ive already spent a week on it, before I started I was thinking of have like 2-3 towns on each planet, and like 5 or 10 planets, but shit, going to be scaling down
>>
why is freelance so much stressful and why am I such a sperg..
>>
>>58085287
glad you're having fun dood
>>
File: g programming challenge.png (305KB, 1920x1080px) Image search: [Google]
g programming challenge.png
305KB, 1920x1080px
>>
>>58085287
Yep. I think everyone goes through that. I know I did. Video games are more of an exercise in scale than anything else I think, especially if you're working alone.
>learn to program
>I'M GONNA MAKE VIDYER GAEM
>3 months later, just finished a simple-but-barely-working dungeon generating algorithm
>realize that this is going to take years on my own
>>
>>58085368

Hence why good video games are made by companies that can afford to pay multiple employees good money to work full time, and often overtime. It is rare that a single developer can do everything. Unless of course you're Zun, in which you're so drunk you don't even notice how much work you're doing.
>>
>>58085427
Who is Zun?
>>
>>58084695
use an enum for the numbers and suits
>>
>>58085480
Python has no enums.
>>
>>58085064
Get out namefag
>>
>>58085456

who?
>>
>>58085522
Disgusting
>>
>>58084397
Here is a project I wanted to do for a while, but haven't bothered with yet.
Extrapolate Conway's Game of Life into multiple dimensions (change the rules accordingly) and generate boards, iterate over the boards, and detect interesting patterns. Export any interesting patterns you find to a text file of coordinates in however many dimensions you are working in, and show them off to your friends.
>>
>>58085522

https://docs.python.org/3/library/enum.html
>>
>>58085456
>>58085543

Zun is the dude that made all of the Touhou games... on his own. Artwork, music, programming, story design... the whole thing. Or at least that's how it was with the earlier games. I'm not sure if he actually has any employees.

He also really loves beer.
>>
File: .png (17KB, 771x374px) Image search: [Google]
.png
17KB, 771x374px
>mfw
>>
I'm working on my decentralized TV platform, and I got a quick question: what is the most secure encryption system? I'm especially interested in keeping it quantum computer proof (non-BQP)
>>
>>58085679

who?
>>
>>58085693
>I'm especially interested in keeping it quantum computer proof (non-BQP)
why.jpg
>>
File: Reimu-KittyEars.jpg (116KB, 600x600px) Image search: [Google]
Reimu-KittyEars.jpg
116KB, 600x600px
>>58085701

Have you not played any of the Touhou games?
>>
>>58085368
>starting out wanting to make a FPS video game
>got 2500 LoC and barely no networking, but it works
>didn't understand bullet physics at all
Shooting a bullet made the game freeze (pentium 4 1.7GHz, so that's expected), but otherwise it worked pretty well.

I don't have it anymore
>>
>>58085723

who?
>>
>>58085701
>doesn't know ZUN
heck off newfag
>>
>>58085693
>>58085706
I want to keep the integrity of the private-public encryption. I get that Shor's Algorithm only makes RSA as efficient as half of the bit length on a standard computer, but I want to see what other options exist
>>
>>58085742

Fact: Encryption is only good if a multi-trillion dollar US government program to break it fails to do so.
>>
What's the best way to get started on programming from scratch? Set up a few ideas, and I've set up IDEs but could never get around to using them since, holy shit, the learn curve is stupid steep just for the IDE itself (I've programmed before).

What's a babby-tier set up so I can get to reliable coding in a hurry? Language doesn't matter (and I don't care about, "muh best language," pissing contests).

Need something with a pretty quick turn around on visual feed back (basic lines, colors, etc.)
>>
>>58086155
>the learn curve is stupid steep just for the IDE itself (I've programmed before).

Then don't use them. Use a basic text editor instead. IDEs are supposed to enhance productivity, and if they're not working for you, drop 'em.

If you want to be able to quickly create something interesting, I would recommend learning Python. Ignore the memers who say that it's a bad language. Pick of Automate the Boring Tasks for something similar.
>>
>>58086155

To follow up... I'm not scared of learning the language... I'm just fucking fed up with having to learn interfaces which are more complicated than the language itself. And every time I get a set up going I have to dive into PATH files and other fucking nonsense that requires me to spend hours of research just to get shit running.

To clarify I programmed a few decades ago on QBasic and Visual C++, WAY back in the day, and want to get back into it as a hobby. I just can't stand this newfangled bullshit which seems more complicated for its own sake.
>>
>>58086155
Use a text editor then like Sublime, Atom, or VSCode and start with Python, you'll get up and running fairly quickly.
>>
>>58086186

I'm okay with text editors and the like, but what about compilers (or at the least an interpreter).

Why does it always seems just getting my feet wet again requires a PhD in and of itself?

Is there a self-contained Python IDE? I have no problems going into babby-tier.

Thanks for the reply.
>>
File: Idle_gui.png (491KB, 722x743px) Image search: [Google]
Idle_gui.png
491KB, 722x743px
>>58086205
Python for Windows comes with IDLE, which is very straightforward to use. If you're on Linux, just use vim; python will be pre-installed.
>>
>>58086155

Babby tier is Python or Ruby. If you want to actually develop programming skills proper though, start with C.

Don't use an IDE. IDEs are needlessly complex, when all you really need is a text editor and a terminal. If you understand how your compiler works and you really need to boost your productivity in a way you can't get with a regular editor, then you can move ahead to an IDE.

>>58086205

Your compiler of choice should be gcc or clang for C or C++ development, or just run the regular old interpreter if you're doing Ruby or Python. You don't need to know much to use a command line interface. In fact, it's probably the dumbest, most simple interface to use any program from.
>>
>>58084450
>puzzle pirates
the most underrated game of all time
it's a shame it's so unpopular
>>
File: 1472440597561.jpg (83KB, 590x690px) Image search: [Google]
1472440597561.jpg
83KB, 590x690px
God I'm always so close yet so far to being done with my project.

It works perfectly in the IDE so why doesn't my project work as a Jar file? Did I fuck up the exportation?

(To be specific the jar file runs, and many aspects of the program work. There are just features which don't seem to work even though they work perfectly in the IDE)
>>
File: Scratch_Pac_Man.png (531KB, 1920x1080px) Image search: [Google]
Scratch_Pac_Man.png
531KB, 1920x1080px
>>58086155
>>
>>58086322
The worst part of Java is that you practically have to use an IDE but it pretty much ruins your project.
Check how your IDE builds it and build it the same as your IDE does and it should behave the same.
>>
>>58086364
Thanks. This seems smart.
>>
any ideas on how to make an unordered_map accept any type as a value?

ex:
std::unordered_map<std::string, anytypecouldgohere>

boost::variant looks like it could do the trick but that is still a finite number of types
>>
>>58086456
void*
>>
>>58086456
>>58086484
or std::any
>>
>>58086484
>>58086493
well i'm stupid, thanks
>>
>>58086456
You've got two choices:
A. Kill yourself
B. Learn how templates work
I recommend A.
>>
>implying microsoft isn't retarded
>systems hungarian instead of apps hungarian
>D3D9 half-pixel/half-texel offset
>C#
>>
File: 1479883677181.jpg (143KB, 833x696px) Image search: [Google]
1479883677181.jpg
143KB, 833x696px
>>58086776
--- NO BULLYING BELOW THIS POINT ---
>>
File: 1481674803909.png (511KB, 836x964px) Image search: [Google]
1481674803909.png
511KB, 836x964px
>>58086829
Anybody who unironically uses C++ should kill themselves though.
>>
Everyone in this thread should just kill themselves immediately.
>>
File: 2016-12-19-213815_1617x601_scrot.png (484KB, 1617x601px) Image search: [Google]
2016-12-19-213815_1617x601_scrot.png
484KB, 1617x601px
>>58084335
I'm working on Ivy, my taggable image viewer. What it used to do is only record the image and its tag list in a database, but the past week or so I've been adding XMP support so that it can embed the tags into supported files. Next I'll make a more proper metadata editor for people who want a little more control. I suppose I should also get it to display more than just the dc:subject information, too...
>>
>>58085693
NTRU post-quantum key exchange?
>>
>>58086839
Fuck off you dumb fucking weeb neet piece of shit never written anything of note in your life you've never even TRIED. You're a hollow broken asshole. LET GO OF YOUR WEAKNESSES. Find your meaning in life and start becoming a good person!!!
>>
>>58086841
Include a trigger warning in a post like that next time. thx bby <3
>>
>>58086928
Could you project any harder?
>>
>>58086936
You're just deflecting now! Open up your heart for once. Cut the snark; snark breeds nihilism in your mind. Speak only the TRUTH, and let go of the LIES. Treat yourself as a friend, and do the best you can to help yourself.
>>
>>58086155
1. Install Racket
2. Open DrRacket
3. ???
4. Profit!
>>
>>58086957
Stop trying so hard.
You're not funny.
>>
>>58084335
>What are you working on, /g/?
>>
>>58086969
Stop living a meaningless life. Today is the day you change for the better. Not tomorrow.
>>
>>58086976
>>>/mlp/
>>
>>58086839

I unironically use C++. What'chu gonna do about it?

>>58086841

Start with yourself.

>>58086928
>>58086957
>>58086982

Quit acting like an edgelord and go back to sucking your trap girlfriend's dick, Anon.
>>
>>58087040
What do you use C++ for? Honestly I'd rather use C in all cases.
Also, I wish I had a cute trap gf with a feminine penis.
>>
>>58087056
same on all both counts
>>
How did you guys get good at programming? What do you make?
>>
>>58086982
>Stop living a meaningless life
he said on 4chan
>>
>>58087082
I'm here on my mission to proselytize the good way.
>>
>>58087056

>What do you use C++ for? Honestly I'd rather use C in all cases.
Honestly, my standard practice for developing software is to use Ruby for anything that needs to be done quick and C++ for anything that needs to run quick. If it also doesn't need to be very complicated, or I need to make most of what I'm working export a C ABI, I'll use C, but otherwise, C++ makes a lot of tasks easier if you've used it enough.

You don't need to use OOP to make the best use of C++. RAII allows for deterministic, scope-based management of resources and is a reason on its own to use C++. On top of that, the standard template library allows me to not have to re-invent the wheel every time for some basic data structures. Sure I could use a library like KLib, but it's just not the same. Really, the greatest benefit of C++ is that if you use it right, you can avoid writing a lot less code, while getting mostly similar benefits.

Also the type system's nice. We may not be Haskell-tier wonkiness, but templates are pretty goddamn powerful.

>Also, I wish I had a cute trap gf with a feminine penis.
Sounds nice on paper, but the reality is that the majority of trans-gender women, even the cute ones, are extremely depressed to the point of being suicidal. They experience extreme dysphoria over the fact that they have a penis in the first place, and would likely rather you leave it the fuck alone. So you get all of the negatives of an extremely moody woman, without anything extra on the side.
>>
>>58087147
C++ has a terrible "type system".
It's only slightly better than just using macros.
>>
File: 17549383359.png (48KB, 400x389px) Image search: [Google]
17549383359.png
48KB, 400x389px
>netbeans

Anyone here actually use this piece of shit?
>>
>>58087147
There are plenty of traps proud of their clitty. I don't want a trans-woman.

C++ is nice if you avoid almost the entire language.
>>
>>58087223
that's basically what "modern C++" means
>>
>>58087234
.cc master race
>>
>>58087243
>.cc
y tho
>>
>>58087211
Freshmen learning Java tend to
>>
>>58087264
c with classes is the only valid way to write C++
>>
>>58084870
You will almost never see a limit in CS, famalam, and when you do you hardly need to know calculus to understand it.
>>
>>58087293
>You will almost never see a limit in CS
what is asymptotic analysis
>>
#ifdef NULL
#undef NULL
#endif
#define NULL (void *)(localtime((time_t[]){time((void *)0)})->tm_mday % 2 != 0 && rand() % 1024 == 0)
>>
>>58087332
don't run this it makes mustard gas
>>
>>58087332
WTF
>>
>>58087176

>Turing complete type system
>Only slightly better than just using macros

>>58087223

It's not so much "avoid almost the entire language" as it is "use appropriate features from the language to the task."
>>
>>58087332
what the fuck is this and why isn't NULL defined as (void *)0?
>>
>>58087364
Macros are turing complete
>>
>>58087370
On odd days of the month there is a 1/1024 chance of your program breaking if it relies on NULL being it's usual definition, (void*)0.

>>58087374
Only with multiple passes from cpp.
>>
>>58087282
this

>>58087211
use eclipse
>>
>>58087283
What do you need classes for.
>>
>>58087567
They're good sometimes.
>>
>c with classes
love this meme
>>
>>58087581
Like when.
>>
>>58087600
love you
>>
Is there a difference between a programmer and a programmer analyst
>>
        try {

BufferedReader reader = new BufferedReader(new FileReader(filepath));
String line;
while ((line = reader.readLine()) != null ) {

//DO SOME STUFF
}

} catch (IOException e) {
e.printStackTrace();
} finally {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}

}


Eclipse tells me that "reader cannot be resolved", as reader was declared in another block, the try-block.

Where should I declare the reader so it is defined in the finally block?
>>
File: ewwww.png (287KB, 405x390px) Image search: [Google]
ewwww.png
287KB, 405x390px
>>58087987
>java
>>
>>58087987
Cant you just initialize the reader outside the try block and then open a file inside the try block
>>
>>58088001

yeah, there are people who want actual jobs here.

>>58088003

thx, must be something like that.
>>
>>58088023
>Muh jobs
>Muh jobs
>Muh jobs
Is that all you drones can say?
>>
File: 1458581214279.png (99KB, 236x287px) Image search: [Google]
1458581214279.png
99KB, 236x287px
>>58088023
>java """""programmers"""""
>people
>>
>>58087987
in Haskell this is just

lines <$> readFile filepath
>>
File: comfy kotatsu.png (391KB, 796x573px) Image search: [Google]
comfy kotatsu.png
391KB, 796x573px
How does the "this" variable work in javascript?
Where does "this" point to when assigning an onMouseOver action?
Does it get passed a DOM node to the div where it was called, or do i have more control than that?

I'd really like to find a K&R-eque javascript book that teaches just the core language but they all seem to be written for webdev retards who don't even know what a for loop is.
>>
>haskell
>javascript
fuck off
>>
>>58088189
JavaScript is one of the most used programming languages available on virtually all platforms.

If you're so small-minded not to use a language because it has a few design flaws, you're missing out.

However, there is literally no reason to use Haskell.
>>
>>58088085

So how does this handle a missing filepath?
>>
>>58087332
this elicited a hearty laugh. thank you
>>
>>58088245
throws an exception

did you want
try (read <$> lines)
>>
>>58087380
the chance could be higher than 1/1024 since rand() is called every time NULL is used
>>
>>58088280
whoops
try (lines <$> readFile filepath)
>>
>>58088165
You can bind 'this' to whatever you want with .call(), .bind(), .apply() before you invoke a function.

But you shouldn't be using 'this' at all in JavaScript, it's one of the bad parts.

Instead of using prototypes, use factories to create objects.

To get the target element when you click, mouseover, etc. use "event.target" instead.
>>
>>58084335
>What are you working on, /g/?
My PHP Discord Bot got all fucked up and shit after I updated to the new library and Composer, so that was a mess...

On another note, I'm learning Python now, and I got a new Discord Bot that's about half as good as the best bots I've previously made!

214 lines of code in it already, and it can spit out like 50 legit Dank Meemz and responses!
I also found what I think will be the libraries I need to make it load web content the way I had done in previous Discord Bots!

(If it wasn't clear enough, I'm pretty fucking pissed that DiscordPHP has such bad support, but I am slightly bemused by the fact that I was able to get the general syntax and some understanding of the libraries down in like 6 hours.)

Python is not as bad as I thought it was... I still prefer C-like syntax, but this language isn't that bad. I apologize to whoever I shit on on this board for using Python. It's pretty simple, useful, and the fucking engine it runs on just werkz.

Thoughts on picking up Ruby and Lua after this?
>>
I made a thing to write Anki decks for whatever in Clojure.

I just pushed my first release of anything ever onto Clojars after making sure I had good test coverage and generating a bunch of decks.

The last deck I did was Japanese Pokemon names to their English versions:
(ns anki-playground.core
(:use jsoup.soup)
(:require [clojure.data.json :as json]
[clj-anki.core :as anki]))

(defn bulbapedia-page-to-maps
"For a given URL, extracts all Pokemon name translation tables, and
returns their values as a list of maps that can be used to create a
deck of Anki cards."
[url]
(for [row (->> url get! (select "table.roundy tr"))
:let [[id _ english kana hepburn trademarked] (text (select "td" row))]
:when (not (empty? hepburn))]
{:question kana
:answers [(str english " (" (or trademarked hepburn) ")")]
:tags ["japanese-pokemon"]}))

(defn bulbapedia-page-to-collection!
"Given a URL and a file name, will extract all Japanese-translated
Pokemon names, and create an Anki deck at the output file."
[url outfile]
(anki/map-seq-to-package!
(bulbapedia-page-to-maps url) outfile))


I called this like
(bulbapedia-page-to-collection! "http://bulbapedia.bulbagarden.net/wiki/List_of_Japanese_Pok%C3%A9mon_names" "Pokemon.apkg")

And imported the collection into Anki. Results are 802 flashcards like pic related.

Clojure is so neat.
>>
>>58088513
very readable
>>
>>58088560
Oh, thanks..!

I was focusing on terseness here, so I wasn't really thinking too much readability compared to the things I actually put somewhere.
>>
How do collision meshes work?
Do they check every single face for a collision if anything is moving in a certain radius of the mesh?
>>
>>58088630
For polygonal meshes you typically divide them into convex hulls and use an algorithm like SAT or GJK as the narrow phase.
>>
>>58088654
Not him, but can you link me info on this?

This is something I plan on needing in future projects
>>
>>58088165
A good book is Secrets of the JavaScript Ninja. It goes over things like context, closures, prototypes, the call chain, functional APIs, and so on...

It was written by the guy who made jQuery, and has an amazing amount of useful information.
>>
>>58088681
Just fucking google it.
>>
File: wink.png (759KB, 1440x810px) Image search: [Google]
wink.png
759KB, 1440x810px
>>58088023
Don't worry. Java isn't nearly as horrible as it was before 8.

Do yourself a favor though, and learn how to use streams and lambdas after you get good at lists. Also teach yourself to use a functional style on the small scale--which basically means try to not change the value of things unless you absolutely have to. If you do this, you have far fewer moving parts to keep track of when working on things, and as a direct result, far fewer points of failure. This gets more and more important the better you get.

Also, because it looks like you are still learning, when you get to something called "interfaces", REALLY pay attention. They look useless when you first learn them, but they will be your absolute best friend if you don't want to pull your hair out when you want to add similar behavior to a lot of classes.
>>
File: Oshasmile.png (31KB, 224x224px) Image search: [Google]
Oshasmile.png
31KB, 224x224px
>>58084397
Ever get annoyed by computers?
Good!
Make that annoying thing less annoying by writing something.

Repeat until good.
>>
>>58088795
Java 8 streams are the most half-baked shit I've ever seen a serious language implement.
Go learn Rust or some other language who has streams that aren't complete crap, and then tell me how they compare to Java streams.
>>
>>58088879
I wasn't saying they were they best. I was saying that the situation is so much better than it was a few years ago, and not learning them would be a bad idea.

Java is limited by backwards compatibility, so there is only so much you can do when trying to add functional bits to a language.
I wish Java's streams were as good as Rust's, but the way that Rust was designed makes that much more possible than it does with Java.
>>
>>58088914
They're just missing way too many things to be generally useful.
You basically get filter, map, reduce, limit, and skip, which are the bare essentials, but beyond that, there really isn't anything going for it.
There are no reversible streams, zip/unzip, filter_map, partition and all of the other useful shit that Rust iterators have,

And there is that whole stupid deal of needing a bunch of extra special stream types for the primitives, because Java is retarded that way.
>>
>>58089011
Please fuck off and kill yourself.
>>
>>58089022
Wow, you Java fags really can't take criticism for some reason.
Next, you're probably going to bring up employment or some shit.
>>
>>58089011
Java's Stream API is quite a bit bigger then that, yo.
http://www.oracle.com/technetwork/articles/java/ma14-java-se-8-streams-2177646.html

>>58089034
You should know that >>58089022 is not me.
>>
>>58089011
Oh also, what I am used to is pretty much all streams. (And that thing is Clojure, which has a collection library that eats Rust for breakfast)

So when I write Java, yeah I can totally see its limitations. They make me sad.
>>
>>58089048
>quite a bit bigger then that
I'm not really seeing much there which I didn't mention.
>>
In C++, is there any difference between:
std::string s{};


And:
std::string s{""};
>>
>>58089076
On that page we have sorting, matching, lazy and parallel mapping, coercing into types like sets or maps, optionals, aggregate functions, and the ability to use them on quite a large number of arbitrary things.

To top that off, this isn't even the API in its entirety. I just linked it because it had examples of things on it.

So, it's no Clojure, but it holds its own pretty well.
>>
>>58089110
Yes
>>
>>58089110
why not just
std::string s;
>>
>>58089110
They're both wrong.
The proper was is
std::string s();
>>
>>58089147
>proper
>was is
Initialisation lists are perfectly fine in C++11 and newer.
>>
>>58089129
What's the difference?

>>58089133
Because I want to default initialize them.

>>58089147
>They're both wrong.
Care to elaborate?

>The proper was is ...
That declares a function s that takes no parameters with return type of std::string.
>>
>>58089159
I just pointed out of the ridiculously stupid things in C++. This anon >>58089167 gets it.
>>
>>58085346
rolling, out of ideas to learn haskell by writing it
>>
>>58089167
>I want to initialize them
yeah
std::string s;

does that as well
>>
Why is JSLint autistic? It doesn't like you using "this" and it doesn't like you using perfectly reasonable workarounds like:

var obj = {
log: function () {
console.log(obj);
}
}
>>
>>58084397
write a websocket server from scratch
>>
For those of you who have no idea on what project to do:

Starcraft API
C++: https://github.com/bwapi/bwapi
Java: http://sscaitournament.com/index.php?action=tutorial
>>
>>58089284
C: ?
Haskell: ?
>>
>>58089313
>C
Obsolete.

>Haskell
Too slow for AI.
>>
>>58089321
>>C
>Obsolete
For something to be obsolescent, there has to something that actually makes it obsolete.
Tell me, what makes C obsolete?
>>
File: dragoncolors.gif (599KB, 794x795px) Image search: [Google]
dragoncolors.gif
599KB, 794x795px
>>58089332
>Tell me, what makes C obsolete?
not him but i would say 50 years of PLT and the lack of jobs.
>>
>>58089332
C++ obsoletes it.
>>
File: 1478778500017.jpg (65KB, 601x601px) Image search: [Google]
1478778500017.jpg
65KB, 601x601px
>>58084335
rails behemoth at work, fucking 10 million gems, im scared, last pull request was 2400 lines of code and database migration plz help me /g/.
>>
Any good resources on making good decisions about the design of a database?

I'm needing to store students in classes, each having their report card data, such as teachers comments and grades per subject.

I'm not sure what format I will get the data on the students in, but I'm not sure I want to dump a massive list of students on the database and then have to manually assign them to a class, etc.

Is there any issues with using Mongo DB?
>>
For you.
>>
what is the convention for seperate files in java?

do large static methods get their own files? or do they go together with main?
>>
>>58089446
C++ is nowhere near a replacement for C.
I think you're just baiting though, so I'm not going to bother giving an indepth answer.
>>
>>58089557
>what is the convention for seperate files in java?
One (public) class per file.
>>
>>58089566

yeah, but what about a static method?
>>
>>58089569
Both static methods and non-static methods must be contained within a class definition in Java. The Java compiler does not support splitting a class definition across separate files.
>>
>>58088513
I also generate anki flashcards to study Japanese, but with Scheme.
>>
>>58089482
you know about one to many and many to many relationships?
>>
>>58089576

okay, so i leave the static methods in the same class as main.
>>
>>58085657
How do you define an interesting pattern?
I can think of only a few interesting things:
- Something cyclical that doesn't happen often.
- A pattern shaped like a penis
>>
>>58089562
http://www.stroustrup.com/bs_faq.html#C-is-better
>>
File: output_emboss.jpg (52KB, 557x765px) Image search: [Google]
output_emboss.jpg
52KB, 557x765px
>>58084685
Do you like my emboss filter ?
>>
>>58089642
That's completely irrelevant to anything.
C++ is completely unfit to fill C's niche.
>>
>>58089649
anything you do with c, i can do it the same or better with c++.

>>58089649
>C's niche.
there no more c niche excepting for maintaining legacy code.
>>
>>58089668
Produce a program with a stable ABI.
You may not use C's ABI for this exercise, because it obviosuly belongs to C.
>>
>>58089562
Do you have any logic to back your opinions up?

C++ being a superset of C (C with more features) while maintaining acceptable backwards compatibility (C++ can be used in kernels just as easily as C can, I'd like to see other """"systems"""" programming languages achieve this) convinces me that C++ does in fact obsolete C, in every way. Whatever C can do, C++ can do it better.
>>
>>58089668
>anything you do with c, i can do it the same or better with c++.
Okay, I'll wait while you rewrite the Linux kernel in C++ and do it better.

>>58089668
>there no more c niche
Plenty of embedded jobs involve C programming. Sure, many architectures has a C++ compiler, but there still are many that don't.

For AVR for example, you can compile C++ but there is no stdlib implementation, which makes it pretty useless IMO. Without templates and STL, and without smart pointers, you might as well just use good old C.
>>
>>58089649
C++ literally couldn't be more fit to fill C's niche, and it already has.
>>
>>58089579
Ah neat! The next thing on my todo list is to allow embedding media into cards. But .apkgs are surprisingly nice to work with, so I don't think that will be an issue.

I'm translating Pokemon Green currently, and have a whole mess of generated Jisho links in my org file, which I am extracting, pulling the definitions from Jisho itself, and then stuffing those into cards like pic related.

How is Scheme for this sort of thing? I've never actually written any.
>>
>>58084487
#define
Constants
I would raise an eyebrow if i saw it but if it's your code who cares
>>
>>58089689
you didn't write the Linux kernel.
>>
>>58089689
>Without templates
You can use templates you fucking retard.

>and STL
Easily implement your own subset

>and without smart pointers
Very easily implement your own

>you might as well just use good old C.
C++ offers languages features that are useful even without an stdlib, like classes which provide RAII, templates, many other conveniences like function/operator overloading, default params, etc.
>>
>>58089688
>C++ being a superset of C
That's wrong, you fucking idiot.
>C++ can be used in kernels just as easily as C can
C++ has a whole lot of shit which is not suitable for a kernel. Exceptions, templates, ANYTHING involving dynamic memory. Anyway, you wouldn't have access to your standard library.
>Whatever C can do, C++ can do it better
C++ is just a fucking terrible language. It's extremely poorly designed and with a lack of direction.
Even if it was supposedly better than C for some purpose, I wouldn't use it. I would use something else.

But C's niche is producing small, efficient programs, that map onto hardware quite cleanly. There are no features that cause a massive "explosion" of object code or have hidden delays in them. The same cannot be said about C++.
>>
>>58089585
Yes. I expect each student will be a row and have attached each subject comments, grades etc.

Each student will be assigned to a class and I'd like it for teachers to be assigned to particular classes too.
>>
>>58089704
>you didn't write the Linux kernel.
No, but I've contributed to it.

>>58089732
>You can use templates you fucking retard.
I meant template classes, but yeah. You can obviously use templates.

>Easily implement your own subset
Why would I want to waste time doing that?

>Very easily implement your own
Why would I want to waste time doing that?

>C++ offers languages features that are useful even without an stdlib, like classes which provide RAII, templates, many other conveniences like function/operator overloading, default params, etc.
These are useful, but not critical. Hey, I like C++, I even prefer programming C++ over C. But the reason I prefer it, is because I DON'T have to reinvent the wheel every time I use it and implement a fucking vector class or string class or whatever, or use some third party implementation for it.
>>
>>58084335
I'm working on a very /g/-type of web-application.
It's a small thing that allows some people to register their working hours.

It consists of a few static web-pages, and a small Java EE framework behind it that records the information and sends it back out.

And by Java EE I mean SparkJava and FreeMarker.

It has only simple HTML, about 40 lines of CSS and a few JavaScript functions that makes life easier for the end user.
(For example it prefills the current date into the selection box. So if you send in your hours everyday you log on and click register and you're done. Life is too short to spend needless time typing.)

Since there are no ads, no images and no fucking <VIDEO> bullshit, the whole thing is lightning fast. I'm kind of impressed by how usable this web 1.0 thing actually is. It even works on my phone just fine.
>>
>>58089701
I hope you drown in your own vomit, weeb
>>
>>58084769
when I go to sleep after programming I often have dreams completely lacking a visual component where my consciousness is just subjected to the "feeling" of being wrapped in a closure and applied elsewhere, or recursing into sub-levels of consciousness. It provides an illusion of enlightenment but then you wake up and realize nothing made sense
>>
>>58089701
What you're doing is more complicated, it seems.

I use Scheme parse a directory of plaintext grammar entries then cross-compile them into a single pdf with LaTeX. So I have my own little dictionary to reference.

For making the corresponding anki cards for each grammar point, I just write a tab-delimited file.

I think any language would be suitable since it's just string manipulation. Scheme happens to be the most natural option for me.
>>
>>58089737
>That's wrong, you fucking idiot.
Prove me wrong faggot

>C++ has a whole lot of shit which is not suitable for a kernel.
>Exceptions
I'll give you that. But then again, exceptions are not suitable at all in any situation.

>templates
There's nothing unsuitable about templates in kernel programming

>ANYTHING involving dynamic memory
Just wrap kmalloc/kfree, what the fuck is the problem with that?

>There are no features that cause a massive "explosion" of object code or have hidden delays in them
You've obviously never looked at the assembly output of a C++ program, C++ compilers are extremely good at optimizing and C++ programs are just as small and efficient as C programs, if not in some cases faster.

Clearly you're too retarded to argue with.


>>58089760
>No, but I've contributed to it.
What did you contribute? out of curiosity

>But the reason I prefer it, is because I DON'T have to reinvent the wheel every time I use it and implement a fucking vector class or string class or whatever, or use some third party implementation for it.
Fair enough, but your forgetting that in an embedded environment, you're going to have to implement something like that whether you write in C or C++ anyway.
It'll pay off in the end with C++ since with templates you can write a typesafe vector class that works with all types rather than doing void pointer garbage in C and not having RAII.
And this applies to everything else you do, C++ allows you to build powerful and easy to use abstractions that C can't do nearly as well.
>>
>>58089695
I get the feeling we keep cycling retards here.
This has been discussed at great lengths in the past and somehow there's still people who don't understand the issues with writing C++ for C appropriate applications.

Kinda makes you lose your desire to tell them off desu.
>>
>>58089750
Well it looks like you need the basic tables and then need to look at the relationships.
Are students a member of one class with many subjects, or many classes and many subjects?
Can teachers have several classes or several subjects?
What can have comments?, can students have comments?, classes, grades also?
At least grades are straight forward since its related to a student and subject.
>>
>>58089845
>What did you contribute? out of curiosity
I've modified the TCP output engine to bundle previously sent segments into segments that are sub-MSS-sized and scheduled for transmission, provided. This eliminates the cost of having to wait for retransmissions in TCP flows that are application-limited.

>Fair enough, but your forgetting that in an embedded environment, you're going to have to implement something like that whether you write in C or C++ anyway.
I'm not forgetting this, that's my entire point. I like C++ programming because I don't have to implement that stuff, it's already there for me.

>It'll pay off in the end with C++ since with templates you can write a typesafe vector class that works with all types rather than doing void pointer garbage in C and not having RAII.
The payoff depends entirely on the size of the code-base. I usually write stuff for microcontrollers that have between 2 kB and 4 kB ROM for code. Our company has developed a really simple software suite and we rarely much use for generic collection classes.
>>
>>58089832
Ah, well if you wanted to try, .apkg files are just ZIP files with an sqlite database in them, a JSON file which is often just "{}", and the media referenced by said JSON: http://decks.wikia.com/wiki/Anki_APKG_format_documentation

That page has the SQL to make a base schema, but just coping a blank deck which you then modify and add stuff is probably the easiest route to get something up and running quickly.
>>
>>58088165
What is in those bottles? Why would she need a funnel?

>>58089482
Database design book:
http://ptgmedia.pearsoncmg.com/images/9780321884497/samplepages/0321884493.pdf

Pretty well written, aimed at the person who isn't aspiring to be a DBA.
>>
>>58089845
>There's nothing unsuitable about templates in kernel programming
Code explosion.
Unstable ABIs.
>what the fuck is the problem with that?
It's just that a lot of C++ things rely on dynamic memory, which you want to minimise the use of most of the time, and be very explicit when you do use it.
>C++ compilers are extremely good at optimizing
So are C compilers.
>just as small and efficient as C programs, if not in some cases faster
Not everything in C++ is free. There are C++ features that will definitely be slower than C.

Really, another thing about C++ that is fucking shit is how much shit it hides from you.
my_fn(a);

It turns out that it took a reference and now a's state has changed.
a + b
It looks like simple arithemetic which would be a single CPU instruction, but it turned out to be a complex function call.
int my_fn(int arg);

I thought I was creating a function called "my_fn", but it's actually something else entirely.
and so on.

C is explicit about what gets done, most of the time.
C++ is not.
>>
>>58089845
People underestimate the mental overhead of having a lot of language features. ASM is very easy to read and write because it's limited. Same with C.
With C++ there's tons of considerations. Every time you're considering templetizing something you're taking a hit. If you go through your codebase to 'clean up' those considerations are also a hit.
Goes for almost every feature. Distracts from the problem (RAII especially, as now every object construction is not implicitly uninitialized or explicitly zeroed).

If you actually needed those features C++ offers you probably shouldn't even be writing C++. There's plenty of languages that give you a better compromise between ease of programming and performance.
>but all my abstractions are zero-cost
They really aren't because your ability to reason about your code was completely destroyed. It's true that they're zero-cost if you yourself can't do any optimizations. But then again, why use C++? It's not a language that gives you performance for free, it's a language that gives you control. If you can't use the control you have maybe just switch to a language with a better autopilot?
>>
>>58089945
>sample

Well, you can probably find a PDF fairly easily, but it's "Database Design for Mere Mortals"
>>
>>58089877
All details that I will need to confirm, but my current understanding:
Teachers will have one class, but many subjects (primary school)
Teachers may cover other classes. This makes me not so sure to lock it down for a teacher, but not sure I want any teacher to have full access.
Students will have comments from the teacher, but not the other way around.
There may need to be some system for setting up individual lessons, perhaps to have multiple test scores or something.

But that's implementation detail. I'm more looking for resources on good and bad design decisions to help guide me.

>>58089945
Thanks
>>
>>58089951
>mental overhead
Don't tell me what do do, upvoted.
>>
>>58089680
>Produce a program with a stable ABI.
1. abi is the implementation, not the language (The C standard doesn't say anything about an ABI).
2. extern C { }
>>
>>58089951
>ASM is very easy to read and write because it's limited.
No, it's tedious, hard, and error prone because you have to do the role of the compiler.
>>
>>58090150
>abi is the implementation, not the language
Yes, but the language can allow for an ABI to be stable.
C doesn't add anything that forces implementations to change their ABI.
C++ does. GCC even did it recently, in fact.
>extern C { }
That's cheating. Also, that's basically saying that C's ABI is better.
>>
>>58090172
This

There's a reason why we invented programming languages.
>>
>>58089737
>ANYTHING involving dynamic memory.
wrong. you don't know what you are talking about.
>>
>>58090175
>GCC even did it recently, in fact.
>recently
They did this once, and it was when they released version 3. Which was around 1999-2000 some time.
>>
>>58090172
>>58090176
Ok literal retards. Perhaps you need a better explanation.
For any piece of assembly you don't have to consider as many circumstances as for a piece of C++.
You have your instructions. They're explicit in what they do.
The easiest example of how C++ fails in this would be operator overloading. You have absolutely no clue what a + entails.

That's the gist of it.
>>
>>58090198
P.s. If you're the kind that wants abstractions. As mentioned C++ isn't for you. I thought all this was perfectly explained in the relationships between the languages I chose as examples.
But not for some dummies I suppose.
>>
>>58090189
They added a new one in GCC 5.X so they could have C++11 conformance or some shit.
>>
>>58090198
>The easiest example of how C++ fails in this would be operator overloading. You have absolutely no clue what a + entails.
You have no idea what addl %rax, %rbp means either, because you have to always keep in mind what the different registers are currently used for, i.e. doing the job of the compiler.
>>
>>58090198
>You have absolutely no clue what a + entails.
You do if you wrote the code.
>>
>>58090225
And what if you're looking at somebody else's code?
>>
>>58090212
Source?
>>
>>58090233
https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/
>>
>>58090225
Yes because the large majority of the time in software you're looking at code that only interfaces with code you've written.

That's possibly the case if you're a NEET but NEETs need not apply to language discussions because you don't have any constraints. Time, resource, performance. It's all self imposed.
>>
>>58090231
then read their classes implementation.

If you can't guess what the operator does, then it's poorly written code and poorly written code can be written in any language including C.
>>
>>58090231
Then you rely on that person's ability to use sensible variable names and class definitions and a following the project's code guidelines.

Also, see >>58090223

You cannot just look at a random line in an assembly code and figure out what's going on. But
matrixC = matrixA * matrixB
is fair to assume assigns matrixC the dot product of matrixA and matrixB.
>>
>>58090198
>They're explicit in what they do.
then tell me what this procedure does

xxx:
testl %esi, %esi
pxor %xmm0, %xmm0
jle .L2
leal -1(%rsi), %eax
pxor %xmm0, %xmm0
leaq 8(%rdi,%rax,8), %rax
.L3:
addsd (%rdi), %xmm0
addq $8, %rdi
cmpq %rax, %rdi
jne .L3
.L2:
pxor %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
divsd %xmm1, %xmm0
ret
>>
"caring about performance" is a meme when I am simply parsing text files, amirite?
>>
Any one with crippling depression? How do you manage to work?
Weird thing is that I can do my job (not prog related), but am tired at home. I want to learn web-dev asap to get better income and because want to work in my field.
Pls help, sorry for blog.
>>
>>58090247
>assignment
>>
>>58090251
Yes, unless you're parsing a stupid bloated language like C++ where you have exponential growth on compile times.
>>
>>58090241
Thanks. But anyway, that's dealing with a new standard of C++ which wasn't fully supported up to that point. Anon's original point was anyway that stable ABI design is a compiler issue, not a problem with the standard. And he is correct.
>>
>>58090251
pretty much, just use parsec
>>
>>58090272
It's the standard's fault that they had to change it.
Also, that doesn't even bring up the issue of code between two different compilers.
Good luck trying to get MSCV code to link with GCC code.
>>
>>58090175
>C doesn't add anything that forces implementations to change their ABI.
Yeah, that's the problem; C is stuck 50 years ago in the past.
>>
>>58090280

is parsec widely known in the Java industry?
>>
>>58090302
>It's the standard's fault that they had to change it.
Clang and MSCV didn't change their ABI afaik

>Also, that doesn't even bring up the issue of code between two different compilers.
>Good luck trying to get MSCV code to link with GCC code.
NVCC is able to link code compiled with GCC and itself, no problem.

Clang/LLVM is able to link GCC compiled code with Clang compiled code, no problem.

MSVC won't link ANY code compiled with anything but MSVC, not even C.

Your point is moot when suggesting compiler/linker specific behaviour.
>>
>>58088872
I will keep this in mind

>>58089260
I don't know what that means though. So it's not that compelling to me
>>
>>58090324
It's a Haskell library so I doubt it
>>
>>58090248
It's averaging an array of integers, poorly.
Judging by the code, I think it's C prototype would be:
double xxx(long *array, int len);

but I'm not certain.
>>
>>58090345
wrong https://godbolt.org/g/2Fa4su
this is why you should avoid assembly programming at any cost. self documenting code is the best thing plt has made so far.
>>
>>58090369
Ok, it was an array of doubles.
I should have seen that with addsd.
I just got too fixated on the $8 on the next line and though 'long'.

However, if that was hand written assembly, you would expect comments.
Compilers are not known for outputting the most readable assembly.
>>
>>58090369
Anon you're arguing against a strawman anyway.
The point wasn't that asm was easy to understand. It was that it was possible. Anon here >>58090388 even spotted his mistake directly in the code.
>>
>>58090254
I had it, but then I got a job. I'm now a happy peon. ^_^
>>
Just wanted to make sure before I dive headfirst into Android Dev, but Java is pajeet tier, right?
>>
>>58090508
java is pajeet tier under any circumstances my mate
>>
File: java.jpg (109KB, 1200x1198px) Image search: [Google]
java.jpg
109KB, 1200x1198px
>>58090431
Not very helpful, but thanks anyway.
>>
File: abstraction.png (1MB, 1200x1198px) Image search: [Google]
abstraction.png
1MB, 1200x1198px
>>58090551
>>
can I set a boolean to "undefined" in Java?

a state where it is not initialized yet. kinda.
>>
>>58090543
Well fuck that.
Would I be better off learning Swift/Objective-C then?
>>
>>58090622
A nullable boolean?
>>
>>58085368

>egr programming class
>only uses matlab
>had previous experience with programming but never the motivation to finish anything substantial
>doing well, easy class for babies
>final rolls around
>get to make anything we want as long as it hits some requirements in terms of features used and complexity
>foolishly decide to make an extremely basic roguelike
>takes a week to come up with a good way to render the map (ended up rendering to an output normally for graphs or something)
>everything is smooth sailing after that
>didn't add all the things I wanted, but got mapgen, simple enemy ai, multiple maps, combat log

things in games go pretty fucking quick once you're done with graphics as far as I can tell. That might just be limited to 2d though, displaying simple images is no big deal. Once I had that done though, everything just flowed out. Matlab is a goddamn mess though, apparently it's OOP but it's also just weird and wrong from what I could tell. In the end I wrote a ton of total shit, absolutely disgusting code. I learned tons though. All around a nice experience and made me switch to CS since I learned that if I'm obligated to program I'm actually able to start and finish things.
>>
>>58090643
Name some languages where booleans have two possible values.

I'll wait.
>>
>>58085368
This is why things like UE and Unity exist.

Rolling your own engine for a non-trivial game is only for learning, or the most autistic of autists.

Hell, most of the work on any given game is assets. Models, animations, pixel art, music, sound effects, GUI design, etc.

The logic is the easy part once you have a programmable engine.
>>
>>58090694
???????
>>
>>58090622
>>58090643
Boolean b = null;
?
>>
>>58090694
C#, for one. I'm not sure of other languages that do this, but personally prefer having types explicitly nullable, generally speaking..

What does that have to do with anything?

I do see that Java allows null to be assigned to booleans, so >>58090622 can just use null values to accomplish what they're doing.
>>
is there a way to close the constructor, without creating an object, if a condition is met.

for example,

Circle() {

if (Circle.isQuadratic()) {
(its not a fucking circle in the first place, so dont create one);
}

}
>>
>>58090773
How about you throw an exception?

I constructor should create an object. If it doesn't, something is horribly wrong.
>>
>>58090632
Not that anon.
Java is a must for android dev, you can try kivy (python) but never tried it.
Also I don't know java and it does look ugly but if you want to go in android dev you will have to learn it sooner than later I guess.
And learn to form your own opinions based on facts, not on /g/.
>>
>>58090773
Either:
struct Circle {
bool valid = false;

Circle() {
if (!Circle.isQuadratic()) {
valid = true;
}
}
};


Or:
struct NotAFuckingCircle: public std::exception {
virtual const char *what() final {
return "It's not a fucking circle in the first place.";
}
};

struct Circle {
Circle() {
if (Circle.isQuadractic()) {
throw NotAFuckingCircle;
}
}
};
>>
>>58090773
>>58090787
This, maybe you should perform the check wherever the Circle is created, rather than in the circle itself.
>>
the ugliness of the code is proportional to the amount of lines squared
>>
>>58090853
small is beautiful
>>
>>58090882

girls dont seem to think so ;____;
>>
>>58090914
get a height adjusting surgery then
>>
>>58090926
I think she's talking about benis.
>>
>>58090959
he's*
>>
>>58090914
unless you're under 2 inches it's not even a problem
>>
>>58091029
t. 4 inch microman
>>
Anyone in Product Data Management? Or is this just a thinly veiled homework help thread?
Tell stories about the product lifecycle management tools you use.
>>
>>58091029
What the fuck

if (Benis b is MicroBenis mb when mb.Length < 5.5)
{
Log($"Ha you have small benis of length {mb.Length}!!!");
}
else
{
SexTheBenis(b);
}
>>
>>58091071
>SexTheBenis(b);
>not SexTheBenisDDDDDDD(D);
>>
>>58091080
>The name "D" does not exist in the current context D:<
>>
System.out.println("Take it easy!);
>>
for (;;) {
consumeDankMeme();
}
>>
>>58091094
>not just using
println("Take it easy!");
>>
Why the fuck would I use byte or short i instead of int if the JVM just stores it as 32-bit anyway?
>>
>>58091102
System.out.println("How do I java");
>>
>>58091119
Because signed overflow is defined behaviour in Java.
>>
>>58091106
>>58091119
>>58091129
You are confusing the java virtual machine with hostpot, one of its implementations.

https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.3
>>
>>58090773
Create a wrapper function that checks validity, and creates the object in that instead.
You'll probably also need a destroy wrapper function to complement it.

For every problem OOP solves, it creates two new ones.
>>
>>58091165
What's OOP?
>>
>>58090508
Unless you plan on making pajeet-tier html5 apps that are basically just web browsers locked to a specific website, you will not progress very far without using Java & XML directly.

Xamarin is a pipe-dream, you only need that shit if you have incredibly bloated UIs anyway.
>>
>>58091183
Google
>>
>>58091183
The best thing that came into software development since we stopped writing bytecode.

Don't listen to the highschool dropouts on /g/
>>
File: Picture3-1-759x500.jpg (42KB, 759x500px) Image search: [Google]
Picture3-1-759x500.jpg
42KB, 759x500px
Learning Java atm (not Pajeet, got access to Treehouse with work and they have a ton of java tutorials)

Still can't figure out why you'd use Private for anything, what's the use case?

Any explanation I've seen basically says
>you can use it to hide data
>you can't access it or change it without getters/setters

But if you're just going to write shit to access/change it, then why not have it public in the first place? I don't get it
>>
How do you guys prevent plagiarism?

Are there any other places besides github I can upload things so I can say "I uploaded it first on 20 Dec 2016"?
>>
>>58091321
licences nigga
>>
>>58091288
When you work with other people and they use your classes and shit, you have control over what they can fuck with and what they can't. If everything was public, then they could go in and fuck with every member variable and they could just fuck everything up.
You should google encapsulation
>>
>>58091288
Stop with the Java = Pajeet bullshit. Yes, there are a fuckton of Indians that program in C++, Python, C, Java, and C#.

No, using one of those languages does not make you a pajeet. Using those languages POORLY does.

For example, if something is public get, private set, that means that anyone can read it, but they're not allowed to fuck with it. This is useful for something like a number or some text that should be changed in a specific way that the class knows how to do. So, you expose a public method that says to update a number, and maybe that method logs the change and does some sanity checks. This prevents the pajeet from fucking with a variable that needs to be treated a certain way.
>>
>>58091288
Anything that is public is a shipped API and can never be allowed to change.
Changed your mind about how something works? Too bad! Changing it now will break the API and make you into an even more horrible person than you presumably are.

What's public is what you support.
>>
>>58091348
This is exactly why we use get/set, rather than exposing a field publicly.

With a getter/setter, you can modify the behavior without breaking the contract.
>>
New thread:

>>58091373
>>58091373
>>58091373
>>
>>58091286
Even OOP people are making concessions against OOP atm.

Won't be long until your future self will want to kill your current self anon.
Thread posts: 318
Thread images: 34


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