Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Data Graham posted:

What I really enjoy is big robust APIs that sporadically return loving 500 errors. AdWords I'm looking at you

God dammit you're fricken Google can you please fix your own goddamn poo poo

Man don't even talk to me about AdWords. The supposed bread and butter of Google's entire massive empire and the API is unusable. I spent at least a year of my life trying to automate a big Adwords related thing.

I can't remember which random deeply nested endpoint it was expects a value in 1 millionth of a penny. Do that math wrong, use 0.1 millionth of a penny like an idiot, and get charged $ out the bum.

Adbot
ADBOT LOVES YOU

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I really liked the Google Maps API, I used that recently. Works pretty well but the radius stuff is a bit suspect. No way to get visible results, some math is required and then you have to loop through the results to see if they're really on the screen.

Also the radius is more like an oval.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Wait a minute that was the Yelp api.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Grump posted:

at work we have a coding test for interview candidates.

Some questions involve writing some functionality in jQuery. The supposed hard part is to turn the jQuery into vanilla JS. This test is super outdated and hasn't been changed in like 5 years.

The hard part of that test is trying to figure out what different jQuery functions used to do.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Lumpy posted:

Yeah, I'd fail the "do it w/ jQuery" part because it's been so long.

Doing it with jQuery is easy, you just pretend jQuery in't on the page.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

The Dave posted:

Current Status: Sitting on a demo review of a new product for a large company and stakeholder is questioning the limited scope for the MVP when we're a month out from release and he's known the scope for months.

Feel you bro.

Assert that you are on track for release despite numerous challenges with a product at a high level of quality. Risking a change to the target scope could result in delays, re-assessment should occur in one months time. Tell them Nolgthorn from the internet said so.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

kedo posted:

So my first real-world React app has reached its first functional milestone

It will certainly remain clean and fast and organised as the codebase grows. I'm being sarcastic! Congratulations on the milestone, feels good. You might check out the modern framework thread if you aren't there already.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I prefer to structure my components into areas of functionality and pages. Directories such as 'page-messages', 'page-accounts', and subdirectories within those. I feel like there's too much emphasis made on component re-usability. When in 90% of cases I've experienced, they are never re-used anywhere.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
The best part about open source software are all the wonderful feature requests you receive. Therefore allow me to contribute the idea, not code mind you, that I be able to monitor multiple groups at the same time with the same process.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Looks basically like the job description of a professional blogger, there's tons of people who do that kind of work. I bet many would enjoy $17/hr to do it too.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I'm trying to get secure Websockets working, it's a Node project and I'm using the ws library along with express.

code:
const express = require('express');
const http = require('http');
const https = require('https');
const fs = require('fs');
const path = require('path');
const serveStatic = require('serve-static');
const WebSocket = require('ws');

const env = process.env.NODE_ENV || 'development';

// server

function readCert(filename) {
    const filepath = path.join(__dirname, '..', '..', 'private', '.dehydrated', 'certs', '[my-domain.com]', filename);
    if (!fs.existsSync(filepath)) {
        console.log('Warning: Missing SSL cert: ' + filename);
        return undefined;
    }
    return fs.readFileSync(filepath, 'utf8');
}

function createServer(app) {
    if (env !== 'production') return http.createServer(app);
    return https.createServer({
        cert: readCert('cert.pem'),
        key: readCert('privateKey.pem')
    }, app);
}

const app = express();
const server = createServer(app);
const wss = new WebSocket.Server({ server });

// http

if (env === 'production') {
    app.use('/.well-known', serveStatic(path.join(__dirname, '..', '..', 'public', '.well-known'))); // ssl signing
}

// primary

wss.on('connection', (ws) => {
    console.log('connection!');
});

// working

const port = process.env.PORT || 9090;

server.listen(port, () => {
    console.log(`Server running on port: ${port}`);
});
And that's all ok. Though none of it feels right. I have to make exceptions for production, and I still need to support http, in order for letsencrypt not to expire after 90 days. Adding to the confusion, my host handles http->https for me. So really I need insecure http and secure websockets.

But the ws library doesn't let me do that, I have to provide it an https `server` option to get secure websockets. I know I can also declare a second http version of the site as well. Then I've got both an http and https version running, and my host is handling http->https on top of that? I'm imagining the number of `if (env === 'production')` `if (env !== 'production')` statements I'm going to have to use and the whole thing feels wrong in the first place. I'm starting to have fever dreams about forking the ws library and making some hacky version out of it.

Please tell me where the stupid happened to me.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

kedo posted:

Why do :before and :after pseudo elements need a content:""; to be displayed, even if they don't actually have any content?

What's the answer to this one? It seems like it wouldn't break anything for the browser to just assume an empty string.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Grump posted:

I just started working on my personal site, and I've been playing around with the idea to make every part of the site have an icon with a small description that can be clicked on and will pop-up a modal with more information.

At first glance, do these icons look clickable? What's an easy way to convey to the user that an icon can be clicked on?



