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

File: pair_programming2.jpg (298KB, 800x650px) Image search: [Google]
pair_programming2.jpg
298KB, 800x650px
Daily Programming Thread

What are you working on, anonymous ?

# New & Revised /dpt/ Code of Conduct #
We want to ensure that the /dpt/ community, while large and diverse, remains
welcoming and respectful to all participants. To that end, we have a few
ground rules that we ask people to adhere to.

- *Be friendly and patient.*

- *Be welcoming.* We strive to be a community that welcomes and supports
people of all backgrounds and identities. This includes, but is not limited
to members of any race, ethnicity, culture, national origin, colour,
immigration status, social and economic class, educational level, sex,
sexual orientation, gender identity and expression, age, size, family
status, political belief, religion, and mental and physical ability.

- *Be respectful.* Not all of us will agree all the time, but disagreement
is no excuse for poor behavior and poor manners. We might all experience
some frustration now and then, but we cannot allow that frustration to turn
into a personal attack. It’s important to remember that a community where
people feel uncomfortable or threatened is not a productive one. Members of
the /dpt/ community should be respectful when dealing with other members as
well as with people outside the /dpt/ community.

- *When we disagree, try to understand why.* Disagreements, both social and
technical, happen all the time and /dpt/ is no exception. It is important
that we resolve disagreements and differing views constructively. Remember
that we’re different. The strength of /dpt/ comes from its varied community,
people from a wide range of backgrounds. Different people have different
perspectives on issues. Being unable to understand why someone holds a
viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to
err and blaming each other doesn’t get us anywhere. Instead, focus on
helping to resolve issues and learning from mistakes.
>>
>>56982611
References are different from pointers you retard.
>>
>>56982628
When you're talking about performance they might as well not be.
>>
>>56982609
who could be behind this?
>>
3rd for C
>>
>>56982624
>pure
>R5RS
intothetrash.jpg
learn common lisp
>>
>>56982635
a concept and how that concept is implemented are two different things.
>>
File: 1399679322247.gif (3MB, 365x341px) Image search: [Google]
1399679322247.gif
3MB, 365x341px
>>56982609
>immigration status
>>
>>56982645
Feel free to let me know how else a reference is going to be implemented.
>>
Niggers no welcome.
>>
File: Capture.png (47KB, 919x591px) Image search: [Google]
Capture.png
47KB, 919x591px
r8 my fizzbuzz.
>>
>>56982635
isn't a reference usually implemented as a double pointer at least in a GC language?
>>
>>56982643
I know it already, thanks.
>>
File: 1462827754164.png (21KB, 447x197px) Image search: [Google]
1462827754164.png
21KB, 447x197px
are these good which one do i read first
>>
>>56982663
We're talking about C++.
>>
>>56982691
>it is less memory consuming tho
>
>>
File: foo.png (72KB, 629x434px) Image search: [Google]
foo.png
72KB, 629x434px
what can I use to make graphs that are like this, but less shitty?
>>
>>56982609
Working on a autodl-irssi clone for weechat. Uses the weechat relay protocol and matches for regexes inside of buffers.
>>
>>56982660
1
10
10/1
10/10
>>
>>56982691
>it is less memory consuming tho
A pointer is 4 or 8 times as large as a char on most platforms.
>>
Why the fuck doesn't Java have type inference. It's 2016.
>>
>>56982713
literally any language that can write output to a file3
>>
>>56982758
import java.awt.*;

public class InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState {

public static void SimpleNetBeansItsTheCurrentFuckingYear() {
System.out.println("CURRENT YEAR");
}

}
>>
File: Untitled.png (28KB, 956x436px) Image search: [Google]
Untitled.png
28KB, 956x436px
>>56982727
...
Oh. You were right.
>>
>>56982758
Because one of java's design goals is to be verbose as possible.
>>
Stop arguing retards.

https://ideone.com/o3VeCo
>>
I want to implement sanitization in my express app, using a module like sanitize-html or express-validator. Is it possible to just call their sanitization methods on the req object and be done with it, or will I have to manually iterate over every key I want checked, sanitizing them individually?
>>
>>56982584

 
#include <string>

int main()
{
std::string str;

for(int i=0; i<1000000; ++i)
{
str.push_back('p');
}

for(char &ch : str)
{
ch='u';
}

return 0;
}



I tried this with &ch and just ch and there was no performance difference.
>>
>>56982844
I hope you're meming.
>>
File: 1428670267684.jpg (60KB, 706x706px) Image search: [Google]
1428670267684.jpg
60KB, 706x706px
>>56982832
>>56982844
>>
File: ayy lmeow.webm (1MB, 640x640px) Image search: [Google]
ayy lmeow.webm
1MB, 640x640px
/dpt/-chan, daisuki~

>>56982758
It's considered bad for self documenting code and automatic generation of documentation. Note that Java has limited type inference.

>>56982654
A pointer is a typed address.
A reference is a number which is not necessary a memory address.
Two pointers pointing to the same object are always equals.
Two reference referencing the same object are not necessary equals.
Pointers have arithmetic, references don't.
A Reference can be implicit (no need to deference).

For the implementation, a reference could be an index in a table.

>>56982609
Thank your for using an anime image.
>>
>>56982844
They're both syntactic sugar for
for (char *ch = str.begin(); ch != str.end(); ++ch)
*ch = 'u';
>>
>>56982881
>It's considered bad
By whom?
>>
>>56982881
fuck off faggot
>>
File: smug monkey.gif (1MB, 500x354px)
smug monkey.gif
1MB, 500x354px
>>56982881
>Java
>self documenting code
>>
File: akari!.jpg (2MB, 1300x1560px) Image search: [Google]
akari!.jpg
2MB, 1300x1560px
still working on akari-bbs!

I got thread bumping working now, currently doing thread pruning.
>>
>>56982844
Hmmm...

#include <vector>

struct Huge { int a, b, c, d, e, f, g, h, j, k, l, m, n, r, o, p, q; };

int main()
{
std::vector<Huge> huge{};
for (int i = 0; i < 1000000; ++i) huge.push_back(Huge());
for (Huge &obj: huge) { }; // vs Huge obj: huge
return 0;
}


With reference:
mov     QWORD PTR [rbp-40], rax
lea rax, [rbp-160]
mov rdi, rax


Without a reference:
mov     rdx, QWORD PTR [rax]
mov QWORD PTR [rbp-256], rdx
mov rdx, QWORD PTR [rax+8]
mov QWORD PTR [rbp-248], rdx
mov rdx, QWORD PTR [rax+16]
mov QWORD PTR [rbp-240], rdx
mov rdx, QWORD PTR [rax+24]
mov QWORD PTR [rbp-232], rdx
mov rdx, QWORD PTR [rax+32]
mov QWORD PTR [rbp-224], rdx
mov rdx, QWORD PTR [rax+40]
mov QWORD PTR [rbp-216], rdx
mov rdx, QWORD PTR [rax+48]
mov QWORD PTR [rbp-208], rdx
mov rdx, QWORD PTR [rax+56]
mov QWORD PTR [rbp-200], rdx
mov eax, DWORD PTR [rax+64]
mov DWORD PTR [rbp-192], eax
lea rax, [rbp-160]
mov rdi, rax
>>
>>56982881
>A reference is a number which is not necessary a memory address.
>For the implementation, a reference could be an index in a table.
Explain how this could possibly work in C++.

