[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

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

Thread replies: 255
Thread images: 16
File: hime uses thinkpaddu.png (788 KB, 1280x722) Image search: [Google]
hime uses thinkpaddu.png
788 KB, 1280x722
old thread: >>53826391

What are you working on, /g/?
>>
>>53831641
Please make more hime edits.
And requesting Hime's tickling punishment.
>>
I just made a square and circle in a console application.
>>
>>> from sys import getrecursionlimit
>>> def get(base = 0):
try:
return get(base + 1)
except:
return base


>>> get()
994
>>> getrecursionlimit()
1000
>>>

Explain why these are not equal?
>>
Any good x64 linux assembly book?
Also,i was doing the drpaulcarter.com 32 bits examples ,i tried to link the file and then my PC crashed.
WTF
>>
>>53831719
Because Python is not a predictable language suitable for real time systems.
>>
>>53831719
try running it outside the idle
>>
>>53831719
998 with command-line python. A stacktrace shows
File "<stdin>", line 1, in <module>
as the first frame, and we are counting from zero, so that makes sense.
>>
Why is casting from void * necessary in C++?
>>
>>53831719
Frames are probably being added by your IDE.
>>
>>53831824
Beaurocracy
>>
how do I unlearn Lisp
>>
>>53831883
Remove the parentheses keys from your keyboard
>>
Am I going to make it even if I get stuck on first chapter exercises in SICP? They're like really hard.
>>
Are brackets an anti-pattern?
>>
>>53831824
it's an implicit cast in C, not so in C++

I still do it anyway
>>
>>53831894
SICP is an algorithms book, not a beginner text.
>>
>>53831907
There is no such thing as implicit cast. Please learn what a cast is.
And why is it necessary?
>>
>>53831929
>SICP is an algorithms book
> Second, we believe that the essential material to be addressed by a subject at this level is not the syntax of particular programming-language constructs, nor clever algorithms for computing particular functions efficiently, nor even the mathematical analysis of algorithms and the foundations of computing, but rather the techniques used to control the intellectual complexity of large software systems.
>>
>>53831957
it's not a beginner text, either way

it teaches you to write your own interpreter
>>
Let's say I have
int x[100];

Would doing
int y[10][10] = x;
y[5][5] = 5;
undefined behaviour?
>>
>>53831974
which everyone learns in cs 101
>>
>>53831974
>it's not a beginner text
It is. It was taught in a freshman curse in MIT even for people that did not go for CS.
Moreover, making an interpreter is not magic or difficult, especially if you use a language like scheme and it's something that everyone who finishes their first CS year should know.
>>
should i go to UCSB, UCSD or Cal Poly SLO for CS?
>>
I ordered a K&R and didn't look at the picture, they sent me a poo in loo version.

How do I disinfect it?
>>
>>53832073
Burn it and order a new one
>>
>>53831719
>recursion limit is 1000 and no tail call optimisation

why the fuck would someone use that language
>>
>>53831719
because p. is really, really cancer
>>
>>53832099
Python isn't a recursive/functional language
>>
>>53832099
i think some implementations do have TCO but it's still a FUCKING SHIT AS SHIT language and it gets used because people are cancer
>>
>>53832099
it's a system limitation not a language limitation
>>
>>53832134
functioning*
>>
>>53832185
why do you hate it so? did guido van rossum shank you with a rusty knife?
>>
>>53832240
who
>>
>>53831982
That code won't compile. x decays into a pointer in the first statement, which means that you are trying to assign a variable of type
int[10]
to a variable of type int*, which can't be done because they are incompatible types.
>>
In shell, how do I list the contents of a directory in order to iterate through them, if they have spaces in their filenames.

I'm using
for file in `ls $dir`; do

but file becomes, say, "with" and then "space" instead of "with space".
>>

int n = 4;

// Return the factorial for the specified number
public static long factorial(int n)
{
if ( n== 0)
return 1;
else
return n * factorial(n - 1);

}



I don't understand the return 1 part when the factorial is suppose to return 24 wouldn't it just return 1 instead? Can someone explain
>>
>>53832270
he created python
>>
>>53831628
I just always thought that making new branches for every reasonable change is a good practice.
>>
>>53832393
in many ways that is the same as shanking someone with a rusty knife
>>
>>53832368
for file in "$dir"/*; do ....
>>
>>53832388
factorial is a function, n is the parameter
the int n outside of the function is completely seperate and has nothing to do with the function whatsoever

what you meant was

factorial(4); (after the function)

if you look at the function body, it only returns 1 if n is 0
this is called a base case
factorial(0) = 1

if n is not one, it returns N * factorial(n - 1) - i.e. 5! = 5 * 4! = (5 * 4) * 3! = (5 * 4 * 3) * 2! = (5 * 4 * 3 * 2) * 1! = (5 * 4 * 3 * 2 * 1) * 0! = 5 * 4 * 3 * 2 * 1 * 1
>>
>>53831982
In C and C++, that declaration isn't syntactically valid. With just
int y[10][10];

Separate space would be allocated for y, and y is treated as if it were declared as int *const y, and you cannot reassign it.

However, you can do that conceptually using pointers, and have the y variable share the same memory space as x:
int x[100];

int *y = x;
y[5][5] = 5; // valid
>>
>>53832605
that is not valid either
>>
>>53832605
>>53832618
Right, sorry, the declaration should be
    int x[100];

int **y = reinterpret_cast<int**>(x);
y[5][5] = 5;
>>
>>53832699
that is not valid either, please stop
>>
File: functional programming vs.png (2 MB, 1000x3000) Image search: [Google]
functional programming vs.png
2 MB, 1000x3000
Come check out /fpg/ and #/g/fpg on Rizon!

>>53819299

We miss moot! We're definitely praying that we'll have namefagging and Google Plus support soon!
>>
>>53832699
Not C
>>
Let's suppose I want to get values from standard input but the separator is any kind/amount of whitespace. What's a proper way to do that in C#? I would like to avoid string splitting.
>>
>>53832311
This?
int x[100];
((char[10][10])x)[5][5] = 5;
?
>>
Anyone have any experience with nonblocking asynchronous web server frameworks? Looking at one of a few possible options and wondering what's the best in terms of performance/speed when supporting high traffic (several dozens/hundreds/thousands). Wanted to get some optioninions, here are our options:

-Blocking MVC (e.g. Spring) with nonblocking database connector (e.g. Postgres async)
-Nonblocking asynchronous framework like Vert.x with nonblocking (e.g. Postgres async)
-Nonblocking asynchronous framework like Vert.x, but with blocking database connector like JDBC

Is there any benefit of going with option 2 over option 3?
>>
>>53832890

char[] whitespace = { '\n', '\t', '\r', ' ' };
foreach (char c in string)
if (!whitespace.contains(c))
yield return c;
>>
>>53832926
whoops misread
>>
>>53832926
>char[] whitespace
Might as well pass it to Split. As I said, I want to avoid temporary strings.
>>
Should I back it? Seems ok. https://www.kickstarter.com/projects/520965826/basil-the-comprehensive-programming-language
>>
>>53832471
why would you put the /* outside of the quotes? What if any file in that dir has a space in the name?
>>
>>53833025
doesn't make a difference, the wildcard isn't expanded at that point
>>
>>53833070
still pretty fucking ugly
>>
>>53833022
looks like shit
>le ebin jobs quote
xD

And the quotes... 100% true I bet.
>>
File: .png (50 KB, 678x89) Image search: [Google]
.png
50 KB, 678x89
>>53833022
>one more "I just wanna make games" niche language
>>
>>53833089
What about the Twitter thing?
>>
>>53833089
These people never heard of "libraries"
>>
>>53833022
>shilling this hard

why the fuck would you pay for some douchebag to make meme language #12371328787231

if the creator was remotely serious he would just make the language without demanding money for it and he'd get rich either way if he made the language to completion and it wasn't complete shit
>>
>>53833022
>image class has jump function
>there is a collision checker in global space
just wow
>>
>>53833022
it's literally just like python with a few libraries thrown over it
any language could be made to be that "simple" by using library functions
>>
>>53833086
I just did it to make it clear that the quotes are only there in case the variable contains spaces.
>>
>>53833022
>Over 95% of Computer Science graduates are incapable of creating the simple FizzBuzz program in a language of their choice.
topkek
if you can't make a fizzbuzz you have a bigger problem than your language syntax.
But since this language seems "ready" where is a working implementation? I see none.
I bet it's a scam
>>
>>53833106
What does it even do? What is https://twitter.com/intent/user?user_id=1 is 404 for me. was that supposed to be a json output or something and the code prints first 10000 people?

also
>i = 100000
>for i to 99999
wth
>>
>>53833022
no, look at the 12 yo behind it and their twitter account
>>
>>53833176
in basil you can do fizz buzz in 1 line!
fizzbuzz

it is that easy!
>>
>>53832471
Thanks.
>>
>>53833209
wow this cancerous fuccboi is just trying to pilfer €5000 off of the kickstarter meme

either that or he's delusional as fuck about his programming ability
>>
>>53833209
https://twitter.com/caolanfleming
>I won
>imgur is giving me shekels
>10 followers
lol'd
>>
>>53833240
read his entire twitter
>>
anybody has debugger working in visual c++ for linux thing? I get "unable to start program 'app_process' The debugger is not properly installed" BS. And no idea where to dig to fix this: gdb_server seems to be running, build goes through just fine.
>>
File: .jpg (122 KB, 500x500) Image search: [Google]
.jpg
122 KB, 500x500
>>53833022
>tfw planning to make a forth-inspired language with fancy modern syntax features but always postponing it trying to come up with real new shit
Another HQ9+? These niggas haven't even read the dragon book. Mount stupid at its finest.
>>
>>53833022
>Capitalism is bad
>Syndicalism is good
>retards can convince other retards to spend their investment dollars on retarded shit they aren't capable of pulling off

I designed a language too!
run game.
>>
>>53833286
for i = 100000
i to 999999
run game
std::tweet << "games for everyone"
>>
>>53833022
>We have a strong development team
>>We have a strong development team
:^)

Just wondering, what makes you think that it seems ok and where did you find this project? I get the feeling that you are the creator of it.
>>
>>53833327
>std::tweet
top kek
>>
File: yeb.jpg (196 KB, 800x763) Image search: [Google]
yeb.jpg
196 KB, 800x763
>>53833327
>tweet will be added to the C++ standard library in your life time
>>
File: Screenshot_2016-04-02_18-47-45.png (67 KB, 601x647) Image search: [Google]
Screenshot_2016-04-02_18-47-45.png
67 KB, 601x647
This seems deceptively easy
>>
>>53833329
>using the smiley with a carat nose
>>
>>53833327
>tweet being under std namespace
it should be global
>>
>>53833364
Literally a library function.
>>
>>53833364
find a tutorial with pictures, it will be easier to understand
>>
>>53833364
what a fucking annoying way to "explain" it. how about some examples. i know what they are i just think those are horrible explanations
>>
>>53833364
>cross product 3D
>not nD taking n-1 vectors
>>
>>53833353
wait what

pls no
>>
>>53833176
https://blog.codinghorror.com/separating-programming-sheep-from-non-programming-goats/
>>
>>53833416
These aren't explanations, these are just the subtitle paragraphs from wikipedia - it's supposed to be a short correct summary. If you think you could do better you can always help and contribute to the wiki.
>>
>>53833022
>Pledge €7,000
>You get to rename Basil, no holds barred!

>NO HOLDS BARRED!

this sounds like a fucking /g/ challenge to me
>>
>>53833475
C--
>>
>>53833475
Dicks+=
>>
>>53833491
or F--
>>
>>53833475
BASIL
:^)
>>
>>53833468
Well, it does say how dot product is calculated does and what it is, but in a very complicated way
>>
>>53833475
That's what they want though. They have no obligation to finish it, and will just walk off with all of your money.
>>
>>53833514
v1 = a b c
v2 = 1 2 3

v1 . v2 = a1 + b2 + c3
>>
>>53833555
this does not explain the importance of dot product though.
>>
>>53833555
sqrt(v . v) = |v|
>>
>>53833468
this: >>53833514 and imo the roll thing should have a bit more effort put into it than just linking to wikipedia

>>53833475
fuck off shill
>>
>>53833571
neither does the original description
>>
>>53833571
(a.b)
------- = cos(theta)
|A||B|

where theta is the smallest angle between a and b


a.^b
where ^b is a unit vector
is the magnitude of a in the direction of b / the projection of a along b
>>
>>53833591
>it is the product of magnitudes of the vectors and cosine of the angle between them
>>
>>53833613
>>53833600
a.b = |A||B|cos(theta)
>>
>>53833613
which is completely meaningless to anyone who doesn't even know what a dot product is
>>
>>53833422
Cross product is uniquely defined only in the basis of 3 vectors, last time I checked.
>>
>>53833623
>>53833600
whoops A should be a and B should be b
>>
>A certain string-processing language allows a programmer to break a string into two pieces. Because this operation copies the string, it costs n time units to break a string of n characters into two pieces. Suppose a programmer wants to break a string into many pieces. The order in which the breaks occur can affect the total amount of time used. For example, suppose that the programmer wants to break a 20-character string after characters 2, 8, and 10 (numbering the characters in ascending order from the left-hand end, starting from 1). If she programs the breaks to occur in left-to-right order, then the first break costs 20 time units, the second break costs 18 time units (breaking the string from characters 3 to 20 at character 8), and the third break costs 12 time units, totaling 50 time units. If she programs the breaks to occur in right-to-left order, however, then the first break costs 20 time units, the second break costs 10 time units, and the third break costs 8 time units, totaling 38 time units. In yet another order, she could break first at 8 (costing 20), then break the left piece at 2 (costing 8), and finally the right piece at 10 (costing 12), for a total cost of 40.

>Design an algorithm that, given the numbers of characters after which to break, determines a least-cost way to sequence those breaks. More formally, given a string S with n characters and an array L[1..m] containing the break points, compute the lowest cost for a sequence of breaks, along with a sequence of breaks that achieves this cost.

how do i do this with dynamic programming and not brute force?
>>
>>53833633
i don't even get it (from what little effort i put into understanding it), it's just a wall of text with no "visual" examples
>>
>>53833633
>she

>dynamic programming
come up with a recursive solution to the problem first
>>
>>53833022
I pledged 100 to this, got the beta, they actually have a really impressive way of integrating the jump, collide, move, etc. functions. They only import the function if it's used in the program, so it's not like it's a bloated or anything.It's decent on Windows and Linux(all native code) but on Mac it's basically a glorified Python pre-processor, slow as shit. They said it's just a concept and they'll improve it. It is in beta I guess but I have 0 faith in them completing it. If you're using OSX don't donate to it until they update the beta. I wouldn't trust a 14 year old to complete it(https://twitter.com/caolanfleming).
>>
>>53833631
retarded choice by retarded mathematicians, some aren't this retarded and use the smart definition

you can extend it to an n-ary product that computes a vector perpendicular to all arguments in n+1 dimensions

e.g. in 2D it takes one argument
>>
File: sink2.jpg (1015 KB, 4288x2848) Image search: [Google]
sink2.jpg
1015 KB, 4288x2848
Is HTDP a good book for someone with no experience?
>>
>>53833715
you should check basil
>>
File: smugfuck.png (49 KB, 566x429) Image search: [Google]
smugfuck.png
49 KB, 566x429
>>53833252
Y? Seems pretty normal
>>
>>53833352
we fucking need this
>>
>>53833089
>while true
Trash it.
>>
>>53833841
Whoah, why would anybody name a girl after a failing jetbrains IDE?
>>
>>53833737
not sure if trolling or just retarded
>>
import std.stdio;
import std.math;

struct Vector
{
int mag;
double angle;
}

int algDotProduct(int[] a, int[] b)
{
assert(a.length == b.length);

int ret;

for(int i = 0; i < a.length; ++i)
{
ret += a[i] * b[i];
}

return ret;
}

double geoDotProduct(Vector x, Vector y)
{
double theta = x.angle > y.angle ? x.angle - y.angle : y.angle - x.angle;
return x.mag * y.mag * cos(theta);
}

Alright, that wasn't too painful
>>
>>53833914
What's wrong with CLion?
>>
File: lmao.jpg (34 KB, 413x395) Image search: [Google]
lmao.jpg
34 KB, 413x395
>>53833914
kekt hard
>>
>>53834055
What language?
>>
>>53834073
shill harder
>>
>>53834095
rust
>>
>>53834095
D
>>
>>53834095
meme
>>
>>53834112
genuinely asking, I find it quite nice and haven't been able to find anything that stands up to it. that's why I was wondering.
>>
>>53834129
std.numeric has dotProduct

>>53834124
>>53834129
dot product is
fold (+) (zip (*) a b)
>>
>>53834095
haskell
>>
>>53834055
that is a retarded vector definition
>>
>>53834152
>fold (+) (zip (*) a b)
how about
sum $ zip (*) a b
>>
>>53834152
>std.numeric has dotProduct
I really should read through the library at some point
>>53834178
What would be better
>>
File: 1459286386228.jpg (716 KB, 2448x3264) Image search: [Google]
1459286386228.jpg
716 KB, 2448x3264
>>53831641
anyone know what register atof() returns in?
x86_64 linux btw
>>
>>53834190
yes that's what I said
>>
>>53834227
>What would be better
uh, coordinates?
>>
>>53834146
well I haven't touched it yet and I haven't touched it because it doesn't even have a community version - that's why I wrote that it's failing, it may be indeed very nice though.
>>
>>53834247
https://en.wikipedia.org/wiki/X86_calling_conventions#cdecl
>>
>>53834280
If you're a student you can get it for free
https://www.jetbrains.com/student/
>>
>>53834275
That seems irrelevant going by the geometric definition
>>
File: 1449346520711.jpg (74 KB, 691x780) Image search: [Google]
1449346520711.jpg
74 KB, 691x780
Hey guys I'm gay as fuck:
What do I do here if i want everything in the impl block to be public?
impl Weapon {
fn new(desc: &'static str, dmg: u32) -> Weapon {
Weapon {
name: desc,
damage: dmg
}
}
}

pub impl and normal fn new? normal impl and pub fn new? pub both?
>>
>>53834227
Array
>>
>>53834247
xmm0
>>
>>53834286
>Integer values and memory addresses are returned in the EAX register, floating point values in the ST0 x87 register
>>53834423
>xmm0
guess I'll try both
>>
/g/ I need help, I have everything to print out the way I want to and I feel like everything functions well however I cannot get a function that I wrote to print out all of the averages of the numbers I imported correctly. Any insight guys? Here are the two separate functions involved.

void calculateGrade(double tstData[][COLUMN], char gr[], int count)
{
for (int i = 0; i < count; i++)
{
if (tstData[i][COLUMN - 1] >= 80)
{
gr[i] = 'N';
}
else if (tstData[i][COLUMN - 1] >= 60)
{
gr[i] = 'L';
}
else if (tstData[i][COLUMN - 1] >= 50)
{
gr[i] = 'R';
}
else
gr[i] = 'H';
}
}


void print(string n[], double tstData[][COLUMN], char gr[], int count)
{
cout << left << setw(10) << "Name"
<< right << setw(18) << "1990"
<< setw(10) << "2000"
<< setw(10) << "2005"
<< setw(10) << "2012"
<< setw(10) << "Highest"
<< setw(10) << "Grade" << endl;

for (int i = 0; i < count; i++)
{
cout << left << setw(18) << n[i];
cout << right;

for (int j = 0; j < 5; j++)
cout << setw(10) << tstData[i][j];

cout << setw(8) << gr[i] << endl;
}
cout << endl << endl;
cout << "Group Ages 15-24 Years Old Highest Employment Average: "
<< calculateGrade /*WHERE I WANT TO PRINT OUT THE AVG*/ << endl;
}
>>
>>53833022
it's like a code golf language for shitty 2d games
>>
>>53834587
reread whatever tutorials you're using
>>
>>53834587
it is impossible to calculate average of numbers in C, you have higher chances at solving P=NP
>>
>>53834587
Just do a for loop over elements in tstData:
double sum = 0;
for (int i = 0; i < count; ++i)
{
sum += tstData[i][COLUMN - 1];
}

