[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: 331
Thread images: 26

File: 1467570941060.jpg (517KB, 1521x1076px) Image search: [Google]
1467570941060.jpg
517KB, 1521x1076px
Previous Thread: >>56183463


What are you working on, /g/?
>>
First for sublime text is best editor
>>
Why is the professional enterprise using C# and Visual Studio when /g/ says both are shit?
>>
>>56190243
>enterprise
>>
>>56186173
>I feel like literally everything has been done already

I get why one might feel that way in consumer or enterprise software - even though it's still not true there either.

But this is why I enjoy being in academia despite the pay being much lower than in industry. When you're on what amounts to the bleeding edge of a field many obvious things have NOT been done, and what has been done has very often been done really inefficiently. Actually improving it to make it a usable tool will give you lots of citations and make you a regular speaker at any methodology-focused sections of a your field's conferences.

And if the low pay is really bothering you, know that you are in the best position to monetise your know-how when whatever you've been working on starts being applied in non-academic/clinical use. You can start spin-off companies to capture a big chunk of a nascent market yourself or (if you lack the entrepreneurial mindset) just do consulting for companies which do that. They will approach you themselves - after all, they attend all the same conferences where you speak about methodology. I've made significant money doing the latter and I'm planning to do the former at some point.

tl;dr: Everything still sucks (even more?) in academia but that's great.

t. man who replies to seven hour old posts from a previous thread
>>
char answer[5];
fgets(answer, 5, stdin);


Do I need to free answer? Thank you in advance.
>>
>>56190243

C# and Java are preferred by enterprises because they are harder to fuck up for their thousands of sub-par programmers. If they let their employees use C, they would break everything.
>>
>>56190300
Can a Pajeet learn C?
>>
>>56190303
Only hardcore /dpt/ experts can learn C properly :^)
>>
>>56190303

They can sort of do C++, but they are the type of people who do this:

Foo* foo = new Foo();


They may or may not remember to use delete, but they certainly won't be using smart pointers or allocating on the stack. They might also use malloc in C++ code.
>>
>>56190303
Yes it's simple
>>
in two sentences: how does a gui framework like qt work in combination with say X

obviously at the bottom of the "stack" we have the OS, in this case linux, which has acces to the hardware, but who tells the graphics card/unit what to reunder, how does this work (in two sentences) ?
>>
>>56190321
Foo* foo = (Foo*) malloc(sizeof(Foo));
foo = new Foo();
>>
File: output.png (7KB, 201x201px) Image search: [Google]
output.png
7KB, 201x201px
An Ulam spiral generator. It's extremely fast, but I'm having problems with my prime sieve library. It only accepts a u32 as a top limit, and I need a higher limit to get a 50,000x50,000 spiral.
>>
>>56190346

// Stack allocation
Foo foo;

// Heap allocation
auto bar = std::make_unique<Foo>();


Both are preferable to naked new/delete or malloc/free.
>>
>>56190329
https://en.wikipedia.org/wiki/Xlib

1980s style C library
You can make pure Xlib GUIs but it's maddening.
>>
File: poo_in_it.jpg (80KB, 747x560px) Image search: [Google]
poo_in_it.jpg
80KB, 747x560px
>>56190321
Poo* poo = new Poo();
>>
>>56190381
Loo.push_back(poo);
>>
>>56190381
>>56190374
// Street allocation
Poo* poo = new Poo();

// TODO: Loo allocation
>>
>>56190381
Loo *loo = new Loo();
loo->in(poo);
>>
>>56190404
// Street allocation
Poo* poo = new Poo();

poo.bring_to(new Loo());
>>
>>56190350
Use u64 instead?
>>
>>56190300
not really
memory leaks can still happen pretty easily

those languages are preferred because of their large arrangement of libraries/frameworks that support modern technologies and because development speed is very important
>>
>>56190374
Just make your own resource manager so you can use it with < c++14. No need to bother with latest standard
>>
>>56190350
>my prime sieve library
literally a few minutes to look it up on wikipedia and implement the pseudocode
>>
Why are you guys even using C++ like this? It has no upsides.
>>
>>56190505
what speaks against using it ?
>>
Has anyone done terrain generation that does not use Perlin noise? I've been trying to get a large-scale planet made but the continents end up with no lakes or inner seas ever.

I feel like I could just make a bunch of patches of "land" inside of the continent regions, but just deleting the land to make water will fuck-up the natural features (suddenly water, out of fucking nowhere).

I can't think of a way to program it in less than a megabyte of source code. Can someone push me in the right direction?
>>
>>56190512
> ?
Please stop committing crimes against typography.
No spaces before punctuation.
>>
>>56190519
Why are you trying not to use perlin noise? There is reason everybody uses it
>>
>>56190512
The fact that buffer overruns are the norm and undetectable namespace poisoning ruins lives.
>>
whos the qt
>>
>>56190535
What do you suggest?
>>
>>56190527
Ideally, Perlin Noise works great for making shapes. It sucks at accurately placing lakes and small internal features where they would belong.
>>
>>56190321
The only problem with this is the placement of the star.
>>
>>56190596
star goes with type signature! Off with your head, heretic!
>>
>>56190596
>>56190603

Foo * foo = new Foo()
//compromise
>>
>>56190562
Isn't that a function of terrain elevation? Lakes match a basin, they're not sudden disruptions of land.

This guy is doing fine:
http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/

You might want to do some sort of "erosion" processing on your land though.
>>
>>56190611
>no ;
>>
>>56190603
int x, y, *p, *q
>>
>>56190538
biribiri
>>
>>56190446

Why would I re-invent the STL when my compiler supports the latest standard? Moreover, why would I bother with old and decrepit standards when the current one exists?

>>56190596

To the left or to the right, both are bad. Aside from it being likely unnecessary heap allocation, there remains the fact that it does not automatically clean itself up, meaning there is more work on the hands of the programmer to make sure all of the pointers get cleaned up.
>>
>>56190634
Exactly the reason why gods of programming made it possible to have declarations on multiple lines.

>>56190611
Argument to moderation fallacy
>>
>>56190646
I have committed no fallacy, and if you knew any rudimentary minimum about methods of debate you would know this

I have made no proposition or claim to truth
>>
>>56190652
Damn, didnt expect you to know that. Nvm you win.
>>
>>56190631
That generation demo works really well for making islands, but since I'm trying to build a whole continent, a lot of what he's doing for elevation and biome selection doesn't work for me.
My existing code generates cliffs and mesas and other elevation features. I'm currently using similar methods to decide the shape of the continents, but they're also really nasty looking. If there's a better method, I'd like it.
>>
>>56190217
went for an interview last week and bombed it, so going back and looking over the basics again.

