[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: 330
Thread images: 43

File: 1447367031667.jpg (247KB, 936x960px) Image search: [Google]
1447367031667.jpg
247KB, 936x960px
Previous thread: >>56076273

What are you working on, /g/?
>>
>>56082496
First for C++
>>
Very nice, how much?
>>
>>56082517
16
>>
>>56082496
Program me a gf
>>
>you will never buy a mail order bride from ukraine and murder her
>you will never develop a file system
>>
File: ohmyoeuf.jpg (114KB, 487x675px) Image search: [Google]
ohmyoeuf.jpg
114KB, 487x675px
>>56082496
web application for managing events (laravel)
>>
>>56082496
Thank you for not using anime
>>
>>56082544
>>>/g/wdg
>>
rate my stupid game
import System.Random

main :: IO ()
main = do
putStr "guess a number between 1-1000: "
fst <$> randomR (1,1000) <$> newStdGen >>= loop 0

loop :: Int -> Int -> IO ()
loop c n = do
i <- read <$> getLine
if i==n then putStrLn $ "you win!\nguesses: " ++ show c
else if (i < n)
then write "higher: "
else write "lower: "
where write s = putStr s >> loop (c+1) n
>>
>>56082542
reiserfs?
>>
>>56082729
Neat-o. Now make a Hangman game.
>>
>>56082496
thanks for no anime shit
>>
Is this regarded as good form in coding? I'm not if this more readable or not.

 String str_Query1 = "INSERT INTO perguntas ("+
"area,"+
"question,"+
"r1,"+
"r2,"+
"r3,"+
"r4,"+
"difficulty,"+
"correct) SELECT"+
"'math',"+
"'2+2',"+
"'1',"+
"'2',"+
"'3',"+
"'4',"+
"1,"+
"4"+
"WHERE NOT EXISTS (SELECT * FROM quizz);";
>>
>>56083084
*I'm not sure
>>
File: 295.jpg (13KB, 177x278px) Image search: [Google]
295.jpg
13KB, 177x278px
>>56083084
>>
File: 1468523512594.jpg (15KB, 450x349px) Image search: [Google]
1468523512594.jpg
15KB, 450x349px
working on my first serious project using a gui toolkit

is it supposed to be this frustrating?
>>
>>56083136
Probably. What toolkit?
>>
>>56083112

I know, right? My teacher taught my class something like this, but never a query of this size. It was mostly bite sized queries. It didn't looked like this abomination.
>>
>>56083159
What language is that? It looks like it's just going to generate a static string to me.
>>
>>56083136
It really depends on the language and the toolkit. You're going to have a harder time programming Gtk in Perl than, say, using the built-in GUI libraries in Java or Racket.

That being said, GUI programming is hairy no matter what. You're going to have a whole lot of ugly programs before you really get the knack of things. If you're just starting out, I wouldn't worry too much because no matter how hard you work on it it's going to be shitty.
>>
>>56083184

Java. My teacher is an old fart that isn't really coherent with his programming style. I'm just wondering if this is actually good form that I will find on other people's code regularly, because this looks awful.
>>
>>56083207
you have any experience in gui programming with haskell??
>>
>>56083157
>>56083207
using qt, Im trying to code it manually using c++ and avoid using the designer
>>
>>56083221
if + just concatenates strings, there is no reason to split them up like that
just do "r1,r2" etc etc
>>
>>56083221
>I'm just wondering if this is actually good form
It isn't. At most I would split that whole thing in maybe two.

>that I will find on other people's code regularly
You definitely will. Of course, I've seen a lot of really, really bad Java code.
>>
File: 1426552108056-1.jpg (94KB, 2700x1520px) Image search: [Google]
1426552108056-1.jpg
94KB, 2700x1520px
>>
>>56083279
>>56083263

Thanks, mates.
>>
File: Yay! 03.png (17KB, 500x300px) Image search: [Google]
Yay! 03.png
17KB, 500x300px
>>56083255
Negative

>>56083261
>manually using c++ and avoid using the designer
Godspeed. Qt isn't the worst, but you can lose yourself pretty easily. It just takes practice, anon, I believe in you!
>>
>>56083084
not really, but then again its fucking DB shit so it's gonna look like shit either way
>>
Good morning. I see the assassins have failed.
>>
>>56083084
maybe something like this

String str_Query1 =
"INSERT INTO perguntas (area, question, r1, r2, r3, r4, difficulty, correct) " +
"SELECT 'math', '2+2', '1', '2', '3', '4', 1, 4 " +
"WHERE NOT EXISTS (SELECT * FROM quizz);";
>>
File: panic.jpg (34KB, 192x279px) Image search: [Google]
panic.jpg
34KB, 192x279px
>something completely new works on the first try
>>
File: 1468546966467.jpg (53KB, 960x960px) Image search: [Google]
1468546966467.jpg
53KB, 960x960px
>>56083658
>"works"
>>
File: Capture.png (15KB, 469x299px) Image search: [Google]
Capture.png
15KB, 469x299px
a stupid game
>>
>>56082729
I really like your work, kid. You got talent. Talent like that is hard to come by these days.

I want you to work for my firm. 148k per annum. We're based in New York. We'll fly you in here - first class and free of charge. You start tomorrow.
>>
File: 1447194513193.gif (1MB, 480x640px) Image search: [Google]
1447194513193.gif
1MB, 480x640px
How can I make this code more performant?

time node if.js 


real 0m4.405s


const exec = require('child_process').exec
const fs = require('fs');

checkEquality = (this_variable, do_something_if_true, do_something_if_false) =>
{
fs.writeFile('do_something_if_true.js',`eval('(${do_something_if_true.toString().replace(/\\/g,"\\\\").replace(/\"/g,"\\\"").replace(/\'/g,"\\\'")})()')`,(err) => 1)

fs.writeFile('do_something_if_false.js',`eval('(${do_something_if_false.toString().replace(/\\/g,"\\\\").replace(/\"/g,"\\\"").replace(/\'/g,"\\\'")})()')`,(err) => 1)

exec(`echo \'exec(\"python -c \'\"\'\"\'from subprocess import Popen,PIPE;Popen([\\\"\'\"node\\\\\"\'\",\\\"\'\"-e\\\\\"\'\",Popen([\\\"\'\"cat\\\\\"\'\",\\\"\'\"do_something_if_true.js\\\\\"\'\"],stdout=PIPE).stdout.read()]) if \\\"\'\"true\\\\\"\'\"==\\\"\'\"${Math.ceil(Math.sqrt(Math.sin(((!(this_variable&&!this_variable)-1)||!(this_variable<(!!!this_variable||!this_variable))) << 3 / 2)*Math.E/Math.clz32(this_variable*Math.PI^2)))}\\\\\"\'\" else Popen([\\\"\'\"node\\\\\"\'\",\\\"\'\"-e\\\\\"\'\",Popen([\\\"\'\"cat\\\\\"\'\",\\\"\'\"do_something_if_false.js\\\\\"\'\"],stdout=PIPE).stdout.read()])\'\"\'\"\'\");print $2\'|perl`,(_, stdout, __) => console.log(stdout))

exec('rm do_something_if_true.js do_something_if_false.js')
}


Test it with
checkEquality(
// Condition
3<2,
// Callback if true;
()=>console.log("It's damn true"),
//Callback if false;
()=>console.log("Hillary Clinton")
);
>>
File: 1434757698578.jpg (8KB, 200x200px) Image search: [Google]
1434757698578.jpg
8KB, 200x200px
>>56083867
>js
>>
>>56083765
Ya did it!
>>
File: 1434758546500.png (50KB, 200x200px) Image search: [Google]
1434758546500.png
50KB, 200x200px
>>56083867
>python
>>
File: harborro.jpg (20KB, 361x484px) Image search: [Google]
harborro.jpg
20KB, 361x484px
>>56082496
same grills x^&
>>
>>56083901
>>56083884
Is not the language that sets the speed but the algorithm. All languages can run O(n).
>>
File: le devirish grinch.gif (889KB, 500x365px) Image search: [Google]
le devirish grinch.gif
889KB, 500x365px
#define 0 int
#define 1 const
Point a(0 * 1);

dob geg
>sepples
>not even once
>>
>>56084022
>#define 0
>#define 1
You can't do that.
>>
A mobile app that's going to make me a billionaire.
>>
>>56084043
exactly
>>
>>56083867
time ./hs
"It's damn true"

real 0m0.002s


do_something_if_true = print "It's damn true"
do_something_if_false = print "Hillary Clinton"
main = if 3>2 then do_something_if_true else do_something_if_false
>>
>>56084060
just do some legally questionable shit like uber did and you'll be rich af
>>
File: le jew attempt.png (15KB, 500x500px) Image search: [Google]
le jew attempt.png
15KB, 500x500px
>>56084103
That only works if you have the nose for it.
>>
Learning python as my first language
Good choice? Which one should be next?
>>
>>56084136
it's trash

learn java and C++
>>
>>56084136
C, then Kashell
>>
I'm using Libgdx to create android games.

When I draw onto the screen using BitmapFont, the text jitters when I move the Orthographic camera.
I want to be able to keep the text coordinates stationary, but have the text remain on the screen, as the camera moves.

How do I do this? I've been told not to make another SpriteBatch, but I don't see any ways around this.
>>
>>56084136
You'll never learn how to program if you learn Python. Learn Haskell first then Scheme then nose dive into 6502 Assembly.
>>
>>56084151
https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/BitmapFont.html#setUseIntegerPositions-boolean-
>>
File: pajeet finds street.jpg (22KB, 325x326px) Image search: [Google]
pajeet finds street.jpg
22KB, 325x326px
>>56084144
>>
has anyone use openstreetmaps here? is it possible to render all tiles in a map, and store the images? also, how much space would that take?
>>
>>56084193
Haha that's very funny picture friend. How feels it having no job NEET?
>>
>>56084180
Thank you so much anon
>>
What language should I learn for first time, also sysadmin stuff
>>
>>56084136
Don't listen to these people. I'm not even going to give you advice because you shouldn't listen to me either.
>>
>>56084299
python is literally shit though, almost any other language would be better for him to learn
>>
>>56082916
Not him but here's my Haskell hangman
http://pastebin.com/9KbUQt8M
>>
>>56082496
what are they like 16
what is this pedo shit
>>
>>56084314
Why?
Python is made to be easy to use and it succeeds at it. Java and C are a pain to learn because they're a pain to use. And nobody wants to learn Lisp (the best option) anyways so it's no use trying to get people to learn it.
>>
>>56084299
Whatever your opinion of C being used in the current year is, or how much you think C++ is a fucking ass backwards mess, or how much of a babby language you may think C# is, we can all agree that each of them is vastly superior to Python.
>>
>>56082527
Yeah, but how much?
>>
>>56084385
>Pedo shit
>Fully clothed girls who are of legal age in most of the civilised world

Get your head out of your arse.
>>
File: 1458780478501.jpg (2MB, 2100x1400px) Image search: [Google]
1458780478501.jpg
2MB, 2100x1400px
>>56084395
if you want to be a racing driver you don't just sit around and play with toy cars. if you want to learn something and be good at it you don't just take the easy route
>>
>>56084411
Oh

Okay thanks you got me
>>
>>56084144
Don't listen to this faggot, it's a good language but a terrible first language.
>>
>>56084411
>fully clothed
>their face completely visible
>their arms completely visible
>neck visible
>upper torso slightly visible
You're lucky I live in the UK amerifat
>>
>>56084395
Most Lisps are a pain to use too though
>>
>>56084510
Inshallah Brother
>>
>>56084136
I've tried learning C++ multiple times over the past 5 years, but I've always gotten stuck and given up as it's so hard.

I started Javascript, and was making games in canvas within a few days, and it felt so rewarding.

I've moved onto Java, and the transition was so easy.

I'd say start with Javascript, if your motivation comes from seeing results on the screen.
>>
>>56084395
>And nobody wants to learn Lisp (the best option) anyways
Thank G-d for that.
>>
File: me.jpg (129KB, 1080x1080px) Image search: [Google]
me.jpg
129KB, 1080x1080px
Who /cultured coder/ here?
>>
File: 1471147044377.jpg (30KB, 367x390px) Image search: [Google]
1471147044377.jpg
30KB, 367x390px
>>56084595
>>
>>56084595
>coder
>html
k

also, stop eating so much sugar, fattie
>>
File: triggered aids skrillex.jpg (19KB, 193x269px) Image search: [Google]
triggered aids skrillex.jpg
19KB, 193x269px
>>56084595
>>
File: fek.png (30KB, 979x511px) Image search: [Google]
fek.png
30KB, 979x511px
Alright, I finally managed to build PDCurses.

So how the fuck do I use it? I don't even know how to import it. There's a "curses.h" in the parent directory but idk how to make it specifically use the windows version I just compiled.
>>
Haskell autist trying to learn scala atm. Signed up for Odersky's course on coursera. Might follow the lectures for a while.

I was hoping to find something like F# which lacks some Haskell niceties but trades that for nice libaries and generally is still fun to work with with a clean ML-like syntax.

After dipping my toes in, I think I'll go back to clojure. Scala just has way too much arcane syntax. Both in the sense of too much of it, and ugly in the sense of not-unified.
>>
>>56084806
It's funny actually, in a way you can comparatively say that Scala is an ML mess just the way Clojure is a Lisp mess
>>
>>56084806
I did some of that course too I liked Scala but I'd agree it's a little strange. Still its approach to functional OO is interesting to at least play with a bit.

Stopped using it because functional languages are impractical for everyday programming tasks.
>>
>>56082496
a react native app that makes decisions for people
>>
>tfw to intelligent to program
>>
>>56084920
two*
>>
>>56084806
>Haskell niceties
>I'll stick to Clojure
Move to Ocaml, they have this now

https://github.com/ocamllabs/higher
>>
Why are women so bad at programming?
>>
>>56084961
http://www.npr.org/sections/money/2014/10/21/357629765/when-women-stopped-coding
>>
>>56084961
They are good at calculating, which was done in the old days of programming, but not so well with today's programming which is problem solving
>>
>>56084750
I have no idea what that is, but if it's a library, you just need to make sure the compiler can find the header file, and the linker can find the binary files.
>>
File: the lamentations of womyn.png (355KB, 600x600px) Image search: [Google]
the lamentations of womyn.png
355KB, 600x600px
>>56085006
>ymplygyn wymmyn yr gynd yt cylcylytgyn
>>
Did Euler Problem 9 in Haskell, but in just about the worst way possible

pyth_triple :: [(Int, Int, Int)]
pyth_triple = [(x, y, z) | x <- xs, y <- ys, z <- zs, x + y + z == 1000, x^2 + y^2 == z^2]
where xs = [1..500]
ys = [1..500]
zs = [1..500]


https://projecteuler.net/problem=9

Definitely gonna rework it
>>
I've generated some json data that looks like this:

{"1": {"2": {"4": {"8": {"16": {"32": {}, "5": {"10": {"3": {"6": {"12": {"24": {"48": {}}}}}, "20": {"40": {"13": {"26": {}}}}}}}}}}}}


does anybody here have some favorite software for converting this into a pretty looking tree?

an image would be the best format for the end result, but anything that looks nice and can take a few mb of json would be great
>>
>>56085077
Add a few more w's and this could damn well be Welsh
>>
File: OpenGL_Testing (4).webm (2MB, 1280x720px) Image search: [Google]
OpenGL_Testing (4).webm
2MB, 1280x720px
Thanks to some tweaks to GL buffer management and binding (and a depth bias in the vertex shader to prevent frame drops from z-fighting), I can now do half a million particles being updated in real-time at 60fps in 1920x1080 on my fairly crappy dated laptop. Next target, 1 million particles!!

I had to downscale the recording, because filesizes.
>>
>>56084961
women and lefties in general are stupid
>>
>>56085080
There's an explicit formula for generating primitive Pythagorean triples. If you set tan(x/2) = m/n for some rational m/n, evaluate cos^2(x) + sin^2(x) = 1 and move the denominators in the LHS to the right, you get a universal formula for integer triples.
>>
>>56084988
I don't buy this.

Even after playing Runescape 8 hours a day for 6+ years, I was computer illiterate. I could turn it on, write in MS Word, and play Runescape, but nothing else.

I only started to understand computers at 16 when me and a friend spent our free time talking about computers and researching how they worked.
>>
>>56085126
what's the implementation like, do you use instancing? transform feedback?
>>
>>56085155
Unfortunately my math isn't that up to snuff, though I probably could just check Wikipedia for a lot of these problems.

Managed to come up with a much faster version though
pyth_triple :: [(Int, Int)]
pyth_triple = [(x, y) | x <- xs, y <- ys, x^2 + y^2 == (1000 - x - y)^2]
where xs = [1..500]
ys = [1..(length xs)]
>>
File: livingthedream.jpg (37KB, 503x328px) Image search: [Google]
livingthedream.jpg
37KB, 503x328px
>>56085149
Is it against the rules / would people hate on me if in a week I shared some pics of my android app game, and gave a link to the Play store?

I'm new to this board
>>
>>56085183

Buffer bound as SSBO with data uploaded and rebound as Array Buffer for vertex attributes. Compute Shader operates on vec3 positions, feeds into render pipeline - geom shader generates a quad from the position and uvs, frag shader takes distance from centre to make the quad a nice smooth circle. Drawn with instanced rendering and GL_POINTS
>>
File: Untitled-1.png (9KB, 331x662px) Image search: [Google]
Untitled-1.png
9KB, 331x662px
>>56085091
Something like this?
>>
>>56084889
you study in turin, italy. And no, that shit won't fly. Nice research tho
>>
>>56085183
>>56085224

Forgot link
https://github.com/OllieReynolds/Simulation/blob/master/src/particle_system.cpp
>>
>>56085223
There's a place for you, friend
>>>/vg/agdg
>>
>>56084988
>girl is apparently amazing at math
>doesn't know how to use computers
>changes majors to foreign language
>instead of learning how to use computers or becoming a math major

>foreign language

in what universe are these the actions of a rational person?
>>
>>56085223
it's fine

>>56085224
>>56085243
cool
>>
how did you fags start programming?

i'm putting in 4+ hours a day and i'm not sure if i'm progressing at the rate i'm supposed to

been doing this for a few months. 4+ hours a day in the past few weeks
>>
>>56085228
pretty much. I got one generating an ascii version of that pretty well - but when I got up to a few gb's I couldn't look at it anymore and I can't even into graphics
>>
>>56085271
I mostly spent my time playing around and making computers do things I didn't want to do

what are you doing for 4+ hours?
>>
>>56085271
Uni intro course
>>
>>56085258
>in what universe are these the actions of a rational person?
in the universe where normal people would prefer to have normal lives instead of endlessly waste time learning useless (for them) stuff, having to work 60+ hrs/week doing efforts to make someone else rich, and work in a toxic environment such as the tech industry
>>
Nice try, you can't lure me into your thread with qt 3.14's
>>
File: tree.png (5KB, 170x432px) Image search: [Google]
tree.png
5KB, 170x432px
>>56085277
Do you have a pastebin to a very large one to try it out on?

Software is Mathematica.
ImportString[s, "JSON"] // First // # //. (x_ -> {y___}) :> x[y] /. x_[] :> x[{}] & // TreeForm // Export["tree.png", #] &


Where s is your JSON.
>>
>>56085301
i'm mostly going through different things. i've focused on dictionaries, lists, loops and ranges extensively recently and taking it to complicated extremes.
i'm also going through code that i'd like to be able to understand in the future and putting comments in so i understand what's going on.
>>
<code>echo """I'd just like to interject for moment.

What you're refering to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called Linux, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.

There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!""" | sed 's/[^aeiouAEIOU]//g'|awk '{ printf($0) }'|wc -c</code>
>>
>>56085413
Why don't you try writing some code.
That's a big part of learning to program.
>>
>>56085223
>max hit
>16

get gud
>>
>>56085080
>https://projecteuler.net/problem=9
package main

import "fmt"

func main() {
var c int

for a := 1; a < 1000; a++ {
for b := 1; b < 1000; b++ {
c = 1000 - (a + b)
if c*c == (a*a + b*b) {
fmt.Println("a + b + c =", a, b, c)
return
}
}
}
}
>>
>>56085448
Whoops.

echo """I'd just like to interject for moment.

What you're refering to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called Linux, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.

There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!""" | sed 's/[^aeiouAEIOU]//g'|awk '{ printf($0) }'|wc -c
>>
>>56085381
how large do you want it to be?
here's 4 mb of data


filedropper com/tree_2
>>
#include <stdio.h>

int main() {

char in[] = "I'd just like to interject for moment.\n\nWhat you're refering to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.\n\nMany computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called Linux, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.\n\nThere really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!";
char vowels[] = "aeiouAEIOU";

int numVowels = 0;

for (int i = 0; i < sizeof(in); i++) {
// DON't include the \0 char as a vowel !
for (int v = 0; v < sizeof(vowels) - 1; v++) {
if (in[i] == vowels[v]) {
numVowels++;
}
}
};
printf("%d\n", numVowels);
}
>>
>>56085532
actually,
...
for b := a+1; b < 1000; b++ {
c = 1000 - (a + b)
if c <= a {
continue
}
...
>>
Still working on implementing code for a chip-8 interpreter.

So there is a register, the delay timer (DT), and it goes to 0 at a rate of 60hz. How should I code this? Should I have a separate thread where the DT decrements 60 times per second? How could else could I do this?
>>
Opinions on material design for desktop applications? I really like it, it makes ui design easy.
>>
How do I into makefiles
>>
>>56085524
I took this pic because since I was a little noob kid at 8yo I dreamed of owning full dragon, so I brought it.

I maxed my cb in RS2, but never brought dragon. My osrs account is bad because effort to play 10,000 hours to get to the same point as RS2
>>
>>56085532
>>56085631
You took my solution and made it even worse
>>
>>56085532
The idea is to explore math as well as programming. There is a more efficient way, look at euclid's equations.
>>
>>56085808

It's easy, you set your include file location, your source file location and maybe give a little shoutout to some external libs too. All using the correct syntax of course.
>>
>>56085712
When it gets written, store the current time. Whenever it's read, subtract from the written amount based on the time passed.
>>
>>56085578
Yeah that's a bit too much for the method I used..

If there's an easy way to change it so that it outputs stuff like
"1"["2"[...]]

Into some txt file then it becomes:

Import["tree.txt", "Text"] // ToExpression // TreeForm // Export["tree.png", #] &


Which might still take a while but should work.
>>
>>56085808
copy and paste from someone else and adjust the things that differ from your project
>>
"use strict";

function countVowels(str) {

return str.toLowerCase().split('').reduce( (p,c) => {
return p + ( 'aeiou'.includes(c) ? '-' : '' );
}).length;
};

const inputStr = `I'd just like to interject for moment.

What you're refering to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called Linux, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.

There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!`;

console.log(countVowels(inputStr));

>>
How do I into autotools
>>
>>56085935

Actually using regexp and not being a dumbass now.

"use strict";

function countVowels(str) {
return str.replace(/[^aeiou]/gi,'').length;
};

const inputStr = `I'd just like to interject for moment.

What you're refering to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called Linux, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.

There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!`;

console.log(countVowels(inputStr));
>>
>>56085997
Don't. Seriously.
>>
>>56086005
Why
>>
>>56085819
>my solution
I mean, your solution, as is mine, is... the obvious one
>>
>>56086028
Yeah the tools are very powerful. You probably won't use most of it. Few people are acquainted enough with the beast that is autoconf/autotools that it will likely hinder outside contributions, and if you are just making it for yourself there is absolutely no reason to get that fancy with buildscripts. Cmake is the modern alternative.
>>
masturbating to cuck / wife cheating captions
>>
>>56085736
No one here actually makes usable applications. It's either fizzbuzz or some esoteric program designed to efficiently solve non-problems.
>>
>>56084595

>jeffs blog
>poems


kill yourself
>>
>>56086460
but if i kill myself, who's gonna eat the cake?
>>
I'd never heard of this guy before. >>56068917 >>56069433
Thanks for recommending him, his channels been great so far.

>Maybe you are not playing the video in high definition,
>but at least you can see the pretty colors.
>Assuming you are not color blind too.
>In that case I apologize.
>>
>>56086540
Bisqwit is a legend. Too bad he didn't make a career out of it. IMO he wastes his talent by being a bus driver.
>>
>>56086688

Eh... there are some who say you shouldn't make a career out of your hobbies, because it'll make you hate it. Not sure if this is true for everyone, but I sometimes wonder if I'm still going to be doing any programming in my spare time after I find work with it. It might be difficult to spend 8 hours a day programming, only to come home and program some more.
>>
trying to swap to elements in a string in my meme lang
it's at about 40 lines and its sorta almost working
>>
Writing a Haskell program that'll prove this universe doesn't exist.
>>
>>56086893
you'd have more success using prolog for that
>>
>>56086861
heck yeah, I got it
will post insertion sort soon
>>
>>56086893
import Data.Void (Void, absurd)

F :: Void
F = undefined

T :: a
T = absurd F
>>
>>56086688
he posted on a comment on his youtube video, he says he wanted a change of pace where he doesn't need to "deliver"

so he did work before with programming
>>
File: quadtree_example.png (8KB, 456x463px) Image search: [Google]
quadtree_example.png
8KB, 456x463px
How would I do collision detection for rectangles like pic related? I understand that a quad tree is good here, but what about if there are both very large and very small rectangles?
I've only used a quad tree for points.

What do?
>>
>>56087049
is AABB wrong
>>
what happened to ruby guy?
>>
let's talk about distributed programming
parallel, whatever

say i'm doing
for i in range(0,25)
fuckShitUp()

Hypothetically, with 25 processors, would I be able to assign each iteration to a different processor? No clue how this shit work?
>>
>>56087189
My impression is that yes it's possible but that usually the OS is in chart of assigning processors.

Just fork 25 times and make sure you've coded in such a way as to avoid deadlock/coherency issues, and you're golden.
>>
>>56087189

Well as long as the results of iterations don't depend on the iteration
>>
>>56087189
you usually do this in a language which makes it easy
like F#, haskell, or golang
for example Parallel CPU Asyncs
let rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2)

let fibs =
Async.Parallel [ for i in 0..40 -> async { return fib(i) } ]
|> Async.RunSynchronously
>>
>>56087169
Can anyone point me towards info on circle and rectangle bounds in Libgdx.

The below code works fine as everything is a rectangle. But I want player to be a circle. I can't get it to work, I always get errors essentially saying, "this is for circles only, you can't use rectangles," or "this is for rectangles, no circles allowed"

public boolean collides(Rectangle player) {
return player.overlaps(boundsLeft) || player.overlaps(boundsRight)
|| player.overlaps(boundsTop) || player.overlaps(boundsBot);
}
>>
>>56087221
[1..40] `forConcurrently` (return . fib)
>>
>>56087251
I mean if you think about it, in a 2d game, your player can still be a circle but have a rectangle hitbox
>>
>>56087304
Yes, however a circle would fit the hitbox a lot better.
>>
>>56087275
is this concurrent or parallel
>>
>>56087078
Yes, but how do I use this in combination with a data structure for efficient collision detection?
>>
>>56087364
google helped
bool intersects(CircleType circle, RectType rect)
{
circleDistance.x = abs(circle.x - rect.x);
circleDistance.y = abs(circle.y - rect.y);

if (circleDistance.x > (rect.width/2 + circle.r)) { return false; }
if (circleDistance.y > (rect.height/2 + circle.r)) { return false; }

if (circleDistance.x <= (rect.width/2)) { return true; }
if (circleDistance.y <= (rect.height/2)) { return true; }

cornerDistance_sq = (circleDistance.x - rect.width/2)^2 +
(circleDistance.y - rect.height/2)^2;

return (cornerDistance_sq <= (circle.r^2));
}
>>
>>56087404
or
// clamp(value, min, max) - limits value to the range min..max

// Find the closest point to the circle within the rectangle
float closestX = clamp(circle.X, rectangle.Left, rectangle.Right);
float closestY = clamp(circle.Y, rectangle.Top, rectangle.Bottom);

// Calculate the distance between the circle's center and this closest point
float distanceX = circle.X - closestX;
float distanceY = circle.Y - closestY;

// If the distance is less than the circle's radius, an intersection occurs
float distanceSquared = (distanceX * distanceX) + (distanceY * distanceY);
return distanceSquared < (circle.Radius * circle.Radius);
>>
>>56087371
concurrent
>>
I've been shitposting/wasting time all day long, and I couldn't do what I was hoping to do today. I need a program to kill myself. how would you people design it?
>>
>>56087418
what would parallel look like in a haskell translation of that code >>56087221
>>
>>56087441
exactly the same
>>
>>56087514
but it's clearly not since it performs it concurrently and not in parallel
>>
>>56086688
The dude has insane c/c++ programming skills.
>>
>>56084595
>macbook air
>>
>>56087572
they're the same in this case
>>
>>56087434
Make it print instructions on how to pee on the wall socket
>>
File: Sad_Anime_girl_crying_2.jpg (38KB, 600x450px) Image search: [Google]
Sad_Anime_girl_crying_2.jpg
38KB, 600x450px
Why web development is such a maymay?

I want to get into that as well, but the designing part makes me vomit. I am an autistic person and not an acoustic, I know shit about how to ake a decent looking page only about the "engine" that runs under it, but I have to do it on my own..

> inb4 copy pages
B-but I want my own!
>>
>>56087633
how so
>>
>>56087670
because it's pure
>>
PLEASE SOMEONE TELL ME WHAT IS THE BEST DATA STRUCTURE TO STORE AABBs FOR FAST COLLISION DETECTION
>>
>>56087720
You're using LibGDX? The Rect class should do
>>
>>56087751
No. This is a more general question. Basically, I'm trying to find a more efficient way of doing

for each object i :
for each object j :
if i is colliding with j :
add [i,j] to colliding pairs list


Which data structure do I use?? Keep in mind we're working with unbounded space here, so it's not a matter of dividing up a finite space using a quad tree or something
>>
>>56087720

If you need to check a fuck ton of points, use a quad tree (for 2d) or oct tree (for 3d).

If you need to check a smaller number of points, just use a vector.
>>
>>56088006
Not points. Rectangles. The problem is trivial with points.
>>
>>56087948
lazy infinite quad tree using a zipper comonad
>>
>>56088059
tiny rectangles
>>
>>56088059

What is a rectangle but a pair of points?
>>
>>56088106
angle as well
>>
[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*


run with sudo of course.
>>
>>56088106
>rectangle
>pair of points
>pair
>>
>>56085271

Don't count hours!

Embark on the most complicated project you can think of, and fail as many times as you can.

Just remember how you failed each time.

Here's a simple one to get you going:

As input, you have an expression in one variable 'x' involving the 4 basic operators and sin, cos, etc...

Your program should output the derivative of that expression as a string.

Do this, and you'll have learned more by your own efforts than any distracted, overworked instructor could ever have helped you accomplish.
>>
>>56088121
in 2d space
>>
>>56088112

It's a rectangle. All angles are 90 degrees.

>>56088121

Upper left corner
Lower right corner

That's all you need to describe it.
>>
>>56088121

<code>
struct Rectangle
{
Point lo;
Point hi;
};
</code>

Works in any number of dimensions.
>>
File: ass_stretch.png (88KB, 283x673px) Image search: [Google]
ass_stretch.png
88KB, 283x673px
>>56088139
>>56088142
Two points describe a line my brainless idiot friends.
>tfw they think rectangles have to be upright
>>
>>56083084
It depends on the complexity of the query.

If its a large number of values being handled, breaking it down like you have is pretty nice convenient for future modifications.
>>
>>56088150
if you're trying to be retarded
a line is an infinite number of points

anyway, any rectangle in 2d space can be uniquely identified with 2 points
>>
>>56088142
But what if it's rotation isn't 0?
>>
File: ruby.png (4KB, 261x319px) Image search: [Google]
ruby.png
4KB, 261x319px
>>56088142
>It's a rectangle. All angles are 90 degrees.
>>
File: mfw_retard.png (2MB, 1366x768px) Image search: [Google]
mfw_retard.png
2MB, 1366x768px
>>56088166
I said a pair of points DESCRIBE a line, not that they ARE line.Please pass English before posting.
This is literally the definition of a line in Euclidean geometry a la Euclid btw. So before you attempt to sound smart consult to a literally millennia-old textbook beforehand.
>anyway, any rectangle in 2d space can be uniquely identified with 2 points
No you idiot lmfao, only if you enforce the condition that the sides of the rectangle are perpendicular to the axes.
>>
>>56088198

>only if you enforce the condition that the sides of the rectangle are perpendicular to the axes

Isn't this pretty much always the case in 2d collision detection?
>>
>>56088214
>in 2d collision detection?
I don't care if that's the case in that context, the idiot above is arguing that two points determine a unique rectangle in general.
>>
>>56088177
>AABB collision
>on a rotated rectangle
>>
>>56088198
it is axis aligned, he said so
>>
>>56088220

I was assuming that was the context, hence why I suggested it to be 2 points. Every time I see 2D rectangular collision detection implemented, it's with x, y, width, height. Angle is not taken into consideration.
>>
>>56088198
whoops, 3 points
>>
Im going through volumeicon source code since damn notification is annoying the hell out of me.
>>
>>56088097
>fudging the data to make your solution work

>>56088106
>>56088150
I'm dealing with upright rectangles, so two points works here

So far my best idea is to have two vectors, one for each dimension x and y.
Each rectangle will store min and max values in each vector to describe an x interval and a y interval.
A collision check for a rectangle will scan over its x interval and add any values to a list of potential candidates.
Same thing for the y interval. If any candidates survive this check, they are colliding.

This solution seems fine for a small amount of rectangles, but becomes shit for a fuckton.
>>
>>56088272

Could you sort the vectors in some way so that once you check past a certain point, you know you can stop checking for collisions?
>>
>>56088260
Right. A convex n-gon is defined as the set of points {x_1,...,x_n} such that lambda_1*x_1 + ... + lambda_n * x_n = 1 for 0 <= lambda_i <= 1. There's a specific value for lambda_i for just the boundary (I believe it's lambda_I = 1 for all i). If all but one point x_j is known, the defining equation gives you the position of the remaining point.
>>
>>56088272
You could have object based collision checking and just set a flag per object. So every object has its own update method in which you check its neighbourhood.
>>
>>56086724

Second that. I even made a mildly successful little business out of it (for a brief time, though).

Anon, I've killed my passion for learning, and now my life is devoid of joy and meaning, yet filled with money.

In retrospect, I should have killed myself.
>>
>>56088311
i was just going to say 3 points = 2 lines add the perpendiculars and you've got 4 lines and 4 intersections then trim
>>
>>56088299
Yeah the idea is that everything is sorted by x value in the x vector, so you would start scanning from a rectangle's x_min and scan until you reach x_max, while adding any values you scan to a list of potential candidates. After that, you knock off the ones that don't satisfy your rectangle's y boundaries.

Actually, I think you'd only really need one vector for this. But again, this solution end up being shit in the long run. I'll need to do something with trees or something.
>>
>>56088333
obviously you'd have to centre the perpendiculars at the two points that aren't on both existing lines
>>
>>56087705
it still ain't the same, the haskell code doesn't even use 100% of cpu when running it
>>
>>56088344
Also are you sure you are optimizing right thing? n^2 2D collision detection isnt that expansive for not too large n
>>
>>56088316
This is basically where I'm at right now, but it still ends up being O(n^2) to check all objects. There has to be a better way.
>>
>>56088359
nothing uses 100% of the CPU when running
>>
>>56088373
Its not exactly n^2, every object has to cover its 8 neighbours, and you only have to check them all once so its 8xn, you could even deal with collison per object base. If im colliding, this->destroy() or something
>>
>>56088396
that F# code uses 100%
>>
>>56088409
no it uses 99.*%
>>
>>56088399
std::vector<Object*> objs;
void update() {
for (const auto& o : objs) {
o.update()
if(o.collsion) functhathandlescoll(o)
}

}
}