return double / count;
>>
>>53834651
*
return sum / count;
>>
>>53834651
>double / 2 will never be float
Why live?
>>
>>53834456
I can't fucking find it
    mov    rdi, [r12+8] ; r12 has argv
call atof

mov rdi, format_test ; "%f", 0x0A, 0x00
fst qword [rsp] ; can I move floats directly to gp regs?
mov rsi, [rsp] ; google said I can't, but that doesn't seem right
call printf ; prints 0.000000

I'm new to assembly, pls no bully
>>
>>53834864
also someone needs to tell hiroshimoot that replacing tabs with 4 spaces is not cool
>>
>>53834878
4 spaces is the only acceptable conversion
>>
File: Boba Fett.jpg (566 KB, 2560x1600) Image search: [Google]
Boba Fett.jpg
566 KB, 2560x1600
I've been studying C# for a couple of months now for a bit each day.
If I start taking studying more seriously and doing a lot more each day, how long do you guys think it would be before I could start doing freelance work?

Also, how is freelance work?
I really like the idea of changing projects regularly, doing different project for different people, and being able to work from home at whatever times I'm comfortable with.

Although, I can imagine there are downsides to freelancing, as well. I'm just not sure what those would be.
>>
sup /dpt/. quick concurrency design question here (C++, I'm new to threads).

I have Thread A that reads some raw data, parses it, puts it in an object. I have n other threads that are taking those objects and doing work with them. will a std::vector be sufficient, efficient and thread-safe to store the objects that Thread A corrects for the n threads to subsequently pop and use? should i emplace or push the objects in the vector if yes?
>>
>>53834864
on x64 it's saved into xmm0
check out gcc.godbolt.org you'll see how the returned value is handled
>>
>>53834938
use a mutex with the vector
>>
>>53833089

This snippet suggests that Basil is some sort of DSL for game development (which we already have plenty of), but it raises some questions immediately. First, where are the player and baddie sprites displayed relative to the screen? Presumably, since they are generated with the same constructor, if they are drawn to the screen immediately afterwards, they'd be drawn to the same location. The loop that follows should be rather useless unless the control() method is blocking, because collide should resolve immediately before the player has time to react. If it IS blocking, then you more or less have an "avoid the other guy" game, which can be played indefinitely if you play correctly.... unless of course the only possible way to move would in an area that would collide with the baddie after the wall bounce.

He complains that Python with Pygame is too verbose, but the reality is that it just requires you to specify things that quite frankly, need to be made explicit in the program. How big should the window be? Where should we draw the sprites? How do we tell that something is colliding? Maybe there are a lot of things colliding and we want to use quadtrees. Maybe the sprite should be allocated at program startup, but not drawn until after the player has gone through the menu. It seems a little silly for the language to interpret "create an image" as "create an image and draw it at a default location".
>>
>>53833022
confirmed shill. he posted here >>>53833907 also. Caolan I really suggest you stop doing this before you piss someone off here.

>>53834973
ok I was hoping there was someway I could avoid the mutex lock/unlock but it makes sense that I can't. Thanks man.
>>
>>53834961
cvtsd2ss        xmm1, xmm0

>cvtsd2ss
fucking
>>
File: theendpw.jpg (332 KB, 1600x1422) Image search: [Google]
theendpw.jpg
332 KB, 1600x1422
>tfw don't know how to make GUI so i'm using VB.NET
a gui for a c++ command line

Is VB.NET a meme?
inb4 C++ is a meme
>>
>>53832035
Cal Poly SLO. I graduated from there, had a blast, and got a really good job after graduating.
>>
>>53835032
>cvtsd2ss
Well it is pretty obvious that it's
>Convert Scalar Double-Precision FP Value to Scalar Single-Precision FP Value
What else would it be!
>>
>>53835106
>demands readability in assembly
>>
>>53835106
cvt = convert
sd = scalar double
2 = to
ss =scalar single
>>
>>53835144
wow you're pretty smart anon
>>
>>53835153
thanks retard
>>
        movq    rax, xmm0
mov QWORD PTR [rbp-8], rax
mov rax, QWORD PTR [rbp-8]
mov QWORD PTR [rbp-40], rax
movsd xmm0, QWORD PTR [rbp-40]

why
>>
>>53835234
Did you disable optimizations or something?
>>
>>53833022
>>53835001
shilling and underage.

https://www.siliconrepublic.com/discovery/2013/03/15/11-year-old-irish-kid-claims-to-be-europes-youngest-published-app-developer

>11 years old in Mar 2013
>only 14 today, kek
never too young to shill I guess, any mods around?
>>
how passionate do you have to be to major in cs? i'm really doubting my decision rn and idk what else i can do with my life
>>
>>53831641
whois $SEMEN_DEMON
>>
>>53835412

There are plenty of CS majors who have no passion at all for their field, and they generally tend to make an okay living writing enterprise Java or .NET shit. That said, if you don't really like software development, and you aren't really deep into your major, you can always change majors.
>>
>>53835520
Hime is not a semen demon.
He is the student council's dog.
>>
>>53835412
Well, you have to love something to do it every day. But I wouldn't change majors - 70% of college grads get job outside their field, as Ruby will find out once he graduates.
>>
>>53835412
whats your current major and why are you doubting it
>>
Stupid question, but what does this do in javascript?

<code> <script type="text/javascript">
function check(form1)
{
var string = form1.add.value;
</code>

trying to understand the significance of this statement
>>
>>53835784
Yes.
>>
>>53835784
nothing
>>
>>53835714
I'm a high school senior that got accepted to some pretty great schools for CS but I never really considered my major choice as much as I should have. Writing code can be pretty fun at times for me, but I really don't feel passionate about it. If I didn't get paid for it, I don't think I would enjoy doing it as a hobby or just for fun. I do well in math classes and enjoy the subject itself so I think that I could probably be passionate about some type of engineering and my parents want me to do engineering as well. I'm just really confused because I just don't really have a passion. I have a passion for art on the side but I don't think I could pursue art as a career because my parents wouldn't let me and it's pretty much too late now. Fuck
>>
>>53831889
You don't
>>
>>53835784
generates a syntax error
>>
>>53835805
>>53835797
Sorry i meant
var string = form1.add.value;

I know it doesn't do anything by itself, im just wondering what string holds after the statement
>>
>>53835819
Go into machine learning.
>>
https://github.com/ParsePlatform/parse-server/issues/1050
>>
>>53835874
This wouldn't happen if it were written in Basilscript.
>>
>>53835819
step 1: go to the school you feel you will enjoy the most.
step 2: go in undecided unless the counselors at your school shill you into picking one.
step 3: take some math, CS and engineering courses while getting involved in the university.
step 4: excel at all classes you take.
step 5: ???
step 6: try to get laid.
step 7: pick the major you feel is right based on coursework and classmates.

I changed majors three times in school and barely use my major, still get paid well. Don't freak out.
>>
>>53835859
why?
>>
File: [ELECTRONIC MUSIC].gif (498 KB, 320x240) Image search: [Google]
[ELECTRONIC MUSIC].gif
498 KB, 320x240
>VFMSUBADDPD

I'm going to get a raspberry pi now
>>
>>53834321
it's relevant as fuck idiot
>>
>>53833681
shut up idiot
>>
>>53836004
Feel free to articulate why anytime, as far as I can tell coordinates are irrelevant to calculating the dot product
>>
>>53836055
Because storing angle is fucking retarded
1) It's not easily extensible to more dimensions
2) It makes all other vector maths fucking retarded
3) Angle might not be the same type as distance
4) A million other fucking reasons like performance and consistency and shit