Fucked up on a question about implementing chain-of-responsibility in Java.

I'm using HackerRank, is there any other things that help me practice interview style programming?
>>
>>56190668
How do you generate terrain for a sphere?
Are you just using regular 2d methods and mapping them onto a sphere?
>>
File: 55203488696678185.jpg (117KB, 352x259px) Image search: [Google]
55203488696678185.jpg
117KB, 352x259px
i have this function
void post(const LogEntryInfo& log)
{
for(BaseLoggerSink* sink: sinks_)
sink->post(log);
}

is it safe call it from multiple threads? sinks_ is just a std::set, im worried that iterating over it from multiple threads could fuck up some iterators or something, content of sinks_ never changes, content of post() is irrelevant
>>
>>56190687
If your function is pure then its safe to call from multiple threads. If not than maybe? Probably not
>>
>>56190603
Foo* bar, baz;

Why is this acceptable??!??!

The syntax of a declaration is not
type identifier;
It is
base-type declarator;
And the declarator has all the information showing how the type being declared is related to the base-type. That's how we can have useful stuff like
int (*f())[5];

This is a function returning a pointer to an array of five integers. Declaration mimics use: if you call this function, dereference the result and take an array subscript of the result, you get an int.
>>
>>56190271
No it's allocated on the stack.
>>
>>56190687
http://en.cppreference.com/w/cpp/container/set/insert

>No iterators or references are invalidated.
>>
>>56190525
: ^ )
>>
>>56190668
Real life formation and evolution of continents/coastlines/lakes/rivers occurs by vastly different mechanisms over very different time scales so I'd say it makes sense to do it iteratively with different methods focusing in each of those in isolation rather than attempting to do it all in one go.

As to the specific algorithms I can't help much, sorry.
>>
>>56190700
>>56190710
my function is pure, but im wondering for example, one thread is iterating, its at 5th element from 100, and then second thread start iterating too, wont this affect the first threads iteration?
>>
>>56190736
It's always going to be safe for reading, the point is that inserting items won't make the iterators invalid
>>
>>56190425
It's a library made for very fast prime computation that is extremely optimized (to the point of being cache friendly). I'm afraid that I'll fuck something up when I edit the source.
>>
>>56190772
Use a different library
>>
>>56190684
I'm just lopping off the poles and generating them separately, so I end up with an orientable 3d surface. This allows me to describe each location uniquely as a 2d manifold. I have a vector field (really just a scalar height) defined at each point on that manifold (everything starts zeroed out).

The field function is actually a distribution over the whole manifold, so I'm allowed to do cheap tricks. I add normal distributions centered at points where I want mountains and other flat-topped distributions where I want mesas. For sheer cliffs, I use truncated log-normals. All these distributions add together to form a smooth terrain map (too smooth, so I do some jaggedization after everything).

Having a Manifold lets me do cheap tricks later on, like being able to paint trees onto the landscape nicely without clipping the terrain and some drainage calculations for erosion.
>>
>>56190436
That's why those languages have garbage collection. If you want to make memory leaks impossible and have no garbage collection, you have to use an ownership model like Rust. The disadvantage to ownership is that it's somewhat harder to learn, and beginners often experience something called "fighting the borrow checker". You have to realize that the borrow checker screams at you because it loves you, not because it hates you.
>>
>>56190782
bivariate normals*
>>
>>56190447
Good luck trying to create a prime sieve that's as optimized as Rust's primal crate.
>>
File: 14556381470030.jpg (122KB, 1146x938px) Image search: [Google]
14556381470030.jpg
122KB, 1146x938px
why to pleb languages when there is holy js
>>
>>56190816
>is the shape of your code
>>
File: IMG_0302.jpg (1MB, 2592x1728px) Image search: [Google]
IMG_0302.jpg
1MB, 2592x1728px
led strip works
temperature works
now just have to light the rgb leds according to temperature
>>
File: 1468472224634.jpg (61KB, 990x557px) Image search: [Google]
1468472224634.jpg
61KB, 990x557px
>>56190802
>This uses a state-of-the-art cache-friendly Sieve of Eratosthenes to enumerate the primes up to some fixed bound (in a memory efficient manner), and then allows this cached information to be used for things like enumerating and counting primes.
>state-of-the-art cache-friendly
>(in a memory efficient manner)
>>
>>56190833
teach me electriconics
>>
>>56190833
How would you recommend I get into stuff like this as a C# dev?

I've always wanted to tinker around with electronics and make neat little physical things with what programming ability I have I just have no idea where to even start with it.
>>
>>56190840
>state of the art
>>CTRL+F "wheel"
>>0 results
https://hackage.haskell.org/package/primes-0.2.1.0/docs/Data-Numbers-Primes.html
>>
>>56190789
garbage collection isn't always gonna save you from memory leaks dude
>>
>>56190855
get an arduino
????
start

would be the easiest way. you can go the hard way and directly start with pure C on avr boards

>>56190841
no i am dumb.
>>
>>56190857
>state of the art
>
use wheel;
>>
>>56190860
>garbage collection isn't always gonna save you from memory leaks dude
wtf i hate gc now
>>
>>56190855
arduino
>>
post the latest code comment you've made
>>
>>56190868
Apparently it does use a wheel in the sieve but they don't mention it
>>
>>56190873
>Fuck this shit. Fix later
>>
>>56190873
>// Main method to implement
>>
>>56190873
Does it have to be in the past week?
>>
>>56190879
this rust code has use wheel; i just thought it was funny because of how simple the statement is, it's not even namespace-prefixed though so how does that work, where can i find wheel? i'm not familiar with rust obviously

https://github.com/huonw/primal/blob/master/primal-sieve/src/streaming/presieve.rs
>>
>>56190903
nvm i guess you can just refer to local "folders" in your project like that without a namespace
>>
>>56190708
Thank you friend
>>
>>56190321
Type "C tutorial" or "linux tutorial" into youtube. Most of them are from pajeets.

I always laugh at /g/ spergs who think they are superior to anyone because they write their fizz-buzz tier programs in C. Even stinky indians can do that.
>>
>>56190929 was meant for >>56190303
>>
>>56190929
this, C is like the easiest language, it has the basic syntax of any C-like language and it just has a few extra very basic things like functions, structs, pointers, arrays, preprocessor macros
>>
https://en.wikipedia.org/wiki/Fortune%27s_algorithm#Pseudocode
>pseudocode
>>
>>56190873
# Using callable wrapper class to avoid Pool pickling overhead