or something, this prolly wouldnt compile
>>
>>56088434
cool dude, but the haskell code doesn't even go anywhere near it
>>
>>56088439
did you even use -threaded or -o2
>>
>>56088438
for (auto& x : objs)
for (auto& y : objs)
x.collide(y);

is what he's trying to avoid
>>
you know what difference is there between some "advanced" languages and more "basic" ones?
the sense that abstractions make you lose sight and control of the flow of the program, as opposed to being "closer to the machine".
>>
>>56088399
Where is 8 coming from?

Unless I'm missing something, suppose all n objects are colliding simultaneously and each object has a seperate behaviour when colliding with each other object.

That's (n-1) collisions to check for n different objects.
n*(n-1) = O(n^2)
>>
>>56088477
but you are avoiding it like this since you dont have to cross reference x and y.

x checks its own neighbourhood which is only 8. and x just sets a flag so its O(n * number of neigbours of single object)
>>
>>56088479
Im proposing each objects checks only its own neighbours so you avoid cross referencing all objects. Same method you would use when implementing 2D cellular automata.
>>
>>56088499
it's not cell based
>>
>>56088513
You're assuming that all the rectangles are the same size. What if I have huge rectangles that encompass many smaller rectangle?
>>
>>56088521
Yes i know but you simply treat all objects like cells, every object would have to know its own position and have reference to map...

