[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: 320
Thread images: 19

File: himegoto considered harmful.png (1MB, 1000x1400px) Image search: [Google]
himegoto considered harmful.png
1MB, 1000x1400px
What are you working on, /g/?


Previous Thread: >>59034724
>>
>Step 1
>write down algorithm
//read values
//make a function to change values
//return it to a vector
//find the largest
//return answer

>Step 2
>Implement those algorithms
//read values
>(code)
//make a function to change values
>(code)
//return it to a vector
>(code)
//find the largest
>(code)

Is it a valid style?
>>
before I go balls deep into learning a language, can one of you tell me what is worth learning and what isn't? something that is well payed and no Pajeet shit
>>
File: 1431432030106.jpg (13KB, 228x238px) Image search: [Google]
1431432030106.jpg
13KB, 228x238px
>>59040172
Trap posters are the worst posters in these threads.
Delete your stupid fag image.
>>
>>59040201
>something that is well payed
>payed
>"pajeet"
>I want to program but what language will pay me money?
I don't think you have a bright future, how upi about start flipping burgers?
>>
>>59040223
>upi
you*
>>
>>59040201

im in the same boat dude

just start with C ... only choice you have

do CS50 if you need Harvard(tm) , or just watch thenewboston's C Tutorial Series .. use codeblocks and just code along.

He is a great tutor.
>>
>>59040238
This. C is a well suited beginners' language
>>
>>59040198
It's what I do every time.
>>
>>59040172
Is anyone else doing >>59038891?

I'm trying to learn matrix multiplication to do gauss jordan elimination, but the row additions seem arbitrary, can I not touch any of the later rows without adding something from the previous ones?
>>
So I'm learning JavaScript and I'm trying to get a series of prompt windows to open and then perform actions afterwards
function myFunct (){
var x = prompt("Enter length");

if(x === 1)
do x;
if( x === null;
otherFunct();

myFunct();
}


My issue is that the actions won't happen all the prompts have happened. How do I fix this.
>>
>>59040238
>or just watch thenewboston's C Tutorial Series
>Learning to program from YouTube
Not to mention, his C programming videos are pretty shit.
>>
>>59040198
No, you should start by first designing your data structures. Then, define the operations on them (functions). Now the algorithm should be easy.
>>
>>59040267
oooo | o x o x
xxxx | o x o x
oooo | o x o x
xxxx | o x o x
>>
>>59040267
>gauss jordan elimination
might as well create an AI for that. Just follow the Cramer's rule
>>
>>59040281
I see you are a fan of Java (tm).
>>
>>59040201
Do you have a plan for how youll score that well paying job after you learn your shitty language?
>>
>>59040238
yeah I'd rather buy a good book, none of that youtube or "for dummies" books
Just need to commit to a language, I think I'll go with python or C
>>
File: 1448747924339.jpg (189KB, 624x584px) Image search: [Google]
1448747924339.jpg
189KB, 624x584px
Write an algorithm that finds the mode of an int array of any length.
>>
>>59040291
I see you are a Moron (c)
>>
>>59040302
1) do a project
2) show to employer
3) profit
>>
>>59040305
>/g/ cant even average two ints
>expects us to average an entire array
>>
>>59040321
Don't worry, it isn't the arithmetic average, so it's actually possible
>>
File: 1421367587836.jpg (44KB, 681x496px) Image search: [Google]
1421367587836.jpg
44KB, 681x496px
>>59040321
>mode
>average entire array
>>
>>59040321
>expects us to average an entire array
But I've posted by C solution to that many times.
Also, why the hell would you refer to 'mode' as average?
>>
when doing operator overloading
am I supposed to define each operator both ways?
eg.
template<typename T, std::enable_if_t<std::is_integral<T>::value, bool> = { }> constexpr bool operator==(const my_type& lhs, const T& rhs) { return /* comparison */; }
template<typename T, std::enable_if_t<std::is_integral<T>::value, bool> = { }> constexpr bool operator==(const T& lhs, const my_type& rhs) { return rhs == lhs; }
>>
>>59040343
Jesus christ.
How do people defend this shit?
>>
>>59040343
thanks for the eye cancer
>>
The question:
>How can I synchronously check, using node.js, if a file or directory exists?
A very reasonable thing to want to do, I'm sure you'll agree. Even with Node's strong emphasis on async I/O, it still makes sense to do sync work e.g. in scripts or on app startup. Very straightforward. I'm sure there will be no problem.

It turns out that the answer is so long, and has changed so many times, it needs a chronological summary section.

I have been contracted to write a huge webapp in Node.

Kill me now.
>>
>>59040332
>>59040339
The mode is a kind of average. Please tell me you made it through highschool
>>
>>59040273
>Not to mention, his C programming videos are pretty shit.

no they arent .. actually most of his videos are pretty good

>>59040303

sure if you are the book type ... go with C
>>
>>59040305
import Data.List (maximumBy)
import Data.Function (on)

counts xs = map (\x -> (x, length $ filter (x ==) xs)) xs

mode = fst . maximumBy (compare `on` snd) . counts
>>
>>59040373
Why would you want to do anything synchronously in node.js? The entire point is an event loop async hell-hole. Poor developers probably havent even heard of a continuation
>>
>>59040201
>this is the current /g/
It's been nice knowing you all
>>
>>59040305
>an int array of any length.
My architecture cannot handle an int array of any length
>>
>>59040272
Please write code in proper syntax first before asking people to fix your issues. No one knows if it is a simple missing bracket that is fucking with your code.
>>
>>59040397
Once the web server gets listening then sure, it has to be 100% async. But the app needs to do some bookkeeping file checking/shuffling before starting the webserver, so it is fine to use sync functions before then. Or at least, I assumed it was until I read that SO answer.