A comment of the "explain why it's done in the more complicated way" variety.
>>
File: Capture.jpg (8KB, 104x30px) Image search: [Google]
Capture.jpg
8KB, 104x30px
>>56190873
>>
>>56190873
// used by asm_gen
>>
>>56190833
Is that a Teensy?
>>
>>56191089
No.
Arduino nano. Same as arduino uno, just smaller
>>
is it alright to do shit like this

Class<? extends Container<? extends Item> >... containers


if I want generic varargs that also applies to subclasses of a particular type, or should I just skip the
? extends 
part?
>>
God is dictating me the specs for a new OS guys.
>>
>>56190603
>star
>part of type signature
That's not how it works. The type in the beginning of the declaration does not necessarily represent the type of the variable declared.
p is a pointer to int <=> *p is of type int <=> int *p;
similarly
p is an array of ints <=> p[<int>] is an int <=> int p[];
p is a function taking two ints and returning an int <=> p(int <int>, int <int>) is an int <=> int p(int, int);
You read the declared type from the variable and outwards, so that it corresponds to the usage of the variable in code.
>>
>>56190873
-- Send only to the sender to prevent channel-wide spam with generic word triggers
>>
>>56190840
Say what you want, but it is fast.
>>56190857
It does use a wheel
>>
Is there any small, fast and safe c compiler similar to the Tiny C Compiler? TCC is unfortunately discontinued since a few years.
>>
File: fuckedup.png (5KB, 275x33px) Image search: [Google]
fuckedup.png
5KB, 275x33px
>>56190873
>>
>>56190873
Comments are for programmers that can't read code
>>
>>56191233
If you're looking for alternatives to GCC, consider Clang.
>>
>>56191254
XD
good meme!
>>
>>56191254
The code tells you how, not why.

Comments are essential for unintuitive hacks, e.g. >>56191075
>>
>>56191254
Good luck remember what your code is supposed to be doing months after you stopped reading it without comments.
>>
>>56191184
that looks fine, but you should make separate classes where the extension is declared and then use those classes when defining their container I think
>>
>>56191222
Is that you Terry?
>>
>>56191233
Look into a compiler called PCC or Portable C Compiler, it's still being maintained to this day. At one point, Theo from OpenBSD was considering using it to replace GCC, but they later decided it's not ready yet and replacing GCC isn't a top priority.
>>
>>56191348
who said that

CIA niggers
>>
>>56191262
You think clang will overtake GCC one of these days?
>>
File: 1471638760120.png (128KB, 300x300px) Image search: [Google]
1471638760120.png
128KB, 300x300px
>>56190873
Look anon, I did this just now. Just for you!
randomRIOx x = replicateM x . randomRIO
-- x random IO numbers in range
>>
>>56191370
Clang is pure cancer.
>>
>>56191378
What's wrong with clang?
>>
>>56191385
it's pure cancer
>>
>>56191370
In performance? Yes. It's only a matter of time.
>>
>>56191262
I want alternative to GCC, Clang and Intel Compiler.

>>56191349
Looks interesting, thanks.
>>
>>56191385
It's classic Embracem Extend & Extinguish writ large.
>>
>>56191378
it is not though

https://www.youtube.com/watch?v=UtwaK-s9QRI
>>
File: a9a.jpg (112KB, 1113x630px) Image search: [Google]
a9a.jpg
112KB, 1113x630px
>>56191385
>>
File: 1468689473815.jpg (54KB, 530x800px) Image search: [Google]
1468689473815.jpg
54KB, 530x800px
i have 2 days to learn C pointers, malloc(), calloc() and free(), can i make it guys?

[spoiler]any tips or material to study pointers would be appreciated[/spoiler]
>>
>>56191473
Pointers are fucking easy. They're just memory addresses. What's the issue?
>>
File: _asd83.jpg (359KB, 1172x894px) Image search: [Google]
_asd83.jpg
359KB, 1172x894px
>>56191473
>pointers

here you go
>>
What would be the equivalent of 'delete' in Java?

Is setting a value to null close enough to that?
I'm trying to optimize large amounts of data processing by ensuring that old data gets GC'd right away
>>
>>56191514
>ensuring that old data gets GC'd right away
You cannot do that in Java. Sorry.

Your only recourse is to use unboxed primitives so the GC never touches them in the first place.
>>
>>56191473

http://cslibrary.stanford.edu/102/PointersAndMemory.pdf

You can pretty much learn everything you need to know in a couple of hours.
>>
>>56191513
This is some lies-to-children shit.
>>
>>56191480
Yeah, but all pointers are memory addresses? i mean, i don't quite understand whats happening when theres a vector/array with n spaces and that n is a pointer
>>
File: 1436897873612.png (151KB, 449x442px) Image search: [Google]
1436897873612.png
151KB, 449x442px
>>56191527
>You cannot do that in Java. Sorry.
slowly starting to see why people prefer stuff like C/C++
>>
>>56191574
Yes, all pointers are memory addresses.

T x[n];

x[i] = x + (i * sizeof T);
e.g., say T is a 4 byte integer

x[0] = x + 0
x[1] = x + 4
x[2] = x + 8
>>
>>56191568
how cum?
>>
>>56191527
>You cannot do that in Java.
you are an idiot, really...
no wonder /g/ays constantly bashes java, they know nothing about the underlying vm...
>what is the System.gc() VM hint
>>
>>56191656

There is no guarantee that System.gc() will actually run the garbage collector. As you stated, it's a hint. If you want truly deterministic memory management, RAII or manual is the way to go.
>>
>>56191673
a hint is close enough
you do not need a guarantee about this you pedant
>>
>>56191568
>This is some lies-to-children shit.
All of C is lies-to-children.
>>
File: perv.webm (3MB, 1280x720px) Image search: [Google]
perv.webm
3MB, 1280x720px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA).

>>56191480
>They're just memory addresses
That an usual error spread by low-quality C tutorials. A pointer is a type while an address is nothing more than a value. It's easier to see how pointer enhance addresses when you came from assembly programming where there no such thing. We could say that pointers are typed addresses.

>>56191321
Clojurescript.

>>56191254
>self-documenting code
No.