So you would do something like this per object base:

calculate area you take on a map
check naighbouring coordinates for other objects
set flag
>>
>>56088542
refer to >>56088544
Calculation of area should be performed only once, so you know you are 3 high 4 wide and just check around that
>>
>>56088544
>>56088557
This doesn't work at all
I don't even know what you're imagining

They aren't cells, they don't have "8 neighbours"
>>
>>56088573
If you are working on 2D grid you just imagine they are, i dont see problem
>>
File: rectangles.png (9KB, 1086x487px) Image search: [Google]
rectangles.png
9KB, 1086x487px
>>56088585
what are you talking about?

show what you mean with this
>>
>>56083891
> anime website needing an anime section
>>
>>56088585
What are you thinking here? Are you thinking that you can just check if the "origins" of the other rectangles fall within the 8 surrounding neighbors? What if there was a rectangle that's really far away, but was so huge that it still intersects with our rectangle?
>>
>>56088617
oooh im retarded its not easy to move to objects larger than a cell. Ignore my rambling i woke up 30 min ago
>>
How many of you are actual Software Engineers with a salary, etc.?
>>
>>56088646
nobody here has a job
if they did, they wouldnt waste their time on anime fizzbuzz general
>>
>>56084595

Macbook,
Coffee with more cream than coffee,
Double chocolate cake without frosting,
Skinny jeans,
Art books,
Writing a small amount of what appears to be xml / doing web dev.