I can't do the bookkeeping work in a separate script either, because it relies on a config.js file with arbitrary JS expressions mixed in with static data.
>>
>>59040392
Or you could just... sort it, group it, max by length...
>>
>>59040305
public static int mode(int a[]) {
int maxValue, maxCount;

for (int i = 0; i < a.length; ++i) {
int count = 0;
for (int j = 0; j < a.length; ++j) {
if (a[j] == a[i]) ++count;
}
if (count > maxCount) {
maxCount = count;
maxValue = a[i];
}
}

return maxValue;
}
>>
>>59040473
That IS maxing by length
>>
>>59040458
>because it relies on a config.js file with arbitrary JS expressions mixed in with static data.
Shit why? Sounds like a nightmare. You can't just have different initialization steps (functions) that get chained by callbacks? I know it sounds terrible but it IS node you're working with here. Async exists sounds like such a stability nightmare (we all know how reliable it is to count on node libraries to stay consistent ;) ) you should probably find some way to do initialization async
>>
How do I write a python interpreter
>>
>>59040214
How can you tell OPs cartoon girl is a trap?
>>59040172
perlscript to scrap stuff and make it look fabulous for terminal, json and static webpage.
>>
>>59040513
In the most inefficient way possible.
Look at you counts function - it's O(n^2)
>>
>>59040539
Start with the lexer.
>>
>>59040539
Can you charm snakes?
>>
do{
printf("\nInput two values and an operation: ");
scanf("%d %c %d", &a,&c,&b);

answer = calcMath(a, b, c);
printf("\nAnswer: %d", answer);

fprintf(fileWrite, "\n%d %c %d = %d", a, c, b, answer);

printf("\nRun again? Y/N > ");
scanf("%c", &runAgain);
if (runAgain != 'Y') useCalc = 1; //set to 1 for debugging, exists loop if set to 0

} while (useCalc)


Doing a simple calculator. Why does it skip the second scanf line? It outputs correct answers over several loop interations.
>>
>>59040554
>muh efficiency
>>
>>59040568
Go back to CS101, do not pass go, do not collect 200 neetbux
>>
So I have this script that utilizes the first two rolls from a bitcoin gambling site and a client seed and it returns the server seed which i can use to get the SHA256 Hash of the string of the server seed to predict future outputs of the gambling site to a degree of statistical significance. I know if I have a program where I can input three rolls to generate the server seed it would be magnitudes more accurate (if not 100%) guaranteeing returns always though the computational time would skyrocket. Any ideas?
    var clientSeed = "2";
var preRoll1=63.40;
var preRoll2=71.72;

//crypto lib for hmac function
var crypto = require('crypto');

var roll = function(key, text) {

//create HMAC using server seed as key and client seed as message
var hash = crypto.createHmac('sha512', key).update(text).digest('hex');
var index = 0;
var lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);

//keep grabbing characters from the hash while greater than

while (lucky >= Math.pow(10, 6)) {

index++;
lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);
//if we reach the end of the hash, just default to highest number
if (index * 5 + 5 > 128) {
lucky = 99.99;
break;
}
}

lucky %= Math.pow(10, 4);
lucky /= Math.pow(10, 2);

return lucky;
}


var i;
for (i = 0; i < 99999999999999; i++) {

var roll1=roll(i.toString(), clientSeed+'-'+0);
var roll2=roll(i.toString(), clientSeed+'-'+1);

if(roll1==preRoll1 && roll2==preRoll2)
{
console.log(
"Result ", i," -> ",
"Client Seed: ", clientSeed,
" - Server Seed: ", i,
" - Roll 1: ", roll1,
" - Roll 2: ", roll2
);
}
}
>>
>>59040566
Newline left in the stream.
>>
>>59040305
    ; assumes:
; ds:si is ptr to array
; cx is length of array
; es is a free segment initialized to 0
@@: lodsw
mov di, ax
inc [es:di]
loop @b
push es
pop ds
xor si, si
xor cx, cx
xor bx, bx
@@: lodsw
cmp ax, bx
jbe .a
lea bx, [si-1]
.a: loop @b
; result in bx
>>
I just applied for my very first job ever. It's for an entry SE position in my city. I'm nervous about what to do if I actually get contacted back. If I do get contacted, how long will it probably be? And if they want to set up an interview, how long from then should I schedule it?
>>
File: mystery.jpg (72KB, 825x369px) Image search: [Google]
mystery.jpg
72KB, 825x369px
>>59040172
C fags will defend this.
>>
>>59040589
Is it a seed or just a nonce?

Also try to clarify a bit, I have no idea how this system works or what you're trying to accomplish. Relevant information only helps.
>>
defend this
-- | 'the' ensures that all the elements of the list are identical
-- and then returns that unique element
the :: Eq a => [a] -> a
the (x:xs)
| all (x ==) xs = x
| otherwise = errorWithoutStackTrace "GHC.Exts.the: non-identical elements"
the [] = errorWithoutStackTrace "GHC.Exts.the: empty list"
>>
>>59040595
Thanks. I fixed it.
>>
>>59040321
int average(int a, int b)
{
int sum = a + b;
return(sum / 2);
}
>>
>>59040741
>library
>>
>>59040540
>How can you tell OPs cartoon girl is a trap?
Because cisgender girls don't use C.
>>
>>59040763
haha no way this would pass production code review
>>
>>59040636
>not ANSI compliant
>doesn't use 1TBS
0/10 see me after class
>>
>>59040695
it generates only a server seed. I then take that seed and get the SHA256 hash equivalent using this site:
http://passwordsgenerator.net/sha256-hash-generator/
I then use this site, plug in the hash, server seed, client seed and then it generates the nonce for me
https://dicesites.com/primedice/verifier
>>
>>59040793
What's wrong with it?
>>
>>59040763
yes but can you average two strings
>>
>>59040763
template<typename... T> constexpr auto average(T... n) { return (n + ...) / sizeof...(n); }
>>
>>59040885
>Array
>>
>>59040826
Autist on /g/ who started the meme used to say nope, UB, not portable, etc. to every response.

His definition of averaging 2 ints(only kept to himself) was incomputable. Don't bother.
>>
>>59040836
/**
* Averages strings s1 and s2, storing the result in s3
* Up to the caller to ensure that s3 is at least as long as the longer of s1 and s2, otherwise undefined behavior will result.
*/
void str_average(char s1[], char s2[], char s3[])
{
size_t len1 = strlen(s1), len2 = strlen(s2), maxlen = len1, i;
if(len2 > len1) maxlen = len2;
memset(s3, 0, maxlen);
for(i = 0; i < maxlen; ++i) {
s3[i] = (s1[i] + s2[i]) / 2;
}
}
>>
>>59040826
What's the average of 1 and 0?