Literally why would you use radial coordinates as a default
>>
>>53836055
like when doing lighting in opengl you do it all the time to get the cosine of the angle
>>
>>53836069
*polar
>>
Why is typical java code lines recommended to be max 80? It leaves so much space on any widescreen monitor.
>>
>>53836055
the dot product for a 3d vector is dot(vec3(a,b,c), vec3(x,y,z)) = ax + by + cz with a,b,c and x,y,z being coordinates
>>
>>53836069
>>53836075
Interesting, I'll keep that in mind for when I'm doing more than simple challenge programs
>>
>>53834055
>algdotproduct
T algDotProduct(T)(T[][] args...)
{
return args.reduce!((a, b) => a *= b).reduce!((a, b) => a + b);
}
>>
>>53836111
why would you use polar coordinates for the simple challenge when you could use cartesian coordinates
>>
>>53836086
because you can open panes side-by-side
also there is some research indicating that lines longer than a 100 or so chars significantly lose readability
>>
>>53836086
it's only for neckbeards

you can use 120 or 140 or even 160 if you want, but in general i'd recommend not having lines too long, put a newline with double indent to signify a continued line
>>
>>53836086
Because terminal width defaults to 80. Mostly a relic from the past, but it general keeping lines short makes things more readable. Just don't sacrifice clarity for legibility.