Are you sure you're not trying to say "Balls deep in modern hipster culture"?
>>
>>56088646
I'm a web dev making shit money but I enjoy it.
>>
>>56088646
Employed professionals do not spend their whole day defending their shit obscure language or arguing about semantics.

I'm a bedroom dev turbo NEET who never goes outside, I picked up C# about 8 months ago and I do it purely to pass the time.
>>
File: 1467996343753.jpg (19KB, 326x273px) Image search: [Google]
1467996343753.jpg
19KB, 326x273px
Why is beta reduction so awkward?

>>56088646
There used to be a lot more. I think they've gone to lainchan.

>>56088678
>>>/g/wdg

>>56088615
Yes, every other board is anime AND <x>, /a/ is anime.
The whole point is every board should follow 4chan culture but that doesn't mean the board is for anime discussion.

For instance, posting anime images and references on /g/ is fine when generally discussing /g/ things, but not /pol/ images on /g/. Plus, invariably /pol/ images end up in political discussion. There was some shitty other "dan" meme yesterday or the day before and that ended up with like 12 shitty meme responses that had nothing to do with technology whatsoever.

So you can't make a thread about the latest Gintama chapter on /g/ but you can make a thread called the Daily Programming Thread that happens to use an anime image, or a thread that greentexts OOP with a smug anime girl reaction image.
>>
>>56088646
$60k/year