All the changes you made is worse than the original design. Looking at the icons it seems clear to me I can click in those areas, when I hover I would expect the cursor to change around a wide area, a huge area, as big as possible for each of them so that they are touching each other.

I now see that what was clickable is actually a relatively small area, since you changed them to buttons. The buttons look harder to click and makes it feel unappealing to do so. I'm not submitting a form every time I click on something so why are they buttons. Not being able to click on the icon as well as the text looks strange since they are related.

When an accent was suggested, I don't think they meant use two wildly different colours at once. But instead use a shade and a colour or two shades of the same colour.

I'm concerned about your page now. :ohdear:

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
There should have been a checkbox or a confirm alert something

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I'm not gonna get all conspiracy here but there's no way a missile alert for an entire state could have been triggered by a single person acting alone. That whole thing was theatre done on purpose by the reptilians and deep state and you know it.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I've built a whole API based on Websockets.

I built loosely around some specification I found online about a best practice for communication. Where if you wanted to wait for a response you sent an `id` attribute along with the request. Then there was also a `method` attribute which was required.

There was some other stuff like how to format error responses and how I should allow arrays of requests, which could be run in any order. What was I looking at. Because at the time there was no javascript library available that did all that stuff, and I'd like to either check again or build one.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
In this case it's a notification api, so I had to either use HTTP and poll the server all the time, or use Websockets. Websockets are pretty sweet rear end at handling idle connections, nearly the same as no connection at all, and I get to send data to the client.

So I'm poo-pooing HTTP.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
WAMP!

I was looking at WAMP.

http://wamp-proto.org/

http://wamp-proto.org/static/rfc/draft-oberstet-hybi-crossbar-wamp.html

On second thought, I was looking at a different subprotocol before I think because this is nothing like my API. Actually I think it's JSON-RPC and now I'm conflicted about what I should be using.

http://www.jsonrpc.org/specification

Nolgthorn fucked around with this message at 01:31 on Jan 22, 2018

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

PantsBandit posted:

Hey guys, I am VERY fresh with html, but I find it really fascinating so far.

I was looking at the source for a webpage and noticed a link to a jquery script. The script in question was extremely complex, so I'm assuming the web dev didn't put it together.

So I guess my question is: where did he find that script and how are scripts like that implemented?

I think your question is about bundled javascript, which can look more complicated in its final form than it is in the source code. There are many bundlers, they are synonymous with writing client side javascript these days. Popular ones include Webpack, Browserify, and (my personal pick) Rollup. Jquery is very outdated and should almost be considered an antipattern at this point. It was from a time when Javascript was a lot harder to write and ran a lot less reliably across browsers than it does now.

Most javascript libraries can be found on https://www.npmjs.com/ though technically mostly it's for server side Javascript instead of client side. There's a lot that build their own webpages or just host their code on Github. So it's best to use web search and read stackoverflow if you're looking for something.

On second thought; Jquery might be awesome if all you want is to plug and play something because there is a hell ton of Jquery plugins out there, way too many.

Nolgthorn fucked around with this message at 17:27 on Jan 27, 2018

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I like CSS. I can't imagine what could be done to make it a lot better, 'less' is better, but it's awful when you try and set up a watcher on it, or use middleware to render it live which causes all kinds of complications once you want to go to production. 'sass' isn't any good when used in node because it doesn't have a javascript implementation. People complain about CSS but I can't figure out what they want instead. Variables and some sort of modular architecture is all I need.

You don't need BEM, you don't need computed namespaces. The language itself is built on namespaces.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Ape Fist posted:

I think some very basic variables and if statements would really help a lot tbh.

CSS variables are here and there's a really really awesome calc function. I'm just not sure how backwards compatible those things are... not at all I suspect. Probably have to continue compiling less for a while.

Less isn't as good you can't do `width: calc(100% - 100px);` for example.

I've been thinking about trying http://www.myth.io/ instead of less.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
What makes me feel like I can't live without less is nested styles.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

huhu posted:

Met a guy at a meetup last night who was building a full stack JavaScript site. He had a chart he wanted to group the data by month and I said just do a SQL query... Pretty straight forward I thought. He wants his database to be "dumb" and just fetch the data from it. So he's using vanilla JS with Moment to write queries. Is this actually a thing now? He was also against stuff like Django with its orm.

Tell him he should make the data grouping into a microservice with an API.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

kedo posted:

In the future there is only one language and that language is Javascript. All y'all just wasting time and energy worrying about snakes and Jamie Foxx.

True. But it's rude to point out.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I've got a sweet web based email reader.

It loads the html email client side, parses it, traverses everything to ensure scripts are stripped out/links are `target="_blank"` stuff like that. Inserts some default styles into the top of the thing, then dumps it all into an iframe. I'm wondering if there's no better way than this:

code:
const source = new DOMParser().parseFromString(myHtml.trim(), 'text/html');
myCleanupMethod(source);