int is_op_a_fag = 1;
int n = 1; // n for what?
>>
>>53836123
wait
>a *= b
a[] *= b[]
>>
>>53836123
surely one of those reduces should be a zip
>>
>>53836155
ohh, uses assignment
nice
>>
>>53836155
nah
reduce!((a, b) => a[] *= b[]) is an array wise multiplication
>>
Guys, I've got an idea. I'm going to make my own virtual machine architecture. It'll have a JIT like the CLR and JVM, but it won't have any garbage collection. I'll make a language to support it too! I'll call it D flat, which will behave almost just like normal D, but with even less library support! Now, I know what you're thinking. What kind of binary format will it use? Java's jar files are just zipped up piles of a custom .class file format, and .NET embeds everything into Portable Executable files with an entry point contained in a .DLL that defines the jitter. Well, after some real hard thinking, I've decided to use HTML as a target format. Think -- you could run bytecode in your web browser! Ain't that a useful and original idea?
>>
>>53836178
oy vey
>>
>>53836178
I didn't laugh
I want you to think about your post and why it didn't make me laugh and then try again
>>
>>53836171
(a[] * b[]).sum
>>
>>53836178
>D flat
I like it

>just like normal D, but with even less library support
b-but I can call C[++] code from D
>>
>>53836208
It's a variadic function
you could give it 400 arrays if you wanted to
>>
i = 100000
i to 999999
post "Shitposting from Basilscript" to 4chan.org/g
>>
>>53836223
reduce wouldn't work with that
>>
>>53836204

