• What are you working on? v67 - March 2017
    3,527 replies, posted
wtffff I've got a job interview for a junior front-end developer role! It's tomorrow and I have like five hours to prepare? It's React-focused and this is my first ever programming-related interview and I've never coded professionally before. Any advice? A bit of the job spec is below: Essential Skills: Familiarity with cross-browser and cross-device performance, issues and tricks Knowledge and desire to make the most performant front-end experiences Command line Professional work experience as a developer for minimum of 6 months - 1 year  Nice to haves: Node.js experience Experience with webpack UX experience Familiarity with AWS Sass/SCSS experience
Lemme tell you about the wonders of legacy code once more, folks: that's right, Paindoc is back on THAT project which has caused so many of his "lovely" posts on this forum I was generating doxygen documentation for our in-house simulation application, as we have a new employee that will be working with me to improve it. Their focus is on the mathematics, model construction, and that angle of things (effectively, they're a super smart maths person and i am very not that person), so I wanted to help them understand the codebase with some diagrams generated by Doxygen+Dot. And looking at these diagrams has identified uhhh at least one problem But holy shit lmao I found a hell of a bug. There's a "tvector" class in this code like so: class tvector { public: tvector(double x); double x1, x2, x3; // further methods/ctors etc }; inline double abs(tvector vect); Those two single functions alone are a deadly combo: they are both in the programs namespace, so everytime you call the "abs" for a SINGLE NUMBER it attempts to use that "abs" method. This means that a single number results in the construction of a new "tvector" object, as that constructor is not explicit (meaning implicitly calling it for a conversion, to satisfy function parameters, is ok). So instead of taking the absolute value of a single number, approximately 48 separate methods (from free, static, member, etc) were all calling into this method and constructing a new object to get the absolute value of a single number. I'm not sure how or if this optimized out - I don't really think it could, however. I'm also lucky that the person who wrote this in 1996 decided to explicitly initialize "x2, x3" to 0: otherwise who knows what kind of chaos could have resulted, as the implemention of abs there becomes (also this is the original indentation lol) inline double abs(tvector z) {     return sqrt(z.v1 * z.v1 + z.v2 * z.v2 + z.v3 * z.v3);   }   So we get two extra multiplies and a sqrt, everytime we want to simply find the absolute value of a scalar value ._. This happens in several methods that are called per simulation step, too. So yeah, that's where I'm back at haha. Refurbishing old code can be satisfying, but I'm consistently surprised by just how it manages to fuck things up tbh
WIP javascript LoL map viewer https://i.imgur.com/xm29vmt.jpg
Whoa, I've finished the core features for my VJ engine 2 weeks ahead of my next big event. Now I have 2 weeks to actually create content!
So I'm now in charge of coming up with the Auth scheme for all of my company's products. Want to reiterate here that I am an intern
Interns usually do the best work at companies.
at my company we make interns do VR and high score systems, your company is fucked up.
Still working on that level editor for my old taxi puzzle game, now using line drawing for creating/deleting roads and stuff too: http://odin.prfn.se/u/scenestuff-2018-04-27_11.56.26.webm
GUys how do I store passwords? IN plaintext .txt file? Just iterate though \n character and check if username == username and pw == pw? am only inter pls help
ofc not you dummy someone could read that text file hardcore it in the executable souce: not even intern yet
So we're using JWTs and our own kind of OAuth thing (if I understand OAuth correctly). There's an auth server that creates the tokens and returns the token as a cookie to the client on the domain he wants to use it on. The Authenticate the token, currently for development we've just got an environment variable with a simple shared password so that each client can authenticate the token by itself. What we want to do, however, is let other people develop applications for our framework. So what I've proposed is that each client is generated a secret key, and everything is signed using that secret key. That way you can only make requests against your own application and can only access the data on the Main service that you've authorized it to access (probably no data at all, given what our platform does). The auth server signs JWTs using this secret key (stored in some Key manager somewhere). This way, we don't have to give out a shared key to 3rd parties, and if one key is compromised then other services won't be compromised. Am I missing anything?
make sure to only store the first 8 character too, otherwise the comparison algorithm will not scale
The hot trick these days is to not store passwords and just trust that the user has inputted the right username + password combo
Look into OpenID Connect (a spec built on top of OAuth2), we're using it at my company for a few of customer portal style products, and it sounds like it should do what you're after. Essentially, you'd have an "Identity Provider" server with all the user accounts on (may be easiest to use an off-the-shelf solution for this, no point in reinventing the wheel) and this server also tracks 'Clients'. A 'client' is basically another application that wishes to use the Identity Provider as its login/authentication method. The Identity Provider signs all its tokens with its private key, and any 'Resource Providers' (i.e. APIs or services that you need to be authenticated to access) just need to know its public key to validate the JWTs received.
We actually were using Azure ActiveDirectory at first. We showed it to the CEO and he didn't like that running our software would pop up a microsoft signin page for branding reasons and wants us to reinvent the wheel
Little showcase of hotloading classes for my engine. I've shown a variation of this like 4 times already, but this time I've done it the way I like it I think. https://www.youtube.com/watch?v=lL88GZ07m9Y
Is that good content I see ? I won't let this go unpunished. Here, feast your eyes on shitcode ! https://files.facepunch.com/forum/upload/133076/5efe1deb-a7be-455e-b245-2c4c9b51a906/image.png Look at all the features ! https://files.facepunch.com/forum/upload/133076/004af13c-ed9f-49b3-aea3-a35eba936667/image.png OK !!! Memory be like: 00: 0xFFFFBABE [Awesome content truncated] But in all seriousness, thanks @Fourier for telling me about the existence of Nancy a long time ago. It looks neat, and seems to be more lightweight than ASP.NET Core. I did this in the middle of the night, sorry if it's terribly stupid.
now I can load LoL models, todo: skeletal animation have a scuttle https://i.imgur.com/eh0sz8E.png
Oof, transparency is hard. Gives me a whole new level of respect to engines that seem to handle it so easily.
Ooh! I remember making MIPS emulators I went a little overboard with mine back in the day: https://github.com/Sidneys1/Mips-Emulator/tree/master/MipsEmulator
Haha, nice ! Here's a bonus over-engineering diagram ! https://files.facepunch.com/forum/upload/133076/161d0f7f-36a6-4dfb-bd3e-243f75a81de9/Class Diagram (02).png
my shitty language now supports modules https://files.facepunch.com/forum/upload/237369/17690f13-2e02-4c00-92cb-039b3f08e8fd/image.png
Indeed, I keep putting it off, in hopes a better solution comes around. For now, I only support full alpha or full transparent textures (discarding their fragments)
I've just settled for the GL_ONE blend func as it is sufficient for what I am trying to do.
Those days learning about algo-trading, fuck me this is deep rabbit hole.
https://i.imgur.com/2Gwv9e0.png Trying to make Gabriel Gambetta's notes on client-side prediction work with the Grid engine is a pain in the ass, but it's my fault. Grid currently has some basic client-side prediction, and I'm trying to implement server reconciliation. It's the only piece the engine doesn't have out of prediction, interpolation, and reconciliation, but without it, all client-side prediction is basically worthless. In the Quake model, iirc, "reconciliation" is just ignoring old payloads. Okay, so what currently happens? I try to mimic the Source engine's model. Actually, you could argue that's the whole philosophy Grid is built on. https://i.imgur.com/vagmR6R.png Look familiar? If you've worked in the Source SDK, then it should. `_CLIENT`, `_SERVER`, etc. help out with distinguishing what universe we exist in for listen servers, dedicated servers, and clients. So in the above code, you can see that we do a bit of (code omitted) position interpolation, we update our current region if we've crossed region boundaries (think level streaming), think if we need to, and we don't have the equivalent of `CBaseAnimating`, all `entity`s animate, so we update spritesheets here, too. The highlighted piece is me updating the `position` network variable every frame, and internally, the engine is only sending the position vector if it's changed. If a developer decides to mutate the Box2D body state by altering position, linear velocity, etc, we just send position for now, and sync this on the client-side. Let's say you have a spell that lets you short-distance teleport. There's nothing you have to think about, just render some particle effects, emit sounds, and set the position of the body. Multiplayer networking takes care of the rest. No need to dispatch payloads for any of those steps. It's suppose to provide the same developer experience you'd get in say, Garry's Mod. The reason reconciliation is such a pain in the ass right now is that we do this convenient networking of positions on players. Right now, the way the sample code we provide (Vertex Adventure) works is that we hold button state. https://i.imgur.com/Syoxk3p.png If we see that any of these keys are down, then we move the player to the tile in the direction they're attempting to move. The big problem I have here is that as the move logic runs and alters the position of the player, position automatically gets networked to clients without any knowledge of command sequence, and I cannot ignore the redundant movement coming in post-prediction. I don't really know what Quake or Source truly does here, but I'm certain it's not this, and I'm at a loss currently as to how to move forward without reading up on either codebases. There's an implication here that positions for players should not automatically be networked, because player positions shouldn't be networked, player inputs should. The problem I have with that is it ignores environmental factors, such as an explosion kicking a player back, or a spell or item suddenly changing the player's position. These aren't inputs, they're actions which cause player position state to change. Both entity positions need to be automatically networked, and player input affecting movement should be predicted, but I don't know how to get both systems to work without dramatically changing something. 😕
Is it even something worth getting into if you don't have a super fast connection to the NYSE/NASDAQ to make microsecond transactions?
I wish to trade crypto only, so even seconds are fine for me. But yeah, if I wanted to trade high-frequency style on NYSE/NASDAQ, that would suck balls.
So whenever I do socket stuff in C, my go-to tutorial is this page: Sockets Tutorial I mindlessly copy this stuff in, but even reading the tutorial, I feel like i'm just following a tutorial. Does anyone have any recommendations for reading on how these things work and what these libraries mean? is Unix Network Programming (https://en.wikipedia.org/wiki/UNIX_Network_Programming) still relevant (i.e: the high level functions remain the same) or is it outdated?
https://beej.us/guide/bgnet/ This was where i started with socket programming, I advise you to go through it slowly and actually read things though. (and then, make some application of your own that builds on all of it afterwards)
Sorry, you need to Log In to post a reply to this thread.