>>56190873
// closed on finalization
>>
File: weird_laugh.jpg (9KB, 236x260px) Image search: [Google]
weird_laugh.jpg
9KB, 236x260px
>>56191514
>optimize large amounts of data processing
>large amounts of data processinig
>java
>data processing
>large amounts
>>
Where can I learn how to make crosscompilers and how to use them?
>>
>>56191758
>java
>data processing
It's not the stupidest thing. If they're in a situation where using Java is either necessary or more convenient, then doing the processing in Java makes sense. And it's not like Java is THAT slow.
>>
>>56191758
Literally faster than anything that isn't C-family.
>>
>>56191759
A crosscompiler is just a compiler. It only stops being that when it deduces the target architecture from the host architecture and doesn't let the user override that behavior.

Anyway, just learn how to write compilers.
>>
File: 1458780613244.jpg (25KB, 704x528px) Image search: [Google]
1458780613244.jpg
25KB, 704x528px
>>56191822
>Literally faster than anything that isn't C-family.

Haskell GHC:                    0.454930841 seconds time elapsed
OCaml: 0.747779583 seconds time elapsed
Java OpenJDK: 1.189619693 seconds time elapsed
>>
Just finished adding support for if statements to my C compiler. Now it can compile the following function:

int foo(int a)
{
if (a) {
return 3;
} else {
return 1;
}
}


It produces shitty code in this case since I don't eliminate the dead branches to the "after" block after the returns, but proper DCE can come later.
>>
>>56191888
Not even willing to show what you're benchmarking?
>>
>>56191822
>what is Rust
>what is D
>what is Nim
>what is Crystal
On top of my head
>>
this is salvia
>>
File: wow anon.jpg (78KB, 884x574px) Image search: [Google]
wow anon.jpg
78KB, 884x574px
>>56191932
>>what is Rust
>>what is D
>>what is Nim
>>what is Crystal

Crystal:                        3.034363672 seconds time elapsed
D DMD: 9.432905226 seconds time elapsed
D GDC: 25.970303586 seconds time elapsed
D LDC: 6.347934615 seconds time elapsed
Nim: 6.083644424 seconds time elapsed
Rust rustc: 6.583698221 seconds time elapsed
>>
>>56191969
See
>>56191919

Otherwise you're just posting random numbers.
>>
>>56191932

What is FUCKING FORTRAN?
>>
>>56191986

Smells like Closurebench. It's a useless benchmark and it generally favors functional languages IIRC. It made C++ perform excessively bad because std::function is a piece of shit.
>>
File: sadloli.png (570KB, 1080x1600px) Image search: [Google]
sadloli.png
570KB, 1080x1600px
>>56192071
c++14 fixed that in part.

C clang:                        9.971914301 seconds time elapsed
C++ clang++: 5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed
>>
File: ezgif-685458725[1].gif (4MB, 320x178px) Image search: [Google]
ezgif-685458725[1].gif
4MB, 320x178px
My creation.
I used arduino UNO for this.
-Recorded on shit camera
>>
>>56191822
: ^ )
>>
>>56191986
I'm not >>56191969, but here's a benchmark of a bunch of different languages https://github.com/kostya/benchmarks. In every benchmark (except one) Java was slower than Rust, D, Nim and Crystsal
>>
>>56192149
Does it use a light sensor, or is it timer based?
>>
>>56192177
Timer based.. no money for light sensor ;)
>>
>>56192161
Whats nim and crystal?
>>
File: le poo calling.jpg (51KB, 512x288px) Image search: [Google]
le poo calling.jpg
51KB, 512x288px
Daily reminder that if your language has different (in the sense of !=) values that evaluate to false, it's shit
>>
>>56190217
Should I learn C or C++? My main goal is to contribute to open source projects until I'm good enough to find a job. I'm more interested in contributing to qt and KDE applications and distros that focus more on them.
>>
>>56192274
Kek, he looks like a glob of shit himself
>>
>>56192302
>qt and KDE
C++ it is.
>>
>>56192345
I heard the C++ is a handful to take in at first, should I read the C programming language before diving into it? I already know some of C++ and some of C, pretty much in equal parts. I'm wondering what the best course of action would be to learn C++ properly.
>>
>>56192372
>I'm wondering what the best course of action would be to learn C++ properly.
Read a book that teaches modern C++ (C++14 preferably).
>>
>>56192408
I started bjarne's The C++ programming language and C++ primer. I might continue C++ primer.
>>
>>56192372
>>56192408
Just learn about C++11, 14 is not even implemented properly yet, where 11 works in G++ 4.9 or so up.
You can read up on 14, but it's not really useful atm.
>>
I've been spending the past few months learning Java, reading through one of Oracle's books and recently trying JavaFX. Recently however, I've been reading that Oracle stopped really supporting JavaFX years ago and that the only other alternative (for desktop applications) is Swing which is dated. Even on dedicated Java forums people mentioned that C# is much easier for desktop GUIs.
So I looked into making games, where the general consensus was that Java doesn't see a lot of use either, at least compared to C++ and other languages. Really, it seems like the only application is android mobile development or making web applications, none of which I'm particularly interested in.

Did I fuck up? Should I try a different language before I waste any more of my time?
>>
>>56192215
Crystal is a language inspired by Ruby that aims to be as fast as possible. Nim is a statically-typed fast scripting language. It's pretty sad that Java gets beaten by scripting languages.
>>
>>56190512
It's mainly about the heavy C++ feature use which gains you nothing. But since you can't even see how it's questionable I doubt I can find good motivation.
>>
>>56192518
It's always a good idea to get experience with different languages. If you really want to make GUI's (for Windows), learn C# and .NET. If you want to create webpages (not servers, node.js is a meme), learn JavaScript. If you want to quickly create and solve problems (scripting) without a GUI, learn Python. It's easy to learn other programming languages when you've learnt a language already, the hard part is writing good algorithms.
>>
>>56192518
If you want to make games with nice graphics, learn C++ and OpenGL.
>>
>>56192631
Oh and "it's useful abstraction" or "I believe in useful abstractions" makes no sense.
>>
>>56192596
>scripting language
you don't know what it does mean.
>>
>>56192518
Use C++.
Avoid as much C++ as you can without feeling bad.
Learn a graphics API
Learn to interact and wrap the OS API to fit your goals
Learn to optimise code beyond algorithmic optimization.
>>
>>56192161
>slower than Rust
That would embarrass anybody.
>>
>>56192691
rust is quite good actually.