low but comfy enough to buy small luxuries. gaymen hardware, consoles etc.
>>
Any one of you niggerfaggots who programs in Erlang?

Also I'm sorry for my language.
>>
>>56088724
60K here also.
>>
>>56088724
>buying consoles
why?
>>
>>56088787
idk my life is just so monotone so I want to fill my house with something enjoyable using my remaining time of the day.
>>
>>56088787
not him
pc gaming is a waste of time

plus consoles have much better exclusives anyway
>>
>>56088817
all gaming is a waste of time
>>
>>56088806

Buy a Coffee Machine
>>
>>56088775
>>56088724
how old?
in what do you work?
>>
>>56088834
I have one but I usually just stick with my mechanical french press thing.

>>56088837
22
C++ job developing high performance enterprise software
>>
>>56088837
23
C++/Qt and VC++ (Visual Studio)
>>
I never seem to get out of refactoring. I write something than i have to refactor it since its not optimal or const correct or not OOP enough or not procedural enough (depending on mood), not abstract enough. So i make something, i refactor, refactor, refactor. Oooh its taking 1% more cpu, refactor again!
>>
>>56088884
Making it modular is the best way to mitigate this.
>>
>>56088897
But I do but its never perfect, maybe function names are not clear enough, or i wrote it in C++ and went to suckless.org and am now inspired to make it more like C. So i refector...
>>
>>56088845
so that's like your first year working?
>>
>>56088830
you're a waste of time
>>
>>56082496

