Daily Programming Thread

Old /dpt/ at What are you working on?

I'm currently looking at github.com/cicakhq/potato code to learn Common Lisp

Other urls found in this thread:

en.wikipedia.org/wiki/WebAssembly
hacks.mozilla.org/2016/10/webassembly-browser-preview/
youtube.com/watch?v=hP-DZMmQBng
twitter.com/SFWRedditImages

Finally, some good op-pic.

>well-scaling software does not need to run in parallel
If all you're doing is shuttling data around and mostly doing I/O and networking, yeah. If you're doing any actual fucking computation, no.

Currently setting up atom, but I'm getting something that looks kind of weird...Anyone know how to fix this?

is he gonna do a christmas tree lecture this year

This is how i handled error detection this morning
inline void ThrowOnError(HRESULT hr, char* s)
{
if (FAILED(hr))
{
CleanUp();
throw std::runtime_error(s);
}
};

HRESULT errorcode = SomeLibProcedure(); ThrowOnError(errorcode, "SomeLibProcedure");
errorcode = SomeOtherLibProcedure(); ThrowOnError(errorcode, "SomeOtherLibProcedure");

Now i have
struct throwOnError_struct
{
char* message;
std::function cleanUpFunction;
};
inline throwOnError_struct ThrowOnError(char *s, std::function cleanUpFunction = [](){})
{
return{s, cleanUpFunction };
}
inline HRESULT operator>>(HRESULT hr, throwOnError_struct s)
{
if (FAILED(hr))
{
s.cleanUpFunction();
_com_error err(hr);
throw std::runtime_error(std::string(s.message) + "\nErrorcode " + err.ErrorMessage);
}
}


SomeLibProcedure() >> ThrowOnError("SomeLibProcedure", CleanUp);
SomeOtherLibProcedure() >> ThrowOnError("SomeOtherLibProcedure", [](){/*maybe some custom cleanup here*/});


I don't know if i'm retarded or brilliant.

install vs code

Why the fuck do you crossdresssers use rust?

Well, IF it would scale well, say linear, you technically wouldn't need parallel.
But almost no non-trivial problem does that.

Are we talking "scales to hardware" or "scales to input" here?

trying to figure out how the triangle inequality makes kNN classification faster.

that's a strange anime crossdresser.

No, I don't!
If you agree to touch me inappropriately, I'll start using it.

I mostly talk scales to input, since that is a more immanent problem. Sorry for the ambiguity.

Still, scaling to hardware is all you can do once you run out of ways to reduce complexity.

>tfw all the tree traversal and recursion clicks at the same time

oh boy. i'm starting to feel ready.

babby steps

oh wow, nice plot twist there

in the literature there are "strong scaling" plots (constant input size, x = resources, y = time) and "weak scaling" plots (x = input size and resources in a constant relationship, y = time). the former will necessarily converge to some hard law, e.g. amdahl's parallelism law. the latter will not necessarily converge and in theory can flatline forever, e.g. double input, double resources, same runtime. generally when people talk about "scalable" systems they mean that the system is nearly-flat in a weak scaling plot.

a really key observation is that an arbitrarily shitty system can be flat in a weak scaling plot, because it's not a comparative plot. in fact, the easiest way to get a weak scaling plot is to design an incredibly shitty system, such that the shit is proportional to the input and dominates the input, and then make the shit scale. this will give you near-linear weak scaling

there's been a push to report "COST", i.e. Configuration that Outperforms a Single Thread

Indeed. Now the rest comes pretty easy.
Feeling good.

and just to be flip and name some names:
Hadoop is a system like this. Giraph and GraphLab/Turi are systems like this. Spark is a system like this.

now implement a depth/breadth first search

[/code]
def passwordgenerator():
strong_password = 'aBcdeFghijklmnoPqrSTuVWxyZ19846438!@#%!#%$#^%$&^$*&^'
user_input = input('enter yes and I\'ll gnrate passwd :^): ')
randomint = random.randint(7, 14)
l = []
if user_input == 'yes':
for i in range(randomint):
password = random.choice(strong_password)
l.append(password)
print(''.join(l))
[/code]

day three of learning programming. kinda feel like I'm getting to the point of possibly making something useful. Just overwhelmed plus Making a webscraper using requests and beautiful soup random library etc. How is this stuff coded from scratch?

G R A P H S
R
A
P
H
S
open your mind to the possibilities of djikstra and tarjan

how do I get into writing cheats for games, I know C and assembly, I'm guessing that'd be useful

>that'd be useful
That's all you need.

Depends on the game. C and ASM won't do you much good if the game is C# or C++

>How is this stuff coded from scratch?
same way you're doing it, it was just a lot of work over many years, which is why we depend so much on libraries. if you stick with programming for years it will become more obvious to you how everything is done

i strongly recommend against browsing the beautifulsoup code, however, because it's FAMOUSLY insane. the guy who wrote it made up a bunch of crazy shit that is totally different from the normal way of doing parsing

Pretty sure you need to reverse engineer the game.

Already know them. They are also conveniently nearly the same except for one being a stack and the other a queue.