https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp
>>
What do you do to motivate yourself, /dpt/? Like most of us here, I program because I want to, but I used to program much more prolifically because I was worried I was unemployable. It wasn't until college that I realized how far ahead I was, and that was when all my motivation dried up. It seems like I never get anything done unless there are consequences if I don't (grades, work, etc) and this is obviously not a good long term strategy. Has anyone else struggled with this? How did you build good habits?
>>
>>56190217
fuck you weeb faggot
>>
>>56192706
You misunderstood. It would embarrass anybody that a meme language made by SJWs is faster than a real language.
>>
What are other popular programming languages that are very concise like golang? I'm using golang for network stuff but I want to do some systems programming.
>>
>>56192710
Higher standards? Be able to write good software? You're probably actually shit at it. If you're not looking at every application you touch with disgust you're bad.
>>
>>56192750
J
>>
File: 233oSLU (1).png (731KB, 610x610px) Image search: [Google]
233oSLU (1).png
731KB, 610x610px
>>56191226
>>56191756
Speaking of pointy ears.

Is there any C static analyser or compiler option that shouts at you when you do non-permissible operations with pointers such as adding two pointers together or multiplying? I know C is lenient and permissive on purpose, but I'm curious.

Maybe the C++ Core Guidelines stuff includes somwthing to that effect?
>>
>>56192780
- Turn on all warnings
- Turn on extra warnings
- Turn on pedantic mode

But, in general, even this won't catch all of the obviously stupid things you can do with pointers. You just have to git gud
>>
>>56192780
-pedantic-errors
>>
>>56192426
Nigga stop bullshitting, C++14 is just a small improvement over C++11 and it's fully supported by both GCC and clang.
>>
>>56192759
That's the thing. I've had internships now and realized I was better than everyone in the room wherever I went. Am I just being unlucky? Last year the people I worked for tried incessantly to get me to drop out of college and work for them, offering almost 90k a year (which I refused, because they had all the disadvantages of a startup and none of the advantages, even though the money was good). I've only met a few people better than me in domain specific areas.

But the thing is, I'm not exceptional. I'm just competent. I want to be exceptional but I have lost the ability to work diligently towards that.
>>
>>56192780
Nice image faglord.
>>
>>56192855
*tips fedora*
>>
>>56193000
If I told you all the nasty things about me would it make you feel better? I'm asking for help. If you're not going to try then don't waste your time.
>>
>>56193024
Not him I told you you should keep higher standards. But you insist you are.

You're not.
>>
>>56193024
>If I told you all the nasty things about me would it make you feel better?
I'm a sadist, so yes.
>>
>>56190519
have a look at simplex noise
>>
So what's the best C library for basic data structures like linked lists, hash maps and so on?

Is there some sort of list/database of existing open source C libraries?
>>
>>56192855
if you are better than anyone at work and can't stand it then leave and look for a more challenging position. If you think you have reached the top then you are dead wrong, there are always so many things that could be better and so much more knowledge that could be gained, that never stops. The only motivation I need is a fun project
>>
>>56192725
Nice bait
>>
>>56190221
VS Code is pretty good senpai.
>>
>>56192780
I know what you're looking for; it's called Rust.
>>
>>56193046
I'm sorry, what do you mean? I am what?

>>56193053
Well, sure, I guess. Not like we'll meet. I'll keep it brief, but I'm your splitting image of a virgin sperglord loser, minus the weight, the fedora, and the acne. I'm polite to the point of awkwardness and am pretty sure I really am on the autism spectrum somewhere. I fap to weird shit and watch a really unhealthy amount of anime. My only saving grace that keeps my life from falling apart is my latent ability in math and computer science from a young age. That's why I have friends, my scholarship, and anything else that prevents me from committing suicide.
>>
>>56190217
OPs image makes it a cringe/programming thread.
>>
>>56190873
// Helper for determining, if the client currently has an open post not older
// than 29 minutes. If the post older, it is closed automatically.
>>
>>56193150
I know... I'm so far below people like kripken, one of the biggest players behind emscripten, for example, that I'm literally retarded by comparison. I never finish anything I write unless it fits in a week of time or less. I lose the development hangout that quickly. I'm in a high percentile, but now that I have a safe career I just stopped trying to push beyond that. It's like indefinite procrastination.
>>
>>56193300
Development habit*

Typing on a phone.
>>
>>56190873
//Abandon all hope, ye who enter here
>>
>>56190873
// TODO figure out how on earth this works
>>
>>56190217
Please do not use a socially damaged autistic anime image next time.
>>
>>56190217
https://www.youtube.com/watch?v=KINIAgRpkDA
you fags are so elite!
meanwhile, Go devs improve Go... by parsing ASM from .s files and the specs directly from the arch manuals PDFs
>>
>>56190873
I don't write comments because I actually know how to name my functions and variables in a descriptive way
>>
>>56193455
Go is a bad language. Any effort spent on it is wasted.
>>
>>56193469
Want to know how I know you're unemployed?
>>
>>56193483
There has not been a good language created since the beginning of time.
>>
>>56193505
Go is an especially bad language
>>
>>56193455
The Go compiler is just as good as gcc and clang 20 years ago.
>>
How should I name a function which merges ranges on a number axis?

e.g. it gets (from=10, to=20) and (from=20, to=35) and returns (from=10, to=35), although they don't have to be adjacent or overlapping and (from=10, to=20) with (from=50, to=80) returns (from=10, to=80) too.

Currently it's span_positions(from_pos, to_pos) but I feel that's shitty.
>>
>>56193483
go tell that to the people actually producing quality software written in Go

>>56193533
yet Go 1.7 is now as fast as (if not even faster than) C and C++, i.e., lots of space for improvement.
btw, as usual, patches are welcome, and I'm sure the elite /dpt/ programmers will contribute, amirite ;^)
>>
>>56193618
Already done, I told it to the empty set
>>
>>56193526
Name some reasons.
>>
>>56193618
>yet Go 1.7 is now as fast as (if not even faster than) C and C++, i.e., lots of space for improvement.
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=go&lang2=gcc
TL;DR no it slow as fuck. That's mainly because their compiler is complete shit. It's C code automatically translated into Go, because Pike is autistic as fuck.
Go has just implemented SSA for x86. GCC has this since April 2005. https://en.wikipedia.org/wiki/Static_single_assignment_form
Also, Go has no generics.
>>
>>56190321
>freeing heap allocated objects

The computer takes care of all this when execution of my program is done. Why bother with it?
>>
>>56193681
No generics
claims to be suitable for systems programming yet is garbage collected; in fact it is not suitable any programming
Shit performance
interface {}
Typical pattern returns a pair where returning a disjunction would be more appropriate
if (err != nil) EVERYWHERE

