[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
/dpt/ - Daily Programming Thread
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /g/ - Technology

Thread replies: 343
Thread images: 50
File: ew.jpg (100 KB, 600x338) Image search: [iqdb] [SauceNao] [Google]
ew.jpg
100 KB, 600x338
What are you working on, /dpt/?

Old thread: >>52255722
>>
first for niggers aren't people
first for traps and weebshits need to be purged
first for fuck you
first for alcoholic programmers
>>
second for lolis are the best
>>
Working on pasticode.com's live coding, gonna give it a whirl, what should I make?

https://pasticode.com/#live_165818848
>>
File: rew.png (711 KB, 1012x1088) Image search: [iqdb] [SauceNao] [Google]
rew.png
711 KB, 1012x1088
>>52261948
>first for traps and weebshits need to be purged
There's no need for this.
>>
>>52261986
Fuck off faggot. I addressed you here >>52261114
>>
File: er.jpg (25 KB, 533x300) Image search: [iqdb] [SauceNao] [Google]
er.jpg
25 KB, 533x300
>>52261993
Why are you so angry, anon?
>>
File: 1438833110357.webm (3 MB, 640x360) Image search: [iqdb] [SauceNao] [Google]
1438833110357.webm
3 MB, 640x360
>>52261986
hey.
look.
im sorry. im not i oh you replied
>>52262028
in the best mood tonight.
here. please accept this cute webm as an im sorry. a lot of shit is going on right now.
>>
>>52262048
Is the programming literate having a bad day?
>>
File: trap programmer.png (1 MB, 1702x2471) Image search: [iqdb] [SauceNao] [Google]
trap programmer.png
1 MB, 1702x2471
Daily reminder that if you don't program while dressed like a schoolgirl, you don't belong on /dpt/.
>>
File: dsfff.gif (403 KB, 640x360) Image search: [iqdb] [SauceNao] [Google]
dsfff.gif
403 KB, 640x360
What music are you listening to, /dpt/?
>>
>>52262077
Yeah, I'm not that faggot tetsumi.
more than happy to benchmark my dick on in your throat until asphyxiation takes places though.
no "no bully" required.
>>
>>52262084
I do :3
>>
>>52261903
>What are you working on, /dpt/?
>/dpt/
I like that you said /dpt/ and not /g/, I hate the global normies.
>>
>>52262095
this https://www.youtube.com/watch?v=ByPwoGTVFbY
>>
>>52262095

Not my usual fare, that's for sure:

https://www.youtube.com/watch?v=ngzC_8zqInk

I heard it while watching Peaky Blinders.
>>
>>52262134
are you at least drinking with me tonight you race traitor
>>
does anyone else miss Fūzetsu? ;_;
>>
>>52262095
https://www.youtube.com/watch?v=eogxWpgSIic
>>
>>52262095
https://www.youtube.com/playlist?list=PLLGk12CjUeW50Xt3-ObW2rqVPZaIG8zio

10/10 album btw, you're missing out if you haven't listened to it yet
>>
File: o.png (35 KB, 500x402) Image search: [iqdb] [SauceNao] [Google]
o.png
35 KB, 500x402
what could i do with my own home server, /dpt/?
>>
>>52262181
The uploader has not made this video available in your country.

ok..
>>
>>52262095
https://www.youtube.com/watch?v=CwiWJcDWq10
>>
>>52261903

Working on an HTML5 chatroom:
http://www.raskie.com/#on-notice

Please let me know what you think.
>>
File: AgaetisByrjun.jpg (134 KB, 1920x1080) Image search: [iqdb] [SauceNao] [Google]
AgaetisByrjun.jpg
134 KB, 1920x1080
>>52262198
git fucked

Album's Agaetis Byrjun if you want to find it elsewhere and try it
>>
Is youtube cucked for anyone else in chrome?

>inb4 stop using chrome
>>
>>52262219
why you hate canadia?
but alright i'll check it out.
>>
>>52262134
aww yiss arctic monkeys
>>
>>52261977
nevermind, fuck this for now
>>
>>52262186
serve
>>
>>52262201
pretty sick in my current state.
>>
>>52262210
>ignore your mam, talk to strangers
fellow northern britbong?
>>
>>52262149

No. I quit drinking.
>>
So /dpt/ I've been tweaking a script posted on /g/ to suit my needs but now I'm stuck since I don't know how to program
#!/bin/bash

read -p "Input: " password

md5_PASS=$(echo -n salt)$(echo -n $password | md5sum)
EXAMPLE_PASS=$(echo -n $md5_PASS | md5sum)
PASSWORD=$(echo -n $EXAMPLE_PASS | md5sum)

read -p "your password will be outputed in this terminal window: " -n1 -s

echo Your password is $PASSWORD


Thats the code but I want to be asked for the salt rather than having to edit the salt in the .sh file I'd also like it to split every 8 chars

example
>please input salt:
salt
>please input text:
text

your password is
12345678
12345678
etc.

can anyone help?
>>
>>52262186
anything that involves leaving your computer on 24/7 should be on your home server.(torrents/long downloads/encoding/archiving/etc)
>>
Is anyone else seeing the hashtags in quote links or have I fucked up something?
>>
>>52261903
https://github.com/Shrooms/Musique-Libre
>>
>>52262186
run up a large electricity bill
>>
>>52262301
are you serious
>>
>>52261903
Revising for my algorithms exam. Wish my professor used Python instead of Java. Thankfully we can use psuedocode.
>>
File: KzlePUG.png (134 KB, 1430x426) Image search: [iqdb] [SauceNao] [Google]
KzlePUG.png
134 KB, 1430x426
i think i'm almost done with this shit, just gotta add a pretty printer and import/export functions. can the F# CsvProvider do anything more than this basic functionality?
>>
>>52262336

Yes.
>>
>>52262355
>let _
>not let ()
It's like you don't want typechecking to help you or something!
>>
>>52262321
I'm a retard, I had my user agent set to android. :^)
>>
>>52262210
Pretty neat to be honest.
>>
I worked through SICP this semester and will be moving onto java next semester. I also want to start working on C or C++ (which ever is better learning first), how should I go about this?
>>
>>52262378
>implying that 20 line script wasn't written in 30 seconds
i even got lazy and used
let open N in
rather than writing
N.(...)
by the end of it
>>
>>52262369
why you resolution cunt
mine was to cut down on blow and drinking but not to quit. fuck. you've left me alone with these cunts now.
>>
does using auto keyword essentially make the variable "dynamically" typed? and what is the point of using it?
>>
>>52262355
>can the F# CsvProvider do anything more than this basic functionality?
What is yours doing exactly? The F# one lets you do
rows
|> Seq.iter( fun row -> printfn "%s, %s" row.Date row.Open)

kinda shit as far as i recall. Can't tell what yours is doing that much. I'm not good enough with ocaml.
>>
>>52262458
>let open N in
>keeps using N.[...] anyway
top cuck
>>
File: ew.png (272 KB, 470x624) Image search: [iqdb] [SauceNao] [Google]
ew.png
272 KB, 470x624
What do you think of my clean 4chan CSS senpai.

.ad-plea, .middlead, .bottomad, .aboveMidAd, .belowLeaderboard, #delform > hr:nth-child(7),
.absBotDisclaimer, #footer-links, #blotter, .sideArrows, body > div:nth-child(6),
body > div:nth-child(16), #delform > div:nth-child(4), .rules, body > div:nth-child(15) > div,
body > div:nth-child(15), #captchaFormPart > td:nth-child(2) > div.passNotice, body.is_catalog > div:nth-child(4),
body.is_catalog > div:nth-child(13), body.is_catalog #content > div:nth-child(14), #content > hr.desktop,
#boardNavDesktopFoot > span.boardList {
display: none !important;
}
>>
>>52262490
no. It means the type of the variable is figured out automatically by the compiler.
>>
>>52262490
No, it's type inference. One use is to save you from having to write shit like:
SuperLongName<Foo<Bar>> x = new SuperLongName<Foo<Bar>>();