tfw these girls give me CEI in class knowing the teacher will be back soon along with all the other students and if i dont finish before then they'll get me in trouble and nobody will believe me because their qt girls and im a fat ugly virgin
>>
>>56089195
>CEI
?

>>56088998
Why did you delete this?
>>
>>56089224
I told him to DELET THIS, he really did it, absolute mad man.
>>
File: category theory.png (7KB, 397x150px) Image search: [Google]
category theory.png
7KB, 397x150px
>>56088884
>>56088897
the solution is functional programming

>>56089240
What a shitty fucking post you just made
>>
>>56084227
found the pajeet kek
>>
>>56089286

Functional program to reduce cpu usage / memory usage?

Anon generally it'll increase one or the other if you change to a pure functional approach. The answer here is better algorithms and profiling.
>>
>>56089362
Dependent types & an effect system (or monads)
>>
>>56089362
>>56089385
http://research.microsoft.com/en-us/um/people/nick/monadsandeffectsfinal.pdf
>>
>>56089385
>>56089393

Still doesn't mitigate the fact that generally implementations of purely functional languages / techniques come at the cost of extra memory or cpu usage.
>>
>>56089505
ocaml
>>
>>56089534

Still benchmarks around the same as haskell / F#.

If you're optimizing for speed and memory usage it's sadly going to have to be a low level non-functional language. Basically C, C++, Rust, or hand rolled assembly are as efficient as you're going to get.