I could go on
>>
>>56193600
I would have told you to call it the union of intervals based on your first example, but with your second it's really just finding the extrema. Maybe find_extrema?

>>56193694
Wow, finally? Still doesn't (and likely will never) have TCO. And you can't fix their broken type system without it no longer being Go, so...
>>
>>56193751
:^)
>>
>>56190873
# waste some frames to get up to date

Oh yeah it's bad, I'm getting the frames from a program I didn't make that just pushes shit onto a queue, and I have no idea where the publisher is in that program so I could just rewrite it to just limit the queue size.
>>
>>56193781

Thanks. I really appreciate it.
>>
>>56190217
>learning python
>learning to host my own website
>learning css
>learning processing to create interesting visuals

help. I have no direction
>>
>>56193803
Anything for you, mummy!
>>
>>56193751
ayy
>>
>>56193830
Wrong thread buddy.
>>
>>56193890
Not him, but try to keep your personal convictions away from beginners. You're allowed to talk about anything programming related, as well as shit on people for their choices. But keep it away from beginners, man. He's clearly willing to try multiple technologies so whatever you hate might not last long anyway.
>>
>>56193924
Guido pls go
>>
>>56193830
One thing at a time! Do you know HTML?
>>
>>56193763
>find_extrema
The real finding of the extrema goes on in the function that calls this one though. Basically I'm looking for all intervals that satisfy a particular condition and then make a new interval that spans from the beginning of the first interval which satisfy the condition to the end of the last one which satisfies it.

This function is just for stitching them together.
>>
>>56193694
>>56193757
>No generics
Don't be babies.

You don't need generics.
>>
>>56193977
Have fun writing swap, len, less for each sort.
>>
>>56193924
Sure but we have a general dedicated to web stuff which would be more appropriate.
>>
I built a brainfuck compiler today. Please rate.

https://ideone.com/ZGZZDr

Holy shit it is slow as fuck. And does not work for some programs.

But hello world works fine!
>>
For an internshippy thing, I'm trying to display the original rating of some websites on a page. I used the code from here: http://rog.ie/blog/css-star-rater with some modifications, but now I'm a bit stuck again.

Should I do a 'for' loop in the javascript itself, iterating through the entries? Or should I just create a function and run it through that way? I also still need to properly understand the best way to load in the individual stars for each entry. Something like:

document.querySelector("1.resultBox"); where 1 is the id of the element and resultBox is the class maybe?

I haven't worked with Javascript too much, so forgive me for being noobish at it...
>>
>>56190873
// do NOT sort, the indexer will lose track of features
>>
>>56192124
Source? (the image)
>>
>>56194053
Use pointers.
>>
>>56194016

This is an interpreter, not a compiler. BF Interpreter issues are universally related to looping. Take a second look at your implementation for that.
>>
>>56194129
Oh shit, typo. Yes it's an interpreter, not a compiler.

Not sure why i wrote compiler. I'm kinda burned out right now.
>>
>>56193757
>No generics
Because an implementation that allows for fast compile times and low runtime cost does not exist yet.
>systems programming
Server programming, not systems programming. They overlap but are two separate concepts.
>Shit performance
Good performance comparable to C++ on typical server tasks.
>interface {}
Hurr durr, then don't use void pointers.
>disjunction
Needless complexity.
>if (err != nil) EVERYWHERE
Errors are values. You can do more with them then just bubble up.

>>56193986
>swap
a, b := 1, 2
a, b = b, a

>len
Built in and generic.
>less
The < operator? Can be done on any types derived from built in number types.
>>
>>56194016
I made a brainfuck interpreter in Rust, but it isn't nearly as bloated as yours. Take a look at my code, it's pretty fast. http://pastebin.com/8vNWmdyP
>>
File: [email protected] (21KB, 350x350px) Image search: [Google]
python-for-beginners@2x.png
21KB, 350x350px
I know python
I got my first smartphone
can I use python to make some andoid apps?
I know pyqt, but I read that Kivy is gui for mobile devices
so that makes me think that I could use python

but would I be able to use phones API, like fingerprint sensor, camera, and all that shit?
>>
>>56194197
You're full of shit. You MUST implement Len yourself.
package main

import (
"fmt"
"sort"
)

type Person struct {
Age int
Name string
}

func main() {
var persons []Person
persons = append(persons, Person{
Age: 10,
Name: "Foo",
})
persons = append(persons, Person{
Age: 25,
Name: "Bar",
})
sort.Sort(byName(persons))
for _, person := range persons {
fmt.Println(person.Name)
}
}

type byName []Person

func (n byName) Len() int {
return len(n)
}

func (n byName) Swap(i, j int) {
n[i], n[j] = n[j], n[i]
}

func (n byName) Less(i, j int) bool {
return n[i].Name < n[j].Name
}

Have fun writing boilerplate :^)
>>
>>56194197
>Because an implementation that allows for fast compile times and low runtime cost does not exist yet.
Rust.
>Good performance comparable to C++ on typical server tasks.
With typical server tasks you mean IO. I can't deny that Go is good at IO, due to its async nature. C++ is way better at processing.

These are the things I know about Go. I don't write Go.
>>
>>56194315
No. Just no.
If you want to learn how to make Android apps (it costs money btw) you should learn Java.
>>
>>56194408
>it costs money btw
heh, doubt it
also nigger substance, give substance why, not nigger level yes*no*blabla
>>
>>56194016
>>56194286
from sys import argv, stdin

cdef char cells[30000]
cdef short int cellPos = 0, filePos = 0
cdef list stack = []

cdef inline void move():
cdef int i = 1
while i != 0:
cChar = input.read(1)
if cChar == '[':
i += 1
elif cChar == ']':
i -= 1

with open(argv[1]) as input:
while True:
cChar = input.read(1)
if cChar == '':
break

if cChar == '>':
cellPos += 1
elif cChar == '<':
cellPos -= 1
elif cChar == '+':
cells[cellPos] += 1
elif cChar == '-':
cells[cellPos] -= 1
elif cChar == '.':
print(chr(cells[cellPos]), end = "")
elif cChar == ',':
cells[cellPos] = ord(stdin.read(1))
elif cChar == '[':
stack.append(input.tell())
if cells[cellPos] == 0:
stack.pop()
move()
elif cChar == ']':
if cells[cellPos] != 0:
input.seek(stack.pop() - 1)
else:
stack.pop()


Mine in Cython
>>
>>56194286
>devance

Is that even a word?
>>
Learning about callback functions in JS

>_<
>>
>>56193656
https://github.com/avelino/awesome-go