Now what does your method return?
>>
>>59040821
What algorithm does that verifier use, is it documented anywhere?
>>
>>59040914
You didn't say you wanted the answer in floating point form, or using a specific rounding convention, so by default the function uses the same rules as integer arithmetic in C.
>>
>>59040945
https://dicesites.com/provably-fair
they run through the process here. Dont have the algorithm itself however
>>
>>59040291
You frown on first designing your data-structures? Data-structures are the bread and butter of any program.
>>
>>59040952
I'm not the one who prompted you in the first place. However, if you think returning an int for an arithmetic mean is good practice, you can argue as much as you want that the specifications weren't fair. You're still wrong.
>>
>>59040906
That reads past the end of the string with the shorter length.
>>
>>59040458
If you have the option of forcing the app to be deployed on Node version >= 7, I highly recommend to write everything you can with async/await. It maybe pretend synchronous, but a hell lot easier to work with.
>>
>>59040763
Better yet:
float average(int a[]) {
float result;
for(int i = 0; i < a.length; i++) result += a[i];
return result / a.length;
}
>>
>Le integer average meme
God damn, I have to keep posting this shit.
/**
* Averages an array of integers.
*
* Averages an array of integers, without overflow or conversion to a larger type.
* It is equivalent to the sum of the array, divided by the array's length (rounded towards zero).
*
* @param n Number of array elements. Must be greater than zero.
* @param arr A pointer to an array of n integers. Must be non-null.
* @return The mean of the array's elements.
*/
int iavg(int n, const int arr[static const n])
{
int avg = 0;

/* A buffer of values that are lost to integer truncation.
* It should always be in the closed interval (-n, n).
*/
int error = 0;

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int loss = arr[i] % n;

// error + loss >= n
if (error > 0 && loss > 0 && error >= n - loss) {
// error = (error + loss) - n
error -= n - loss;
++avg;

// error + loss <= -n
} else if (error < 0 && loss < 0 && error <= -n - loss) {
// error = (error + loss) + n
error += n + loss;
--avg;

} else {
error += loss;
}
}

// Fix some overcompensation for error

if (avg < 0 && error > 0)
++avg;
else if (avg > 0 && error < 0)
--avg;

return avg;
}
>>
>>59040836
>convert both strings to an int value
>average them
>convert average to a string value
>>
File: screenshot.png (70KB, 816x921px) Image search: [Google]
screenshot.png
70KB, 816x921px
HOW DO YOU DO THIS IN ASSEMBLY?

I AM FUCKING PANIC RIGHT NOW
>>
>>59041021
me@server node -v
v4.4.2

And no I can't upgrade it. There's a hacky third party lib that might do the job, though.
>>
>>59041013
/**
* Averages strings s1 and s2, storing the result in s3. Up to caller to ensure
* that s3 has enough allocated space to store the shorter of the two input
* strings, otherwise undefined behavior will occur.
*/
void str_average(char s1[], char s2[], char s3[])
{
size_t len1, len2, minlen, i;
len1 = strlen(s1);
len2 = strlen(s2);
if(len1 < len2) minlen = len1;
else minlen = len2;
memset(s3, 0, minlen + 1);
for(i = 0; i < minlen; ++i) s3[i] = (s1[i] + s2[i]) / 2;
}


Should be fixed now. My original intention was to treat the shorter string as being extended with null characters at the end, but that wasn't implemented properly and I ended up deciding it would be "cleaner" to just do the averaging up to the null character of the shorter string.
>>
>>59041150
nvm? Do it! It will save you 10 headaches per function. As a bonus they might call you back later, because Pajeet can only into ES5.
>>
>>59041124
SOMEBODY

PLEASE


RESPOND
>>
>>59040272
On line 7 of the code you posted you are missing a closing ) bracket.

Look up how error reporting works in javascript so you know whats wrong. Usually languages that arent compiled like javascript and PHP have a line of code to turn on error reporting and print errors to the browser window for testing purposes.
>>
>>59041202
Write it in C and then compile and disassemble it
>>
How would I go about calculating seconds until the next Friday 10 AM in Lua?
>>
>>59041124
Don't know what architecture you're using, but one of the first steps when looking at a problem is to find out how many variables you must work with. In this case it's four (current, stars, spaces, counter) so if you have that many general purpose registers, you don't need to worry about storing them on the stack.

Next step is to transform your loops and ifs into jump statements. Your program uses no standard ifs, and only while loops, and the general template for the assembly code of a while loop is something like:
LABEL: 
test condition
jump to EXIT if condition is false
blahblahblah
jump to LABEL
EXIT:
>>
>>59041213
Our class isn't using x86, it's this shit:

https://en.wikipedia.org/wiki/LC-3

I don't understand assembly AND I NEED HELP THE HOMEWORK IS DUE TOMORROW
>>
>>59041228
The class is using the LC-3 cpu and there are 8 16-bit registers

Thank you so much i'll keep working on it
>>
>>59041232
;; Author: Chris Wickell


.ORIG x3000

LD R1, N
NOT R1, R1
ADD R1, R1, #1 ; R1 = -N

AND R2, R2, #0 ; R2 = holds number of *'s to be printed

LOOP LEA R0, NEWLN

PUTS

ADD R3, R2, R1 ; while (R2 < N)

BRzp ELOOP

ADD R5, R5, #1 ;

ADD R4, R4, #1

FLOOP LD R0, STAR ; R0 = *

OUT ; Write *
ADD R5, R5, #-1

BRp FLOOP

ADD R5, R4, #0

ADD R2, R2, #1 ;

BRnzp LOOP
ELOOP
LEA R0, NEWLN

PUTS

STOP HALT

N .FILL 6

STAR .FILL x2A

NEWLN .STRINGZ "\n"
>>
>>59041232
>Have psuedo code
>still cant write assembly
just drop out and stop wasting your time
>>
>>59040201
Languages are just tools. Figure out what you want to accomplish. Find a niche you know will intrest you and dive into the language that can accomplish that.

You wouldnt use a hammer to install a screw.

Specializations:
Phone apps = Java
Desktop apps = C++
Websites = HTML, CSS, Javascript, PHP
Database Admin = SQL
Network Admin = DOS/Powershell or Unix/Bash shell
>>
>>59041257
>interrupting the enemy when he's committing a mistake
>>
>>59040914
>>59040763
import std.stdio;

void main(){
int a = 1;
int b = 0;
writeln((a+b)/2.0);
}
>>
>>59041256
I'll read through this, thanks

>>59041257
>>59041274
please guys i'm just getting started
>>
>>59040273
Offering criticism without an alternative is useless
>>
>>59041293
>I'll read through this, thanks
it is straight from stack overflow

careful about copy-pastes from the internet /fraud
>>
>>59041284
>import std.stdio
>void main
>writeln
[TRIGGERED]
>>
char *
>>
>>59040914
(/ (+ 0 1) 2)
1/2
>>
>>59040318
I thought I could accomplish this but 3 years later my website I am building as a project is still no were near fully functioning. I did learn a shit ton though.
>>
>>59041296
No it's not.
You could hardly say what I said was criticism. I just don't like his video series for it and was expressing my opinion.
It was quite a long time ago when I watched it, but I just remember it was pretty shitty.
I think videos as a means of learning to program is a pretty bad idea.
>>
>>59041293
>please guys i'm just getting started
No you are not. Homework is given when the professor has taught you enough to do given home. You don't understand how to write assembly when your professor has already given you the pseudo code means either you are 60 IQ or you haven't been in/sleeping in classes.
>>
>>59041268
What about python?
>>
>>59041284
well? was it that hard to find an average?
>>
>>59041342
classes are pretty boring so i skipped them, and the book isn't helping

asked one of the assistants what chapter i should read and they said that the assembly stuff is covered in lecture only and now i'm FUCKED
>>
>>59041358
Data Science
>>
>>59041310
[code ]
(char *) malloc(sizeof(char));
[/code]
>>
>>59041372
fucking nerds, amirite
>>
>>59040172
I am digging into PHP and SQL. Reverse engineering website logins and session management. I downloaded a free book called Sams Teaches SQL in 24 hours.

I am having a ton of issues trying to design the entire database from scratch. I could really use some database examples. Ones that show what a website would have.
>>
>>59041372
>classes are pretty boring so i skipped them, and the book isn't helping
I have no fucking idea why idiots like you sign up for college or classes and then go well its boring, guess I won't go.

What did you expect was going to happen?
>>
>>59041372
well then buddy, try again next semester
>>
>>59041391
it's been pretty easy so far, classes up till now just repeat from the book, so it's easier to just read the book and ask questions
>>
>going to non-mandatory classes
yea nice waste of my timE LaMO
>>
>>59040201
Worth learning: Haskell
Not worth learning: *
>>
>>59041378
There's an old saying on the Internets. It goes:

"Derp"
>>
>>59041406
>It's been pretty easy so far
>HELP I DON'T KNOW WHAT TO DO
Pick fucking uno
>>
>>59041408
this

sitting 2 hours in a lecture is boring as hell.

is it better to study from the course slides after?
>>
>>59041358
Python can take over for PHP on a websites back end. I look at Python as a scripting language. I never really got that deep into python though.

I hear its a powerful language. A system admin could also use it.
>>
>>59040977
>>59040314
What do you do with data in a program? Do you store it? NO. You operate on it. So the best data structure is one that enables you to easily manipulate that data. What better way to decide on how to store your data efficiently than to design your operations? Also, you can't fully develop your data structures until you take into account temporary variables in your methods. They hold manipulations of your data, so they are a part of the data structure.
>>
>>59041423
assembly is so different from high level programming, i'm completely lost

pelase send help
>>
>>59041440
>What do you do with data in a program? Do you store it? NO. You operate on it
>Data isn't stored
>Data is ONLY operated upon

Wew lad!
>>
>>59041417
>Worth learning: Trash
>Not worth learning: Not trash
>>
>>59041417
Whats your end game? I've never met anyone that reps Haskel. I hear its great for mathematicians.
>>
>>59041451
you lose
>you lose
you lose
>you lose
>>
>>59041451
Maybe if you went to class you would know how to do your homework?
>>
>>59041461
Once data is stored it ceases to be data.
>>
>>59041481
No
>>
>>59041488
Yes

Also nice Hitler dubs
>>
>>59041451
just imagine you can only use for variables a limited set of global variables
>>
>>59041476
i promise i'll go to class from now on

please help me understand condition codes and branching ;_;
>>
File: 88-flak-kill-markings.jpg (59KB, 397x500px) Image search: [Google]
88-flak-kill-markings.jpg
59KB, 397x500px
>>59041496
Please explain
>>
>>59041501
please help me understand raycasting and shaders
>>
>>59041498
i understand that but how am i supposed to implement a while loop with only compares and jumps?
>>
>>59041472
You haven't been in /dpt/ very long. Hasklelslimes run rampant in /dpt/.
>>
>>59041501
https://www.tutorialspoint.com/assembly_programming/assembly_conditions.htm
>>
>>59041522
It basically looks like
loop1start:
if(!(condition)) goto loop1end;
blah_blah_blah();
goto loop1start;
loop2end:
>>
>>59041522
LOOP:
do stuff
compare
skip if flag set
JUMP TO LOOP
>>
>>59041531
>>59041538
>>59041548
Makes sense, thanks
>>
>>59041558
Now go to classes and stop asking retarded shit here that you should have learnt in class.
>>
>>59041510
1488 nigger.

>>59041461
It isn't stored IN THE PROGRAM. Usualloy it's stored in a database, file, "someone else's computer", etc. The program exists to tranform data, not to store it internally. The few exceptions that exist are: databases, key-value stores, etc.
>>
So I'm sort of new to programming. I recently installed bash on Ubuntu on windows and installed mingw-w64, and g++. I wanted to write a simple hello world program in c++ and compile it to a windows executable so I wrote this in bash script.

 
#!/bin/bash
g++ -c prog1.cpp
g++ -o prog1 prog1.o
x86_64-w64-mingw32-g++ -static-libgcc -static-libstdc++ -o prog1.exe prog1.cpp
$SHELL


When I ran it initially the executable said it was missing some dll's, I looked into it and apparently they were mingw specific, and to fix it you need to add them statically when building, so I did as you can see above. My problem is even after adding it I keep getting more and more error messages with new dll's I'm missing. Is there some way to tell mingw to statically attach all dll's the program will need to run, or at the very least determine, based on the contents of my code, what things I have to add?
>>
>>59041660
>Once data is stored it ceases to be data.

I could care less about numbers

Your statement makes absolutely zero sense.
>>
>>59041701
forgot to mention, the 2 g++ lines infront of the mingw line are just remnants I forgot to remove from when I was building and testing the program in the bash shell.
>>
I've been programming for about 8 years on and off, and I've always learned through online tutorials, experimenting myself, and asking about shit on stackoverflow. But I'm still mediocre as fuck, and every project I make inevitably turns into a mess of spaghetti code. What's a resource for a more solid foundation on designing programs? Preferably not a super dense book from the 80s.
>>
>>59040172
Reworking the core game loop of my game.
>>
>>59041701
install gentoo
>>
Anyone have any ideas on improving this function? Or maybe it already exists and I can't find it.

bundle :: (Ord a) => [(a, b)] -> [(a, [b])]
bundle list = recurse Map.empty list
where
recurse !memo [] = Map.toList memo
recurse !memo ((x,y):zs) = recurse (Map.insertWith (++) x [y] memo) zs


Basically, it takes a list of tuples and groups the list by the first tuple value. So

> [(1, 1), (1, 2), (1, 3), (2, 4), (2, 5), (2,6)]