Convenient is probably not the right world because it's inherent to that data structure, but whatever.
Now I need to fully understood all unique permutations of a string function. Not as fun unfortunately.

You can read all machine code as asm-code. That's how reverse engineering works.

That's pretty good for day three, I know a lot of students who still cant do that shit after their first semester.
Libraries and stuff get written from scratch because somebody wants a thing that does it a thing, and then they decide to write it as a library instead so they can implement it in other things later.
It takes a long time and starts out as some small scripts initially, and just gets built up.

You can also dig a canal with a spoon. That doesn't mean it's the best way to do it. Use a decompiler

>Use a decompiler
Yeah, no. That shit doesn't work.
If you don't understand the disassembly, you just need to git gud.

Have fun sifting through billions of lines of assembly. Have you ever seen modern x86? It's a complete cluster-fuck

CVTTPD2DQ xmm1, xmm2/m128

>9 digit instruction identifiers

Yeah, and that's why decompilers can't do shit.
There's no way you can go back from SSE instructions back to meaningful C or C++ source code.

Now the good thing is vectorized instructions are only used in specific cases such as tight loop working over arrays, so most of the time you don't see them at all.

Is NodeJs any good or is it just hipster shit?

I want to lean javascript but I have no interest in front end development.

Use Lua + Luarocks.

Lua Lapis if you want the whole web thing.

Pretty much just hipster shit. It's dog slow an has all the problems of the JS ecosystem.

It's a way for web devs who are unable to learn anything but JS to branch out in different domains, with often terrible results.

Is the event loop all hype then?

no
node was made for webdev retards who can't learn another language.
Just learn something else.

It's pretty much just Stockholm syndrome, when you're used to the state of Javascript you find joy in the little things.

Any other language will let you choose if you want an event loop, threads, or something else.

Isn't that true for about all languages out there?
>inb4 triggered

Is there any reason I shouldn't include a parent field as part of my node in binary trees?
For interview purposes.

How about doubly linkedlists instead of single?
Disregarding the interviewers explicitly mentioning to use a certain implementation of course.

In JS there are many things for which you don't really have a choice, and many things which are broken and patched up hapazardly by a gazillion different libraries being rewritten every 6 months.

Can't wait for Web Assembly so we can compile real languages for the browser.

Retard here.

>Is there any reason I shouldn't include a parent field as part of my node in binary trees?
Yeah, it's a complete waste, it's useless.

>For interview purposes.
The interviewer will ask you to justify that, and you'll have nothing good to say, because your idea is bad.

>How about doubly linkedlists instead of single?
Only do that if it's required, or if it significantly improves runtime.
Don't just add pointers everywhere for the fun of it.
The goal is not to make the most feature complete data structure, it's to make the simplest, most performant one.

Web assembly is a fucking bane.

There we are, fought years and years and years for open standards like HTML and Javascript and whatnot, finally abandoned Silverlight and Flash - and now a new generation of retards is advocating Web Assembly.

When I press CTRL I can see the source code directly. Can I do that with Web Assembly too? Would be new to me.

Keep your Web Assembly off of me.

Meant CTRL + U.

When web assembly comes around we can compile the NodeJs runtime into web assembly and program in JS on top of web assembly.

Beautiful things are coming.

WASM is actually an open standard and will kill all shitty browser plugins. WASM is the nail on Flash and Java applet's coffins.

It's not any different than compiled, obfuscate asm.js, except for the whole part where it actually has good performance and decent semantics, so your point about seeing the source is moot, WASM changes nothing here.

You'll be dragged into the modern world kicking and screaming, or you'll be left behind.

Web Assembly isn't meant to completely replace javascript. WASM is actually slower in most things than JS. It's essentially going to be like Flash that everybody can agree on and won't (hopefully) complete dog shit.

>WASM is actually slower in most things than JS
That's completely wrong, please don't spread misinformation that you just pulled out of your ass.

Recently published benchmarks show that the current alpha quality implementation of WASM beats JS in almost all cases by two digit percents.

What is this webassembly i keep hearing about? what is it for? what it do?

Woops. I meant asm.js

>or you'll be left behind.

Got no problem with that. You can all die from cholera for all I care. I'll keep my Javascript deactivated and my websites blocked, if you like it or not. And I already hear the cries on how I should deactivate my Adblocker and activate JS and install this shitty plugin.

Fuck off. I don't need you.

>you'll have nothing good to say, because your idea is bad.

No need to get so sensitive.
I asked the above for a reason, never claimed I found the ultimate truth to data structures.

Not sure whether to laugh or feel bad for you at such bitter responses.

en.wikipedia.org/wiki/WebAssembly

user, I have no point to make in this thread but I love you. :3

Still wrong!

>Not sure whether to laugh or feel bad for you at such bitter responses.
It's not bitter, it's just aggressive. You faggot.

Is it unreasonable to make a community website with 0 cookies, data logging and JS? I'm pretty far along and so far my project is faster than any other social platform I've seen without really sacrificing any features up till this point. Though some hurdles required a lot of thinking to work around.