>>56193694
>http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gcc&id=3
>/usr/bin/gcc -pipe -Wall -O3 -fomit-frame-pointer -march=native -fopenmp -D_FILE_OFFSET_BITS=64 -I/usr/include/apr-1.0 binarytrees.gcc-3.c -o binarytrees.gcc-3.gcc_run -lapr-1 -lgomp -lm
>-march=native
well, AFAIK, golang still doesn't support many ISA extensions... so yeah, of course it will be slower.
>>
>>56194513
Can anyone explain this to me

>Here is an example of using sort with a compare function that will sort the elements from smallest to largest number:

var array = [1, 12, 21, 2];
array.sort(function(a, b) {
return a - b;
});


Even though it's a simple example of callback functions it already confuses me

I understand an anonymous function is called as a parameter for sort() function

but why two parameters and why is one subtracted from another?
>>
>>56194390
>Rust
>fast compile times
No.
>>56194380
Only if you need to sort it. You must satisfy sort.Interface for that. len(byName) would have worked fine in other cases.
>>
>>56194588
sort is being passed an anonymous function (a lambda function) that is being used as the test for how to sort the array
>>
>>56194588

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
>>
Getting bored of doing those little code practice problems. Thinking about taking on some ridiculously lofty goal (that I'll probably never complete but eh), like making an MMO. Good idea yes/no?
>>
>>56194619
OK I think I understand
But isn't it a bit weird way to do it?
It's not very intuitive to me, maybe I'm dumb.
>>
>>56194646
welcome to JS :)
>>
>>56194646
no, its actually very intuitive and consistent, compare that to how Ruby would pass a block or Perl's implicit itterators
>>
sorry if this is cosnidered a bad posting practice here, but i need advise.

I have this month and the next one to Learn a language and land a job no matter how shitty, What language(s) do you suggest, so i cna be employable asap?
I'm begginer tier(or maybe lower) in C, C++, java, C# and have only done really basic tutorial stuff.

The problem is things are happening and my family might not be able to support me, so I want to get a job to remove that burden from my parents, IF this seems unrealistic just say so and I guess I will go and look somewhere that will pay me to flip some burgers.
>>
>>56194588
>but why two parameters and why is one subtracted from another?
Sort expects you to pass in a comparator function. What that usually means is that the function will take 2 numbers, in this case a and b, and return a negative number if A is smallest, 0 if they are equal, or a positive number is B is smallest.

Then it applies that function on all elements of the array and uses it to sort them. You're basically saying "here is how I want you to order the elements of that array". If you switch out return a - b; with return b - a; it will sort from largest to smallest.

When this becomes really useful is when you want to sort an array of objects. You can then do return user1.id - user2.id; or similar.
>>
>>56194679
>having to redefine functions and even operators
>>its actually very intuitive and consistent
kek, is this what JS devs believe?
>>
>>56194436
It does. 25$ a year + some extra for every app IIRC
>>
>>56194690
you'll be flipping burgers, its takes about 2 years to get good at any kind of programming, even web programming. There are people who are highly skilled and educated who will work internships for free to just get their foot in the door, if youre a shitty programmer no one will even take your work for free
>>
>>56194690
You have no formal education and no portfolio of completed projects? I assume so because if you have a degree then language usually doesn't matter. Unfortunately 2 months is unrealistic then, chances are you are going to have to take on a burger flipping job for now.

If you want to be a programmer but can't/don't want to go to college, getting a job could take 5 weeks or 5 years. I would pick one technology/stack instead of jumping around between languages and try to really master it, make something impressive with it and put that on your resume before you start sending it out.
>>
>>56194783
yes it is, stick to fizzbuzzing in C if you cant handle 'redefining' functions
>>
>>56194597
That's why you have debug compilation. Rust is getting incremental compilation soon too, so that would help a lot as well.
>>
>>56194690
>The problem is things are happening and my family might not be able to support me, so I want to get a job to remove that burden from my parents, IF this seems unrealistic just say so and I guess I will go and look somewhere that will pay me to flip some burgers.
I'd say it is unrealistic... but if you need to learn something ASAP for $$, learn PHP. you won't make a lot of money, but it's easy and very widespread
you didn't say if you already know a language, though
>>
>>56194783
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort

Is this really that difficult to you?
>>
>>56194690
If unpaid internships are legal in your country you're in a pretty bad spot. Granted you'll have to send some 200 resumes out if you even want to get contacted for an HR interview 2 months from now.
>>
>>56194873
>difficult
it's not difficult, it's just useless and retarded.
incredible, people now DEFEND JS in /dpt/?
fucking memers
>>
>people think they can learn enough programming in a few months that people will want to pay them money to write code
Stop this
>>
>>56194916
>useless and retarded.
No it's not. You have a generic sort function and then you pass in how you want it to sort stuff. You can very easily tell the sort function "sort this shit based on age, even numbers before odds" or any other dumb criteria you might come up with.

It's not a defense of JS, any good language/standard library has generic sorting with comparator functions. It just so happens that JS has it too.
>>
>>56190221
Is there a crack out there? I really dont want to pay $70 US for quality of life upgrades
>>
>>56194916
Name a better language for web dev? pro-tip you can't
>>
>>56194945
If you're learning webdev, this is literally what happens tho.

It's just nepotism tho.
>>
>>56194916
How will your computer understand the semantics of sorting for any arbitrary class of data. The sorting function isn't just going to sort primitives, it could be used to sort JSON objects.
>>
>>56194964
TypeScript
ClojureScript
PureScript
Elm
>>
>>56194286

I'm interested in knowing what exactly makes my code (>>56194016
) bloated? The use of vector<int>, or the use of so many functions?
>>
File: 970587615623165.png (5KB, 471x258px) Image search: [Google]
970587615623165.png
5KB, 471x258px
guys im making multithreaded program, im sitting at it for few hours now and i cant think clear anymore, im trying to find hole but im overthinking it.

shared structures are: Peer and Room
threads are: 1 main thread + thread for every room
only one thread have access to room, either main or room thread, this is the first lock, then inside it, thread can additionally lock access to peer for a moment. thats the second lock.
none of the threads can lock peer if they didnt lock room structure