would become:

> [(1, [1,2,3]), (2, [4,5,6])]
>>
>>59041781
import Data.Function
groupBy ((==) `on` fst) xs
>>
File: 1.gif (819KB, 483x360px) Image search: [Google]
1.gif
819KB, 483x360px
What do I need to put into the .vimrc file so that Vim will auto-indent like emacs does?
>>
>>59041963
>>59041963
$ sudo rm /usr/bin/vim
>>
>>59041963
set cindent
>>
>>59041701
Just -static.
>>
>>59041963
echo "alias vim='emacs'" >> ~/.zshrc
>>
what can i do with the ip of an iphone thats connected on my network? i wanna fuck around with my old iphone to see if i can hack it
>>
>>59041963
Just looking through my own .vimrc, I have:

set filetype plugin indent on
set smartindent
>>
>>59041995
That's not valid vimscript.
>>
>>59042050
You can grow up.
>>
>>59041701
Try tdm gcc, it's a bit better about this kind of thing. Overall though I suggest against fighting windows by trying to use gcc on it... set up an msvc project if you need to target the platform.
>>
>>59041819
Not sure if that works since groupBy would result in

[(a, b)] -> [[(a, b)]]

Where as I need

[(a, b)] -> [(a, [b])]
>>
>>59042040
thank you!
I feel really stupid now...
>>
>>59042050
MITM, WebKit has a new vulnerability each week. If it hasn't been updated in a while, even better.
>>
>>59040172
I need help, /g/. I'm trying to make a simple program in C++ that forks then has the fork execute the specified program, but I don't know how I'm supposed to properly use execl. It seems like it only allows absolute file names, which simply won't work. Ideally, I'd like it to use PATH to look for the binary first, then look in the local path if it can't be found in PATH.
Is this even remotely possible?
>>
>>59042177
execlp
>>
>>59042177
>I'm trying to make a simple program in C++ that forks then has the fork execute the specified program

Why don't you just do it in bash?
>>
>>59041232
>LC-3
Holy shit, I remember having to use that as well. What school are you at?
There's a C compiler to LC3, but it doesn't exactly make human-readable code and your instructor would immediately realize that you didn't create it yourself.
>>
>>59042222
Fuck, thanks. I suppose I should read up on the rest of the exec functions to make sure I'm using the right one.
>>
>>59042277
Just read the man page of any of them, it's the same one.
>>
>>59042241
not op, but same, georgia tech
>>

greetings = ["bonjour", "hola", "hello"]
planets =['monde','mundo','world']

for greeting in greetings:
pass

for planet in planets:
pass

print(greeting, planet)
>>
Is it hard to write your own shell?
>>
>>59042371
no
>>
>>59042371
Not really, they're all roughly the same. The only difficult part is making it convenient enough to use that someone (even yourself) would use it over something like bash or zsh.
>>
>>59042371
It depends on what nice features you want in it.
A basic shell is actually pretty easy to write, though.
>>
>>59042371
alias myshell='bash'
>>
>>59042371
Depends how rigorous you are to a standard, if you're not doing the full POSIX bourne shell it's quite simple. A quick shell is demonstrated in the GNU libc manual, section on job control.

https://www.gnu.org/software/libc/manual/html_node/Implementing-a-Shell.html
>>
File: neat.jpg (36KB, 320x314px) Image search: [Google]
neat.jpg
36KB, 320x314px
>>59041327
>I'll tell you what I think is a bad way to learn, but not what I think is a better way

I didn't realise I was on StackOverflow.
>>
>>59042435
Go read a book, idiot.
>>
>>59041745
That wasn't me m8. I'm OP, he's a retard.
>>
>>59042435
Not him, but K&R is about as good as it gets, if you can get over the older C89 style.

You can't find a more sensible and concise explanation of pointers in C anywhere else.
>>
>>59042435
I'm sure that's a real convincing argument for everyone new to the thread.

Are you really implying that ANY book is better than video tutorials?

Generally books are better, but jesus christ nothing is that black and white.
There are also some pretty terrible books, and some not so terrible youtube series'.
>>
>>59042420
Also if you're a new C programmer, targeting anything but windows, I would recommend reading most of that manual.

There's so much shit in there and tons of examples of how to use libc(glibc, not everything is ISO or even POSIX)
>>
>>59042527
Derp, meant for >>59042443

>>59042524
Completely agree. That said, K&R is pretty terrible for anyone completely new to programming, the learning curve is pretty steep.
But as you say, it's the easiest way to learn pointers, so I guess you either start with a shitty language that doesn't have them at all, or just read that section first.
>>
>>59041372

>so I skipped them
If you do not attend each and every class lecture, and start working on the homework a reasonable amount of time before the deadline (early enough that you can ask questions in class about the homework during time allotted), you deserve no sympathy. Reap what you sew.

>>59041406

>classes up till now just repeat from the book
Protip: Don't buy the book unless the homework assignments are only available in the book. There is typically nothing in the book that can't be taught in the lecture, or found from other free sources.
>>
File: 1364462871771.gif (2MB, 350x258px) Image search: [Google]
1364462871771.gif
2MB, 350x258px
Devise an algorithm to generate orthogonal binary sequences of length n.
>>
>>59042623
Devise an algorithm to kill yourself.
>>
what does the equals sign mean in programming?

int x = 6;

what is it suppose to mean?
>>
>>59042750
It's the dimensionality operator.
It states that x is a 6 dimensional data structure.
>>
File: faggot.png (232KB, 1920x1080px) Image search: [Google]
faggot.png
232KB, 1920x1080px
>>59042679
EZ.
>>
>>59042750
Depends on the language.
>>
>>59042750
"let x equal 6"
????
>>
>>59042750
is
>>
>>59042817
>>59042817

Let X be an integer of the value 6
>>
How would I limit the number of forks running simultaneously? For example, if I wanted to fork 3 times, then wait until one of them has ended, and only fork again once one of the previous three has ended, how would that be achieved? I've seen a couple of ways to check for one fork, but never multiple forks simultaneously.
>>
>>59042750
= is an assignment operator; it is assigning the value of the right side to the memory address on the left side.
>>
>>59042750
Rust makes more sense

let x = 14;

If you don't know what the line above means you never took maths.
>>
>>59042865
So is X an int? a float? a double?
>>
>>59042828
If you want to do it that way then it's "let integer x equal 6"
>>
>>59042894
String
>>
>>59042865
Fucking rust

>>59042894
https://en.wikipedia.org/wiki/Type_inference
>>
>>59042911
I was making fun of dynamically typed languages
>>
R U S T
U
S
T
>>
>>59042903
Which has the same meaning as the sentence I typed while your previous statement lacked the type of X.
>>
>>59042750
I assume from the declaration that this is C or C++. The equals sign means assignment. The statement declares a piece of memory of size
sizeof(int)
on the stack and assigns the immediate value of 6 into that memory location using a store operation that works on values of size
sizeof(int)
.
>>
>>59042937
ok
>>
>>59042938
It's Java
>>
>>59041307
>TRIGGERED
why
>>
>>59042911
>https://en.wikipedia.org/wiki/Type_inference

Only works if the type can actually be inferred via usage.
>>
public static void main(String[] args)
{

}



can one starting application of a program be so elegantly written and beautiful to look at?
>>
>>59043016
void main(string[] args)
{

}
>>
>>59042982
Well, simply ignore the bit about the memory allocation. That's all "handled for you". You can't do shit like this
long a = 0;
printf("%ld\n", a); -> 6
strcpy(&a, "nigger");
puts((char*)&a);
>>
File: 1486855618695.jpg (214KB, 1920x1080px) Image search: [Google]
1486855618695.jpg
214KB, 1920x1080px
>>59042988
>not keeping your imports as local as possible
>>
>>59043036
why would I want to do that? I just want to write code
>>
>>59041284
>>59042988
>import std.stdio
>std.std
What a joke.
>>
>>59043028


python
>>
>>59043119
if __name__ == '__main__':


No
>>
>>59042750

int x
Create an integer value named x

= 6;
and assign the value of 6 to it.
>>
>>59043136
So far this is the best explanation

You would be a good computer science professor
>>
>int x = 6;
Oh it's okay
>int input = scanf("%d". &input);
OMG NOOOO
>>
>>59043136
>Create an integer value named x
wrong
>>
>>59043159
>Cee
Found your problem. It's 2017
>>
webdev programming is real programming because it's where the money is at all of your lisp and haskel and rust memes are all memes
>>
>>59043193
I do webdev in Lisp for money.
>>
>>59043159
Defend this
>>
File: new_teenage_trend_peer_pressure.jpg (40KB, 640x626px) Image search: [Google]
new_teenage_trend_peer_pressure.jpg
40KB, 640x626px
What is Ruby doing her phd in, and why is she up at the strangest hours?
>>
>>59043193
Hookers make twice what you do, is that considered real programming?
>>
What language do you default to for a hobby project? Assume that your chosen problem is fairly general and could be solved with a wide variety of techniques and paradigms.
>>
>>59043252
D
>>
>>59043235
since when do they make $100,000 a year?
>>
>>59043252
Lisp.
>>
>>59043252
Rust, no competition. D was okay too.
>>
>>59043252
Javascript.
>>
>>59040376
Mode is the number that occurs the most
>Mode-most occuring in array
>Mean-average of array
>Number in the middle of array. If there is no 'middle', you average the 2 numbers that split the middle

Did you even make it through highschool anon?
>>
>>59043252
Rust
>>
>>59043295
The mode is a type of average, dummy.
>>
>>59043271
Since a long time, not talking about crack whores.
>>
>>59043336
http://www.statisticbrain.com/prostitution-statistics/

>Average annual income of a U.S. prostitute: $290,000

Are they real programmers yet?
>>
>>59043252
C++. With anything else I eventually run into a limitation or headache. How do I use this C library in Go? You write a convoluted wrapper for it. How can I use this popular large C++ library in Java? You basically can't. How can I make sure this object is allocated on the stack? You probably can't. How can I do some text based preprocessing without cracking out an external script for some basic codegen? I can't.

Meanwhile C++ doesn't stop you. It gets ugly eventually, and you need some experience to know what's okay to hack around and maybe fix later vs. what really needs done properly first time. But when you need to do something, you're never left thinking "C++ can't do that".
>>
>>59043369
Is this the arithmetic mean, or the median?
>>
File: mhgvmhhbm,.jpg (57KB, 660x495px) Image search: [Google]
mhgvmhhbm,.jpg
57KB, 660x495px
Best algorithm and data structure books?
>>
>>59043372
You have colossally shit taste, and should consider suicide,
>>
>>59043381
The average of integer prostitutes.
>>
>>59043382
CLRS is definitely the most comprehensive, but I really liked Algorithms by Dasgupta. It doesn't cover nearly as much as CLRS, but it's a lot easier to digest, especially if you are learning about algorithms for the first time.
>>
>>59043390
Like I said anon... it's ugly. But am I actually wrong?
>>
>>59043382
http://www.bccfalna.com/category/data-structure-in-hindi/
>>
>>59043382
https://drive.google.com/file/d/0B7F22FpNUKgSNEg5M2Q0ZHJJV00/view
>>
>>59041232
Try fucking killing yourself you retarded brain damaged moron.
>>
>>59043252
Racket lisp
The ultimate multi paradigm language
>>
>>59043404

reading Algorithms by Dasgupta finally an easy to read Algorithms book that isn't 1256 pages of non sense!
>>
>>59043382
The Algorithm Design Manual, 2nd Edition
Steven Skiena

Written by a well-known algorithms researcher who received the IEEE Computer Science and Engineering Teaching Award, this new edition of The Algorithm Design Manual is an essential learning tool for students needing a solid grounding in algorithms, as well as a special text/reference for professionals who need an authoritative and insightful guide.

---

My absolute favorite for this kind of interview preparation is Steven Skiena's The Algorithm Design Manual. More than any other book it helped me understand just how astonishingly commonplace (and important) graph problems are - they should be part of every working programmer's toolkit. The book also covers basic data structures and sorting algorithms, which is a nice bonus. But the gold mine is the second half of the book, which is a sort of encyclopedia of 1-pagers on zillions of useful problems and various ways to solve them, without too much detail. Almost every 1-pager has a simple picture, making it easy to remember. This is a great way to learn how to identify hundreds of problem types. -- Steve Yegge
>>
>>59043252
Whatever the hot new meme language is, because I like trying new things and there's no better opportunity for it than with a pet project.
>>
Shell script to keep my Downloads folder organized