Instead you just write:
auto x = new SuperLongName<Foo<Bar>>();

The type of "x" is still "SuperLongName<Foo<Bar>>".
>>
6210001000

real 4m47.803s
user 4m45.323s
sys 0m0.260s


Cut down quite a bit on my time lads
Who's the shitty programmer now faggot?
>>
>>52262561
>
>if(...) {continue;}
break;

Do you notice something here?
>>
>>52262476

It was spiralling out of control. Had nothing to do with the new year, btw.
>>
File: MD2.png (6 KB, 429x153) Image search: [iqdb] [SauceNao] [Google]
MD2.png
6 KB, 429x153
I'm working on some crypto hashing in Lua. I've already successfully recreated MD2 and now I'm getting started on SHA-2.

(I hope those hashes are right)
>>
>>52262561
still 37 times slower than c++

you're getting there anon
>>
>>52262509
yeah, basically the same idea. I was just writing ugly code lol. only issue is that the lexer requires field names to be lowercase (although past the lexing stage nothing gives a fuck) so I can't do row.Date or row.Open (which is a problem cause open is a keyword and there's no keyword/space escape for identifiers). the big pattern matches against the whole record were just there for an earlier test I was doing but I could just write it the same way as yours.
>>
>>52262605
if(b == 10) { break; }

>>52262624
Eh, I was just hoping to get under 10 minutes, so I'm satisfied
>>
>>52262618
Interesting. I would like to see how the input is processed though lua
>>
>>52262649
interesting. Yeah, I wouldn't think the F# one does anything more special than that. It's a pretty simple file format.
>>
>>52262678
not quite sure what you mean, could you elaborate a bit?
>>
>>52262607
alright. fair enough.
best of luck in your new year, gtp. faggot.
>>
>>52262310
a point in the right direction would help? i.e what things I should google
>>
>>52262561
Optimizations and a lighter CPU load (I was running a few other things before) cut it down a bit. Last post about this
6210001000

real 2m34.082s
user 2m34.100s
sys 0m0.003s
>>
>>52262660
The point of the original program was to check if any other numbers were like 6210001000, breaking after finding that 6210001000 is like 6210001000 defeats the purpose of making the program.
>>
>>52262624
open Core.Std

let () =
let start = Time.now () in
for a = 0 to 9 do
let num = Array.init 10 ~f:(function | 0 -> a | n when n = a -> 1 | _ -> 0)
and zeros = ref 0 in
for i = 0 to 9 do
for j = 1 to 9 do
num.(j) <- Array.count num ~f:((=)j)
done
done;
zeros := Array.count num ~f:((=)0);
if (num.(a) <> a) && (num.(0) = !zeros) then
for k = 0 to 9 do
printf "%d" num.(k)
done;
printf "\n%!"
done;
Printf.printf "%s\n%!" (Time.Span.to_short_string Time.(diff (now ()) start))

Direct ocaml port (not turned into functional code, which should be faster).
It takes exactly as long as the cpp program compiled with -O0, and around twice as long when compiled with any of -O1 through -O3. Didn't play with ocaml's optimization flags, though; and that's excluding the time taken for the ocaml machinery to load (which is around 4x as long as the program actually runs).
>>
File: CPP_badge.png (131 KB, 399x398) Image search: [iqdb] [SauceNao] [Google]
CPP_badge.png
131 KB, 399x398
What can you faggot tell me about this?
>>
>>52262841
Whoops, I was going off the video the original Python user posted and thought we just had to find the first 10-digit self-describing number.
>>
File: b8a.jpg (20 KB, 495x495) Image search: [iqdb] [SauceNao] [Google]
b8a.jpg
20 KB, 495x495
why would you use class?

it's logical to have public methods in top part(and everybody does it) so in class you need public: and then private:

i just use struct and have one less line to write. class is fucking stupid(plus class inheritance assess modifiers are a retarded feature and i also don't need to write them).
>>
>>52262884
Literally a scam.
>>
>>52262884
it's a scam
>>
>>52262900
I laughed!
>>
>>52262884
It's a scam, you pay $300 for a useless certificate.
>>
>>52262900
Because C++ is retarded and didn't make struct only allow POD definitions.
>>
File: 1451851649542.png (55 KB, 419x248) Image search: [iqdb] [SauceNao] [Google]
1451851649542.png
55 KB, 419x248
>>52262933
and you want pods marked... why?
>>
>>52262967
Because he's plain in the head :^)
>>
>>52262900
Object oriented programming is all about self-contained objects that communicate using messages. One object is not supposed to access the private data of another class.
>>
>>52262967
Why not? POD means you can safely do neat things, like memcpy them, or free their memory without calling a destructor.
>>
File: 1451852024959.jpg (82 KB, 700x1000) Image search: [iqdb] [SauceNao] [Google]
1451852024959.jpg
82 KB, 700x1000
>>52262981
bullshit, why would you add overhead to parent methods?

unless you're making modular system with builtin inheritance instead of composition(in which case you should shoot yourself in the head)
>>
>>52262927
>>52262905
>>52262902


How do you know this? And what will employers think of it?
>>
>>52262989
1. bad practice
2. you need special keyword for essentially an optimization?
>>
>>52263026
they'll think that you got scammed
>>
>>52263052
The optimization can be done regardless. The "struct" keyword would make sure that I know if I (or more importantly, someone else) changed something to make it non-POD, thus introducing bugs.
>>
>>52263026
>"this idiot advertises the fact that he fell for an obvious scam"
>>
>>52263026
I really hope you didn't pay $300 for a useless certificate, anon.
>>
>>52262624

Err... that would imply that C++ is executing in 8 seconds. With maximum optimizations, I can get Rust to do it in 2m39s and C to do it in 3m34s, using a naive brute force checking the numbers between 1,000,000,000 and 7,000,000,000, on a Haswell Core i5. Unless you're using an algorithmic advantage or abusing constant expressions (in which case very funny, but the increased time spent compiling should count against you), you should not be getting such low numbers.
>>
>>52263022
This is how object oriented programming is supposed to work. Object oriented programming is supposed to help in program decomposition and re-usability through object composition, inheritance and polymorphism. Breaking the rules of OOP means that you threaten the assumptions under how OOP works. If you're not interested in the rules, it's best not do object oriented programming.
>>
>>52263133
The difference is I'm not iterating through 1000000000->7000000000

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

int main()
{
vector<int> tendigit;
for(int i=0; i<10; i++){
for(int j=0; j<10; j++) tendigit.push_back(0); //treat number like substring
int zeros=0;
tendigit[0] = i; //start from low to high
tendigit[i] = 1;
for(int m=0; m<10; m++){
for(int g=1; g<10; g++){
tendigit[g] = count(tendigit.begin(), tendigit.end(), g);
}
}
zeros = count(tendigit.begin(), tendigit.end(), 0);
for(int n=0; n<10; n++){
if(tendigit[i] == i or tendigit[0] != zeros){
tendigit.clear();
}
}
for(int k=0; k<10; k++){
if(tendigit.size() > 0) cout << tendigit[k];
}
cout << endl;
tendigit.clear();
}
return 0;
}
>>
>>52262900

>public: and then private:
I do it the other way around, and I don't label the private members. So for example:

class foo {
int x;
public:
void do_something_to_x();
};


I use struct when and only when all members are expected to be public.
>>
File: 1450286006539.gif (1 MB, 640x360) Image search: [iqdb] [SauceNao] [Google]
1450286006539.gif
1 MB, 640x360
>>52263117
Haven't taken it yet nigger

>>52263131
Is it really useless? I mean it serves as proof that I know how to program,
>>
>>52263195

Then the advantage is not that you are using C++, but that you are using a different algorithm to solve it.
>>
>>52263218
Fair enough. I might try to implement his algorithm though c++ to see how long it takes.
>>
>>52263215
They're give you programming exercises to do.
>>
>>52263195

Also, why are you regularly using push_back and clear on a vector? If you know you're just going to be using 10 elements, why not simply use an array?
>>
>>52263275
To be fair it won't make a difference, since once the vector has had 10 elements, it will have the performance characteristics of an array anyways

Should initialize it to have a capacity of 10, though
>>
>>52263026
any programming certificate is useless except for java certified programmer which might give you a tiny bit of help in landing you a code monkey job or some cisco cert which might help you land a sysadmin job

besides, just google that particular one, i saw no credible website mention it
>>
>>52263275
Just habit I guess.
>>
>>52263305

clear() may force a reallocation, depending on the implementation. Moreover, use of an array allows all memory to stay on the stack.
>>
>>52263333
dem digits

what about compTIA and shit like that?
>>
>>52263380
I suppose so

Wouldn't lose anything using an array, that's for sure
>>
I'm literally retarded. I can't seem to get this method to ever equal the maxFireRate param

/**
* Returns an random double representing the guns fire rate ranging between minFireRate and maxFireRate.
*/
public double gunFireRate( int minFireRate, int maxFireRate ){
return minFireRate + (double)rng.nextInt(maxFireRate - minFireRate) + rng.nextDouble();
}


If say gunFireRate(7,13) was called it would only ever return a double between 7.0-12.9 Can't figure out a way to get both params to be inclusive.
>>
So... in some areas, Rust is managing to outperform C in both space (at least in the generated assembly for a few functions. The runtime does take up slightly more space than C++'s runtime) and execution time for me. Maybe I should spend more time learning it?
>>
any recommendations for a c/c++ static analyzer?
>>
>>52263471
Not sure what language that is in but usually random number generators go from 0 (inclusive) up to passed in value (exclusive) so all you to do is add 1 to what you pass into nextInt
>>
>>52263384
>compTIA
seems legit

https://www.reddit.com/r/CompTIA/
not that i frequent leddit but it showed up on google
>>
>>52263486
Facebook's Infer is fantastic.

Coverity is also good, but only free if your product is open source.
>>
Random question but anyone know how someone achieved this? https://www.youtube.com/watch?v=16XJBnjzMYU
>>
File: P60105-234240.jpg (2 MB, 3264x2448) Image search: [iqdb] [SauceNao] [Google]
P60105-234240.jpg
2 MB, 3264x2448
first ever program! a screensaver particle sim, followed a caveofprogramming tutorial. thanks john!
>>
File: asdadsads.png (136 KB, 1361x875) Image search: [iqdb] [SauceNao] [Google]
asdadsads.png
136 KB, 1361x875
working on a program that sends input to background windows and will (hopefully) be able to replicate mouse movement and clicks/keystrokes to each individual window
>>
>>52263817
Cool. Hopefully it's not too laggy.
>>
>>52263838
Why
>>
>>52263805
GDI?
>>
>>52263870

I'm going to play 5 copies of counter strike at once
>>
>>52263847
its bretty smooth. my next project is to recreate a tamagotchi. ive got the basic class and methods defined but i need to think about time and how that will move variables. i think ill make it high maintenance but have a babbyMode option.

then theme it as yotsuba and become the little girl
>>
>>52263486
Kill yourself you fucking wee...

Oh wait this is an actual programming question.

I say the more the merrier. You can use both the msvc analyser and the intel icc analyser to start.
>>
What are people supposed to do about giant git projects?
It seems the more commits a repo has, the longer it takes to git clone and "resolve deltas" which I assume means running through the entire history of the repo and grabbing the most current chunks that appear in the most recent branch?

gcc is over 1.4GB at this point
does git have some kind of consolidate or prune option, or are git repos designed to balloon in size forever?
What happens when mature open source projects become so unwieldy that they take hours to git clone?
>>
What is the best practice to getting the length when writing a function that creates an array in C?
>>
>All software is built on a stack of technologies, and you need to understand enough of that stack to build your app.
what did he mean by this?

can I use a heap to build my app instead?
>>
Thoughts on a programming language I'm considering making?

Instead of functions, the language relies on what I call "processes", which are very similar.
Processes primarily take Data as an input and produce data as output.

DATA -> PROCESS -> DATA


A program consists of a list of processes to sequentially run data through.
//the "succ" process adds 1 to the input, the "double" process multiplies by 2

//program:
succ double succ
//input: 1 output: 5


There is a data called unit that is denoted "." and doesn't do very much (but is essential for the type system)
Processes denoted by integer literals take unit as an input and produce that integer as an output

//program:
1
// input: . output: 1

// program:
5 double succ
// input: . output: 11


Processes can also take additional process as Arguments.
// the add(p) takes an input 'n', evaluates the process 'p' (using . as input) with output 'm', and outputs 'n + m'
// that sounds complicated but it's really intuitive

// program:
1 add(2)
// input: . output: 3

// program:
add(4) add(2)
// input: 3 output: 9


The whole point of all this process madness is lazy evaluated list comprehension.
// the process 'to(p)' takes a number 'n' as input and 'm' as the result of p, and returns and list from 'n' to 'm' inclusive

// program:
1 to(5)
// input: . output: [1,2,3,4,5]

// program:
to(10)
// input: 8 output: [8,9,10]

// the process 'map(p)' applies the process 'p' to each element of the input list

// program:
map(add(1))
// input: [1,2,3] output: [2,3,4]

// program:
1 to(3) map(to(4))
// input: . output: [[1,2,3,4], [2,3,4], [3,4]]


There are more implications, including type inference and sort of 'lambda' processes, that I haven't gone into yet
>>
>>52264284
baiting this hard
>>
>>52264284
Yeah it's called spaghetti code
>>
>>52264324
nyoro~n
>>
>>52264028
>he fell for the git meme
>>
File: yt.png (328 KB, 640x360) Image search: [iqdb] [SauceNao] [Google]
yt.png
328 KB, 640x360
Hey, autists.

Can you explain why this isn't working?

"use strict";
document.addEventListener("DOMContentLoaded", function(event) {
let dateTime = document.querySelectorAll(".thread .desktop .dateTime");
let unixTime = Math.floor(Date.now() / 1000);

for(let i = 0; i < dateTime.length; i++) {
let dataUtc = dateTime[i].getAttribute("data-utc");
let seconds = unixTime - dataUtc;
dateTime[i].textContent = "WHY WON'T THIS WORK? REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
}
});


This bit isn't working:

dateTime[i].textContent = "WHY WON'T THIS WORK? REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
>>
It's like I'm living in a Dilbert comic strip. I about lost my shit at work. There are few things as infuriating as a meeting between managers and engineers where the managers do all the talking and everything they say is wrong. Don't ask the people who designed and built the damn thing what they think, can't have that.
>>
>>52264531
>>>/g/wdg/
>>
File: ppp.jpg (90 KB, 1280x720) Image search: [iqdb] [SauceNao] [Google]
ppp.jpg
90 KB, 1280x720
>>52264573
I'm not asking that dead thread for help, I don't even know why it exists. It just seems to be one anon forcing it, most of /wdg/ belongs in /dpt/.
>>
>>52264645
Have you done any debugging?
What does "console.log(dateTime);" provide?
Also, I think 'dateTime' as a variable name for that is really misleading and confusing.
>>
>>52261903
Playing TIS-100. One of the best puzzle games ever. Are there any other games as good as this?
>>
>>52264531
Works fine for me.
>>
>>52264673
I wouldn't call it "the best", it's pretty simple but I would say it's very very challenging and I've been having a lot of fun with it too. Finished the first page and the second page is giving me a lot of trouble
>>
>>52264531
A little digging around
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
and
https://developer.mozilla.org/en-US/docs/Web/API/NodeList
They say it's not an array.
>>
>>52264698
I still have 3 left on the first page until I can get to the second page. I got a friend of mine to play so I can have something to compare to on the leaderboard. I'll see if I can get others from school to play too when the semester begins.
>>
File: imdone.gif (456 KB, 480x361) Image search: [iqdb] [SauceNao] [Google]
imdone.gif
456 KB, 480x361
Interview prepping for companies that probably won't even reply back.
>>
>>52264531
what browser are you using?
>>
File: ddd.png (10 KB, 173x494) Image search: [iqdb] [SauceNao] [Google]
ddd.png
10 KB, 173x494
>>52264660
Pic related.

>>52264691
Why isn't it working for me? REEEEEEEEE

>>52264711
Yeah, I know it's not an array, but it should still work.

>>52264792
Chrome.
>>
>>52264860
Well, it says the node-list is not live, so maybe it's just a clone and doesn't modify the DOM.
>>
>>52261903
Is it bad if I actually did have trouble with that book?
>>
>>52264946
Yeah, if you had any trouble with that book, you should give up being a programmer. You're just a code monkey and not worth much.
>>
>>52264860
It works fine for me in Firefox but not Chromium. It seems it updates the element, but does not display it.
>>
File: lisa.png (120 KB, 346x250) Image search: [iqdb] [SauceNao] [Google]
lisa.png
120 KB, 346x250
>write a bunch of C++ for ages
>one day hear about D
>write a bunch of D
>enjoy the shit out of it
>hey there's a D SFML
>follow all of the instructions for getting it to work
>it links properly and complains about a method in the example code from the website
>yay it finally worked now I'll just fix that method and compile
>change the method
>linker can't find the libraries
>change the method back
>linker can't find the libraries
>get rid of everything except the import and an empty main
>linker can't find the libraries
>try in verbose mode to see exactly where it's looking for them
>go there
>all of the libraries are there
>go back, try to compile again
>linker can't find the libraries
>go back to C++
>can't write it without cringing because it's so ugly
>go back to D

Are there instructions out there for retards like me to follow without shit like this happening? I just wasted a whole day fucking around with it
I have no particular attachment to SFML, so if there's an SDL binding that's cool
>>
>>52265005
Think I'll just stick with JQuery from now on.
>>
File: kekcat2.gif (2 MB, 250x360) Image search: [iqdb] [SauceNao] [Google]
kekcat2.gif
2 MB, 250x360
What is this data type in Python? Is it just a list with keys and values?

{'one' : 'two', 'a' : 'b'}
>>
>>52265104
Dictionary/HashTable
>>
>>52265104
Dictionary
>>
>>52265085
I am surprised browsers still suck.
>>
>>52264028
>does git have some kind of consolidate or prune option
Yes, git repack
Should run that periodically on the hosting server to create slimmer pack files (which is what is sent when yiou git clone and have to be checksummed locally).
Alternatively a basic cp/rsync of the .git folder works too as a 'clone' (but not exactly, have to setup remotes yourself) and then it's just a ormal transfer of the whole 1.4GB of data with no delta compression or checksumming (other than what rsync does).
>>
>>52263805
By hiding the controls under the mouse cursor I guess
Drawing should be a layered window
>>
File: dsfml.png (40 KB, 559x376) Image search: [iqdb] [SauceNao] [Google]
dsfml.png
40 KB, 559x376
>>52265045
In case anyone knows what I'm doing wrong
feel free to call me a retard
>>
>>52265385
Maybe you have to specify the files themselves in the path with the -L option? Also, why not use dmd or gcd?
>>
so I want to add some basic launch options to my bash script i.e
./script.sh -h
./script.sh -a
./script.sh -s
then each does different things h for help a for advanced s for simple

can anyone give me and help with this?
>>
>>52265463
http://wiki.bash-hackers.org/howto/getopts_tutorial
>>
>>52265429
I am using DMD

DMD passes a command to GCC for its linker, to ensure compatibility with object files compiled from C

this is the DMD command I was using
 dmd -I~/Documents/D/DSFML/src -L-L~/Documents/D/DSFML/lib -L-L~/Documents/D/DSFMLC/lib -L-ldsfml-graphics -L-ldsfml-window -L-ldsfml-system -L-ldsfmlc-graphics -L-ldsfmlc-window -L-ldsfmlc-system main.d -v

(anything that starts with -L is passed straight to the linker, as you can see from the linker command in the screenshot I posted)

I actually just now created a symlink to each individual library in /usr/lib/x86_64-linux-gnu/ and it apparently compiles but complains about an inability to locate something from DSFMLC so I'm gonna symlink that and try again
>>
>>52264569
Welcome to the IT industry, you'll enjoy it or bomb out at some point.
>>
>>52265104
>What is this data type in Python?
welcome to the world of dynamic typing
>>
>>52265627
wut? I don't love python, but what does this have to do with dynamic typing? It's just a dictionary, key-value pairs.
>>
>>52265648
It's a classic dynamic typing story. We are unable to determine the type at compile time, resulting in confusion.
>>
>>+++++[<++++[<++++>-]>-]<<[>+>+>+>+<<<<-]+++[>-->++>+>+<<<<-]>.>-.>.>+.
>>
>>52265675
Don't trick me into deleting system32
>>
>>52265663
It's not though. That is code was a literal, you would type it directly into the source. The confusion was the poster not knowing what a dict is.
>>
>>52265627
>>52265663
lmao you're too retarded to post here
>>
>>52265663
>We are unable to determine the type at compile time
Yes you can, considering only dictionaries use {} and key,values
>>
File: dsfml.png (7 KB, 796x622) Image search: [iqdb] [SauceNao] [Google]
dsfml.png
7 KB, 796x622
>>52265524
>>52265385
>>52265045
Okay I don't know what the fuck I changed but it works now

this example from the website is fucking terrifying
>>
>>52265663
>compile time
>python
>>
>>52265663
I hate dynamic typing as much as the next C programmer, but you're a fucking retard
>>
>>52265805
this
>>
File: seven.png (457 KB, 647x1000) Image search: [iqdb] [SauceNao] [Google]
seven.png
457 KB, 647x1000
Quick, someone recommend an editor with good D support!
>>
>>52262618
>I've already successfully recreated MD2
>(I hope those hashes are right)

Wow write some unit tests nigger.
>>
>>52265927
Vim
>>
>>52263951

lol
>>
>>52265675
JUST
>>
Ask your beloved programming literate anything.

>>52265137
a dictionary and a hashtable is not the same thing.
>>
Too much pressure on the job.
Too many hours sitting next to my boss.
Too manty personal problems.
>>
>>52266071
what is the difference between a dictionary and a hashtable?
>>
>>52266087
Dictionaries don't offer thread safety
Dictionaries don't let you access variables that aren't there, whereas hashtables will return null instead of an error
>>
File: 1408310349282.jpg (48 KB, 798x450) Image search: [iqdb] [SauceNao] [Google]
1408310349282.jpg
48 KB, 798x450
>>52266087
a dictionary is just an associative array where the key could be anything.
a hash table is an associative array where the key is a hash.

for example, the dictionary
{"a": 1, "b": 2}
is not necessary implemented as a hash table but could do the association with a plain comparison of the strings.
>>
What's the best way to manage gamestates in c++? I'm using SFML if context matters. In particular, I'm wondering how is my state manager meant to know when a certain state wants to change state? I'm using a vector to hold all my states so I can pause states and overlay menus, which makes it even more complicated.

I probably need to study how other people do it a bit more desu
>>
>>52265927
vi
>>
>>52266087
Dictionary is an abstract type which maps keys to values, it could be implemented with a hash table, but there are plenty of other options as well like bst, red-black, lists, tries, or just a plain old array.
>>
>>52266169
2 seconds in Google for "game state stack"
http://gamedev.stackexchange.com/questions/13244/game-state-management-techniques
>>
>>52265675
+++++[>++++<-]>[<++++>-]<[>+>+<<-]+++[>-->+<<-]>.>++.--.+.

This one's shorter
>>
File: 1451554569278.jpg (93 KB, 720x960) Image search: [iqdb] [SauceNao] [Google]
1451554569278.jpg
93 KB, 720x960
im cleaning up my chan thread searcher, i replaced a disgusting block of text with a nice regular expression after learning that they existed
 acceptedStrings = [sTerm, sTerm.upper(), sTerm.lower(), sTerm.title(),
sTerm1, sTerm1.upper(), sTerm1.lower(), sTerm1.title(),
sTerm2, sTerm2.upper(), sTerm2.lower(), sTerm2.title(),
sTerm3, sTerm3.upper(), sTerm3.lower(), sTerm3.title()]

with
'(^|[^\w])'+sTerm+'([^\w]|$)'

feels good to be learning
>>
>>52261948
>first for alcoholic programmers

Beer is a legitimate breakfast.
>>
File: tim.png (54 KB, 644x454) Image search: [iqdb] [SauceNao] [Google]
tim.png
54 KB, 644x454
he has spoken
amen
>>
>>52266431
>C++
DEEEEEEEEEEEEEEEEEEEEEE
>>
>>52266480
I'm tempted to try it
should I?
>>
>>52261903
Hey guys I want to get into programming and I was wondering how to go about it. Came here for a sticky but there isn't one so I'll just ask. My aim is to go into app andsoftware development.
1. Which programming language do I learn first?
2. Which online resource do I learn it from?
I have basic knowledge in c++ and java which I learned in school.
>>
>>52266509
Not if you ever want to write C++ again

you literally won't be able to after you witness first hand how much more elegant D is

one thing
GDC may compile generally (~0-5%) faster executables, but any help you find online will be using DMD, because it's the reference compiler
If you happen to know the GCC toolset inside out and will never need help, use GDC, otherwise don't even consider it
>>
>>52266431
Better start porting the millions of SLOC in the SDK to C++ :DDDDDDDDDDDDDDDd
>>
>>52266510
1. C - if you learn this, you will end up with rudimentary - decent knowledge of almost every major language in commercial use
2. You can pretty much google any problem you need, since it's such a widely used language you'll find help for anything

I find the best way to learn a programming language is to start from hello world and write progressively slightly more complicated things as you go
This order should help you
>Hello World
>String reverser (take an input string, and output its reverse)
>Averager (take two input numbers, and output the average)
>Prime checker (take an input number, and output whether or not it's prime)
>Fibonacci (take an input number n, and output the nth fibonacci number)
>Fibonacci 2 (take an input number n, and output the 1st to nth fibonacci numbers - you should write a non-recursive algorithm for this)
>Prime finder (take an input number, and output all primes lower than that number) - it shouldn't take you more than a minute to do up to 1,000,000. If it does, consider looking up a more efficient algorithm
after this you'll know enough to be able to branch out into what sort of software you want to write
Maybe write a simple pen-and-paper game Tic-Tac-Toe or Bulls and Cows if you're still not 100% sure you're familiar with the language

warning about 1: absolutely do not learn a language with dynamic typing or overly syntactically significant whitespace first (e.g. python, which will not work if you indent 'wrong')
these will probably teach you bad habits and make it harder to move to a statically typed, bracketed language like C, C++ or Java
>>
Riddle me this, when do you save something to a file and when do you cache them in memory?
>>
>>52266885
Save to file: If the data is really large and would eat up way too much memory, and you don't need to have fast access to it. Also for things you want to persist when your application isn't running.
>>
>>52266885
File: permanent store, too large to hold in memory.
>>
>>52266510
Litterally any C-like language that has widespread usage is a good choice to learn. C++, C#, Java etc. It doesn't matter which one. If you are looking to learn object oriented programming, which 90%+ of professional programmers use, you will want to stay away from C itself though.

You can find heaps of tutorials for all these languages online, though I would recommend finding a book (pdf), rather than some shitty youtube video etc. Also, be wary of the vast number of shitty C++ books if you try and learn it.
>>
>>52266953
>>52266961

Thanks fellas, I'm wondering because my 4chan android browser is getting there soon where I have to think about that.

I'm thinking of threads that one is browsing. I don't really now how android handles minized apps so I should probably look into that.
>>
How easy is a CS degree going to be for me?
Going to do a CS / Computer Engineering double degree. If I don't like one of them I'm going to switch one of them out for a maths degree
>>
>>52267015
I recommend using https://bitbucket.org/qbusict/cupboard for storing data. It's a wrapper around SQLite3.
>>
>>52267051
Thanks man.
>>
>>52261903
twitter dox extractor to get myself used to regexes and python in general. other than that some shitty game
>>
>>52267049
Doing CS atm, pretty easy. Sorta cruising through without really trying. No idea about computer engineering though. Of course, it completely depends on where you live/where you go.
>>
>>52267085
Computer Engineering is the one that I'll probably need to try pretty hard on. Has a bunch of maths and physics stuff but a lot of CS stuff seems pretty straightforward
>>
>>52267068
Are you floens?
>>
>>52267007
Thanks man. Is code academy good for learning?
>>52266755
Thank you. I've done all that with java already in 10th so I'll go a bit deeper now into c++
>>
>>52267089
I am doing CS because it ISN'T maths or physics. CS feels like a hobby, I can enjoy learning things. Maths/Physics both crush me though. Maybe I am just dumb, but I don't have any passion for them, so now I just stay away.
>>
>>52267109
I like maths and am pretty good at it. Not so much physics but I did it in high school and can tolerate it. Would probably rather do pure maths than one mixed with physics but computer engineering might help me out more. Will switch if I don't like it.
CS I'll probably keep no matter what. I'm good with algorithms and stuff so I should be pretty good hopefully.
>>
>>52267103
Ehhh I wouldn't bother with code academy. The only "real" languages they offer are Python and Java. I haven't tried their Java one, but their Python is pretty piss poor. Just look online for a respected book on learning the language, and find a .pdf. More indepth than code academy, which if you already program to a basic level is what you need.

Java: A beginner's Guide (written by oracle themselves) is a good overview of the basics of Java

C++ Primer (NOT Primer Plus) has a good reputation for C++

Both these are 10x better than some shitty online interactive tutorial or video. Go download VS2015 community or Intellij IDEA, and just start working through the topics.
>>
File: umaruwh.jpg (305 KB, 1920x1080) Image search: [iqdb] [SauceNao] [Google]
umaruwh.jpg
305 KB, 1920x1080
>>52266510
>1. Which programming language do I learn first?
i have a preference for scheme but having a good tutorial is more important than the language (except C, avoid C at any cost).

:: Structure and Interpretation of Computer Programs
http://sarabander.github.io/sicp/
http://paste.lisp.org/display/151208/raw

:: How to Design Programs
http://htdp.org/
https://www.edx.org/xseries/systematic-program-design-0

:: Concepts, Techniques, and Models of Computer Programming
not free

:: Composing Programs
http://composingprograms.com/

:: CS for All
http://www.cs.hmc.edu/csforall/
https://www.edx.org/course/cs-all-introduction-computer-science-harveymuddx-cs005x

:: Program Arcade Games With Python And Pygame
http://programarcadegames.com/
>>
Would someone be kind enough to program an extension that would filter all liberal websites and hillary clinton?
>>
>>52267194
Don't use an extension, use ya hosts file. Block the ip's directly.
>>
>>52261903

> https://github.com/Arkq/windy
It is a weather indicator/notification for simplistic desktop managers (mostly tested on fluxbox). It is still in a development phase (right now a conceptual development), but the prototype is available right now. Feel free to test, and let me know it such a project is worth spending few hours/days more.
>>
>>52267103
Code academy is a waste of time in my opinion, it teaches very very little and takes a long time to do so.
>>
I have a large CSV file of movie data. Each line has a unique ID but some contains duplicate data. Does anyone know how to remove these duplicate lines? Obviously the unique ID prevents me from doing a simple find and replace. Example of file:

ID,movie_title,year
1,toy story,1995
2,jumanji,1995
[...]
6676,toy story,1995
6677,jumanji,1995
>>
>>52267179
To be honest I prefer the CS50 course on edX. It teaches both C and some basics of Computer Science in a really intuitive way and isn't a dry pain in the ass like some other CS courses on there.
>>
File: tiffany dp 3.png (64 KB, 200x200) Image search: [iqdb] [SauceNao] [Google]
tiffany dp 3.png
64 KB, 200x200
What are some good books for learning Java?
>>
>>52267378
it's shit course made for rich retards (hurr durr look my dog wearing google glass, we are so cool here at Harvard).
>>
>>52267428
I'm not even close to rich and I still enjoyed it. Maybe you should stop being so bitter about everything and actually try it, it's fun.
>>
>>52267412
head first java
test driven development
effective java
the pragmatic programmer
gang of four
clean code

in that order
>>
>>52267368
R ftw

x=read.csv('file.csv')
x=x[!duplicated(x[,2]),]
>>
>>52267303
>>52267174
Oh thanks. So good ol' books as always.
>>
>>52267412
The best one would have to be The Application of the Java Language by D. Ont-Lerndžava
>>
>>52267461
thanks, but how about something in python or bash... even ruby?
>>
>>52267540
looks like the sort utility has a -u (unique) option built in


sort -u -t, -k2,2 test.txt 


-t, to use comma
-u for uniq
-k2,2 to sort only second column

normally i use sort piped to uniq so that's pretty cool
>>
>>52267540
In meme snake using a dictionary:

# coding=utf-8
import csv
dic = dict()
with open("input.csv", newline='') as f:
reader = csv.reader(f)
header = (next(reader))
for row in reader:
dic[row[1]] = (row[0], row[2])

with open("output.csv", "w", newline='') as f:
writer = csv.writer(f)
writer.writerow(header)
for key in dic:
writer.writerow([dic[key][0], key, dic[key][1]])
>>
File: tiffany dp 2.png (63 KB, 200x200) Image search: [iqdb] [SauceNao] [Google]
tiffany dp 2.png
63 KB, 200x200
>>52267460
>>52267487
Thanks. Will check them out.
>>
>>52267540
check pandas for Python.
>>
>>52267891
should learn groovy or scala too. java just is not very "expressive" (more lines of code to say same thing)
>>
>>52261948
>first for alcoholic programmers
this

MAKE PROGRAMMING FUN AGAIN
>>
>>52266331

Oh man, I just woke up and I'd kill for breakfast beer.
>>
https://play.golang.org/p/4AySD9qKZ5
>>
>>52268036
you can make programming always be fun with just a little bit of mathematical logic
>>
>>52267930
True. But I am doing thia because of my uni courses. They are using Java as the introductory language(Python for the rest who studies Mathematics and sciences).
Focusing on java and c for now, before learning some functional language.
>>
>>52268085
>programming
>"""""""fun"""""""
>>
File: 4kultra.jpg (411 KB, 3840x2160) Image search: [iqdb] [SauceNao] [Google]
4kultra.jpg
411 KB, 3840x2160
>mfw someone calls themselves a software developer and doesn't use ARCH Linux
>>
>>52263838
>checkConfig
Why do you need ret there in the first place? Just make it return false inside the if, and true after the for loop. And you don't need temp and asciiValue there either.
>>
>>52268068
>https://play.golang.org/p/4AySD9qKZ5
import (
"fmt"
"math/rand"
"time"
)

I like that but I don't like how you still need to use " to enclose the imports.
const (
delay = 250
balls = 5
)

I like that you can define multiple consts too but what type are they?
type player struct {
name string
in chan int
out chan bool
}

>type
Why the fuck does this shit use { instead of ( like defining imports and consts?
>in chan int
Are there members in and chan that are type int or is there member in that is type chan int?

Fucking retarded language.
>>
What resources should I look at for game dev and general programming concepts?
Sure I've learnt basics and such on some languages and have basic functional OOP skills but a lot of the time I feel like I'm doing stuff really dirty or wrong
>>
File: 1451860834645.jpg (32 KB, 428x510) Image search: [iqdb] [SauceNao] [Google]
1451860834645.jpg
32 KB, 428x510
>>52268111
>MFW someone calls himself software developer because he uses Arch Linux
>>
int* foo(size_t &size)
{
*size = /* some function to calculate size */
int *bar = malloc(sizeof (int) * *size);
/* assign values to bar */
return bar;
}


Is this idiomatic C?
>>
>>52268196
>I like that but I don't like how you still need to use " to enclose the imports.
Trueish, though some IDE's might shit themselves if you don't make it strings.
>I like that you can define multiple consts too but what type are they?
These consts default to ints. You can also explicitly tell them what they are like so:
delay = uint32(250)
.
>Why the fuck does this shit use { instead of ( like defining imports and consts?
It's a data structure senpai. It's a container of things.
>Are there members in and chan that are type int or is there member in that is type chan int?
in chan int
is a channel that sends/receives ints.
TL;DR you're retarded.
>>
>>52268333
> &size
>>
>>52268333
do it in a macro
>>
>>52268225
assuming you're writing an engine or something to that effect (if not you should go to vg/agdg/)

Don't look at anything specifically aimed at game dev without going through general concepts first, it's not going to help you at all to start with

the most important skill you need is the ability to look at a big problem that you can't wrap your head around first, then define it, break it down and figure out each little bit that you need to do before writing a single line of code - you can't really learn this from a book but just think about it while you learn. Make a point out of drawing lots of diagrams before you write your code. They don't have to be a specific format of diagram - you can learn them later, just draw something that you understand

then you need to learn good OOP practice in C++. Find a good book on it and sit down with it for a week. Make sure you get one with exercises, and actually write and compile them yourself (do not skip this or you will learn nothing, I guarantee you)

then you need to get a good book that covers the whole topic of game engine architecture. I recommend 'Game Engine Architecture' by Jason Gregory. It uses C++, and so does 95% of the industry, so it's good to know it
Read it cover to cover and don't think you can skip any of it
You'll hopefully find that a lot of the diagrams you drew tend to resemble the diagrams used in this book and others. They're not like that arbitrarily, and they tend to be the ones most people come up with naturally - they just have a lot of names and details that might put you off at first

if you don't know C++ already I could probably give you some more advice specific to that, if you want
>>
C++ newfriend reporting in.
I'm looking at branch statements and loops now.
I got "if - else" statements and "while" loops, but the "for" loop still eludes me. I got that basically the second clause (conditional) in a for loop is the same as the condition for a while loop, but I don't get what the other two clauses (initialization and increment) are for.
Could someone lend me a hand?

Also I suppose I should postpone bitwise shit until I finally understand binary.
>>
>>52268409
Thanks. C++ is what I'm trying to write games in. And yeah it's mainly engine stuff I was wondering about, basically how to keep everything expandable and modular and clean. I'll definitely have a look at the stuff you said.
>>
>>52268409
Shit it's 11pm on wednesday here so I'm going to go to bed

basically the meat of my C++ advice is
learn it right from the metal, so to speak
learn what your program does with the code you write. Learn what it compiles to. You don't have to learn full assembly but you do have to know how data types (ints, chars, strings, longs, arrays etc) are stored in memory. Structs too. Also learn about the heap and the stack - any good book should cover it so look out for the terms

this will make it so much easier to follow pointers and references, which is about where 90% of new C++ programmers switch off and go to java (bad move)
>>
>>52268424

int x = 0;

while( x < 10 )
{
// do a thing
x = x + 1
}


for(int x = 0; x < 10; x = x + 1)
{
// do a thing
}


That's it.
>>
File: 7TmJrqf.png (17 KB, 371x751) Image search: [iqdb] [SauceNao] [Google]
7TmJrqf.png
17 KB, 371x751
>>52267368
>>52267540
You ready for some motherfucking ENTERPRISE™?

Buy a server from AWS and purchase licensing for Windows Server 2016 and SQL Server 2016

Do initial configuration and setup for both the server and the instance of the SQL Server database

Use Visual Studio's database ETL functionality to extract the CSV file as a table object

Develop a properly normalized database for any additional movie data you'll need in the future, such as actors, the actors' biographies, more tables for their family and what magazines they may appear in.

Set up a VPN tunnel to your AWS server

Load your data into your movie tables where necessary

Run the following SQL statement in SSMS while connected to your remote database:
DELETE FROM scratch 
WHERE ID NOT IN (SELECT MIN(ID)
FROM scratch
GROUP BY movie_title);
>>
>>52268428
No problem

one last thing to remember after you finish game engine architecture
Don't expect your code to show you gameplay right away, or even soon after you start writing it. Gameplay should be basically the last thing you see. You should learn not to rely on it for affirmation while you're still writing the engine, otherwise you'll end up with one 5% completed engine where you move a character sprite around a blue screen and then give up because everything else seems like an insurmountable slog

Your first project should probably be something super simple, like a platformer with a command line interface and one single hard coded level, then you can expand it by adding level loading from files and a level editor, stuff like that

whatever you do, do not try and write an RPG
>>
>>52268424
It's good if you want to do something a certain number of times
//execute code 5 times
for (int i = 0; i < 5; i++) {
//code
}
>>
File: 5ejvJ7d.png (30 KB, 1236x308) Image search: [iqdb] [SauceNao] [Google]
5ejvJ7d.png
30 KB, 1236x308
>>52268482
This post brought to you by a bored DBA.
>>
File: 1388859307136.jpg (556 KB, 2048x1367) Image search: [iqdb] [SauceNao] [Google]
1388859307136.jpg
556 KB, 2048x1367
>>52268468
Ooooooh. So "for" is basically a more convenient way to write a loop. you set an integer variable (I assume it works with any kind of numeric variable, except maybe float and double, but I still have to go into detail about them), set the condition, then increment the variable.
Got it.
Thanks.
>>
printf("lmao\n");
fseek(stdout, -5, SEEK_CUR);
printf("ayy ");
fseek(stdout, 5, SEEK_CUR);

Is stuff like this legal?
>>
did java all year at uni and thinking of learning ruby or python over the break. i'm thinking ruby, seems easier to develop in.
>>
File: apache.jpg (57 KB, 640x480) Image search: [iqdb] [SauceNao] [Google]
apache.jpg
57 KB, 640x480
I have been troubleshooting a problem and it has brought me to the Apache RewriteLog which I am pretty unfamiliar with.
What does
"init rewrite engine with requested uri"
and
"pass through"
indicate in a Apache Rewrite log file?

That is all that is happening in the log, it doesn't go any deeper into my actual rewrite rules and i am not sure why.
>>
>>52268564
>I assume it works with any kind of numeric variable

It actually works with just about anything, but they're usually numerically based.

>So "for" is basically a more convenient way to write a loop.

Yep.
>>
>>52266755
>C
>Averager (take two input numbers, and output the average)
It's literally impossible to average 3 ints in C.
>>
>>52268684
>It's literally impossible to average 3 ints in C.

avg(a, avg(b, c))
>>
>>52262095
David Bowie, Andrew Jackson Jihad & The Mountain Goats. It's pretty nice
>>
Any idea where I can find really shit code or funny related programing stuff ?

Except for r/ProgrammerHumor
>>
>>52268690
Incorrect. That's (a+((b+c)/2))/2 = a/2 + b/4 + c/4 != a/3 + b/3 + c/3 except in degenerate cases. You want
((a+b)/2)/3 + c/3 + (((a+b)/2%3)+(c%3)>3).
>>
>>52268765
http://www.gnu.org/fun/humor.en.html
>>
>>52268765
r/programming
g/dpt
>>
>>52268797
Is r/programming good or is it full of /wdg/?
>>
>>52261903
Ika-chan is so cute
>>
>>52268825
It's Reddit, what do you think
>>
File: 1449883916015.jpg (46 KB, 500x324) Image search: [iqdb] [SauceNao] [Google]
1449883916015.jpg
46 KB, 500x324
>>52268782

Fair dinkum. Evidently I wasn't paying attention and/or failed mathematics.
>>
>>52268370
What if assigning values to the array is non-trivial?
>>
>>52268825
It's beyond shit, and due to reddit's hugbox nature, nobody is allowed to improve, so it's a great repository of hilariously bad code and threads.
>>
>>52268581
Usually, stdout is not seekable.
>>
>>52268424
Binary is actually really simple
To get a base 10 number, for example a random number:
323
Start writing 2^x backwards starting with the number that doesn't go over 323

256 128 64 32 16 8 4 2 1

Now just add the numbers to get 323.
We know 256 goes into it, but that plus 128 would go over. The next number, 64, won't. Adding 256 and 64 equals 320. We need 3 more, which can be reached with 2 and 1. So the numbers we added are 256, 64, 2, and 1. So in binary it'd be 101000011
>>
>>52268836
>>52268865
The first items I clicked were articles written by hipsters using some JS trash library. The comment system is YT tier retarded. Like I expected from Reddit.
The only place where I've seen quality discussions are on mailing lists.
>>
How to average three ints in RPL.

« + + 3 / 0 RND
»


This code is under GPL 3.
>>
>>52262095
https://www.youtube.com/watch?v=OQz5tWzVQiA
>>
>>52262095
animu music.
>>
>>52268926
Cont.
Any other baseis reached in binary by splitting shit up. Like octal for example is base 8. You can use the log base 2 equation to find how many bits you need to split. log2 (8) = 3 means you need 3 bits for each number. Three bits arranges into

4 2 1

So for a number like 168 the binary would be

001 110 111

Which put together is 1110111

The most useful application of this is in base 16, or hexadecimal.
>>
>>52266755
About the Averager, wasn't it found out that /g/ couldn't do that and it actually turned into a meme?
>>
>>52268999
Oh whoops I meant 167... 168 doesn't exist lol
>>
>>52268999
Here's how I was taught how to convert from decimal to binary.

Take a number and divide it by 2. Write down the remainder (it will be either zero or one). Continue until you get down to 1, and of course the remainder for that one will be one. Then you write the numbers backwards, and you've got the binary representation.
>>
>>52269140
It works for all radix.
>>
>>52268684
static inline int sign(int x)
{
return (x > 0) - (x < 0);
}

int average(int n, ...)
{
va_list args;
int avg = 0;
int odd[2] = {0, 0};
int zeros = 0;

va_start(args, n);

for (int i = 0; i < n; ++i) {
int val = va_arg(args, int);

if (val == 0) {
++zeros;
continue;
}

avg += val / n;

if (val % n != 0)
++odd[val < 0];
}

va_end(args);

avg += odd[0] / 2 - odd[1] / 2;

if (n % 2 != 0)
avg += zeros / 2 * sign(avg);

return avg;
}
>>
>Converting cpp code to c
>The cpp code is using vectors
>get out my stack functions that have push and pop
>now have insanely easy to read code that works like a cpp vector
>>
>>52269150
No.
#define sign (x) ((x) == 0 ? 0 : (x) / abs (x))
>>
>>52269140
You can do it either way. I prefer the other method just because it's easier to remember (for me)
>>
>>52269175
>macro
preprocessor is unsafe and should be avoided at any cost.
>>
>>52269199
No it is not unsafe. It's just a dangerous tool that must be used only by skilled developers.
>>
>>52269020
It's actually not even just /g/, I checked recently and nobody seems to know how to do it correctly.
>>
>>52269204
The only thing the preprocessor system does is help obfuscate the shit out of code. See: any decently sized C codebase.
>>
>>52269175
>division

It's shit.
>>
>>52269217
It seems that the decent way to do it is:
(a/2)+(b/2)+(a&b&1)

but sometimes it gives the ceiling for negatives.
>>
>>52269199
>unsafe

http://conal.net/blog/posts/the-c-language-is-purely-functional
>>
New thread time
>>
>>52269310
not for 15 more posts
>>
>>52269346
This is /dpt/ mate. Anything after 250 is fair game.
>>
Sorry for the shitposting but here's a post for the new thread.
>>
>>52269357
it is and has been 310

if you post at 250 you're a fag
>>
>>52269199
>Not using #defines for constants
>>
>>52264299
Looks like you're thinking of function composition. Most functional languages have a built-in composition operator, eg "comp" in clojure or "." In Haskell.
>>
>>52269373
>you're a fag

Most of /dpt/ is gay.
>>
>>52269239
The correct way is with the explicit if.
>>
>>52269401
fag is not the same as actualfag
>>
int average(int a, int b) {
return ((long long)a + (long long)b) / 2;
}
>>
>>52269423
Why do you need long twice?
>>
>>52269248
This isn't about C being purely functional (which it isn't, not even remotely), it's about proving some retard on twitter's logic, when calling scala a not-functional language, is wrong.
>>
>>52269434
long long is the largest integer type in C
>>
>>52269423
0/10 you're fired.
>>
>>52269423
why not a/2 + b/2?
>>
>>52269401
Nothing gay about cross-dressing grils.
>>
>>52269441
INT_MAX * 2 is smaller than one long.
>>
>>52265935
no thanks
I already tested it with the empty string and some other stuff, I just never tested those specific strings
>>
>>52269419
The logic for averaging positive ints is that if one is even and the other is odd, you add 0.5. If they are both odd, you add 1. It's probably similiar for negatives.
That's how I was doing it before, I don't know what way you mean.
>>
>>52269480
No shit
>>
>>52269454
Nobody said it had to be 100% portable.

>>52269459
Why would you? It's more expensive.
>>
>>52269494
Then you don't need two longs because the value will never exceed one long, fuckwit.
>>
>>52269480
What machine are you running? On mine long and int are both 4 bytes.
>>
>>52269423
Typecasting long long is literally pointless
>>
>>52269204
it is, for example in your example, if you do

#define sign (x) ((x) == 0 ? 0 : (x) / abs (x))

int a = 1;

sign(++a);


it will expand to
((++a) == 0 ? 0 : (++a) / abs (++a))


which would have not been the case with an inline function.

well, you have learn something today at least, tard.
>>
>>52269503
Post benchmark.
>>
It seems the research field of averaging ints has not reached its final conclusion.
>>
>>52269533
Yes but the decimal values differ
>>
>>52269575
>>
>>52269503
Portability is the least of the issues of your implementation.
-You're doubling (or more) the memory usage
-You're casing a long long to an int, using even more unnecessary memory, and unsafely returning the result (even though we know by construction it is correct)
-You have no guarantee that int and long long aren't the same size, so you have no guarantee that you're not overflowing.
>>
>>52268196
>I like that you can define multiple consts too but what type are they?
they are typeless and have very good precision, their type depends on the context they are used in, that's one of the huge advantages of consts in go

>Why the fuck does this shit use { instead of ( like defining imports and consts?
struct { something } is a literal, const ( something ) isn't
type foo struct {} just means that you are aliasing an anonymous struct defined by a struct literal with a name, which means that the anonymous type becomes a named type

>Are there members in and chan that are type int or is there member in that is type chan int?
multiple members are seperated by comma, so whatever you mean would be in, chan int
in chan int is the builtin equivalent for in chan<int> in other langs
>>
>>52269503
>It's more expensive.
Isn't long long arithmetic more expensive than int arithmetic?
>>
NEW THREAD

>>52269646
>>52269646
>>52269646
>>52269646
>>52269646
>>
>>52269635
Yes. At least twice as expensive.
>>
>>52269459
>why not a/2 + b/2?
average(1,1) = 0
>>
>>52269718
./lol gay
*(()((())(()(()))))*()*()*(())*(())*(())*(())
Meme: 45
Total: 214
Total meme percent: 95.421%
>>
I posted a couple of days ago asking why my Project Euler solution in C wasn't working. Well, not I'm back with another question, please help my scrub ass. I'm on problem 13.

#include <stdio.h>
#define LIMIT 1000000

int getcollatz(int index);

main()
{
int i, c, maxindex = 0, maxchain = 0;

for (i = 2; i < LIMIT; ++i)
{
if(getcollatz(i) > maxchain);
{
maxchain = getcollatz(i);
maxindex = i;
}
}

printf("%d\n", maxindex);
return 0;
}

int getcollatz(int index)
{
long step = index;
int count = 0;

while(step != 1)
{
if (step % 2 == 0)
{
step = step / 2;
++count;
}
else
{
step = (3 * step) + 1;
++count;
}
}

return count;
}


This is returning 999999, and apparently the 'if' statement in main() is ALWAYS taken to be true, because when I add 'printf("%d\n", i)' to the 'if' statement in main, it prints out every number from 1 to 999999. What the fuck am I doing wrong? I already checked the values of getcollatz(), they come out fine, and they're not always larger than previous evaluations of the function, so why the fuck is the 'if' statement always considering the condition true?

If I change the limit to, say, 50, the answer it spits out is 49, and if I put in 100 it'll spit out 99 and so on.

This isn't so much a 'do my problem' thing as an 'help me understand why what I'm doing wrong because I don't get it' thing. Thank you for at least taking the time to read this ~
>>
>>52262095
https://youtu.be/Igrx-5seCG8
>>
>>52269545
It's not my problem if you call a macro with ++a. It's yours.
>>
>>52270040
cmen_logic.jpg
>>
>>52262310
Install gentoo
>>
>>52269770
There's a semicolon after the if statement.
>>
>>52270475
Oh, for fucks sake...

Thanks.
>>
>>52270877
It's often the simplest things that are easiest to miss. No prob
>>
>>52267487
Don't worry anon, I got it
>>
I am writing my first C program and am completely stumped, why can't I multiply two floating points??? pic related
>>
>>52271207
you are not multiplying floats
a[8] is an array, or rather a pointer to the first element of that array
you are trying to multiply pointers to floats
>>
>>52271241
I'm not quite to the point of understanding pointers fully. I could just use ints but then that would limit the functionality of the program.
>>
File: ohshitnigger.jpg (122 KB, 1366x768) Image search: [iqdb] [SauceNao] [Google]
ohshitnigger.jpg
122 KB, 1366x768
was i close?
Thread replies: 343
Thread images: 50
Thread DB ID: 367848



[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

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 shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at wtabusse@gmail.com with the post's information.