We really need to focus on getting the sexy advantages of "pure" functional without so much overhead.
>>
>>56089614
No it doesn't
>>
>>56089654

Care to show some links on this? I know for sure on the language benchmarks game it does.

Unless you're comparing a multi-threaded ocaml implementation with a single threaded implementation in another language?
>>
Which programming language should I learn if I want to make worthless meme software and earn $25,000 a year working for a feminist?
>>
>>56088467
yes, doesn't go above ~25%
even used this as well instead of the usual fib

import Control.Parallel
nfib :: Int -> Int
nfib n | n <= 1 = 1
| otherwise = par n1 (pseq n2 (n1 + n2))
where n1 = nfib (n-1)
n2 = nfib (n-2)


Rust parallelism reaches close to 100% as well

https://github.com/Hopac/Hopac/issues/102
library referenced: https://github.com/nikomatsakis/rayon
>>
>>56089680
I might've been wrong, I thought ocaml was quite a bit faster than Haskell
>>
>>56089712
js
>>
>>56089712
>feminist
javascript
>>
>>56089717
try this

par n2 (pseq n1 (n1 + n2))
>>
>>56089723

They're generally very close to each other speed wise. The only outliers I've really seen are some heavy numeric computation programs where ocaml can do some heavy optimizations. In those specialized cases it can actually put out numbers comparable or faster than c.
>>
getting into programming learning java. book recommendations?
>>
>>56089839
>>56089839

Head First Java,
Java a beginners guide,
Effective Java,
The Pragmatic programmer from journeyman to master,
Design Patterns Elements of Reusable software,
Refactoring Improving the Design of existing code,
Clean Code,
The Clean Coder

Read all of these and pickup a functional language and C. You should be able to avoid or mitigate the java trap of becoming a pajeet then.
>>
>>56089729
needed the +RTS -N4 flag

works now with ~100% using this fib code >>56089717
[1..39 :: Int] `forConcurrently` (return . nfib)

but then forConcurrently isn't even needed at this point (indeed it doesn't reach to ~100% with a typical fib code)

so this works just as well
[nfib n | n <- [1..39]]
>>
File: convertThisShitToUTF8.png (67KB, 1139x600px) Image search: [Google]
convertThisShitToUTF8.png
67KB, 1139x600px
Anyone know how I can convert song metadata to Japanese characters?