>Two reference referencing the same object are not necessary equals.
You can't compare references themselves for equality in C++, it always compares the underlying objects.

>Pointers have arithmetic, references don't.
>A Reference can be implicit (no need to deference).
Doesn't matter for the implementation of a C++ reference.
>>
>>56982769
got any recommendations for libraries that make design easy?

I use python the most, but any language should be fine as long is making the graphs look pretty is easy once the data is in the graph
>>
>>56982900
by insecure Java devs who don't know better languages.
>>
>>56982883
No they aren't.

Without the reference, the characters in the string are never actually assigned 'u'.
>>
>>56982959
So the compiler doesn't optimize away what it's supposed to. Now make the for loop actually do something and see what it does.
>>
>>56982963
C++ tends to misrepresent concepts (reference, functor, vector, ...)

>>56982900
>>56982973
This guy
https://en.wikipedia.org/wiki/Gilad_Bracha
>>
>The value of a pointer becomes indeterminate when the object it points to (or just past) reaches the end of its lifetime.
The people of /dpt/ do not know why this is.
>>
>>56983010
I don't give a fuck about what C++ represents or misrepresents, the topic was the implementation of a C++ reference.
>>
first for go
>>
Ada (2005+) vs Common Lisp vs Fortran 2008?
>>
>>56983010
>(((https://en.wikipedia.org/wiki/Gilad_Bracha)))
hmm
>>
>>56983028
GC kicked in yo?
>>
>>56983010
>image
Confirmed huge flaming faggot (not that it wasn't obvious already). Consider a one-time dosage of Parabellum.
>>
>>56983049
i was tidying up my rob pike shrine
>>
File: Polluter.png (34KB, 571x443px) Image search: [Google]
Polluter.png
34KB, 571x443px
>>56983046
>>56983055
And here come the poltards desperate to defend themselves and their orange monkey.

Missed you chucklehucks reeeeeeal much.

Wouldn't be a real 4Chan thread without your oh-so-valuable contributions, right?

Now hush, raus, begone with you, you are: not. wanted. here.
>>
std::cout<< sizeof(char) <<std::endl;
std::cout<< sizeof(char&) <<std::endl;
std::cout<< sizeof(char*) <<std::endl;


1
1
4

Checkmate.
>>
>>56983055
based brendan eich
>>
Joining the ranks of the google empire through google scripts.

I made a pi security camera that can send text messages with an image if the alarm is on + movement spotted via gmail services. Now to learn android programming so I can control the pi from my phone...
>>
>>56983125
>c++
you already lost
>>
>>56983110
You started the derail, go away faggot
>>
>>56983010
>GRAB EM BY THE PUCCY
>>
File: 1474363420668.png (1MB, 1280x1385px) Image search: [Google]
1474363420668.png
1MB, 1280x1385px
>>56983046
>>56983055
> MUH jooz boogeyman
> MUH homophobia
> MUH samefigging
Go back to your containment board, you dumb stormtards. No one's buying your bullcrap.
>>
>>56983110
literally just you shitting up the thread with /pol/ meme bait.
>>
File: cs.jpg (1MB, 1904x4706px) Image search: [Google]
cs.jpg
1MB, 1904x4706px
>>56983159
>>56983055
Miss click, actually wanted to upload this one.

>>56983046
>>56982904
Please, don't
>>
>>56983110
>>56983161
Please read the OP. You're not allowed to discriminate based on board identity here.
>>
>>56983037
Ada 2012, it's 2005 with more features. You can interface with Fortran later if you want, it's trivial.
>>
>>56983125
>2016
>using 32-bit architectures
>>
>>56983168
I don't get the top comic
>>
>>56983168
you can't revert time faggot, we all know how faggoty you are
might as well have accidentally posted gay interracial furry cuck porn
>>
>>56983180
That's what I figured, Ada seems like a great all around language.

Modern Fortran has some interesting features like coarrays (if they're ever implemented) and I'm familiar with older Fortran... And I have a soft spot of course for Common Lisp..


Ada is probably the way to go though.
>>
>>56983125
>When applied to a reference or a reference type, the result is the size of the referenced type.
C++11 5.3.3/4
>>
>>56983168
i miss u ritchie
>>
>>56983235
There are modern Fortran compilers?
>>
>>56982963
>>56983010
>>56983019
references in C++ are syntactic constructs that enable functions to return l-values. an l-value is storage for a type. in terms of implementation this means a memory address, but syntactically there is a crucial distinction from pointers. this distinction also exists in C

in the C statement *ptr = 0, what is the type of the expression *ptr? clearly it's not an integer value because you can store into it. clearly it's not a pointer because that would be circular, a pointer needs to be dereferenced to be stored into and what's what we're trying to do. the type of *ptr is an integer l-value, a storage space for an integer, which is a distinct type from ptr, an integer pointer

this concept exists in C but in C++ it has to be promoted to a first-class concept because it's possible to override operators. if C++ didn't have l-value references then what would be the return type of operator[]? again, it clearly can't be a pointer or else you'd be writing *(vector[0]) = 0. it's an l-value reference

there is a similar concept of an r-value reference, which is storage used for temporaries generated by the right-hand side of an expression. obviously temporary storage uses memory addresses but those addresses can never, ever be materialized as pointer types accessible to the program, because their storage duration is completely undefined, so the pointer would never be safe to use. in C you're never allowed to see these, and in C++11 they are exposed as &&references, which is what std::move does
>>
File: scanningForFiles.png (644KB, 2560x1403px) Image search: [Google]
scanningForFiles.png
644KB, 2560x1403px
i just finished putting together an image duplicate finding program
>>
>>56983307
>in terms of implementation this means a memory address
That's all that fucking matters to the original topic.
>>
>>56982660
Here's mine:
(define-syntax s<
(syntax-rules ()
((_ x () s f) f)
((_ () x s f) s)
((_ (x) (y) s f) (s< x y s f))))

(define-syntax s-
(syntax-rules ()
((_ x () (k ...)) (k ... x))
((_ (x) (y) k) (s- x y k))))

(define-syntax smod
(syntax-rules ()
((_ x y (k ...))
(s< x y (k ... x) (s- x y (smod-rec (k ...) y))))))

(define-syntax smod-rec
(syntax-rules ()
((_ k y x) (smod x y k))))

(define-syntax smaprange
(syntax-rules ()
((_ (k ...) f () res)
(k ... res))
((_ k f (x) res)
(f (x) (smaprange-rec k f x res)))))

(define-syntax smaprange-rec
(syntax-rules ()
((_ k f x res val)
(smaprange k f x (val . res)))))

(define-syntax sdivides?
(syntax-rules ()
((_ a b t f)
(smod a b (sdivides-rec? t f)))))

(define-syntax sdivides-rec?
(syntax-rules ()
((_ t f ()) t)
((_ t f x) f)))

(define-syntax fizzer15
(syntax-rules ()
((_ x (k ...))
(sdivides? x (((((((((((((((())))))))))))))))
(k ... FizzBuzz)
(fizzer3 x (k ...))))))

(define-syntax fizzer3
(syntax-rules ()
((_ x (k ...))
(sdivides? x (((())))
(k ... Fizz)
(fizzer5 x (k ...))))))

(define-syntax fizzer5
(syntax-rules ()
((_ x (k ...))
(sdivides? x (((((())))))
(k ... Buzz)
(k ... x)))))

(define-syntax fizzbuzz
(syntax-rules ()
((_ k) (smaprange k fizzer15
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
()))))

(define (as-number x) ; just for show
(if (null? x)
0
(+ 1 (as-number (car x)))))

This fizzbuzz is dedicated to >>56982643
>>
File: mvc.png (20KB, 466x303px) Image search: [Google]
mvc.png
20KB, 466x303px
I figured I should ask here first before starting a new thread.

I live in a shitty 20,000 person town and there are 1-2 programming jobs posted per year, not only are these jokes in terms of money but they always want specific programming examples with some language that nobody but them uses. I've contacted places in a semi-faraway big city and I ace the remote programming tests but it always comes down to the fact that I'm not a local candidate. I've tried lying about that but they always figure it out. I've saved up enough money to live within 20 minutes of the city for 6-8 months and am going to move there since the best I can get here is semi-decent IT positions.

My question and tl;dr is what is the best code example to show up with as proof that I can do the job? I've seen model-view-controller examples listed as the best example for web apps.
>>
>>56983304
Yeah Fortran 2012 is the latest standard, gFortran supports some of it, then there's f95, Intel fortran, PGI which AFAIK is one of the most complete and supports CUDA, Cray Fortran, etc.


Only g95 and gFortran are free/open source though.
>>
MVC is a solution to the invented problem of overusing OOP.
>>
>>56983323
a pointer is a type. a reference is a type. a memory address is a machine-dependent construct, like a machine code instruction.

my point is that a reference is not sugar for a pointer, and that pointers do not underly references any more than pointers underly symbols or temporary values. obviously memory addresses underly absolutely everything, including instructions, and by that broad definition "everything" is a memory address. but a pointer is not synonymous with a memory address; it's a type that stores a memory address, and not all memory addresses are store-able.
>>
Im new to java and im wondering how can i create and write in an HTML file.
Can sb help a pleb in need?
>>
>>56983447
or more precisely, pointer is the type of a memory address that is store-able, and not all memory addresses are type-able as pointers because not all memory addresses are store-able
>>
>>56983447
How is a reference not a pointer with more semantic restrictions? I mean, you could say a pointer and a reference are both memory addresses but on the topic of performance it really doesn't make a difference how you put it.
>>
>>56983345
Interesting, is Fortran viable as a general purpose language? How familiar is it to someone used to C?
>>
Today I did wanikani for 40 minutes, read programming books for 6 hours, and watched one episode of Psycho Pass.
>>
>>56983476
>>56983479
If a pointer is a memory address with more restrictions then a reference is a pointer with more restrictions.
>>
>>56983499
Good to know.
>>
>>56983502
are you still talking about c++'s reference ?
>>
>>56983499
Wrong thread, friendo.
>>
>>56983502
an r-value reference has less restrictions than a pointer because it is safe to read from an r-value reference, but it is never safe to read from a pointer to a temporary
>>
>>56983525
Yes, I always have been.

>>56983529
Well I wasn't talking about r-value references either.
>>
>>56983529
>but it is never safe to read from a pointer to a temporary
>implying
>>
void f(int *i)
{
}

int main(void)
{
f(&(int) { 1 });
}

This is valid C but invalid C++. You cannot explain this.
>>
>>56983589
i'm talking about temporaries as language-level constructs that do not have a symbol in their materializing scope, materialize as the result of an expression, are passed to some other expression and dematerialize by the end of the statement. i.e. the temporary storage materialized by a = foo(b) + bar(c) to store the result of foo and bar

obviously you can implement your own temporaries with different scope. they won't be enforced by the type system though, which sucks. r-values are enforced by the type system and without performing satanic typecast magic you shouldn't ever have an r-value to a dematerialized temporary
>>
>>56983447
What memory addresses are not storable?
>>
>>56983666
This is valid Python but invalid Go. You cannot explain this.

def faggot():
print('kys')
>>
if i have to use SVN on Linux, what are my best tools for it?
>>
>>56983744
git-svn
>>
>>56983666
c is more permissive in letting pointers be cast into integers explicitly
so basicly c lets you shoot your own foot easier
>>
>>56983757
You're not even wrong.
>>
>>56983755
which is?
>>
>>56982609
I was going to complain about the OP picture not being programming related, but I guess it never really is.
>>
>>56983666
It's almost like they aren't the same language
>>
>>56982635
Sometimes references return pointers, though
>>
>>56983716
if a memory address's storage duration is undefined then, while in principle you could store that address, any use of it would be undefined behavior. and if it's undefined behavior then the compiler can do anything, so of course the compiler can legally elide that memory address

in order to store addresses there must be some concept of a context in which the address is valid. otherwise, you are just typecasting numbers to pointers
>>
File: BMW SS.jpg (617KB, 1920x1440px) Image search: [Google]
BMW SS.jpg
617KB, 1920x1440px
> learning C
> Mon - Fri
> Reasonable but slow progress on problem sets
> Fri - Sun
> Massive progress

Why does being around Mommy produce such quality work ?
How can I replicate this when outside the nest ?
>>
how much effort would you have to put in programming a preferably simple message board for a website? i'm mostly thinking about databases and stuff

considering i have not clue about php, but generally am comfortable with programming in general
>>
public class crap {

public static void main(String[] args) {
randomThing();
}

public static void randomThing() {
int value = (int) (Math.random() * 5);

switch (value) {
case 0:
throw new ArithmeticException();
case 1:
System.out.println("It works: 1");
break;
case 2:
throw new ArrayIndexOutOfBoundsException();
case 3:
System.out.println("It works: 3");
break;
case 4:
System.out.println("It works: 4");
break;
default:
break;
}
}
}
>>
> * 5
I'm I retarded or are you?
>>
>>56983765
Kidding me?

https://git-scm.herokuapp.com/docs/git-svn

apt-cache show git-svn
>>
>>56983168
Why would you search for a 0 byte in memory with such stupid code? What platform/original purpose was that C for? Was this back when compilers were shit?
>>
>>56983904
Yeah, I don't know why so many ingrates have been on /dpt/ recently.
>>
>>56983851
i should point out that the compiler can also legally elide a stored address that you never use.

i can't think of any way to guarantee that an address with undefined duration (e.g. an address you make up ex nihilo by typecasting an integer) is emitted as valid C, hence i say they're not store-able. of course, you can compile and run invalid C programs, which is the language's greatest weakness
>>
File: lispbest.jpg (253KB, 840x412px)
lispbest.jpg
253KB, 840x412px
>>56983911
it does look like this because it's machine code that has been reverted back to c code (decompilation). probably done with ida pro.
>>
>>56983904
i mean, can you tell me why exactly you like that over other tools? theres a bunch of svn tools in my repo, i just want to know what you guys use for this kind of shit.
>>
>>56983969
Ohhh, I see. So this code was generated by the compiler because compilers aren't shit. Yeah, I've actually seen IDA pro in action once or twice and this is the appearance its psuedo C or whatever looks like, so that must be what it is.
>>
>>56983168
I don't get the GitHub pirvate repository one
what exactly happened?
>>
>>56983862
Make your apartment look just like at Mommy's.
Perhaps record her activities and replay them at home.
>>
File: bjarne-stroustrups-quotes-1.jpg (68KB, 575x324px) Image search: [Google]
bjarne-stroustrups-quotes-1.jpg
68KB, 575x324px
>>56983991
if i recall correctly, private repositories are not free on github except if you are a woman.
>>
I don't understand, how could you POSSIBLY write any meaningful code when there are meaningless youtube videos to watch out there?
>>
>>56983991
They deliberately offered said free service exclusively to women. Basically, GitHub used to to to match the open source community in culture - describing itself as a meritocracy, hence the famous mat seen in the picture. Said mat got removed once GitHub got internally overrun by SJWs. The article the picture shows is just another consequence of that.
>>
>>56983864
Not much, a basic imageboard is like an afternoon worth of work if you choose the right tools for the job.

If you're comfortable with programming, stay away from PHP, it's not really suited for backend development even though it's the de facto web language. I'm not too big of a fan of those but the following would be good: Pyhon with Flask or Ruby on Rails. Sure, they have their flaws, but they're miles better than PHP.

As from the frontend standpoint, you can just use Bootstrap and jQuery so you don't have to worry about it much.

As for the database, you will need to learn a bit, preferably MySQL or PGSQL.
>>
>>56982881
What's wrong with this cat's eyes? They look fake/artificial
Never had a cat
>>
>>56984020
>except if you are a woman.

Is that true?
>>
>>56984056
was

https://adainitiative.org/2013/04/26/github-donates-private-repositories-to-women-learning-open-source-software/

Also for fuck's sake why did my filters purge.
>>
>>56984085

Holy shit.

>Also for fuck's sake why did my filters purge.

Because you actually love me, you son of a bitch.
>>
File: matilda.jpg (148KB, 750x750px) Image search: [Google]
matilda.jpg
148KB, 750x750px
>>56984056
not anymore

>>56984036
http://www.aliencatmatilda.com/

read the about section.
>>
>>56984085
current year as fuck
>>
>>56984056
or transgender of course.

and you can be banned for using words that can trigger sex-starved "feminists".
>>
>>56983976
If I already know the best VCS, i.e. git (t. not Linus), why would I learn another one. And that's what git-svn does, mapping git commands to svn, transparent to me.
>>
>>56983332
Jesus, at least post what languages/technologies you're applying for you faggot.
>>
Good evening /dpt/.
My, the op is particularly shitty and, i'm sure, undemocratic today, isn't it?

I'm currently reading and learning about lexing and parsing. I'm still a little confused about the difference.
Lexing is the process of turning a sequence of characters into a sequence of abstract tokens, and parsing is the process of making some kind of semantic sense of the tokens, but when you add lexical analysis into the mix i get a little confused.
>>
So I recently started learning Python after finishing up on C

Can anyone explain to me on a step-by-step basis how this works?

>>> def make_incrementor(n):
... return lambda x: x + n
>>>
>>> print make_incrementor(22)(33)
55
>>
>>56984125
is that really ok, considering how different they are?
>>
>>56983332
>I've seen model-view-controller examples listed as the best example for web apps
What?
>>
>>56984179
>My, the op is particularly shitty and, i'm sure, undemocratic today, isn't it?
*le tips*

lexing: "2 + 2 = 4" => [2,+,2,=,4]
parsing: [2,+,2,=,4] => =(+(2,2),4)
>>
>>56984193
https://en.wikipedia.org/wiki/Closure_(computer_programming)
>>
>>56984179
Lexing is usually meant to designate the parsing of a regular fragment of the language, while the latter parsing constructs an AST from the lexer output according to a context-free grammar. This is usually interspersed with semantic concerns if the creators don't care about separation of concerns.
>>
>>56984193
make_incrementor(22)
returns
lambda x: x + 22
. Calling this with 33 returns 22 + 33 = 55.
>>
>>56984193
make_incrementor(22) = lambda x: x + 22
make_incrementor(22)(33) = (lambda x: x + 22)(33) = 33 + 22 = 55
>>
>>56984193
>after finishing up on C
lel, and that's why learning programming with C is a bad idea. read Composing Program.
>>
>>56984234
>>56984248
So wait, that's functionally the same as:

def make_incrementor(n):
return lambda x: x + n

temp = make_incrementor(22)

print temp(33)


Am I getting this right? The second set of parens in
print make_incrementor(22)(33)
actually calls the returned lambda, not make_incrementor?
>>
>>56984150
>>56984212
>>56983332
php and its frameworks, asp.net/c#, mysql or mssql, js and jquery. or anything that you feel is popular and can net a job.
>>
>>56984310
Yes.
>>
>>56984315
I think one of the best things about Python in comparison to C is the standard library has many, many, more functions and so on than the standard library in C
>>
>>56984114

Transgender women are REAL women, after all.
>>
>>56984314
Write a small app in a popular framework or something. I believe it's all about Laravel in PHP; React, Flux or whatever it's called on the frontend.
>>
>>56984334
Good for you.
>>
What am I missing out on when not using an IDE for C++? Using vim + plugins so essentially have an IDE lite (syntax checking, auto completion and such is there). Then valgrind for finding leaks and gdb for debugging
>>
>>56984335
yes?
>>
>>56984362
Nothing. Vim+tmux/Neovim and Emacs are the master race.
>>
>>56984382

Yes.
>>
>>56984394
Sorry I thought you were applying passive aggressive sarcasm for a second there
>>
>>56984358
Maybe once I finish learning Python I can make the Moonman game I've always wanted to make

"Moonman's Minority Mowdown"

Envision a Streets of Rage-esque clone where you brutally mowdown different kinds of shitskins with a wide selection of weapons and powerups in a spectacular show of gore and racial hatred.
>>
Not sure if this thread is appropriate but anyone have any experience working with vichan? I setup imagemagick with all files supported but the vichan installation can't detect any of the executables like convert.exe or indentify.exe.
>>
>>56984469
Wild guess: Vichan requires the PHP ImageMagick extension, not the ImageMagick binaries.

Also:
>Windows
Good luck with that.
>>
>>56984401

Never in my life.
>>
>>56984384
vim + i3 instead of tmux, but same shit. Not touched neovim at all
>>
holy shit fuck qt right now
im kinda upset
>>
>>56984566
>fuck qt right now
i wish
>>
i have php files
db_connect.php
create_entry.php
get_all_entries.php
...

etc that should all work. is there a way to call these things from the terminal to see if they work? i'm following an android tutorial but android's convoluted as hell and i want to test them separately from that first if i can. the tutorial literally wants me to create an application with buttons that you tap and do the commands, and i have no experience with android so i want to make sure i haven't fucked this part up in isolation from anything else
>>
>>56984591
nm it's as easy as php filename.php, thought it'd be extremely convoluted. the get_all_entries one works but i still don't know how to pass it parameters though
>>
>>56982567
passing by value is faster than passing by reference most of the time
>>
<?php

/*
* Following code will create a new product row
* All product details are read from HTTP Post Request
*/

// array for JSON response
$response = array();

// check for required fields
if (isset($_POST['name']) && isset($_POST['price']) && isset($_POST['description'])) {

$name = $_POST['name'];
$price = $_POST['price'];
$description = $_POST['description'];

// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

// mysql inserting a new row
$result = mysql_query("INSERT INTO products(name, price, description) VALUES('$name', '$price', '$description')");

// check if row inserted or not
if ($result) {
// successfully inserted into database
$response["success"] = 1;
$response["message"] = "Product successfully created.";

// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";

// echoing JSON response
echo json_encode($response);
}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";

// echoing JSON response
echo json_encode($response);
}
?>


how do i give this the parameters it needs from the terminal?
>>
>>56984789
l2google

https://stackoverflow.com/questions/5655284/how-to-pass-parameters-from-command-line-to-post-in-php-script
>>
>>56984362
you will have developed too many skills by the time you go to look for a job and they are going to be intimidated by you
>>
>>56983862
Because you can't watch hentai while your mom's around.
>>
>>56984362
I don't use an IDE for C++ and I get along just fine.
>>
File: dpt2.png (1MB, 1280x720px)
dpt2.png
1MB, 1280x720px
Is System Programming with C and Unix by Adam Hoover a good book?
>>
I'm working with Python and MongoDB and I am trying to update a collection inside a collection of documents.

Ex.
{
"_id": "abc",
"array": [
{
"field 1": "foo",
"field 2": "bar"
}
]
}


Where I would be adding to the array "array" in the document with _id "abc". I'm not too sure how to do this since I'm just starting out with both Mongo and Python.
>>
>>56984825
none of those answers are working for me, probably because I don't know php. What would be the most barebones java program to test it?
>>
>>56984974
If you're just looking to test this with $_POST set via the command line (i.e. this is meant for web use, but you're testing locally), look at that second answer, the one that uses parse_str() on $argv[1]. Throw that in at the top, and when you call your script from the terminal, pass in a query string (as would be posted) as the first arg.
>>
Is this the zen of C ?

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2086.htm

note: C2X is the next update of the C standard.
>>
Is everything that can be expressed in Backus-Nauer Form a Context Free Grammar?
>>
How do I look inside / edit the contents of a .dll or a .so file?
>>
>>56985114
how would i format this part?
>php yourscript.php 'arg1=x&arg2=y'

for the program i posted here >>56984789

i tried it and it just stalled and i had to ctrl c
>>
any AI experts here

please tell me human like AI will come within our lifetime
>>
>>56985490
i think AI is the current field of CS that has the most of false promises.
>>
>>56985484
A hex editor if you know what you're looking for. A disassembler like IDA Pro if you're looking to reverse engineer it.
>>
>>56985490
I think human like AI will not appear before we have hardware that can simulate a neural network of comparable size and complexity, and with comparable speed, to the human brain.
>>
>>56985457
>(e) Make it fast, even if it is not guaranteed to be portable.
No it's not.
>>
>>56985593
even that i really doubt it. brain is not only about electric signals but also about chemistry (neurotransmitter, neurochemical, ...)
>>
>>56985593
we have apparently neurons 86,000,000,000 and 1.5×1014

yeah, that's pretty significant

also, there is immense multithreading going on in cortex, where microscopic substructures act as little processors

Does anyone know if quantum computers can aid here
I'm guessing they could due to larger memory and all of that??
>>
>>56983332
Write some fucking code and link your github on your resume.
>>
>>56985653
actually the brain "only" contains
21,000,000,000

but even a larger amount of the rest are in the cerebellum
>>
>>56984956
a = {
"_id": "abc",
"array": [
{
"field 1": "foo",
"field 2": "bar"
}
]
}
a["_array"].append({"hoge":"fuga"})
>>
>>56985490
it's a matter of opinion. actual research is limited in scope by necessity. if you look at a really general and strong AI paper like:
https://arxiv.org/abs/1608.08225
you'll notice that what's meant by general and strong is very mathematically precise so that it can be well-defined, and that it does not translate elegantly to the semantics of popular science

popular science has a tendency to start from the conclusions sections of papers (which are the bullshit sections) and then extrapolate from there, which means they are flying off the deep end into science fiction. AI reseachers are notorious for exploiting this to get funding, which is why the field is famous for "summer" and "winter" funding cycles

i'm not going to tell you it won't happen, that paper i linked really is astonishing. but the kinds of conclusion that are being made scientifically have nothing to do with Wired magazine articles, and in fact Singularitarian bloggers are intentionally communicating those results wrongly in order to part foolish investors of their money
>>
>>56985593
this is a bit of a meme because there's no reason to conclude that the biological brain is the most efficient hardware conceivable for general intelligence

lots of analogues between biological computing and are computers are bad or broken, e.g. parallelism. biological parallelism is not synchronized like our parallelism and is much more willing to e.g. communicate across the brain in an inconsistent or incoherent way (which is one potential explanation for e.g. seizures). it's not clear whether this is an implementation advantage (because crappier = faster) or a disadvantage

at any rate these kinds of computational mind analogues have almost nothing to do with what's going on in contemporary AI
>>
>>56985649
brain is all about electro-chemical signals. Brain contains many different types of signal transmitting processes, all with their own subtle or not so subtle effects on the signalling, but it can all be abstracted into just that: signaling, and as such can be accounted for in an artificial neural network.
>>
>>56985714
>29 september

ill read it
>>
>>56985490
probably, but it depends on what you mean by "human-like". the early AIs with human-like *intelligence* certainly aren't going to be human-like in every respect, because they're going to be autistic as fuck. it would take an absolute shitload of work to emulate the nuanced social and instinctual aspects of humans in a natural/neural way. though personally i don't really know why you'd even want to do that. it would mostly just add flaws and things irrelevant to an inorganic life form

>>56985593
this is absolutely not necessary, and that's why i think true AI will come along at least a little bit sooner than people think. sensory inputs and outputs of a much, *much* lower resolution (which would drastically reduce the size of a neural network) could theoretically still yield sentience. they could also be pre/post-processed with traditional computation where relevant and bound more directly to the AI's environment, which would remove neural layers of abstraction. senses are only so fine for us because historically it improved our chances of survival. not to mention we won't need to waste simulated neurons on unconscious processes for maintaining an organic body like the shit for breathing, heartbeat, digestion and all that jazz
>>
Say there is a dynamic structure called List_i:
typedef struct {
int * list;
size_t length;
} List_i;

Which way is the more idiomatic way to write an initialization function for List_i?
// returns a pointer from the heap that points to a List_i structure
List_i * create_list();

or
// takes a pointer declared on the stack an assigns to the location of the new List_i structure
void create_list(List_i * li);


I just recently got my head around malloc() and realloc(), but I feel weird allocating the
int * list
and then allocating the
List_i * list
as well. That means you need to write a freeing function to unwrap two separate allocations making up the List_i structure. Is that really right, or am I overdoing it?
>>
>>56985780
>it's not clear whether this is an implementation advantage (because crappier = faster) or a disadvantage
it just werks bro
>>
>>56985849
>dynamic structure
Nani?

That's not a list btw, that's an array.
>>
>>56985578
I want to look inside, see if it contains a file called ParticleSystem.cpp, and if it does, replace this file with my own version.

Which would you suggest for this tast?
>>
>>56985844
>though personally i don't really know why you'd even want to do that.
It social skills are basically the network protocol humans use to share data with other humans. Having machines that can key into this would be pretty fucking useful for human-machine interactions.
>>
>>56985892
.dll and .so are compiled binaries. They're in PE and ELF formats, respectively. They don't contain source files in them.
>>
>>56985653
>>56985675
the numbers that get thrown around in brainscale porkometrics are not really large numbers. an uncompressed topological representation of ~100 trillion synapses is only petabyte scale, and you can compress the everliving shit out of it. the current generation of supercomputers can already touch this scale and the next gen will smash it

the real problems for brainsim are measurement problems, because you can't simulate something that you can't measure first. current technology is to jab at the absolute most 256 probes into a region of the exposed brain (usually more like 16) and pray they hit the neurons you want. the absolute state of the art is the connectome project which will spend the next 2-5 years slicing one brain and scanning its neuro-synaptic connections. this is an absolutely ridiculous fucking problem (since you have to machine-recognize all the topology from the raw brain images and then match it across slices) requiring novel technology from several groups and it's JUST the topology of a DEAD brain, we have no idea what would be going on chemically or electrically

if we had a comprehensive brain dataset then every country in the world would be racing to build the first exascale fiber-optic supercomputer to sim it. instead what's happening is that we're gradually preparing to build such machines in anticipation of someone figuring out how the fuck to measure a brain. the challenges in brainsim are biological, not computational, and the computational advances in AI have very little to do with biology
>>
Sup /dpt/

spending the next couple days in here while I work on a school project. Not here to get answers since that doesn't actually help me.

>tfw finally made the input user will enter dummy proof
Took me a while but baby steps. Now they can only enter exactly what I want them to or else they get an error and program exits. Easy stuff I know. But I'm working in a new language.
>>
>>56985853
this is more astute than you realize, lots of groups have noted in the last ~3 years that if you remove all your synchronization from linear algebra computations (so the result becomes "undefined"), it doesn't fucking matter and you get the same result because of convergence
>>
>>56985780
>there's no reason to conclude that the biological brain is the most efficient hardware conceivable for general intelligence
I never said anything of the sort.

I still stand by my earlier statement.

>almost nothing to do with what's going on in contemporary AI
With the hardware to run human scale artificial neural networks lacking, contemporary research are doing what they can with what they have.
Actually, with natural intelligence still being poorly understood, AI and NI might well be considered the same research field.
>>
>>56985653
>Does anyone know if quantum computers can aid here
>quantum computers

Another false promise

http://www.theregister.co.uk/2015/03/09/quantum_computers_fail/
>>
>>56985844
I suppose you may be right, in a sense. But then it all just comes down to the sliding scale of "human-like" and "comparable".
>>
>>56985853
Except when it doesn't.
>>
>>56983486
It's viable but some aspects still suck, like dealing with text, input/output.

Mostly used for modeling and other numerical stuff, but it does have OO and whatnot.

The closest thing to me (I haven't used modern fortran much, mostly pseudo fortran 77) is like basic or something.

It's honestly a very simple language, that's why it got so much use in science in the past, anyone could just pick it up and translate their equations and shit into it.

fortranwiki.org has all the info you could want on it.
>>
>>56985849
it is fine to write initializers for object-like structs in C. that is completely idiomatic and normal. often you also write a destuctor to do the recursive free()

the correct initializer signature depends on how you intend the object to be initialized. the two signatures you gave are meaningfully different, since the first presumably handles allocation internally (and thus requires the callee to correctly free the data, perhaps by calling a destructor) while the second requires the callee to pass the space and therefore can create stack objects or objects in e.g. arrays. you will also often see
int create_list(List_i **li)
where the function calls malloc internally, stores the pointer into *li, and returns 0 on success and some error code on failure
>>
>>56986031
evolution patches the bugs
>>
>>56986076
And introduces new ones.
>>
>>56985945
neural networks have nothing to do with "human scale" and andrew ng is extremely salty about people who imply NNs are somehow human analogues. he intended it as a catch nickname

NI people are also extremely salty about AI people acting as if their computational theories of mind are widely accepted in NI

i believe in computational theory of mind, but i'm personally extremely salty about AI people who assume what they're doing is part of some framework for understanding "intelligence" without doing the legwork to prove it. some people actually struggle with this legwork and are cool, most are memelords
>>
File: DSC_0356.jpg (3MB, 3840x2160px) Image search: [Google]
DSC_0356.jpg
3MB, 3840x2160px
this arrived yesterday(pic related), not actually new to me but learning/doing exercise and coding while having to look at pdf for references is tedious so I bought a paperback

a-am I-i gonna make it /d-dpt/ ?
>>
>>56986168
but its more tedious to go back on forward with paperback
>>
File: ozlesk.jpg (77KB, 1044x585px) Image search: [Google]
ozlesk.jpg
77KB, 1044x585px
Hey /g/ i recently got into coding and i cant find out whats wrong with this piece of code.
While my whole program works fine the sound is really choppy and cancels itself when i move the cursor over other form objects.
I cant really explain why this is happening.
>>
>>56985915
That makes everything a lot more difficult /:
Thank you though, anon
>>
>>56986246
wplayer is garbage collected. You have to store it somewhere.
>>
>>56986143
>neural networks have nothing to do with "human scale"
What do you mean by this?
Given 'sufficient' amounts of memory, i don't see why one theoretically couldn't model the signalling architecture of a biological brain (what i think of as an NNN) using an ANN.
>>
>>56986275
Ah that makes sense, thanks!
>>
File: no.jpg (186KB, 816x488px)
no.jpg
186KB, 816x488px
>>56985849
>typed array
Eeeek!

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>

void *__arrayalloc(size_t length, size_t size)
{
if (SIZE_MAX - sizeof(size_t) < size)
{
errno = ERANGE;
return NULL;
}

size += sizeof(size_t);
size_t *a = malloc(size);

if (!a)
return NULL;

a[0] = length;

return &a[1];
}

inline void arrayfree(void *array)
{
free( &((size_t*)array)[-1] );
}

inline size_t arraysize(void *array)
{
return ((size_t*)array)[-1];
}

#define arrayalloc(type, length) __arrayalloc(length, sizeof(type[length]))

int main(void)
{
int *a = arrayalloc(int, 125);
if (!a)
{
perror(NULL);
return 1;
}
a[0] = 13123;
a[124] = 4689779;
printf("%zu\n", arraysize(a));
arrayfree(a);
}


https://ideone.com/OWEwWw
>>
Are there any video/audiable learning sites, premium, that teach concepts? not them just going through code in a tutorial style, more of actually teaching you material and fundamentals

I need stuff for more 1 hour long commutes to work and school
>>
>>56986323
you might as well use python if you're going to add all this shit
>>
>>56986323
Holy shit C is disgusting.
>>
>>56986323
Above average code for /dpt/.
>>
>>56986350
Yes
>>
>>56986390
thanks bob -_-
>>
I'm writing a text editor in WPF/C#, I want to be able to save the contents of the textbox when ctrl-s is pressed, which is easy enough, but I can only get it to work when the event is triggered on my TextBox element, but I want it to be triggered if you press ctrl-s -anywhere- on the window.
But if I make the event on my window, then when the event gets called in my code the sender is a window object or grid object or whatever instead of a TextBox, and I need the TextBox to be the sender because I need the TextBox.Text to get the contents.
How do I do this?
>>
File: umarusfs.jpg (115KB, 1280x720px)
umarusfs.jpg
115KB, 1280x720px
>>56986352
>add all this shit
adding what ? with a "normal" dynamic array, you still have to use malloc/free but you also have to manage the length field by yourself. this code actually make things simpler.
>>
Express.js question:

I want to sanitize user input in my Express app. Is there some way to just drop some middleware in my app.js file that cleans the entire req object before it hits the router?

Or am I condemned to refactor my code to clean it property by property?
>>
>>56986419
>>>/g/wdg
>>
>>56986432
stfu
>>
>>56986404
Happy to help Sussy :)
>>
>>56986222
no its not
>>
>>56986415
when you handle the event from the window you have to do:
e.handled = false;

or some shit like that.
>>
>>56986450
wow rude
>>
>>56986323
i should have named arraysize arraylength. my bad.
>>
File: 1470804356900.jpg (256KB, 1280x960px) Image search: [Google]
1470804356900.jpg
256KB, 1280x960px
>>56986323
>40 years later and C programmers still spend their days reinventing the wheel over and over again
>>
>>56986371
this is literally first year college code
>>
>>56986505
I hope you get banned for that image anon.
No girls allowed.
>>
>>56986515
My comment stands.
>>
>>56986287
NNs are a particular model of functions. in a broad sense, functions can model anything that is physically realizable (actually that point is contentious but i believe it and you probably do too, so let's take it as given).

similarly, anything that has been physically realizED (such as the brain) has an existence proof for its computational tractability. however, there is no guarantee that a particular model of functions has a tractable realization of a physical phenomenon, even if that phenomenon is known to be tractably realizable

NNs very loosely resemble (not model) a child's sketch of what we know about the signaling architecture of the brain. they are gaining features all the time, but those features are largely motivated by what works for contemporary problems of interest (e.g. convolution for image recognition) and not by biological analogues, which are still poorly understood. it was never an aspiration to model biology and it is not proven that the NNs can model biology tractably

most important: if you constructed a perfect NN analog of the topology of the brain, what you would have is a dead brain. we don't know enough about the execution of the brain to do anything with a model of it, although such a model would undoubtedly accelerate our understanding. which is why biologists are trying to build one right now by an excruciating process of brute force measurement.

but when you hear bloggers talk about neural networks as if they are big brain-like structures with an analog architecture and similar properties of scale, that is 100% pure marketing speak and i'm aware of no real project approaching the subject from that angle
>>
>>56986323
what's sad is that this actually is the correct way of doing this in C

this is the problem templates solve and the best reason to use C++ instead of C

>>56986505
macroshit is so horrendous that it can never be included in core standard libraries due to the shame it evokes. so everyone has their own fucking macroshit implementation of vector<T>
>>
what's wrong with the arrays as they are in C

very RARELY do you need a resizable array and it just makes things slower

array of structs and you can have all the data you want carried around with it, just store the length at the beginning and allocate a slighly bigger what you need and that's that

growable arrays waste memory too
>>
Just released a stable version of my shity image board. Reached 30K loc. If anyone wants to laugh at other's typing speed, be my guest https://meguca.org/g/1798406

>>56982943
What kind of algorithm are you using for pruning?
>>
File: 1475359427227.jpg (84KB, 559x763px) Image search: [Google]
1475359427227.jpg
84KB, 559x763px
>>56986323
>perror
Ufufufu~

#ifndef ERROR_H
#define ERROR_H
#define DIE(format, ...) die("\n%s:%d in %s\n" format, __FILE__, __LINE__, __func__, __VA_ARGS__)
void die(const char*, ...);
#endif /* ERROR_H */


#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#ifdef __GNUC__
__attribute__ ((format(__printf__, 1, 2)))
#endif
_Noreturn void die(const char *format, ...)
{
va_list vargs;
va_start(vargs, format);

vfprintf(stderr, format, vargs);

va_end(vargs);
exit(1);
}


int main(int argc, char **argv)
{
if (argc < 2)
DIE("%s\n", "Not enough arguments");
}
>>
>>56986684
>very RARELY do you need a resizable array

What kind of world do you live in?
>>
>>56986143
ng sells the shit out of ml
there's nothing wrong with that but i hope he's not surprised by what's happened
>>
>>56986684
>very RARELY do you need a resizable array
no one is this stupid
>>
>>56986731
perror prints errno error message.

http://en.cppreference.com/w/cpp/io/c/perror
>>
>>56986739
>>56986787
in most cases you can just know what you need or if not, then some buffer of reasonable size will suffice, alterantively you can pass around lengths and indicate what you need

if those cases do not apply you just reallocate

name a few instances where this is wrong
>>
>>56986505
At least, we understand what we're doing.
>>
>>56986820
>in most cases you can just know what you need or if not
lel, no. you never made anything else than toy programs, that's why you believe that. take a web browser for example, you can't know how many data you will have to store for a given website page.
>>
>>56986790
I know, not the point.

if (err == some_shit)
{
perror(NULL);
DIE("%s\n", "Some shit happened");
}
>>
>>56986820
>name a few instances where this is wrong
literally any list where you don't know the length.

An array of all the posts in a 4chan thread that you add to as new posts are made.

a list of all the game objects in your game screen.

A list of all the people in your time table organising app

A list of all the exif properties of you image

A list of all the points in your 3D mesh

A list of all the shapes in your 2d vector image

You use this shit all the fucking time man.
>>
File: 1474416995827.gif (351KB, 495x495px) Image search: [Google]
1474416995827.gif
351KB, 495x495px
>>56985882
I didn't want to be too verbose in my post, but List_i would come with add and remove functions that would occassionally call realloc() to resize the block of memory. You're right, though. I have a bad habit of calling resizable arrays lists instead of arrays.

>>56986060
Thanks for this, I prefer the way you pass in the double pointer. I much prefer handling all of the details in the source file, rather than having to worry about the composition of the structure everytime I use it.

>>56986323
Neat. I don't make general container classes often, this was just for example. I'll keep this in mind, though.

I love learning.
>>
>>56986415
>I need the TextBox to be the sender because I need the TextBox.Text

this.textBox1.Text or whatever the name of your textBox is.
>>
give me java ideas to code please
>>
>>56986922
write a loo simulator
>>
>>56986922
Make a grid of square buttons
>>
>>56986922
A hello world that runs in fewer than 100ms.
>>
>>56986922
write some 3DS homebrew
>>
>>56984404
3edgy5me
>>
>>56986936
kek
>>
I unironically wrote a method called makeToast.
>>
>>56986922
Ayy lmao virus. Downloads alien image, then spam it all over the screen.
>>
Why aren't libraries built at compile-time?
If you're making a static binary you could do much better dead code elimination that way. Or am I mistaken?
>>
>>56986964
does the normal run in less than 100ms...?
>>
>>56984334
>bloated standard library
>best
okay pal
>>
>>56987054
pre processor directive bytes
>>
>>56986922
Code an open source reimplementation of https://jrat.io , a lot of people will be angry
>>
>>56987083
What does the preprocessor have anything to do with this?
>>
>>56987054
It happens at link time if you statically link.
>>
>>56987067
Not the normal Java one.
>>
>>56987108
It doesn't compile at link time, it just puts the relevant functions. You could probably go more granular than that.
>>
So how do I seek and write through a RandomAccessFile with variable record lengths in java? I was thinking of making an arraylist to keep the record sizes but then what?
>>
>>56987124
kek
>>
>>56987126
Well, yeah, you can. You're free to include the library that way if you have its source code, but typically you don't want to do that kind of thing at compile time because then you might have to recompile when a different translation unit changes. Better to do those kinds of optimizations at link time and save a lot of work.
>>
>>56987146
How much size would you save?
>>
>>56987173
I dunno anon, that depends how much of the library you use.
>>
>>56982609
How do I "explain the behavior when you declare an array of custom type" in c#?
>>
How do I git gud?
>>
>>56986323
That's pretty hilarious. And it might actually be useful to a C developer to boot. The implementation is clever.

Pay attention, kids, this is what wearing a skirt enables you to do.
>>
>>56987194
Sounds like some poor retarded person is trying to ask you how to declare an generically typed array in C#.
>>
>>56987208
$ git gud


You might need to install git-gud for that to work.
>>
>>56987219
the code is written out and done already, i just dont really know what im supposed to explain with working code already done next to it...
>>
>>56987124
isn't that extremely dangerous?
>>
>>56987235
me neither... god speed anon
>>
>>56986323
SIZE_MAX - sizeof(size_t) < size

What's the purpose of this line? ',:^.]
>>
>>56987240
Extremely.
>>
>>56987240
Yes, I had a brother who died that way.
>>
>>56987259
It's an overflow check which itself doesn't overflow the number.
>>
>>56987259
The real limit is SSIZE_MAX. You git gud once you find out why.
>>
>>56987259
>>56987274
Doesn't that need to be
SIZE_MAX/sizeof(size_t) < size
?
>>
>>56987302
No.
>>
>>56987273
iktfb ;___;
>>
Learning c++ on learncpp.com. Should I be using c++11 or 14? I
>>
>>56987393
2x. It has module support.
>>
I'm looking for interesting things to program / learn about as a beginner programmer.
What are some good books to read, and what are some good, educational programming projects I can take?

I already write Ruby and Python code pretty well, and I'm working on learning C.
>>
>No intel processor (so no HAXM)
>No Mac or iPhone

Is it even worth doing mobile development for final year project?
>>
>>56987492
Do whatever you like my man.

There's this other mobile OS called "Android".
>>
>>56986904
Fug, I just realized I called the implementation a class.
>>
>>56986526
>if you constructed a perfect NN analog of the topology of the brain, what you would have is a dead brain.
What about such an NN analogue under execution? Neural networks work by routing signals between nodes, no? So an NN brain topology under execution would get you sparking brain. At least, that's my understanding.
>>
>>56986526
>most important: if you constructed a perfect NN analog of the topology of the brain, what you would have is a dead brain.
do you have anything to support that assertion?
>>
File: 1460143222655.jpg (19KB, 320x240px) Image search: [Google]
1460143222655.jpg
19KB, 320x240px
>tfw I've completed another commercial game

You know, sometimes I want to just go to a normal programming job and build simpler apps that don't require all the superfacieious stuff that goes into a video game like graphics, sound, making sure it's fun, making sure it doesnt make the user feel this or that way, making sure the menu pops on at the right times, etc, etc.
>>
>>56987715
It's a hard life anon
>>
File: 35325355.gif (628KB, 540x304px) Image search: [Google]
35325355.gif
628KB, 540x304px
>tfw you spend all day programming and you don't feel you've actually done anything
>>
>>56987715
I'm guessing you're not going to tell us which games.
>>
>>56987746
I bet you it's "skeet skeet pajeet", a flappy bird clone with half a sale for a grand total of 7.5 cents.
>>
>>56987746
nah. As much as I wouldnt mind shilling it here, I keep to the old anonymous code
>>
>>56987741

I've spent whole days, many times, without writing a single line of code.

>tfw debugging stupid hard-to-reproduce regulatory bug within the millions of lines of code of a massive tech company.
>>
>>56987741
I spent a couple of hours before noon coding nothing of useful or difficult, and felt i had been productive.

Who of us has it better?
>>
>>56987778
Doesn't make any difference anyway. Would have just been fun to know.
>>
>>56987772
It's a console game you faggot
>>
File: 4_1426.jpg (11KB, 189x207px)
4_1426.jpg
11KB, 189x207px
Dont fall for this bait and teaser
>>
>>56987342
Oh, I see what's going on. Nevermind.
>>
File: 1413513404740.jpg (48KB, 534x664px)
1413513404740.jpg
48KB, 534x664px
Is it possible to compile a program written in C# for *nix systems if said program relies upon .dlls? Is it possible to somehow package it into the same compiled program the same way that you can compile a C# program to be natively runnable on systems, even if said systems don't have .net?
>>
>>56988131
>hey is there a way to cuck myself on a a non native system?
>>
>>56988131
You got the best of both world: The amazing performance of virtual machines + platform dependence.
>>
>>56986603
>this is the problem templates solve and the best reason to use C++ instead of C

Templates are amazing, but there's that glaring problem of implicit instantiation increasing compile times and generating bloat (though modern compilers should be able to match object code that matches and reduce bloat).

and anyways, there's only 1 macro that anon created in that code.
>>
>>56988156
> is there a way to cuck myself on a a non native system?
what
I just want to compile my dependencies to work on more than windows and I want it to be self-contained

>>56988177
C# can be compiled natively m8ey
Plus, it's barely slower than C++
>>
>>56988177
Non-graphical programs don't run slower on virtual machines.

Anyway, run it in WINE. You won't even need to compile it on linux.
>>
>>56988240
Second part was replying to >>56988131
>>
>>56988240
>Non-graphical programs don't run slower on virtual machines.
what did he mean by this?
>>
>>56988240
>run it in WINE. You won't even need to compile it on linux.
This isn't really an acceptable option, users just want to be able to run something and have it just work.
>>
>>56988240
Wrong kind of VM, anon.
>>
>>56988273
Modern virtual machines run the guest (assuming it's the same architecture) in a way similar to a context switch between processes. The instructions the VM runs are executed natively by the CPU; there's no "emulation" process.

>>56988281
Well, you can probably build it for linux and use Mono, but I wouldn't know how/if that works, especially if it depends on a bunch of native Windows DLLs (which is why I suggested WINE).

Also, WINE has been packaged into many commercial products to make OSX/linux ports.

>>56988286
What is he referring to then?
>>
>>56988388
Bytecode interpreter.
>>
>>56988227
This plot triggers me. Those data points really shouldn't be connected.
>>
>>56988397
Oh, alright. Well, the Mono runtime on linux should be able to execute CIL, but I still don't know the answer regarding DLL compatibility. I don't develop for Microsoft products, myself.
>>
>>56988388
Oh, it's possible to take my project and actually package it using wine?
That's pretty fucking neato. Does the end user have to have wine installed?
To be honest, I'm not entirely certain how wine works and whenever I've tried to use it it wouldn't function.

Also, he's referring to the fact that .net applications run within a virtual sandbox, the bytecode interpreter. He's not wrong that it's within a VM, but he is wrong in implying that that's inherently a bad thing.

>>56988410

I know. I'm not certain why EVERY SINGLE LANGUAGE COMPARISON EVER has retarded graphs
I'm honestly considering compiling a similar graph myself comparing all of the most popular languages and making it a nice, easy to understand, meaningful infographic with a litany of tests (and include links to the sourcecode), and measure EVERYTHING (runtime, memory consumption, execution time, et cetera) since literally nothing of the sort exists.
>>
New thread:
>>56988452
>>56988452
>>56988452

No stupid shit in the OP edition
>>
>>56988227
>C++ on linux is 34% faster than C++ on Windows
>Mono on linux is faster than C# .net on windows
I love this graph
>>
>>56988458
Nope, WINE can be run standalone without some system implementation. Building it that way might be harder than normal, but I think there's software that has all that figured out already (which I haven't used). One example is http://portableapps.com/. For example, EVE online runs on OSX using Cider, which is a WINE standalone bundler (I think it's commerical), but they also started supporting WINE in general so it could be run on either OSX or linux just from their Windows client.
Thread posts: 328
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.