Because you can't appreciate satire?

>>53836209

Yeah, but you can't really use C(++) headers, can you?
>>
>>53836264
You can write, using (almost entirely) regular D code, a compile time C++ -> D transcompiler.
>>
>>53836264
Well, you do have the C library available to you and they're working on interop with C++
>>
I see absolutely no reason why you would ever need double precision floating point numbers.
Give me at least one situation where you would need them.
>>
>>53836317
money
>>
>>53836317
trying to resolve general relativity with quantum phyics
>>
>>53836317
when you want more precision

you fucking mong
>>
>>53836317
How else could you prove
1.0000000000000000000000000000000000000001 != 1
>>
>>53836325
You're supposed to do that with integers.

>>53836338
You don't need it.

>>53836340
Useless.
>>
ban double precision assault floats
>>
>>53836338
this
>>
>>53836317
when you do numerical data processing beyond fizzbuzz
>>
>>53836360
Yes I do
>>
>>53836419
What are you doing?
>>
>>53836360
Its not useless if you need to do it
>ie you need that many digits of precision for something
>>
>>53836317
You actually use them all the time: your CPU most likely uses 80 bit floats internally. If it didn't, even just adding like 3 times to a float would ruin the result. In fact on x86/x86_64, you should probably use double as often as possible, simply because there is no real performance downside (except storage space) compared to float.
>>
>>53836413
And just what exactly is there "beyond" fizzbuzz?
>>
>>53831938
char* str = someVoidPointer;

Is an implicit cast. You only specify the data type, not the operation (cast) done to it.
>>
>>53836429
Calculations I want to be precise with
>>
>>53836457
>no real performance downside
>>
>>53836360
>You're supposed to do that with integers.
Tell me, oh wise one, why are longs and ints the same in C?
>>
>>53836727
>why are longs and ints the same in C?
They're not.
>>
>>53836745
they can have the same size, depending on the implementation
>>
>>53836819
CAN, that doesn't mean they're always the same you fucking idiot.
>>
>>53836836
thanks for telling me, i had no idea
>>
>>53836819
>>53836836
But they can't?

The only thing actually imposed by the standard is that there is a definite ordering of sizes. They can't be the same size.
>>
>>53836925
http://ideone.com/RD2Q7y
>>
>>53836925
you haven't read the standard, have you?
>>
>>53836925
>They can't be the same size
Yes they can. On 32-bit Linux (System V i386), long and int are the same size (32 bits).
The standard only says
char <= short <= int <= long <= long long
with char being at least 8 bits, short being at least 16 bits (also imping that int >= 16 bits), long being at least 32 bits, and long long being at least 64 bits.
>>
>>53837009
>bits
>>
>>53831641
does there not exist any good feet pictures of hime?
>>
>>53837030
The C standard defines char in terms of bits, and everything else must be a multiple of char.
>>
>>53837030
bits please
>>
>>53837033
no
>>
>>53837009
> long and int are the same size
Isn't that a bit much?
>>
>>53837064
char can have more than 8 bits
>>
>>53837097
I said they CAN be the same size, and on a common implementation, they are.

>>53837106
>at least
>>
>>53837116
>not getting the joke

I'm outta here.
Thread replies: 255
Thread images: 16

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.