It's some random idiocy due to web development getting popular too fast and webdevs being too retarded to learn anything else than Javascript.

Starting a new social media platform in 2016 is probably a waste of time tbqh.

Fucking Google tried several times and couldn't get any users. Twitter is dying and worthless. Facebook is for old people.
How are you going to do better?

It's always faster when you don't have any real load. This is why the discussion about scalability came up before.

Faster than native doesn't make sense. Your chart is flawed.

>and webdevs being too retarded to learn anything else than Javascript.
WASM is actually how we'll get rid of wevdevs, it's intended for C++ (and C) code to be compiled to the browser.

I'm working on a program for a raspberry pi that turns a for matrix receipt printer into an alarm that prints out the day's forecast.

>It's not bitter, it's just aggressive. You faggot.

Haha holy fuck. Are you genuinely mad?
Times like this I wonder who is behind that keyboard.

Try not to get so sensitive about programming questions, at least it's entertaining to see such a thing exist.

It's only for the special case of one specific benchmark, because of the way the JIT works vs the compiler's default -O2 options.

Send your thanks to Mozilla: hacks.mozilla.org/2016/10/webassembly-browser-preview/

>Haha holy fuck. Are you genuinely mad?

... this new ...

I don't expect it to be big, it's just a personal project as literally every other platform has all of these things and I want to see if it's possible to do it more efficiently. Kind of seeing what the minimum structure required is to support a community while not being a nightmare to use.

there's user load. I can't tell you exactly how many users because no logging, but 190k requests a day.

>Haha holy fuck. Are you genuinely mad?
I'm just poking at you for fun, you seem genuinely offended though. If you keep taking the bait, I'll keep replying; you're entertaining.

>Times like this I wonder who is behind that keyboard.
Self-taught CS student living in Paris, in my early twenties, sleep deprived and thoroughly bored.
Happy to call you a faggot any day.

>Try not to get so sensitive about programming questions, at least it's entertaining to see such a thing exist.
Well then I'm happy to see we're both having fun, you little shit ^___^

>new
Wrong.

Don't forget your tampon you sensitive snowflake. I'll try not to upset you again.

×__×

>calc.exe
>190000 / 24
>~7916 per hour
>we can do deeper
>7916 / 3600
>~2.2 requests per second

I am sure you're straining your hardware.

Yep, sorry. Not new, just stupid.

>Wrong.
I apologize.

... this retarded ...

And I am not even him. Yup, retarded into the last cell.

> I want to lean javascript but I have no interest in front end development.
Then you should seek help.

JavaScript is easily one of the worst languages ever created. The only reason to use it is because it's the only language you /can/ use for front-end web development.

People developed stuff like Haxe, GWT, TypeScript etc just so that you don't have to deal with JS. But ultimately you still need to know JS to debug the generated code.

Node.js exists because web devs already have to learn JS for the front-end, so why make them learn another language for the back-end. Particularly when the most popular back-end language is PHP, which is almost as shitty as JS.

>being offended at somebody calling your idea bad on an anonymous imageboard
>being surprised at a marginally unpolite tone in response to a question on an anonymous imageboard
>expecting regular social setting standards to apply to an anonymous imageboard

user

Ok newfag.

>Well then I'm happy to see we're both having fun
Shitposting and data structures is my favorite combo on the weekend.

>spouting nonsense and expecting anonymous not to get mad
>being this retarded and not killing yourself
user

Not him but most social media platforms take forever to load due to all the added on javascript, not the request processing speed

>Shitposting and data structures is my favorite combo on the weekend.
Too bad you suck at both.

>anons actually arguing with anons
user

wew, case in point

>If-Modified-Since?

>"Optimizing" your code by applying recommended math and replacing the common sense optimization that you made before
>it's slower

thanks, math.

just made this in c++ with opengl

youtube.com/watch?v=hP-DZMmQBng

Why not both?

Because math sometimes does not take into consideration real life limitations.

Mostly it's something to do with memory. Current CPUs are so fast that slowdowns are usually caused by accessing memory that is not within the same cacheline. Or TLB translation. TLB misses also cause bad slowdowns.

doesn't change run time of for instance iteration through DOM elements on overly complex layouts, which is slaughter for most browsers.

>Or TLB translation. TLB misses also cause bad slowdowns.
TLB misses are extremely expensive, since they're essentially equivalent to 2-4 cache misses in a row, then another cache miss when you actually access the memory.
Thankfully they don't happen very often, and there's multiple levels of TLB cache to mitigate that.

Now wait a second. We were talking about load times, not execution times.

This. O(n) can often beat O(log n) because you can make it cache-efficient. E.g. linear search vs. binary search over an array.

It's even slower with both.

Yeah, I wrote that having memory in mind.

>javascript that runs to make the page functional isn't part of loading the page for use

Just because they offload the processing of the html to the client like greedy jews doesn't mean it isn't part of serving a page.

>tfw Project Rider finally added ASP.NET MVC support
I swear I will never use Visual Studio again. I will buy my own license to use at work if I have to.

Profiling shows what?

>not wanting to use the comfiest IDE