[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: 319
Thread images: 32

File: baptise-wicht-list-vector.png (19KB, 373x369px) Image search: [Google]
baptise-wicht-list-vector.png
19KB, 373x369px
Death to Linked Lists Edition

Old: >>56239389
>>
>well I don't care about cache utilization since it isn't important for my Java CRUD application
>well I don't care about data structures or algorithms since it isn't important for my Rails app
>I'll just import a library, I don't need to understand this!
>who cares if it runs slow? muh moore's law will make my O(2^n) algorithm fast in a few weeks I think...
>wow calculus totally wrecked me xD
>I just want to make games and websites, why do I need this theory crap??
>why does some incompetent Pajeet take my job and work for $500/month? :((((
>>
>>56246290
still depends on the usage, your graph only shows inserts, you either you don't understand data structures or you are trolling, either way sage...
>>
>>56246290
>4+ posts before the bump limit
>>
For fucks sakes look at the fucking post count before you post you fucking retard i hate you
thanks for your time
>>
>>56246320
You don't understand CPU caches
>>
>>56246331
You could write a linked list using a vector for allocation & small integer offsets (like a byte) rather than pointers

If the links aren't too distant it might be reasonable on a cpu
>>
>>56246290
>sorting a 300k element list
Just throw it all on the a heap and pop them off
>>
                        buf.append(String.format(
"#EXT-X-STREAM-INF:BANDWIDTH=%d\nhttp://127.0.0.1:" + getListeningPort()
+ "/%d/%d.m3u8", variant.bitrate, randomValue, count--));

what the fug
>>
What would happen if a cosmic ray flipped a few null terminators in a critical system running C code?

Would the program crash?
>>
nth for C#
>>
>>56246517
>Doesn't write cosmic intervention error handling into all his programs

Tourist.
>>
>>56246517
That's why they don't use strings, infinite loop and pointers.
>>
What's the best language to be a 1337haxor with

Python.
>>
File: 1466329334062.jpg (24KB, 258x263px) Image search: [Google]
1466329334062.jpg
24KB, 258x263px
>>56246517
>he doesn't add redundancy to his program
>he adds redundancy to his program
>>
>>56246583
>anime image
>>
>>56246517
Nothing would happen - cosmic rays are not in the C standard
>>
I'm a TA and I saw this shit the other day in a 2nd year CS homework i was grading.

typedef double inches;
typedef double meters;

inches length1;
meters length2;
// ...
length1 = length2;
>>
Rude people go to hell!
>>
File: anime.png (201KB, 335x365px) Image search: [Google]
anime.png
201KB, 335x365px
>>56246694
Show me on the Microdoll where the big mean bullies insulted you
>>
File: 1470441794438.png (518KB, 846x475px) Image search: [Google]
1470441794438.png
518KB, 846x475px
I know this might be more of a /biz/ question but what's the minimum level of math required to get into algorithmic trading? Calc III, differential equations + Bayesian stats?

I'm just a lowly CS pleb so I've never taken a real analysis class, how useful would that be?
>>
>>56246694
SHART
>>
I've rarely found that I need a linked list, i.e. inserting/removing from one end or the other is not sufficient.
>>
>>56246313
>>I'll just import a library, I don't need to understand this!
Tfw guilty of this and I keep getting burnt for it. I'll never learn.
>>
>>56246853
I've rarely found that I need a linked list, i.e. inserting/removing from one end or the other is not sufficient.
>>
>>56246740
AFAIK it's quite math heavy so you will definitely need more than those very basic courses
>>
Is C++ primer the best book/source to start learning c++? I have a pretty good background in programming.
>>
>>56246886
>I have a pretty good background in programming.
You don't need a book
>>
>>56246664
really makes you think
>>
>>56246886
if you dont know c++ you dont have a pretty good background in programming
>>
>>56246886
I'd just Google whatever I need when I need something. Do you know C? Then just do that.
>>
>>56246313
>linked lists in Java
This makes me want to die. Why the fuck do they have to teach linked lists in Java when there's literally no upside to them? Why don't they teach fucking Lisp? Fuck "industry standards" we don't need any more code monkeys, we need programmers who can understand Lisp
>>
>>56246918
I only know Ocaml
>>
>>56246904
really made me think
hmmmm
>>56246918
/dpt/'s advice is sometimes solid, why not ask
>>
>>56246904
Nice meme faggot
>>
>>56246387
But that's a complicated data structure and only useful if you're inserting TONS of elems. There are indeed some use cases, e.g. allocation buffers, and the main upside to doing that is that pointers to within the array are not invalidated on resize. But for a large majority of dynamic lists you should be using vectors. Besides, vectors are easy as fuck in both C and C++, and exists in the core library of virtually every other language.
The only exceptions are Lisp and Haskell.
>>
>>56246944
Well my advice is if you already know how to program a book isn't necessary to learn C++.
>>
>>56246962
Excuse me?
>>
>>56246664
Why
>>
>>56246981
don't "excuse" me you fuckin nerd
>>
>>56246981
kys
>>
>>56247300
>>56247086
>>56246524
I think a minimum chars post threshold would definitely cut back a lot of the shitposting.
>>
>>56247316
>>
why doesn't this shit compile, you fucking nerds

#include <stdio.h>

int maine()
{
printf("Hello world!\n");

return 0;
}
>>
>>56247329
>int maine
>maine

>>56247316
Posts are limited to about 2000 characters
>>
>>56247329
Figure it out
>>
>>56247329
>This much of a bait

it's because you are a moron.
>>
>>56247329
try this:

int mayne ()
{
printf("Hello, world!\n");
return 1;
}


>>56247333
Not max chars, I mean like every post has to be atleast 16 characters excluding backlinks
>>
>>56247329
It should compile just fine. Linking might fail, though :^)
>>
File: 1455646931200.jpg (26KB, 731x565px) Image search: [Google]
1455646931200.jpg
26KB, 731x565px
>>56246290
making a jpg exif remover
any constructive criticism? this is my first real project so dont be rood pls
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main(int argc, char*argv[])
{
FILE* file;
char* file_bin;
long f_len;
if(argv[1] != NULL)
{
file = fopen(argv[1], "rb");
fseek(file,0,SEEK_END);
f_len = ftell(file);
rewind(file);
file_bin = (char*)malloc((f_len+1)*sizeof(char));
fread(file_bin,f_len,1,file);
fclose(file);

if((uint8_t)file_bin[0] == 0xff && (uint8_t)file_bin[1] == 0xd8 && (uint8_t)file_bin[2] == 0xff && (uint8_t)file_bin[3] == 0xe0 )
{
printf("Image is valid JPEG\n");
for(int i = 0;i<64;i++)
{
if((uint8_t)file_bin[i] == 0x45)
{
if((uint8_t)file_bin[i+1] == 0x78)
{
if((uint8_t)file_bin[i+2] == 0x69)
{
if((uint8_t)file_bin[i+3] == 0x66)
{
printf("Image has EXIF data\n");
break;
}
}
}
}
}
}
else if((uint8_t)file_bin[0] == 0xff && (uint8_t)file_bin[1] == 0xd8 && (uint8_t)file_bin[2] == 0xff && (uint8_t)file_bin[3] == 0xe1 )
{
printf("Image is valid JPEG\n");
}
}
else
{
printf("No JPEG to remove EXIF from");
}
return 0;
>>
>>56247392
Fix those nested if statements my dude
>>
>>56247392
The if statements cause me worry. Nothing should have that many levels of indentation.
>>
>>56247392
                if((uint8_t)file_bin[i] == 0x45)
{
if((uint8_t)file_bin[i+1] == 0x78)
{
if((uint8_t)file_bin[i+2] == 0x69)
{
if((uint8_t)file_bin[i+3] == 0x66)
{


in haskell this is just
all $ zipWith (==) (drop i file_bin) [ 0x45, 0x78, 0x69, 0x66 ]
>>
>>56247392
        if((uint8_t)file_bin[0] == 0xff && (uint8_t)file_bin[1] == 0xd8 && (uint8_t)file_bin[2] == 0xff && (uint8_t)file_bin[3] == 0xe0 )

// replace with

if (memcmp(file_bin, "\xff\xd8\xff\xe0", 4) != 0)

// and

if((uint8_t)file_bin[i] == 0x45)
{
if((uint8_t)file_bin[i+1] == 0x78)
{
if((uint8_t)file_bin[i+2] == 0x69)
{
if((uint8_t)file_bin[i+3] == 0x66)

// replace with

if (memcmp(filebin + i, "Exif", 4) == 0)
>>
>>56247408
>>56247417
fixed
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

//Don't remove first 21 bytes (File header?)
//24 - 27 is EXIF Tag
int main(int argc, char*argv[])
{
FILE* file;
char* file_bin;
long f_len;
if(argv[1] != NULL)
{
file = fopen(argv[1], "rb");
fseek(file,0,SEEK_END);
f_len = ftell(file);
rewind(file);
file_bin = (char*)malloc((f_len+1)*sizeof(char));
fread(file_bin,f_len,1,file);
fclose(file);
/*
for(int i = 0;i < f_len;i++)
{
printf("%x ", file_bin[i]);
printf("%x ", (uint8_t)file_bin[2]);
}
*/

if((uint8_t)file_bin[0] == 0xff && (uint8_t)file_bin[1] == 0xd8 && (uint8_t)file_bin[2] == 0xff && (uint8_t)file_bin[3] == 0xe0 )
{
printf("Image is valid JPEG\n");
for(int i = 0;i<64;i++)
{
if((uint8_t)file_bin[i] == 0x45 && (uint8_t)file_bin[i+1] == 0x78 && (uint8_t)file_bin[i+2] == 0x69 && (uint8_t)file_bin[i+3] == 0x66)
{
printf("Image has EXIF data\n");
break;
}
}
}
else if((uint8_t)file_bin[0] == 0xff && (uint8_t)file_bin[1] == 0xd8 && (uint8_t)file_bin[2] == 0xff && (uint8_t)file_bin[3] == 0xe1 )
{
printf("Image is valid JPEG\n");
}
}
else
{
printf("No JPEG to remove EXIF from");
}
return 0;
}
>>
>>56247392
Why not:
if((uint32_t)file_bin[i] == 0x45786966) {
printf("Image has EXIF data\n");
break;
}

?
>>
"main" was the worst choice for entry point.
>>
>>56247329
try adding
#define maine main
>>
>>56247316
hahaha kys
>>
>>56247392
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main(int argc, char **argv)
{
FILE* file;
char* file_bin;
long f_len;
if(argv[1]) {
file = fopen(argv[1], "rb");
fseek(file,0,SEEK_END);
f_len = ftell(file);
rewind(file);
file_bin = (char*)malloc((f_len+1)*sizeof(char));
fread(file_bin,f_len,1,file);
fclose(file);

if((uint8_t)file_bin[0] == 0xff &&
(uint8_t)file_bin[1] == 0xd8 &&
(uint8_t)file_bin[2] == 0xff &&
(uint8_t)file_bin[3] == 0xe0 ) {
puts("Image is valid JPEG");
for(int i = 0;i<64;i++) {
if((uint8_t)file_bin[i] == 0x45) &&
((uint8_t)file_bin[i+1] == 0x78) &&
((uint8_t)file_bin[i+2] == 0x69) &&
((uint8_t)file_bin[i+3] == 0x66) {
puts("Image has EXIF data");
break;
}
}
} else if((uint8_t)file_bin[0] == 0xff &&
(uint8_t)file_bin[1] == 0xd8 &&
(uint8_t)file_bin[2] == 0xff &&
(uint8_t)file_bin[3] == 0xe1 ) {
puts("Image is valid JPEG");
}
} else{
puts("No JPEG to remove EXIF from");
}
return 0;
}
>>
>>56247470
Because type punning is bad, your code depends on the endianess of the target system, and you did it incorrectly.
>>
>>56247473
STFU
>>
>>56247473
Literally what would be a better option, and give me an actually valuable argument about why
>>
>>56247374
>>56247480
still not working:
#define maine main
int mayne ()
{
printf("Hello, world!\n");
return 1;
}
>>
>>56247517
>OSGTP
>valuable argument
wew wew wew
>>
>>56246971
The Haskell standard literary specifies an Array module.
https://hackage.haskell.org/package/array
https://hackage.haskell.org/package/vector
>>
>>56247528
no no no, its
char* maen()
{
printf("Hello, world!\n");
return 1;
}

tard
>>
>>56247517
Pick a function at random
>>
>>56247564

Thanks for posting so I didn't have to.
>>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>

int main(void) {

int n, i;
char *charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#&/()=?";
srand(time(NULL) * strlen(charset));
printf("Length: ");
scanf("%d", &n);
for (i = 0; i < n; i++) {

int r = rand() % strlen(charset);
printf("%c", charset[r]);

}
printf("\n");
}


tell me why i suck
>>
>>56247606
rand() is garbage no matter what you seed it with
>>
>>56247606
because you call strlen too many times
>>
>>56247618
I thought that argument only applied to cryptography.
What should I use instead?
>>
>>56247606
>main doesn't return anything
fired
>>
use xorshift

uint64_t xorshift(uint64_t *state)
{
uint64_t x = *state;
x ^= x >> 12;
x ^= x << 25;
x ^= x >> 27;
*state = x;
return x * UINT64_C(2685821657736338717);
}
>>
File: maxresdefault.jpg (135KB, 1920x1080px) Image search: [Google]
maxresdefault.jpg
135KB, 1920x1080px
What kind of algorithms did Sean Murray use to make No Man's Sky?

and what language?
>>
>>56247606
What's this a drunkposting program?
>>
>>56247586
STFU
>>
>>56247665
>What kind of algorithms did Sean Murray use to make No Man's Sky?
rand() from C
>>56247665
>and what language?
Java
>>
>>56247665
bubble sort, sieve of eratosthenes

Standard ML
>>
>>56247661
C99 allows that
>>
>>56247665
Genetic algorithms in Malbolge
>>
>>56247392
>
uint8_t

Unportable

>FILE*
You should instead write type *var.

Also, learn to use &&
>>
>>56247729
>C99
Yes and coprophagy is a thing too.
>>
>>56247606
You need to use size_t for r.
>>
Anyone have a programming challenge for someone who's literally just learned the basic of Python?
>>
>>56247764
Check if two words are anagram of each other
>>
>>56247764
a program that outputs its onwn source code
>>
>>56247764
Generate random names
>>
how hard is it to learn xlib? how long?
i really want to make my own tiling wm
>>
>>56247801
Too long, it'd be easier to wrap SDL2 or somethnig
>>
My job is basically 4 or 5 sorting algorithms and a few basic scripts but irl
>>
>>56247781

import collections

def anagram(s1, s2):
if collections.Counter(s1) == collections.Counter(s2):
return True
return False
>>
>>56246853
I'm the opposite.
> working as code monkey on the side
> image recognition in Python
> source images are in HSV colorspace but when I load them they're interpreted as BGR
> look up BGR to HSV conversion on Wikipedia
> implement it
> could have just used a function in an image processing library I was importing anyway
Did the same for calculating mean, median and standard deviation of lists of values. Wasted so much time.
>>
File: justzoom.jpg (23KB, 366x364px) Image search: [Google]
justzoom.jpg
23KB, 366x364px
SOMEBODY SEND HELP
I'm trying to run this
https://java.net/projects/glassfish-samples/sources/svn/content/trunk/ws/javaee7/websocket/tictactoe/docs/index.html

On intelliJ idea

the first error was the JavaFX dependency, i had to delete it because i'm using jdk 1.8 so that fixed it

When i run the maven build i get another error in the client

Exception in Application start method: Handshake response not received.

> org.glassfish.samples.tictactoe.client.TicTacToeClient.startGame(TicTacToeClient.java:150)
> org.glassfish.samples.tictactoe.client.TicTacToeClient.start(TicTacToeClient.java:117)

>container.connectToServer(LocalEndpoint.class, null, new URI(SERVER));
and SERVER is
>private String SERVER = "ws://localhost:8080/tictactoeserver/endpoint";

inb4
>Glassfish
>>
>>56247428
Is zipWith just a fold that takes two functions instead of one?
>>
>>56247764
design your own relational database software in python
>>
>>56246290
Honestly, if you do manual cache prefetching and don't allocate any memory then they give great performance when used in memory blocks inside memory pools to mark memory. I can't really think of a replacement.

Like:

struct MemoryNode
{
MemoryNode* next;
uint8_t flag;
};
>>
>>56247823
do you think, xmonad uses xlib and its only 1200 LOC
surely there can't be many uses of the xlib, just some general useful functions
>>
>>56247831
def anagram(s1, s2):
return sorted(s1) == sorted(s2)
>>
>>56247787

import sys
print(open(sys.argv[0]).read())

>>56247801
There's a modern successor, xcb something. If you are learning from 0 you might want to go for it directly.
>>
what's a comfy beginner book to read on summer? Something to not keep me thinking for hours so I don't tire myself during summer vacation but still don't want to completely take a break from programming. doesnt have to be about a specific language. Also im just a first year so smth easy.
>>
>>56247764
make a word based video game
>>
>>56247801
X11 is fucking garbage.
>>
>>56247795

depends on what you define as a 'name'

import random as r

ab = 'abcdefghijklmnopqrstuvwxyz'

def random_names():
name = ''
for i in range(r.randint(3, 12)):
name += ab[r.randint(0, 25)]
return name
>>
>>56247975
Wayland is OOP bullshit so what other fuckign option is there
>>
>>56247975
that's a pretty bold accusation
>>
>>56247992
Unfortunately, nothing.

>>56248001
Have you ever tried using Xlib or XCB? XCB makes it marginally less painful, but the whole protocol (because it's a protocol and not a regular API) is disgusting.
>>
Can I suicide by programming?
>>
why the fuck is there no interpreter for c
just somethingt that takes a c expression and outputs the result
I always have to make another mini program to test if it would work
>>
>>56248085


def kill_Self(me):
pass

>>
>>56248085
 self.kill = True 
>>
>>56246313
I try to reinvent the wheel and learn everything from first principles... but the amount of knowledge, languages, paradigms, standards, protocols, and frameworks made over the last 70+ years is absolutely maddening. Once you think you've learned how something "really" works it just opens up more questions. I mean does anyone know every machine instruction that executes every time you call printf() or create an object? How many of us would be able to recreate all these things if society was wiped out and had to start over? I've just accepted that I'll never be a 100% expert at anything. It's abstractions all the way down to the electrons.

Relevant Feynman:
https://www.youtube.com/watch?v=36GT2zI8lVA
>>
>>56247890
Not a true quine
>>
I need to either find a free, or create my own reference/library (maybe based on the official EWS API?) in VB6 to be able to send emails without having an email client installed. I got it working just fine with a few test libraries I found online, but as it will be used commercially I can't use the ones I found.

I have never made something like this before as I always found some library I could use out of the box.

How do I start?

Why VB6 you ask? The application I need to make the script run in, only supports VB6.
>>
>>56247787
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))
>>
>>56248107
>>56248128
thx guiz
>>
how to translate
[code[
if (bool) ; else something;
[/code]
to use a ternary operator
>>
>>56248197
bool ? <condition true> : <condition false>;
>>
>>56248197
if (bool) ? : something;
>>
>>56248093
Are you trolling or retarded?
>>
>>56246866
I find I'm using queues (not so much stacks) regularly to be honest. Really matters in what you're doing cause they're niche; HashMaps and Vectors fill pretty much every other purpose.
>>
Sick of waiting for next clover release. How difficult is it to compile android apps on your own? I've heard it's difficult.
>>
>>56248259
little of both
>>
>>56248259
retarded, pls tell me
>>
>>56248271
Deques aren't really a far cry from vectors because they can be implemented as ring buffers. Linked lists are a completely different beast.
>>
>>56246740
im so happy this edit exist.
>>
>>56248131
printf() is pretty simple unless you're printing a float. Varargs aren't that difficult to understand. Printing text to the screen is very simple, even in x86 assembly.

You don't need to understand literally every step of the process, but knowing how and why it works is a good starting point and lets you reason about the actual problem solving you're doing much better.
>>
>>56248271
>>56248294
Also, vectors are stacks.
>>
>>56247841
what the fuck jsut happened in this post man
>>
>>56248294
Well if someone's using a linked-list for a lot of lookup activities they're doing it wrong since vectors are contiguous arrays which can be reallocated. Linked-list excel when they're being used for a lot of addition or removal from the ends; with vectors the memory has to be reallocated with more memory is needed or if the first element is being removed.

>>56248345
They can be used like a stack but they are by no means stacks, any point of data within a vector can be accessed unlike a stack, and removal of elements from a vector isn't limited to the last element pushed on top. They are implemented as contiguous arrays.
>>
>>56248407
>with vectors the memory has to be reallocated with more memory is needed or if the first element is being removed.
So you use a ring buffer. You have the same issue with reallocation to increase capacity as vectors, but it's cheap to add/remove from the front.
>>
>>56247606
>* strlen(charset)
Why?
>>
File: niggsect.png (406KB, 853x1224px) Image search: [Google]
niggsect.png
406KB, 853x1224px
can somebody explain and give an example of monad transformer to me
I can't seem to understand them
>>
>>56248131
This is not really abstraction. More like citing text that you never read.
>>
>>56248460
Instead of doing
Maybe (m a)
you do
MaybeT m a
. It's more convenient, that's all.
>>
>>56248476
so, merge the parent container with the child container
into a big container?
>>
>>56248499
>container
What?

Monad transformers work by using type classes to elide explicit calls to "lift".
>>
>>56248476
what are the implications of doing it like the latter
>>
>>56248522
all monads are container
Maybe is a container
>>
>>56247606
why bother multiplying the system time of rand by a constant value. you're getting the same amount of randomness.
>>
>>56248527
See >>56248522 (although by "lift" I mean "return" as "lift" is a monad transformer thing)
The monads are composed for you.

>>56248547
>all monads are container
That's a really disingenuous way to think about monads.
>>
>>56248499
A big container that has all the facilities of both the smaller ones, yes. Check the type of
runMaybeT
-like functions to get it better though. Also I think order matters (it's been some time).
>>56248476
Dumass
MaybeT m a 
boils down to
m (Maybe a)
not the opposite
>>
>>56248589
Righto. I've kind of had a falling-out with monad transformers and monads in general since learning about algebraic effects.
>>
File: téléchargement.png (3KB, 229x220px) Image search: [Google]
téléchargement.png
3KB, 229x220px
>>56248598
Noice. I forgivu yu.
>>
>>56248589
>>56248598
where do u learn this
do you read blogs?

what kind of exercises should I do so that I can better understannd
>>
>>56248582
>disingenuous
maybe, but they are a container
no better way to hink of them
>>
Can anyone explain why this fails? I'm just learning C++
/*first.h*/
#include "second.h"

namespace A{
namespace B{

class Example : public OtherClass{
private:
SecondClass second;
};

}
}



/*second.h*/
namespace A{
namespace B{
class SecondClass{
/*...*/
};
}
}


This fails with error:
"../src/first.h:132:5: error: ‘SecondClass’ does not name a type"
>>
>>56248658
There isn't a "way" to think about monads.

data Term a = Var a | Abs (Maybe a) | App a a

This is a monad. Is it a container?

newtype Cont r a = Cont { runCont :: (a -> r) -> r }

Is this a container?
>>
>>56248704
Yes and yes.
>>
>>56248700
I have no clue but maybe
SecondClass second;
needs to become
int SecondClass second;
>>
File: 1403752704210.png (2MB, 1024x768px) Image search: [Google]
1403752704210.png
2MB, 1024x768px
Threadly reminder that lisp > hasklel
>>
>>56248704
yes, term contains a
and contr contains r and a
>>
>>56248718
>contr contains r
No just a.
>>
hey guys newfag here been working on python for the past week. so far i have made a program that checks whether a website is down for everyone or just you and a program that steals and decodes firefox and chrome login data. now i've been working on a rock paper scissors game for the past 30 minutes , cuz it was in one of the suggestion info graphics. the game is functional but my computerchoice function is shitty and repetitive do you guys have any suggestions to clean up the code.
 def computerchoice():
choices=['rock','paper','scissors']
computerchoice=choice(choices)
if computerchoice == 'rock'and playerchoice== 'scissors':
print "The computer has played 'rock'and you played 'scissors', You lose sorry"
elif computerchoice == 'rock'and playerchoice== 'paper':
print "The computer has played 'rock'and you played 'paper', You win congratulations"
elif computerchoice == 'rock'and playerchoice== 'rock':
print "The computer has played 'rock'and you played rock, You tie play again"
elif computerchoice == 'paper' and playerchoice== 'paper':
print "The computer has played 'paper' and you played 'paper', You tie play again"
elif computerchoice == 'paper' and playerchoice== 'scissors':
print "The computer has played 'paper' and you played 'scissors', You win congratulations"
elif computerchoice == 'paper' and playerchoice== 'rock':
print "The computer has played 'paper' and you played rock, You lose sorry"
elif computerchoice == 'scissors' and playerchoice== 'paper':
print "The computer has played 'scissors' and you played 'paper', You lose sorry"
elif computerchoice == 'scissors' and playerchoice== 'rock':
print "The computer has played 'scissors' and you played rock, You win congratulations"
elif computerchoice == 'scissors' and playerchoice== 'scissors':
print "The computer has played 'scissors' and you played 'scissors', You tie play again"
playerinput()
>>
>>56248644
Ask yourself "why is it this way and not the other way around?". This makes you find mnemotechnics and insights faster than you can imagine. (Works for me obviously.) Then find more what-ifs and try silly things in one-file projects just to see where it breaks. (Good especially if you swim into the maths stuff like I do.) I guess.

Reads:
Docs are precious if you read them the right way. (Hoogle is your friend for real) And mathy blogs that I find randomly. (codewords.recurse.org as a recommendation today. Good and varied shit altho they are SJWs.)
>>
File: 1436043462898.png (102KB, 450x443px) Image search: [Google]
1436043462898.png
102KB, 450x443px
>you will never find a comfy part-time programming job

Why am I even alive?
>>
What's the best advice you could give to an aspiring software developer? What piece of advice
changed your programming life?
>>
>>56248804
Learn C, Caml and Coq.
>>
>>56248709
nope the type is
SecondClass
, and I supose that by including the header file and being in the same namespace it should be accesible
>>
>>56248812
ocaml?
>>
>>56248828
yes
>>
How will I know when I have a language down?
>>
>>56248856
whats so good about ocaml
>>
>>56248865
It works, it's fast and fucking easy.
>>
>>56248718
>contains
Type arguments aren't types of contained values, although the type of contained values is often a type argument.

For t a to be a container of a, there should be exactly one set of zero, one or more values of type a that can be derived from a value of type t a. [a] has its elements, but r -> a returns different sets of one a depending on its argument, so it's not a container.

No source by the way, just a quick rambling.
>>
>>56248812
On that order? Never heard of Caml, and Coq. Sounds interesting, after I finish learning C. I will try those languages out. Thanks.
>>
>>56248885
>On that order?
Yes.
>>
int main(){ //main is the name of my prograym (get it, it kinda rhymes)
printf("Hello World"); // prints ( I don't have a printer though O_o)"hello world"
return Hello // doesn't print "hello world", why even include this???
} //closes program
>>
>>56248891
If you don't mind me asking. What are Caml and Coq used for exactly? I already found some decent pdfs about them already, but haven't breezed through them because I wanna finish my C book first.
>>
>>56248873
faster and easier than haskell?
how mature is it
how can I make a good gui app
>>
>>56248816
Not an expert, but opening a namespace block maybe doesn't automatically entails an implicit "using namespace ...". Try A::B::SecondClass. No one bothers I guess because everyone works outside of namespaces anyway.
>>
File: Screenshot_2016-08-25_00-33-04.png (29KB, 420x374px) Image search: [Google]
Screenshot_2016-08-25_00-33-04.png
29KB, 420x374px
>>56246290
-module(seven).
-export([seven/1]).


seven({X,Y,Z}) ->
case isprime(Y,2) of
true ->
case X==Z+1 of
true -> Y;
false -> seven({X,Y+1,Z+1})
end;
false -> seven({X,Y+1,Z})
end;
seven(X) ->
seven({X,2,0}).

isprime(Y,A) ->
case A=<math:sqrt(Y) of
true ->
case Y rem A of
0 -> false;
_ -> isprime(Y,A+1)
end;
false -> true
end.

Is there anything wrong with this Erlang code? It's the seventh project Euler problem btw, that's why it has this stupid name (yeah I guess the module and the function should have a different name). It's supposed to calculate the nth prime, so calling seven:seven(25). would return 97, the 25th prime number.
>>
>>56248718
>term contains a
Useful instances of that type don't contain any a.
data Empty

-- (λx.xx)(λx.xx)
omega :: Term Empty
omega = App (Abs $ App (Var Nothing) (Var Nothing)) (Abs $ App (Var Nothing) (Var Nothing))


>and contr contains r and a
No.
>>
>>56248920
Coq is for theorem proving and verification.

OCaml is general-purpose but mostly used in finance and in compilers.
>>
>>56248923
Everything in a namespace can see other things in the name space
>No one bothers I guess because everyone works outside of namespaces anyway.
baseless assumption, polluting the public namespace is bad.
>>
>>56248933
>posting literal redundancy
>>
simple JS question, why doesn't this palindrome-checker function work?


function palindrome(str) {
// Good luck!
var strRev = "";
var i=str.length;
while (i >= 0) {
strRev += str[i-1];
i--;
}
if (strRev == str) return true;
else return false;

}



palindrome("eye");

>>
>>56248969
Pic is there because of better syntax highlighting, code is there so people can run it if they wish to.
>>
>>56248965
>Everything in a namespace can see other things in the name space
No, you'd need to "using namespace" first, or have them one after the other in the *same* namespace block. Yes it *is* weird and it makes weird sense in a weird way.
>>
>>56248922
>faster and easier than haskell?
Look for benchmark. I'm sure that caml is faster than haskell, but maybe I'm wrong.
>how mature is it
As mature as C89.
>how can I make a good gui app
That's a tricky part.
>>
>>56248976
>i-1 in a context where i could be equal to zero
>>
>>56246290
I really want to learn to code but I have no idea where to start so I came to /g/. Can you guys give me some sort of advice? I tried to learn python off of codeacademy but I ended up with more questions than answers after 30 mins or so. Where should I start?
>>
>>56248759
bait
>>
>>56249002
does ocaml even have ncurses bindings?
>>
>>56249038
SICP K&R C language Lisp don't learn Java or C# because I had to learn C and so should you
>>
So I hear github is a good place to start and did a bit if poking around about it. Apparently there's some huge drama about it, but I can only find bits and pices of the story. Would anyone mind filling me in?
>>
>>56249050
actually its not, im just shit.
>>
>>56247392
>any constructive criticism?
Yes. It's shit.
>>
>>56249038
Maybe you could ask some of your questions here. Alternatively, you can watch some youtube tutorials and then continue with codecademy, perhaps you're better at understanding things in a video format.
>>
>>56247392
>What is memcmp
>>
>>56249001
Welp I already tried with the full name
A::B::SecondClass
and including the
using namespace A::B;
but neither of that fixes the error. I don't know why but even the IDE (QtCreator) does not 'detect' SecondClass as autocompletion.
>>
>>56249117
Uh? Really really weird. Try
::A::B::SecondClass 
because after that I'm out of ideas. Also now I'm going to bed.
>>
>>56247764
Write your own kernel in python.
>>
>>56249093
how constructive, you could atleast tell me what i did wrong
>>
>>56249098
Well I pretty much know nothing about coding. Tips on which language is good for a beginner would be nice. I was thinking python but should I follow what this anon said?
>>56249062
>>
>>56249083
>drama
they must have been fighting over their memelangs
>>
>>56249162
ya C Lisp is only good language, don't let anything help you

better use assembly or Haskell actually
>>
>>56246320
Inserts should be linked lista advantage over arraylists/vectors
>>
>>56248772
do part time engineering jobs even exist?
>>
>>56249162
He's just making fun of the retards who recommend K&R, assembly and the like to beginners, see >>56249188. I think python should be a good language for a beginner, although I don't think there is such a huge difference in hardness between C and python, so basically learn what you want (and what is better suited to what you want to do, e.g. if you want to make android apps, don't learn haskell).
>>
>>56248772
What makes an engineering job comfy?
>>
>>56249259
he wants to be paid to write fizzbuzz implementations
>>
>>56249141
fuck I just realized that
second.h
had an
#ifndef SECOND
that conflicted with another file outside the namespace.

Thanks for the help though
>>
Is it bad to use a lot of libraries on C? Does <stdio.h> have everything that you need to make programs that work?
>>
>>56249351
You shouldn't feel bad about using standard library functions if that's what you're saying.

Also, no.
>>
>>56249351
No program needs libraries to work. But if you intend to communicate in any way with the OS you will need them.
>>
>>56249443
>if you intend to communicate in any way with the OS
Just implement your own version of what the library does.
>>
>>56249351
headers are not functions
and no, stdio does not have everything
>>
File: comfy anime girl.jpg (73KB, 1280x720px) Image search: [Google]
comfy anime girl.jpg
73KB, 1280x720px
>eclipse marks wherever you have TODO: commented so you can scroll right to all the stuff you need to do
i do this anyways, i forgot how comfy java is
>>
>>56249083
Some girl was harassed and some dude left. Probably on a news site somewhere
>>
>>56249515
>Java is Eclipse
>>
>>56249528
lots of stuff that makes java on eclipse comfy can't be done with other languages
>>
>>56249351
>Does <stdio.h> have everything that you need to make programs that work?
No, it only has IO.
stdlib.h is significantly more necessary since it has the memory management stuff.
>>
>>56249351
>>56249368
>>56249471
>>56249564
Aight, it seems that I have a lot more to learn. Thanks for the answers guys, let me get back into programming.
>>
>>56249515
/TODO
or just Ctrl-F it.
It's not like you need an extra functionality to search for "TODO" in your code.

And seeing "You have 56 TODO's in your project!" is more demotivating than just jumping to the first you come across and working on that!
>>
File: ree.gif (2MB, 216x150px) Image search: [Google]
ree.gif
2MB, 216x150px
>can't cast from int to boolean in java
REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE I FORGOT HOW MUCH I FUCKING HATE JAVA
>>
>>56249683
Can't you just do something like this but in Java:
bool something = integer != 0;


?
>>
>>56249683
If there was ever a reason to hate Java, it's not this.
>>
>>56249683
Get creative anon
>>
>>56249683
I hate Java, but you're probably retarded.
>>
i'm a junior in college
>>
>>56249683
doesn't !!foo work?
>>
>>56249854
i'm trying to subtly ask you guys if there's an obvious elegant way of doing this i'm missing. because i feel like there is and i'm just missing it. it's addition for very large binary numbers
>>
I'm trying to build Conway's Game of Life in react.js.

I'm stumped on how to even start this. How should I create the grid?
>>
>>56249854
i don't know what language is that but if it has fallthrough case statements you can shorten it to something like this:
switch (tempSum) {
case 0:
case 1:
carry = 0;
sum[i] = tempSum;
break;
case 2:
case 3:
carry = 1;
sum[i] = tempSum - 2;
break;
}

you can make it even shorter but i think it gets a little confusing and i wouldn't really recommend it:

carry = tempSum > 1 ? 1 : 0;
sum[i] = tempSum - (tempSum > 1 ? 2 : 0);


(didn't test any of the snippets)
>>
i thought of a problem driving back from class yesterday and was going to post it here but the autistic janitor on /int/ got me banned and i just remembered. how would you most effectively make a numbering system that can store the MOST integers with 10 different symbols (1234567890), with an equal or near equal number of positive and negative values, with a set number of positions?
>>
>>56249963
i thought the version using logic would be easier to read. it IS short but i think i'll keep the case version just because the prof gave a lecture about form reflecting function the other day and its easier to read
>>
is this a good way to generating random-numbers?
what do you guys use?
#include <random>
#include <iostream>

int main()
{
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_int_distribution<int> dist(1, 50);

for (int i=0; i<100000; ++i)
std::cout << dist(mt) << std::endl;
}
>>
>>56250004
i'm the one who thought of the problem and my quick answer is to make highest order symbol mean the value is negative if it's 9, and otherwise the value is positive.

that way you can have 00000 -> 89999 positive (0 through 89,999) and 99999 -> 90001 (-9,999 through -1) but the range of values isn't very close for positive and negative and i'm sure there's a better way to do it anyways
>>
>>56250079
i've only used srand. dont see a reason to use anything else
>>
>>56249057
yes
>>
>>56250165
QUICK, write an ncurses program that lets you browser through the filesystem
>>
I refuse to use any data structure other thank linked lists. I once implemented a hash map using a linked list, a stack, and a single string. It was very fast and outproformed the standard library.
>>
File: 1409793996850.jpg (32KB, 480x454px) Image search: [Google]
1409793996850.jpg
32KB, 480x454px
>>56250220
>a single string
>>
>>56250004
>>56250118
If x is even, it encodes x/2, so 26 would represent 13, 2400 would represent 1200 and so on. If x is odd, it encodes -(x+1)/2, so 1 represents -1, 3 represents -2, 139 represents -70 and so on. Maximum efficiency.
>>
>>56250220
whats a haskmap and how is it useful

is the last element of an array always \0 in C?
is it counted in the length?
can I access it?
>>
>>56248976
why not just do
// ...
var i = str.length - 1;
while (i >= 0) {
strRev += str[i--];
}
// ...
>>
>>56250248
No. C strings are null-terminated by convention. C string literals are null-terminated, and the str* functions use null-termination instead of a passed length (as in their mem* counterparts).
>>
>>56250137
xddddd
>>
>>56250274
explain more, im a noobie
what do u mean by null-termination
and whats with the *
>>
>>56250312
'\0' = null
>>
>>56250220
Is the linked list part for collisions? Because that's pretty normal.

>>56250248
A hashmap is a datastructure where associated key-value pairs are stored in buckets, the buckets being identified by a unique hash. When inserting a key-value pair into the hashmap, a hashing function is applied to produce a hash then it is placed into the bucket with that hash. later when you retrieve the value using the key it hashes the key, compares it with the hash of the bucket, and if it matches then the key-value pair is in the bucket. If more than one key hashed to the same bucket (a collision) there is usually a method used to retrieve the pair with matching key (eg. the bucket is a linked list of key-value pairs).

No, it has to be manually set by the programmer if it wasn't initialized with a string literal.
If using string functions like strlen, no, but it is included in the space taken up by the array.
yes.
>>
>>56250312
>what do u mean by null-termination
It means that a string is always ended by the null character, which is always 0.
So the string "hello" is represented in memory as 'h', 'e', 'l', 'l', 'o', '\0'.

>>56250220
>linked lists
>Not binary trees
>>
>>56246313
>>I just want to make games and websites, why do I need this theory crap??
Are you trolling me, Anon? There are no fucking jobs that give even half a shit about optimization, and anything that does wants someone with a PhD. Theoretical computer science is fucking useless.

I'm fucking #triggered. I could have sat down and read a book about javascript/jQuery, then lied about having a college degree and gotten a job in like 2 seconds. Instead I had to go get my fucking Bachelor's in Theoretical CS so I could work a wageslave job and drown in debt.

ProTip: Unless a business has millions of concurrent users, optimization is fucking pointless. Libraries are already (for the most part) optimized.
>>
>>56250208
no I'm on my phone you faggot
>>
>>56250422
excuses, faggot
>>
>>56250389
>Libraries are already (for the most part) optimized.
What if you need to do something NEW?
>>
ok, im trying to print the lines which have more thatn 80 chars

i made a char current[1000], for holding the current stream, and a int count for counting
if I reach an \n before count = 80, then how do I delete current[1000], aka, make it as though i just declared it
>>
>>56246971
common lisp has resizable and fixed-size arrays
>>
>>56250556
When you just declared it, it is garbage. So doing nothing and treating it as garbage would work.
>>
>>56250556
I assume you're talking about C.
You can't manually deallocate automatic variables.
Just leave the array being too large, and using that int to count how much of that array you're using.
>>
>>56250535
You don't need to do something new you fucking faggot. There are 6 billion people+ on this planet, and the internet has been around for over 25 years. Somebody fucking came up with it already.
>>
char *xss_sanitize(char *str)
{
static const char *escape[UCHAR_MAX] = {
['\"'] = "&quot;",
['\''] = "&apos;",
['<'] = "&lt;",
['>'] = "&gt;",
['&'] = "&amp;"
};
unsigned i;
for (i = 0; str[i]; i++)
{
unsigned char c = str[i];
if (escape[c])
{
unsigned offset = strlen(escape[c]);
str = (char *) realloc(str, strlen(str) + offset + 1);
memmove(&str[i+offset], &str[i+1], strlen(&str[i+1]) + 1);
memcpy(&str[i], escape[c], offset);
}
}
return str;
}



I think my compiler is ignoring my intent.
xss_sanitize(input); /* randomly corrupts strings */

This function writes to a char pointer directly and returns the same pointer back.
Sometimes tho, it replaces the input pointer with garbage unless i explicitly return the pointer back to itself like this:
input = xss_sanitize(input); /* works fine */


How do I stop this shit?
>>
>>56250635
>This function writes to a char pointer directly and returns the same pointer back.
Not necessarily.
You're using realloc, which might not return the same pointer back, so you pretty much have to do it the second way, or use a pointer to a pointer in your arguments.
>>
>>56250635
>How do I stop this shit?

Neck yourself or start using a trip so I can shitlist you, I'm tired of your stupidity, unwillingness to learn without asking to be spoonfed all the time, and using a wrong tool for the job.
>>
>>56250635
wtf, how can a function be a pointer
>>
>>56250671
It's returning a pointer.
>>
>>56250671
>how can a function be a pointer
you fucking what?
>>
>>56250626
Yeah man, shoot for the ground, the stars are too far away am I right.
>>
>>56250671
Well that function isn't even a pointer, it returns a pointer, but function pointers are a part of the language.
>>
>missed preregistration deadline
How fucked am I?
>>
File: are_you_serious.jpg (35KB, 221x344px) Image search: [Google]
are_you_serious.jpg
35KB, 221x344px
>>56246517
What happens if neutrinos from the sun triggered false positives in my cloud chamber?!?!?!???!? Oh no!!1!!
>>
I have no interest in programming.
I want to learn for employment.
I want a job ASAP.
I don't care if it's $500/week.
1.What should I learn?
2.How should I demonstrate skill to recruiters?
3.Should I make up previous jobs on my resume?
4.What jobs should I apply for?
5.Where do I look for jobs, craigslist?
>>
>>56250851
Just flip burgers.
>>
>>56250851
>I have no interest in programming.
Then why the hell would you want to be a programmer then?
Do something else.
>>
>>56250851
>asking questions that he should've learned the solutions to in high school
Just flip burgers.
>>
>>56250869
because i want $80K starting?
>>
any better way to do it?
#include <stdio.h>
#define MAX 1000

int main () {
char current[MAX];
int c, count=0;
while ((c = getchar()) != EOF) {
current[count] = c; ++count;
if (c == '\n') {
if (count < 80) count = 0;
else {
for (int i = 0; i < count; i++)
printf("%c", current[i]);
count = 0;
}
}
}
return 0;
}
>>
>>56246517
>>56250804

Ever heard of bitsquatting?

It's a thing, and there are major consequences for it. Heat/badly doped IC's also account for flipped bits.

That's why a majority of DNS look up errors happen due to mobile phones being too hot.

https://www.youtube.com/watch?v=ZPbyDSvGasw
>>
>>56250908
If you don't care about programming they'll put you in the mail room.
>>
Is it me or is navigation much slower and more cumbersome in emacs than in vim?
>>
File: img_054.png (263KB, 456x620px) Image search: [Google]
img_054.png
263KB, 456x620px
>>56251042
Oh no 2.7T radiation from billions of light years away in outer space is going to flip my switches!!1!1!!! What do I do??!?!/?!??!/!/!
>>
>>56251020
haskell is bettter
main = getLine >>= putStr . foo 80 >> main
where foo n xs = if length xs < n then "" else xs++"\n"

took me literally 30 seconds
>>
>>56251117
In your case? Get pwned it seems.
>>
>>56251146
>I don't understand what CMBRs are but I'll keep replying as if I know anything
Oh no!!!!
>pwned
Cringed so hard.
>>
File: crapstack.jpg (43KB, 700x524px) Image search: [Google]
crapstack.jpg
43KB, 700x524px
>>56250908
You are the plague of the industry. I don't expect or want everyone I work with to be some high-energy "technology enthusiast" who maintains a blog on software development and commits to 20 open source projects. But the people who go into the field only for the paycheck and have absolutely zero interest in CS are the worst. Shitty no-effort code, no knowledge beyond the bare minimum scraped from Stack Overflow. Boring because they view any sort of problem as an impediment to their paycheck that they have to half-ass through instead of a chance to learn or do something cool. You take all of the fun out of programming.

Luckily most of you burn out in undergrad or within a year or two of working.

Just become a dentist or something, no one expects you to be interested in your job then.
>>
>>56251020
Overall, it's fine, but there are several small things you can do to clean it up.
#include <stdio.h>
#define MAX 1000

int main()
{
char current[MAX];
int c, count = 0;

while ((c = getchar()) != EOF) {
current[count++] = c;

if (count == MAX || c == '\n') {
if (count >= 80)
printf("%*s", count, current);
count = 0;
}
}
}

I believe this is equivalent to your program, besides the overflow check.
I think my changes are somewhat self explanatory.
>>
File: solve (2).jpg (208KB, 1280x720px) Image search: [Google]
solve (2).jpg
208KB, 1280x720px
>>56251186
You only have yourself to blame for specializing in a field that's so easy to get into lmao
>>
>>56250869
I want a cushy job, with a chair, so I can sit.
>>
So I've getting into coding and all why does the following command not work?

enter main ()
{
printer("A word!!\n");
return 1;
}
>>
>>56251243
What language is that even supposed to be?
>>
File: light_kek.png (160KB, 253x424px) Image search: [Google]
light_kek.png
160KB, 253x424px
>>56251243
>>
>>56251189
wow, that looks so nice

>the printf line
how does it work
>>
>>56251243
>; instead of :
>>
whats the smallest program ever?
>>
File: 1472011082992.jpg (215KB, 1000x1000px) Image search: [Google]
1472011082992.jpg
215KB, 1000x1000px
>>56251348
ur dick
>>
>>56251298
>>56251189
Actually, looking back on that printf, I made a slight mistake.
It should have a dot, like:
printf("%.*s", count, current);

You can pass numbers into printf to affect how long the thing you print is.
So "%4s" will make the string always print something at least 4 characters wide, padding it with spaces if it's shorter.
"%.4s" will print 4 characters maximum. You can use this to print non-null terminated strings.
You can also replace the number with an asterisk, and you can pass the length in as an argument.

You should take a look at printf's documentation. There is actually a lot of neat shit you can do with it.
>>
If I have a string 0.8 or 1.0 or similar outputted from grep, how do I use bash to convert it to a number and do math with it?

getting sick of useless errors and shit documentation
>>
>>56251348
If you language allows empty files, it would be that.
>>
>>56251243
'return' should be 'exiter', you exiter functions that you enter
>>
Does anyone here know how to write programs in LLVM IR? How did you learn it?

I want to learn how to write it by hand in preparation for using it as a compile target for my language.
>>
>>56251174
watch the video.

>cringed so hard
'okay'
>>
wait, not all char arrays are string in C?
>>
>>56251571
Right. Something is only a string in C if it's null terminated.
char arr[5] = {'h', 'e', 'l', 'l', 'o'};

isn't a string.
>>
>>56251571
No? I think the concept of "strings" in C are "null terminated char arrays" therefore a string that isn't null terminated can't be called a string? You could pass the size to know the length tho.
>>
>>56251584
char *lel = "lello", ecksDee = *lel;
lel += 5;
*lel ^= ecksDee;
>>
File: 1411553396785.jpg (409KB, 2048x1152px) Image search: [Google]
1411553396785.jpg
409KB, 2048x1152px
Next thread is going to be data themed
>>
File: le nigger shitpost.png (194KB, 640x342px) Image search: [Google]
le nigger shitpost.png
194KB, 640x342px
>>56251633
>le i'm such a le nerd xDDDDDéééé
>>
>>56251633
>DAE Star Trek?!?!? xDDxddd lolol I'm sos smart I watch a sci-fi series!!11
>>
why is c so comfy
it so mature too
wow, I need it
>>
File: 1417567490721.png (360KB, 538x477px) Image search: [Google]
1417567490721.png
360KB, 538x477px
>>56251644
Tell me more
>>
>>56250659
>pointer to pointer
This works.

I still have a lot to learn about pointer indirection, thanks.
>>
File: inoperable reddit cancer.png (53KB, 571x618px) Image search: [Google]
inoperable reddit cancer.png
53KB, 571x618px
>>56251672
Consider sudoku
>>
>>56251392
you don't do math with bash. but if you reallt need to, there is apcalc
>>
File: 1411965046073.jpg (6KB, 229x220px) Image search: [Google]
1411965046073.jpg
6KB, 229x220px
>>56251702
>stop liking things waaaaaaaaaaaa
>>
File: back_to_reddit.png (9KB, 355x46px) Image search: [Google]
back_to_reddit.png
9KB, 355x46px
>>56251725
Pathetic lmao
>>
File: reddit bitch.jpg (114KB, 557x305px) Image search: [Google]
reddit bitch.jpg
114KB, 557x305px
>>56251725
>>
>>56251728
>>56251735
Why is it that all the newfags think everyone is from reddit?
>>
>>56251736
>that projection
>>
File: 1425593845210.jpg (51KB, 473x555px) Image search: [Google]
1425593845210.jpg
51KB, 473x555px
NEW THREAD >>56251748
NEW THREAD >>56251748
NEW THREAD >>56251748
>>
>>56251759
>Created before 310
>Posting your stupid agenda
Delete this shit and kill yourself.
>>
>>56251717
Just need basic stuff. Times ten, plus one, etc

Ended up figuring it out soon enough anyways

current=$(ps -ef | grep redshift | grep 'redshift \-b' | tail -c 4)
number="${current//.}"
declare -i number
echo $number
echo $((number * 10))
>>
>>56248131
Love that vid, I don't even have time to explain why I don't have time to explain
>>
>>56251775
DELET THIS
>>
File: happycat.jpg (35KB, 400x400px) Image search: [Google]
happycat.jpg
35KB, 400x400px
>>56248976
>JS
not sure if you can do this in JS, but in Java you can ... nevermind you can do this in JS, too:

call the charAt function in a conditional to match
the character being compared and checked. Since your assignment is an easymode string of three characters, all you need is a simple if/else for it to work

http://www.w3schools.com/jsref/jsref_charat.asp
var str = "HELLO WORLD";
var res = str.charAt(0);

in this case, res is assigned the value of H.

so you might want something like:
if (str.charAt(0) == str.charAt(2))


get used to calling functions...sorry... methods, in pajeet-speak, to make your JS learning experience a lot easier.
>>
I've just started learning programming, I've got this code:
#include <stdio.h>

int main()
{
printf("Hello world");
return 0;
}

But when I run it nothing comes out of my printer.
What am I doing wrong?
>>
Hi, guys. I'm pretty rusty. Can you guys check my work?

class DynamicStringArray
{
public:
DynamicStringArray(); // Default Constructor

private:
int size; // holds the number of entries in the array
};

DynamicStringArray::DynamicStringArray() // sets the dynamic array to NULL and sets size to 0
{
string *dynamicArray;
dynamicArray = new string[NULL];
size = 0;
}


Any corrections or tips?
>>
How does nanosleep work if my system clock is only 1000 hertz?
Thread posts: 319
Thread images: 32


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