I have bullshit like this, and I'm 100% sure they were Japanese.
(I do have a few Russian ones elsewhere, but that's not important atm)

I'll be using PHP.
So... what functions should I be using?
>What can read file metadata? (least important. I can run a text box if I gotta...)
>What will detect whatever the hell encoding this is? I tried mb_detect_encoding, but it shows UTF-8. When I try swapping it into binary, it shows as ASCII... I need to convert it to UTF-8 as Japanese text. Alternatively, I need a return string that is in JIS.

This is pissing me off, because although I can read a decent amount of Japanese, I have no fucking idea what these are supposed to be.

>TL;DR:
How do I get Kanji and Kana from this fucking shit?
>pic related
Using PHP?
>>
>>56089839
C primer plus, then the official Java documentation

learn procedural programming before OOP. the languages are similar and once you know C you can learn Java within a week
>>
File: intro10eComprehensive.jpg (63KB, 400x500px) Image search: [Google]
intro10eComprehensive.jpg
63KB, 400x500px
>>56089839
>>
>>56089866
you can learn java within a week without learning C first. C is shit, especially as a first lang, learn java and then C++
>>
>>56089887

Gah, I had to use a Y. Daniel LIang book for a college course.

It was horrible.
>>
File: 1384354926546.jpg (56KB, 421x571px) Image search: [Google]
1384354926546.jpg
56KB, 421x571px
In C++ is there something like the std::unordered_map that retains elements in the order they were inserted? std::map keeps them sorted alphabetically, but I want them sorted by insertion order.
>>
>>56089864
You need to read in that text as bytes, not as encoded characters. Then interpret those bytes as shift-jis encoding (I think?), and output the Unicode equivalent characters.
>>
>>56089923

Yeah, it's called a vector.
>>
File: 1468834504270.jpg (8KB, 265x265px) Image search: [Google]
1468834504270.jpg
8KB, 265x265px
>>56089745
>faster than c
>>
fuck you OP, i've been drooling over that blondie for at least an hour
>>
>>56089923

You could keep a vector of data and just use the map for indexes into the vector.

>>56089970

http://scienceblogs.com/goodmath/2006/11/02/the-c-is-efficient-language-fa/

Off the top of my head this is one place where I've see it before.
>>
>>56089982
<18
>>
>>56089992

You realize in a lot of places across the world the age of consent is somewhere between 13 and 16 right?
>>
>>56084961
Women were great during the assembly era because of their attention to detail and risk-averseness. Then a man invented the compiler (whether you count early fortran versions or not, lisp was also invented by men) , making programming more about problem solving.
>>
File: 1354816835432.jpg (87KB, 420x358px) Image search: [Google]
1354816835432.jpg
87KB, 420x358px
>>56089987
>I'm a shitty programmer therefore C is slow
WEW
>>
>>56089992
you're not helping the situation at all
>>
Could someone tell me the point of the getopt function in c?

say we have a simple program, that adds two ints

int main(int argv, char** argv) {
int a = atoi(argv[1]);
int b = atoi(argv[2]);
return a + b;
}


What advantage would getopt have over this method? I'm failing to see its purpose and I must be retarded or something because the GNU docs aren't making it clear.
>>
>>56090015

> I'm failing to acknowledge my own oppressed anger and negative emotions so I must attack others.

Anon is there something you need help getting through? Has life been hectic are you worried, scared, or angry over something that is making you attempt to take it out on others?
>>
>tfw you want to share what you're doing with /g/ but your using the wrong language, the wrong operating system, the wrong editor, the wrong ide and are doing the wrong type of project

;_;
>>
>>56089924
Hmmm... so, we want to convert whatever that is to binary??

Also, what would output the newly encoded character, then..?
>>
>>56090046
OCaml will never be faster than GCC or Clang.
>>
>>56090072
Basically your issue is character encodings.

Those characters are encoded as Shift-Jis (most likely, could be some other Japanese text encoding). You need to read in those chars as Shift-Jis and output them as Unicode (which is what Windows is expecting I assume).

In Shift-Jis, those are all valid Japanese letters, but that same binary character is just gibberish in Unicode. So you need to convert the encoding.
>>
>>56090042
It parses the command line arguments, useful for checking illegal options etc.
See
man 3 getopt


Probably useless for a small program like that
>>
>>56090072
Look at this: http://php.net/manual/en/function.mb-convert-encoding.php
>>
>>56090074

I see so you're just directly rejecting any possibility of being wrong due to preconceived beliefs.

That still doesn't explain the willingness and urge to attack others you're show casing.

Yet again anon what is the real unhealed issue you have that is causing such unnecessary aggression?
>>
>>56090110
C is the master race of all languages. OCaml is like near the absolute bottom with Python and JavaScript. Go figure.
>>
What's the difference between:
struct student { char* name, int age };

int main(void) {
struct student *ptr_student = malloc(sizeof(student) * 2);
struct student arr_student[2];
}


Aren't both arrays of structures?
>>
New thread: >>56090130
>>
>>56090124
not an argument
>>
>>56090131
dynamic vs static allocation
>>
>>56084444
This is true, but you learn how to drive to the store and pick up some groceries, and everything else along the way before you're driving a race car.
>>
>>56090138
keep crying bae
>>
File: jej.png (199KB, 467x456px) Image search: [Google]
jej.png
199KB, 467x456px
>>56084595
>jeffs blog
>poems
>>
>>56090094
That was actually he problem. Apparently, after searching like 50 things, there's a plugin for Foobar for it.

It WAS encoded as Shift-JIS, 932
Perfect, though. It works

>>56090105
Yeah, I was looking into this, but I didn't know what it was encoded as, so it was a real pain in the ass.

I THOUGHT it was something else that needed to BECOME Shift-JIS or something.

But, when I ran the text though mb_detect_encoding, it kept showing as already UTF-8, so I was only guessing at the original encoding.

If anyone's interested, the dll for it is called foo_chacon (char conversion)


Thanks everyone, though.

I'd still like to try to automate this, but the issue is: how do I detect the RIGHT character set? I'd like to try to make something that can loop all my files.
>>
>>56090185
does anyone know how to decode whatever the hell a dll is encoded in?

I'd like to take a look at this thing and see if I can actually turn it into a program.
>>
>>56090185
The problem is that those ARE all valid Unicode characters. But they are also valid Shift-JIS characters. So you wanted to pass that as a parameter to that function, rather than relying on the autodetect.
>>
>>56090221
hmmm, right.

but, like I was saying. I did NOT know what they were until I downloaded this plugin.

do you know how to get the code from a dll btw? I'd like to take a look at it, but it's compiled, I think
>>
>>56090251
You can try and decompile, but it doesn't work well, so don't bother. Less effort to redo it from scratch.
>>
>>56090262
hmmm. alright. I'll look into PHP first... if I figure it out, I could try to rewrite it in C/C++.

Might make a neat project.
>>
>>56088272
Maybe predict collisons well in advance, then check again before it occurs. Then it wont have to check so often?
>>
>>56089856
ah really? that surprises me desu
Thread posts: 330
Thread images: 43


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