inotifywait -m ~/Downloads -e create|
while read path action file; do
basename=$(basename "$file")
extension="${basename##*.}"
if [ "$extension" == "crdownload" ] || [ "$extension" == "part" ] || [ "$file" == ".com.google.Chrome."* ]
then
continue
fi
sleep 1s
filetype=$(file --mime-type -b -- "$file")
echo $filetype
if [[ $filetype == image\/* ]]
then
mv "$file" images/
continue
fi
if [[ $filetype == video\/* ]]
then
mv "$file" videos/
continue
fi
if [[ $filetype == application\/* ]]
then
mv "$file" application/
continue
fi
if [[ $filetype == text\/* ]]
then
mv "$file" text/
continue
fi

mv "$file" misc/
echo "$file"" was ""$filetype", "which doesn't have a designated target"

done
>>
>>59043153
Well let's just hope one of my PhD applications gets accepted.

>>59043168
Care to provide a better explanation?

>>59043231
1. His, not her.
2. I have been considering focusing my doctoral research around compiler optimizations.
3. I sleep odd hours when I can. I'm not really a morning person. That said, it is like... 8:23 PM right now. I am not sure why you are commenting about me being up at odd hours.
>>
>>59042834
No one? I can easily increment a counter every time a process is forked, but I can't find a way to decrement when a process is terminated, as that would require a way to actually tell when a process has terminated.
>>
>>59043788
Uh you know as the parent of a process you ARE the one responsible for picking it it's return code when it dies right? You're leaving them as zombies if you don't know when they end
>>
>>59043788
Stinky Windows dev here, so this might not be right, but I believe in Unixville forked processes will send a SIGCHLD to parent upon termination
>>
I'm a self taught programmer who would like to fill in the gaps in my knowledge and vocabulary so that I can understand formal writings on the subject. For reference,
>I can write and contribute to significant codebases and in relatively lower level languages (C)
>I implement plenty of algorithms but I don't truly understand their mathematical notations. Instead I find writeups/overviews/tutorials/sample code/pseudocode and reimplement it. When I'm done, I understand what's going on but I don't know why it works.
>I can optimise functions by identifying redundant steps and thinking of faster ways to do things, and I have a general idea of what it means for its performance to be relative to its input size, but I don't understand proper complexity theory/big O notation. I have no idea what it means for a function to be "O(2 log n)".
>I understand data locality/cache coherence but I've never written a line of assembly
>I understand generally what a compiler is doing (lex, parse, analyse, intermediate codegen, optimise, target codegen, optimise again) but I wouldn't know where to start writing one

In other words, I know how to write 90% of the things I want to, but a lot of the time I'm treating my own mathematical code as a black box and my missing knowledge is an absolute barrier to the last 10% (i.e. implementing algorithms based on their mathematical definitions without help in the form of existing reference code).

Can anyone suggest some books on how to approach these things that assumes I can mostly program already?
>>
>>59043659
I'm scrolling through this book right now, and it seems like it doesn't have any of the tedious talk while keeping it somewhat rigorous. Not that Anon, but I think I'll give this a read.
>>
>>59043819
CLRS
Skiena
>>
>>59043320
I apologize, I've often known average as the generic term applied to mean. You are right
>>
>>59043750
>I am not sure why you are commenting about me being up at odd hours.
Probably a yuropoor. They complain about Americans being self-centered, but they refuse to ever acknowledge other time zones.
>>
>>59040540
>>59040214
how would one go about to make a program that tells the difference between real animu grills and animu traps?
>>
>>59043929
Machine learning.
>>
>>59040305
sauce?
>>
>>59043941

This. Also, if you really want some good tells... shoulders, fat distribution, facial structure/shape, etc...
>>
import java.util.*;
public class IteratorDemo {

public static void main(String args[]) {
// Create an array list
ArrayList al = new ArrayList();

// add elements to the array list
al.add("C");
al.add("A");
al.add("E");
al.add("B");
al.add("D");
al.add("F");

// Use iterator to display contents of al
System.out.print("Original contents of al: ");
Iterator itr = al.iterator();

while(itr.hasNext()) {
Object element = itr.next();
System.out.print(element + " ");
}
System.out.println();

// Modify objects being iterated
ListIterator litr = al.listIterator();

while(litr.hasNext()) {
Object element = litr.next();
litr.set(element + "+");
}
System.out.print("Modified contents of al: ");
itr = al.iterator();

while(itr.hasNext()) {
Object element = itr.next();
System.out.print(element + " ");
}
System.out.println();

// Show list backwards
System.out.print("Modified list backwards: ");

while(litr.hasPrevious()) {
Object element = litr.previous();
System.out.print(element + " ");
}
System.out.println();
}
}

>>
>>59044003
It doesn't help that most artists draw a girl and just call it a boy.
I don't understand how people can defend that shit.
>>
>>59043372
You should check out Common Lisp.

>How do I use this C library?
CL has a fantastic FFI library.

>How can I make sure this object is allocated on the stack?
Implementation detail; let the compiler decide that.

>How can I do some text based preprocessing?
You can do a whole lot more than just preprocessing with macros...
>>
TAD is live:

https://www.youtube.com/watch?v=zht9uTkcTHs
>>
File: 1477156683730.png (476KB, 462x679px) Image search: [Google]
1477156683730.png
476KB, 462x679px
>Mount NFS volume
>Create directory on NFS volume
>Mount another volume on above directory on NFS client side
>Delete directory on NFS server side
>Mount still exists although no longer visible in FS.
>Can see mount in lsblk
>
ls /nfs/deleted_dir_with_mount_still_on_it

>Returns ENOENT and mount disappears as if Linux just unmounted it after determining the mount point was unreachable.

What is going on behind the scenes here in the Linux kernel? And how are mount points represented and stored in the VFS layer?
What's interesting here is that the mount point only exists on the client side, but then the directory gets deleted from the server side which doesn't know about any mount point, and so the clients kernel has the directory dropped from right under it's feet when there's still a mount point on it.

I'm interested because I'm working on my own VFS in my hobby OS.
>>
>>59043803
They're executing other processes using execl, so I am not controlling how they return.
>>59043805
Thanks, this seems like the thing I need. Now I just need to figure out how the fuck I'm supposed to make this work.
All my professor lectured on was use of fork(), and left us to learn the rest of this shit on our own; it's infuriating.
>>
>>59043252
python hands down
>>
>>59044134
>Do new project with python
>70% of the time is hunting down the right library and modules to import

Every python project I have done so far
>>
>>59040305

let mode ary = 
let sorted = Array.sort ary
let mutable best = sorted.[0]
let mutable current = sorted.[0]
let mutable best_count = 0
let mutable current_count = 0

for elem in sorted do
if elem <> current then
if current_count > best_count then
best <- current
best_count <- current_count
current <- elem
current_count <- 1
else
current_count <- current_count + 1
best
>>
>>59043677
this tbqh. if I'm really pressed for time then probably OCaml
>>
>>59044201
Which meme-lang is this?
It seems pretty fucking stupid.
>>
>>59044087

I've seen quite a few anime traps have some rather common tells, particularly around the shoulders. With Hime, you might notice in the OP pic that he does not actually have female fat distribution. The clothes are baggy around the waist to give the illusion of an hourglass figure. Also, the shoulders are very broad compared to those of a woman.
>>
>>59044113
back to /o/ turd
>>
>>59044255

That's F#. And yeah, it is a little silly... but it's fairly alright if you need a .NET language and don't want to use C#.
>>
>>59044260

>I have seen quite a few traps
>seen quite a few traps
>quite a few traps
>traps

/dpt/ average users everyone
>>
>>59040172
Hime a qt :3
>>
>>59044274

Never :^)
>>
>>59044289
more like the average 4chan user
>>
// Calculates mode
void main(string[] args)
{
import std.stdio : writeln;
import std.algorithm.iteration : group, fold, map;
import std.algorithm.sorting : sort;
import std.algorithm.comparison : max;
import std.typecons : reverse;

int[] arr = [9, 5, 2, 8, 4, 7, 3, 6, 1, 6, 3, 8, 4, 5, 2, 7, 2, 2, 5, 1, 2, 6, 8, 2, 1, 3, 5];

writeln(arr.sort().group.map!reverse.fold!max[1]);
}

Bow down plebeians
>>
>>59044446
>not in java

-1 / 0
>>
I found a backup drive I lost in a move, and now I'm looking through some old projects. nothing interesting except for a game I was making for the zune sd. all it does is draw a tile map with grass where you can scroll around. good times I guess
>>
>>59044467
>Java
Absolutely disgusting
>>
>>59044499
>disgusting
absolutely use of language to convey emotion
>>
god I love programming in java it feels soo rightt
>>
File: 1450178882147.jpg (356KB, 1280x720px) Image search: [Google]
1450178882147.jpg
356KB, 1280x720px
>>59040172
So why don't you guys program in sudocode? It seems pretty easy.
>>
>>59044586
I do when I'm fucking with algorithms
>>
>>59044586
> sudocode
>>
>>59044586

It's spelled "pseudocode", and I use it only when I need a quick sketch up of what an algorithm is going to look like. Otherwise, it's rather helpful to test said algorithm by running it. To this end, Ruby makes a great language for prototyping, because it is as easily comprehended as pseudocode.
>>
>>59040201
This is like a mechanic asking what screwdriver he should buy

A tool is a tool, they all get the job done
>>
I want to learn programming and do scripting but it seems super risky. I'm not new to committing to something but I feel like I'm a pretty below average person intelligence wise and I think programming will probably be too difficult, or will take so mu ch time that I can't spare.

How long would it take for a complete novice to go from learning code to starting to work in the industry?
>>
>>59044630
>A tool is a tool, they all get the job done
That is such a dumb thing to say. You need to be able to evaluate things.
Some tools are complete garbage and are outclassed by other tools.
Take Java or C++, for example.
>>
>>59044623
Is there any particular reason you prefer Ruby instead of Python? I heard a lot of bad things about Ruby.
>>
I've been doing project Euler problems recently and other "challenges" online

Do you guys know any good stuff that's similar?
>>
>>59044706
codewars

hackerrank

leetcode
codegulf
>>
>>59044658
For people who've never touched programming before that's the last thing they should be thinking about.

Obviously once you get more experience, yea you're right

That guy isn't going to be doing any real coding for a while, it's better to just jump right in and start programming so you can grasp the basics, you can always switch languages later
>>
>>59044656
Please kindly refer to >>>/g/wdg/
Webdev is a field in which those of below average intelligence can thrive, and I have no doubt you will be welcome there.

Good luck, anon
>>
>>59043060
I want to fuck Tohru.
>>
>>59044768
>/
nice job anon
>>
>>59043252
c#
>>
>>59044658
In an ideal world that is the case but this isn't an ideal world. Most of the time what you code is already determined by someone if you are working in a company. Doesn't if another language is better suited or better documented, they have been using it for 10 years and good luck trying to get them to change that. Even project leaders have a hard time changing that.

For everything else, you code with your favorite language. PHP is fucking hot garbo but some people like to code in PHP and will code in PHP till PHP fucking dies which I hope it does soon.
>>
>>59044882
php is pretty good
>>
>>59044927
Kill yourself please
I need PHP to die off faster.
>>
In reality most coding consists of shimming interfaces together to produce products in months that would've taken your team years to make without pre-existing tools.

I basically just glue libraries together for a living, even solution to interesting problems are usually, "drop in X to do it because it is the fastest implementation on the market".
>>
>>59044949
php makes a lot of money sorry it's not going anywhere all the databases with sql use php for webdev
>>
>>59044791
wait in line fucko
>>
>>59044974
I know PHP makes a lot of money. That doesn't mean PHP isn't fucking hot garbage and that there are plenty of languages better suited to do what PHP is doing. Which leads me to my point here >>59044882 as argument to >>59044658 this.
>>
>>59044664
like what? I literally can't think of a reason to use Python over Ruby unless you absolutely need some Python-specific library and can't rewrite it
>>
I've decided i want to learn to code and c is the one that appeals to me the most (I want to make my gadgets and shit)

What would be the best book to start off with? Im not a complete absolute total beginner, but i pretty much dont know nothing. I barely know functions and controls. I've never touched anything outside of the console let alone embed my code to software (not even make my program write something on a notepad).

So... What should i do, /g/? My first year in college (electronics engineering) starts in two weeks, but i dont start programming until the next semester. Should i learn now the theoric stuff in order to have an easier time? Or should i jump into a more pragmatic oriented book, thinking i'll get the math done for grades later either way?
>>
NEW THREAD: >>59045009
NEW THREAD: >>59045009
NEW THREAD: >>59045009
>>
>>59044664

It's more comfy to program in. Python is filled with shit that looks __like_this__
>>
>>59043681
Very nice
>>
>>59040291
You are a literal retard. Enjoy your intellectual ghetto. Here's a key out. Doubt you'll use it though.

"git actually has a simple design, with stable and reasonably well-documented data structures. In fact, I'm a huge proponent of designing your code around the data, rather than the other way around, and I think it's one of the reasons git has been fairly successful […] I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important."

http://softwareengineering.stackexchange.com/questions/163185/torvalds-quote-about-good-programmer
>>
>>59040305
Quick Clojure solution, should be O(length*log(k)) where k is the number of distinct elements.

 (defn my-mode [input]
(->> input
frequencies
(apply max-key val)
first))
Thread posts: 320
Thread images: 19


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