any scenario where i could get a deadlock?
>>
>>56194983
all JS transpiler languages kek
>>
>>56195008
So? I suppose you would say it's impossible to name a better language for application dev than asm.
>>
>>56194834
It may be fast in comparison to C++, but not as fast as what Go is targeting. That's less than a second for your average 10k+ loc project and 10-30 minutes for multi million loc Google-scale projects. As a measure of comparison Go can recompile its own stdlib (which is comparable to Python in extensiveness) in less than 10 seconds on my cheap laptop.
>>
>>56195037
youre trying to hard to trash JS
>>
>>56195006
>Peer and Room
Whats that?
>>
>>56195066
I'm not trying at all, JS is inherently trash.
>>
>>56195066
You're trying hard at pretending to be retarded.
>>
>>56195037
>"I'll trash JS so I'll be accepted by the /g/ community! Oh shit it didn't work, it's backlashing!"
>>
>>56195087
Sweet. I wonder if I can convince /g/ to write everything in Brainfuck
>>
>>56195083
Meh, it's gotten better with ES2015+. Still shit until we get optional static type annotations.
>>
>>56194641
Good idea. You can also do some less boring coding problems, like creating a brainfuck interpreter
>>
>>56195067
thats irrelevant, peer is just a structure with connection info, its an online program
>>
>>56194957
>>56194977
I'm talking about this particular example: >>56194588
any decent language will provide a function to sort an array of ins/floats without having to pass a function pointer to sort()
>>
>>56195118
Optional typing is gross. It's just bad static typing.
>>
>>56195157
Yes if you don't pass in anything, sort will in fact sort from lowest to highest for all primitives. It's an optional parameter.

I've already linked you this once
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort

>arr.sort([compareFunction])
>compareFunction
> Optional. Specifies a function that defines the sort order.
>>
>>56195114
that seems quite easy, knowing that these memers are able to defend and even justify any shit meme languages
>>
>>56195166
It's better than no static typing at all.You could arguably create statically typed scopes in the same manner as "use strict" to not break existing code, but the language designers simply hate static typing and it will probably never happen. Quite sad.
>>
>>56195196
oh, yeah, and then you get:
$ node
> [1, 10, 2].sort()
[ 1, 10, 2 ]
>>
>>56195220
I disagree. It gives only the illusion of type safety. Without it, you're under no such misapprehension.
>>
>>56195234

Oh, that is rich.
>>
>>56195006
ill make it more easy, there are 2 mutexes, m1 and m2, and multiple threads, each thread is
void function()
{
while(1)
{
m1.lock()
///............some code
m2.lock()
///............some code
m2.unlock()
///............some code
m1.unlock()
}
}

m1 is always locked before m2 and m2 is always unlocked before m1, looks like it is safe
>>
>>56195201
I never come to /g/ for actual advice. 90+% of them have no clue.
>>
>>56195241
How so? You can create codebases of safer and faster statically typed code that can communicate to existing dynamically typed code.
>>
>>56194960
There is. Just one byte that needs to be edited.
>>
>>56195280
I'm thinking of when you might have to use someone else's code. They may have put types at the edges, but who's to say they haven't cheated inside somewhere?
>>
>>56195220
>It's better than no static typing at all.

No it isn't, it's an awkward compromise.

People who want optional typing are retards like you who really just want static typing and can't appreciate a dynamic language.

The end result is everyone trying to use optionally typed languages as if they were statically typed, and since it's not real static typing, you get more friction, less safety, and less elegance than you could have gotten.
>>
>>56195261
Looks robust in principle. In practice what matters is that you do in fact release the mutexes or whatever.
>>
>>56194794 not the same guy but,
couldnt you just develop apps that run only on rooted devices?
>>
>>56195319
It doesn't help that most static typing systems in use are so limited. Even Haskell's is too constraining now, and most languages' type systems are nowhere near as powerful as Haskell's.
>>
>>56194408
What about f-droid and just hosting it yourself?
>>
>>56195316
If their entire library is inside a "use static" scope that can provide a guarantee their code is type safe. This would of course require the stdlib and all browser APIs to define compatible type safe interfaces.
>>
>>56195405
Ah, I see what you mean. Yes, that would be much better, assuming the type system is sound.
>>
>>56195319
I don't want much from a type system in JS. Only a guarantee in parameter and variable types. This would allow to create regions of type safe code with less quirks and more opportunities for the JIT compiler to optimise. It is quite ironic that to write fast JS you have to use it as if it was statically typed to give more opportunities for runtime optimisation.

And there must be a compromise, because all the JS code in the world will not magically migrate to static typing over night or ever at all.
>>
>>56195510
If WebAssembly takes off, there will be no need to use JS.
>>
>>56193960
Yes I learnt HTML years ago back in school.

I may just work on Java. And ditch python
Processing and Java have the same syntax anyway.
>>
>>56195545
It will take off, but not in the next 3 years. Browsers will also need to expose WASM APIs of all existing current JS APIs. Then your target language on top of having a WASM compiler would need to create native interfaces to these WASM APIs. I'd love being able to write my client in multithreaded C/C++/Rust, but that is quite far off.
>>
>>56194588
the sort function takes a function as a parameter. sort then iterates over the array, calling the parameter function with pairs of values from the array, so you can compare two values and decide which of the parameters has higher or lower value.
>>
>Want to dick around with making little tools for my android phone
>Install Xamarin
>Boot up visual studio
>Emulators refuse to work
>"Error: Could not create the Java Virtual Machine"

What a steaming heap of garbage Java is. I literally don't even need to write a single line of Java to have it turn around and fuck me in the ass.

Anyone have any experience with this nonsense? I simply cannot get it to comply and Google is completely free of any helpful information.
>>
>>56190217

In assembly how do I make it so that a bitwise operation combines 2 registers by only placing a 0 where they both are 0
>>
>>56195788
wut
>>
Ny tråd nå?
>>
>>56195788
OR
>>
>>56190840
>sieve of eratosthenes
kek, my quadratic implementation in C is faster even for smallnum.
>>
>>56190873
/* ERROR_H */
>>
>>56190873
/* this could be written better i guess */
>>
>>56190873
# hope you know how recursion works
>>
NEW THREAD!

>>56196196
>>
>>56194964
Backend? Python or Ruby. Frontend? Not many choices because of what browsers support but we have transpilers so you don't have to swim in the cesspit that JS is.
>>
>>56190873
>wtf lmao, I could've done filter (/='\\')
>>
>>56190243
>/g/ says x therefore /g/ is right
I've learned so far that at least one third of /g/ists are here exclusively to trumpet memes and possess no intelligence. Another third of /g/ uses exists solely to be contrarian.
>>
>>56190873
//LEFT OFF @
>>
>>56195972
>>56195824

1010
1100
becomes
1110
Thread posts: 331
Thread images: 26


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