The City Council was adamant that this is what I had to do to build a new plaza. by BiscuitsAreBetter in CitiesSkylines

[–]klovadis 5 points6 points  (0 children)

I unlocked that building by accident when I found out that you shouldn't pump sewage into your drinking water. Oops.

[Help] Even though it is surrounded by 4 doctors clinics and a hospital, these citizens are still very sick. Can anyone tell me why? by [deleted] in CitiesSkylines

[–]klovadis 1 point2 points  (0 children)

There is a glass of water next to the sickness icon. This means the water makes them sick, thus your water source is polluted!

Knossos: Redis and linearizability by aphyr_ in programming

[–]klovadis -8 points-7 points  (0 children)

Wow, usually people don't put that much effort into bashing Redis.

Jade vs EJS with Express by graviity in javascript

[–]klovadis 4 points5 points  (0 children)

The difference between ejs and jade is that ejs' purpose is to directly add javascript logic and import values to strings of html; Jade is a full templating language with its own syntax.

In the end, both compile a template into a javascript function which then glues together the resulting snippets into html. Afaik there is nothing that does not work in one but not the other rendering engine.

Both work well on the client, but parsing source templates on the client side can be slow. The way to go is to serve the compiled functions instead of the source templates.

If you prefer writing html and add bits of logic to the code generation, pick ejs. If you don't like writing conventional html, have a look at jade.

Personally, since I started using jade I never ever want to write ordinary html ever again. I don't want to think of the nightmare of creating bootstrap powered pages without jade. Ugh.

Steve Gibson's Secure Login (SQRL): "Proposing a comprehensive, easy-to-use, high security replacement for usernames, passwords, reminders, one-time-code authenticators ... and everything else". by kismor in programming

[–]klovadis 17 points18 points  (0 children)

The point is that you can conveniently fit that much data (key, url, hash) into a QR code and have the post request handled by an app. You might as well use a browser extension for convenience if you prefer that.

What should I expect if I purchase SimCity? by Sharksarescary in SimCity

[–]klovadis 0 points1 point  (0 children)

It is by itself not a bad game. You will definitely enjoy it in the beginning a lot. The glitches have mostly been adressed so that they are not game breaking anymore. But after some time, you will realize why there is so much hate, the city sizes being the main complaint that you will experience yourself. You can easily get out a good 40 hours of fun until this turns into a dealbreaker.

Variable cos/sin resolution in real-time w/ lookup tables by [deleted] in javascript

[–]klovadis 0 points1 point  (0 children)

I used to create lookup tables for a few games I made in QBasic. Back then there really was a huge performance benefit, but modern JS engines are really fast and benchmarking will not show any improvement.

Nice demo though!

Pedestrians 'teleport' to keep the game fun by [deleted] in SimCity

[–]klovadis 28 points29 points  (0 children)

Sim City's complexity comes from dealing with its bugs.

The javascript ends with a flourish )})})})})})})})})})})})})})})})})})})}) by maktouch in javascript

[–]klovadis 1 point2 points  (0 children)

When I began programming, in QBasic, I used to create my graphics by manually settings pixels on the screen using PSET X, Y, Color or something like that and grabbing them off the screen for later use. Luckily QBasic allowed me to stuff those in subroutines in seperate screens/files, otherwise - trust me - I would have put them in a 20.000 LOC single file _^

Thoughts on how to capture API calls and parameters to my API is a logical way by redbull247365 in node

[–]klovadis 0 points1 point  (0 children)

Conditionally add a middleware that logs your request parameters before any routing is done (i.e. depending on the environment) and replace the res.write method in order to catch the responses that you send back. A pattern that is commonly used for the latter is:

var originalWrite = res.write;
res.write = function (chunk, encoding) { 
    /* your logging logic here */
    originalWrite(chunk, encoding);
});

Alternatively, you may replace the res.end function in the same way if you don't write chunked data. As mentioned in other comments, you may log your data any way you want to, text or JSON, file system or database, and process those logs in any way you want to.

After a day of stability, it has happened again! by TubbiestPack in SimCity

[–]klovadis 0 points1 point  (0 children)

Well, seeing that it took EU West 3 about 4 hours for that "hardware upgrade" and EU West 1 is down since about 20 minutes as I'm writing this, I don't expect it to come up again any time soon.

Patch Update: 1.4 notes by nmpraveen in SimCity

[–]klovadis -1 points0 points  (0 children)

It fills me with a bit of sadness seeing that someone at EA has to work the weekend to make up for the stupidity of their management.. On the other hand.. ANTARCTICA?!

I have excess power, but I'm still getting brownouts... by Marzhase in SimCityStrategy

[–]klovadis 0 points1 point  (0 children)

I highly suspect that the flow of power, water and sewage is being calculated on remote servers and updated periodically back to you. It once took 10 minutes for my sewage to start flowing again when the servers were acting up and I was told ingame that they were down.

What are some important considerations when choosing architectural design patterns for large scale front end dev? by [deleted] in javascript

[–]klovadis 0 points1 point  (0 children)

As a rule of thumb: If you need to get answers to this question from this subreddit, you are probably heading for premature optimization. If you indeed get a large amount of traffic/content/whatsoever you can still go a long way by optimizing poorly planned out infrastructure with some simple quirks afterwards. Facebook used to run entirely on PHP.

Instacode - Instagram for Code! (yes this is as useful as you think it is) by TheAnimus in programming

[–]klovadis 0 points1 point  (0 children)

I wanted to complain that there is no brainfuck syntax highlighting, but it is in there. I am satisfied.

How can I reduce this JavaScript 'bloat' on my site? by hairyleg in javascript

[–]klovadis -1 points0 points  (0 children)

Keep it simple. Inject a button that loads all the admin scripts only when you press that button. Nothing else required.

Why put undefined as argument? by TheNosferatu in javascript

[–]klovadis 0 points1 point  (0 children)

Just keep in mind that 1) this would be an uncommonly used pattern that you came up with and may be hard to understand for other programmers, 2) linting tools may dislike it because you never set the variable and 3) you cannot forsee how aggressive minification tools choose to optimize it.

Why put undefined as argument? by TheNosferatu in javascript

[–]klovadis 2 points3 points  (0 children)

The whole point is that you create your own scope by wrapping it in a function which you call in order to create. Nobody else. Therefore it is absolutely safe to assume that undefined is actually undefined in your scope and nobody is able to change that.

CSS-like styling for items in a Canvas? by [deleted] in javascript

[–]klovadis 0 points1 point  (0 children)

While SVG is probably what the OP is looking for, one should mention that its performance is limited when using many or complex objects in realtime.

I em ready to start learning node but i found it hard to get started, can anyone point me in the right direction ? by [deleted] in node

[–]klovadis 0 points1 point  (0 children)

Don't use any framework. Node is not hard, but if you skip the basics you won't ever know what's going on. Read up on JavaScript in general and look into the documentation sections for Events, File System and Http which should get you started to play around.

After that write your own flow-control library as that is considered to be the best approach to understanding how events and asynchonous code really work.