const doc = myIframe.contentWindow.document;

doc.open();
doc.write(source.documentElement.outerHTML);
doc.close();
The issue I have is just that I am working with two `document` instances, rendering one to html just to dump it into the other.

I've looked all over the place and can't figure out how to say "hey iframe, use this document instance." I could dump the html into the iframe directly and mess around with it there but I can't have it load until I've finished sanitizing. I could use `createElement('iframe')` I think and then insert that element onto the page.

But I'm using some fancy client side framework called Vue and I think using `appendChild` to dump something into the DOM myself would be frowned on.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Tei posted:

Stripping HTML so is safe is not a trivial task. I would not write my own code to do it, and would use a very good library for it.

Consider that maybe the browser see <sc ript> alert("foo"); </sc ript> and execute it like javascript, but a dompaser may see it as node(sc) with attribute ript="" and ignore ir skip it. Even if you are overzealous and work under a "everything not recognized in a whitelist is removed included all attributes" you could end hacked by somebody that find a way to exploit it somewhere.

It's cool to do it if you have a dom parser turn it into element nodes, then you can traverse the element nodes and know exactly how everything will render. Especially if you're doing it in the browser where it is rendered. So it's no problem.

If you're doing it server side then you should also pay attention to comment nodes, because there are some browser tricks that can hide stuff in them, mostly for ie6.

Nolgthorn fucked around with this message at 13:38 on Feb 2, 2018

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Best piece of advice I heard for UI was carefully consider or research exactly what the user wants to do and make it basically the absolute only thing on the page.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I had experience trying to put something out on the open market, and I way way way way way overestimated both the visual comprehension skills of the average user and their resolve to figure anything out. After several revisions the final product was literally one button and that helped a lot.

I'm not sure how websites that even force users to 'sign in' make it anymore. Probably helped a lot by single sign on. I'd be curious to find out the stats regarding how many users sign in with single sign on vs how many create an account using email. For websites that offer both.

Nolgthorn fucked around with this message at 19:02 on Feb 2, 2018

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
It's mainly that layout design and programming are very different skills, one being purely logical and the other purely artistic/creative. There are people out there who can do both though it's rare and those people should be hired immediately. Also someone please hire me.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Everyone stopped using them to avoid arguments with their coworkers about where they're appropriate to use.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Using HAML and then PUG all my elements look like `.header` `.article.is-unread` `#content` it's nice. The new named elements aren't as versatile as a div, I can't put them where I want. I can't see much difference between `section` and `.section` it feels like a bot would ignore all that stuff. I think Google mostly cares about linkbacks and adwords.

When I am on a large project with a bunch of devs it's element soup, too. With what seems like hundreds of nested divs, would putting a `section` or `nav` element in make a difference?

Nolgthorn fucked around with this message at 09:48 on Feb 7, 2018

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
No client side validation at all, there are enough pointless queries made to servers that one out of ten failing isn't a big deal. Just do validation on the server and return a bad request response.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
It sounds like the crux of the exercise is the polygon mapping behaviour. You may need to union your own polygons, before drawing them into maps? It does seem possible that as someone else mentioned clockwise/counter-clockwise might be the trick.

Nolgthorn fucked around with this message at 18:38 on Feb 9, 2018

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
It's Javascript heavy but you need a list of all polygons and then output one polygon. It's an interesting challenge but it's possible that we're making the solution out to be more complex than it is supposed to be. This solution won't help at all if the problem is related to your 2d polygon being face-down.

These guys are talking about polygon merging here.

https://stackoverflow.com/questions/2667748/how-do-i-combine-complex-polygons

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I had challenges for jobs where it ended up being exceedingly complex and I thought while writing it "maybe they just want to see how far I get" so I'd sit down and write a bit about what I was thinking and where I got stuck. I never got those jobs.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Yesterday I was developing something and I added a `setTimeout` to my code. Compilation started warning about how `timers` was not defined and when running it in my browser it didn't work. It took quite a bit of frustration before discovering that Visual Studio Code had automatically placed `import timers from 'timers';` at the top of my file. I have no idea why.

Anyone have any clue, is that a new feature? How and what is `timers` and why is it related to `setTimeout` it looks like a node thing? I couldn't find any setting I could turn off.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I tried to learn Python, once for a job challenge and another that I wanted to develop an application for raspberry pi. I was struck by how the language doesn't let you break up lines. Gimme my brackets back.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
PHP/Perl CGI all these things are still very popular although not for any actual programming.

right?

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
What I meant is those tools are used commonly as a delivery layer, for an application. Such as a single page application to the client, or as a proxy to an application located more deep inside the network as suggested earlier.

I'm pretty sure something like that is how my host is able to offer TLS without much effort for me.

Adbot
ADBOT LOVES YOU

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

geeves posted:

Facebook stuck with PHP because some psycho wrote a PHP -> C++ transpiler that majorly increased the performance.

I hope they are rich now and living on an island because they destroyed humanity

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply