Two Plus Two Publishing LLC
Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > >

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 10-17-2018, 01:01 AM   #35801
PJo336
THRILLHOUSE!
 
PJo336's Avatar
 
Join Date: Mar 2007
Posts: 21,698
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by RustyBrooks View Post
Woah, youtube appears to be hard down world wide for at least the last half hour or so.
How could this happen? Surely they're multi region? Must be a hell of a story...
PJo336 is offline   Reply With Quote
Old 10-17-2018, 02:11 AM   #35802
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

People who do all their stuff on AWS - how do you create intranets, monitoring sites, dev/test environments and static sites that can only be accessed locally and you don't want to expose to the internet?

I can limit S3 to IP addresses. But I can't get HTTPS worknig with just S3 static webhosting.

Cloudfront->S3 handles the HTTPS part, but it seems to ignore static IP restriction. Also Cloudfront is sooo slow to update and it caches crap forever. Terrible for dev and testing.

I managed to get API Gateway to proxy to S3 over https. But I can't figure out anyway to restrict the actual S3 bucket. It still needs to be read access for everyone in the world for my API Gateway proxy to work. Whatever IP API Gateway is sending it's not my source IP. Also w/o a custom domain (CloudFront again) API Gateway adds /{stage} to all its urls - which is hacky to work around.

There has to be some way to do this.

I could proxy all the way to lambda I guess and then give lambda programmatic access to S3. Still have to deal with the path-appending in API gateway though - which screws with static sites. But maybe the Cloudfront custom domain would only act as a DNS pointer and not try to cash everything. Hmmm.

Last edited by suzzer99; 10-17-2018 at 02:23 AM.
suzzer99 is offline   Reply With Quote
Old 10-17-2018, 03:14 PM   #35803
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Ok well I got it working more or less the way I want.
  1. Restrict access to s3 bucket to only cloudfront
  2. Turn off caching in cloudfront by setting the TTLs to 0 - this made a gigantic difference
  3. Add in a WAF and restrict access to cloudfront by IP there.

No idea how much extra this is going to cost us just for dev/internal sites. But YOLO.
suzzer99 is offline   Reply With Quote
Old 10-17-2018, 03:17 PM   #35804
jmakin
 
jmakin's Avatar
 
Join Date: Jan 2008
Location: Streaming
Posts: 29,185
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Craggoo View Post
How would you guys read this situation:

A company that's been around for 14 years, been profitable for the last 10, and has 40 employees? Most companies are all about growth so it seems really weird to me that a company would stay that small for that long.


Probably a good place to work, but management probably lacks ambition or the product is really niche.
jmakin is offline   Reply With Quote
Old 10-17-2018, 03:54 PM   #35805
iversonian
Carpal \'Tunnel
 
iversonian's Avatar
 
Join Date: Sep 2003
Location: Donkversonian
Posts: 20,581
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

People make a big deal about companies like basecamp that are happy to stay small. Iím of the mind that those are anomalies, and that everything in the world is either growing or dying.
iversonian is offline   Reply With Quote
Old 10-17-2018, 04:43 PM   #35806
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

On a civilization timescale - sure. But on a human timescale I think there's something to be said for just carving out a niche and being comfortable there. If humans lived forever I might feel differently. But it's not too hard to live your lifetime in a comfy spot that isn't growing or dying.

I've always thought one of the nice things about Kansas City is that it doesn't seem to grow or shrink. So it's not always having growing pains, nor is it a depressing wasteland. I assume people in Tuscany or Provence feel the same. Not gonna die but they sure don't want to grow.
suzzer99 is offline   Reply With Quote
Old 10-17-2018, 10:04 PM   #35807
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Is this a legit use case for var (in react)? let or const puts it out of scope. I want it to be null if I don't have any yet.

Code:
render () {

    if (this.state.signaturesValidated) {
      var validationResults = (
        <p>{this.state.idTokenSigValidMsg}</p>
      )
    }

    return (
      <div className="Main">
          {validationResults}
      </div>
    )
}
suzzer99 is offline   Reply With Quote
Old 10-17-2018, 10:12 PM   #35808
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 23,965
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

use let at the render() level? What do you want to return when !signaturesValidated?
let validationResults = whateverthatis
as the first line
RustyBrooks is offline   Reply With Quote
Old 10-17-2018, 10:24 PM   #35809
_dave_
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK (or what remains of it)
Posts: 12,779
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

edit: as Rusty said

Idk seems like one would just use let above the if block to scope it suitably? (untested)
Code:
render () {
    let validationResults = null
    if (this.state.signaturesValidated) {
      validationResults = (
        <p>{this.state.idTokenSigValidMsg}</p>
      )
    }

    return (
      <div className="Main">
          {validationResults}
      </div>
    )
}
Though I think it can all be reduced to just this? (no variables, also untested)
Code:
render() {
    return <div className="Main">{this.state.signaturesValidated ? <p>{this.state.idTokenSigValidMsg}</p> : null}</div>
}
_dave_ is offline   Reply With Quote
Old 10-17-2018, 10:27 PM   #35810
Grue
Pooh-Bah
 
Grue's Avatar
 
Join Date: Mar 2004
Location: It is pitch black.
Posts: 5,399
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by suzzer99 View Post
Is this a legit use case for var (in react)? let or const puts it out of scope. I want it to be null if I don't have any yet.

Code:
render () {

    if (this.state.signaturesValidated) {
      var validationResults = (
        <p>{this.state.idTokenSigValidMsg}</p>
      )
    }

    return (
      <div className="Main">
          {validationResults}
      </div>
    )
}
yikes

Code:
render() {

    return this.state.signaturesValidated ? <div className="Main"><p>{this.state.idTokenSigValidMsg}</p></div> : <div className="Main" />
}
Grue is offline   Reply With Quote
Old 10-17-2018, 10:37 PM   #35811
Larry Legend
Celtic Pride
 
Larry Legend's Avatar
 
Join Date: Jul 2009
Location: Kyrie's earth
Posts: 42,568
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

^that
Larry Legend is offline   Reply With Quote
Old 10-18-2018, 12:37 AM   #35812
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

It's part of a larger template. I just simplified it.
suzzer99 is offline   Reply With Quote
Old 10-18-2018, 12:39 AM   #35813
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by _dave_ View Post
edit: as Rusty said

Idk seems like one would just use let above the if block to scope it suitably? (untested)
Code:
render () {
    let validationResults = null
    if (this.state.signaturesValidated) {
      validationResults = (
        <p>{this.state.idTokenSigValidMsg}</p>
      )
    }

    return (
      <div className="Main">
          {validationResults}
      </div>
    )
}
Yeah that works and is obviously the way I'd normally code. But I think it's kinda cool how react will just show nothing and not barf for null/undefined. So why bother declaring it outside the if condition?
suzzer99 is offline   Reply With Quote
Old 10-19-2018, 02:00 AM   #35814
Barrin6
Carpal \'Tunnel
 
Barrin6's Avatar
 
Join Date: Dec 2005
Location: beyond legal blindness
Posts: 6,840
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Work started a CTF since it’s security awareness month. And it has been soo fun and addicting. I shamelessly have been doing no work and instead working on the challenges.
Barrin6 is offline   Reply With Quote
Old 10-19-2018, 02:34 AM   #35815
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I came up with a way to implement component-based architecture in react that similar to my OS node frameworks.

Key principles:
  1. Components should define their own routes internally (/signin, /cool/stuff, /, etc).
  2. Components are auto-discovered, if they're in the right folder they just work, no extra configuration.
  3. Components can be moved, renamed, or deleted w/o any extra configuration or breaking anything in the app (except for any links that point to them of course).
  4. All supporting files like CSS files, test files, JSX files, stubs, etc. - live with the component.

It just makes development more fun imo when you don't have to go and register your routes in 5 different places just for your components to work. And it removes all friction from reorganizing or renaming - which is a good thing.

Just copy a component that's similar and go. Need to rename? No problem. A group of components is growing too big and you want to put it in a subfolder? No problem. Just move stuff into a subfolder and everything still works w/o any extra configuration.

Last edited by suzzer99; 10-19-2018 at 02:42 AM.
suzzer99 is offline   Reply With Quote
Old 10-19-2018, 10:43 AM   #35816
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 23,965
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Not sure I understand how #3 would work, the rest of it sounds pretty standard

Like say I have 2 components, like, Person and Child. So my JSX for Person is like

Code:
<div>
{childlist.map((x) => <Child name={x}>)}
</div>
For this to work, Child needs to be imported into this JS file. If you move Child, then you have to change the import?

I guess I'd like to see a simple example of it if you have one (with routing, I feel like I am doing routing wrong because it does not work the way I'd like it to)
RustyBrooks is offline   Reply With Quote
Old 10-19-2018, 10:58 AM   #35817
Grue
Pooh-Bah
 
Grue's Avatar
 
Join Date: Mar 2004
Location: It is pitch black.
Posts: 5,399
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by RustyBrooks View Post
Code:
<div>
{childlist.map((x) => <Child name={x}>)}
</div>
Can't unsee.

Spoiler:
Grue is offline   Reply With Quote
Old 10-19-2018, 10:59 AM   #35818
jmakin
 
jmakin's Avatar
 
Join Date: Jan 2008
Location: Streaming
Posts: 29,185
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Think Iím doing a cultural fit interview today. What are some nonstandard questions? I have a list of what I think are ones i genuinely want to know the answer to but I donít want to get bull****ted. Weíre one toxic person away from being unable to function.
jmakin is offline   Reply With Quote
Old 10-19-2018, 11:16 AM   #35819
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 23,965
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Grue View Post
Can't unsee.

Spoiler:
Can you hear my eyes rolling from here?
RustyBrooks is offline   Reply With Quote
Old 10-19-2018, 02:00 PM   #35820
KatoKrazy
Pooh-Bah
 
KatoKrazy's Avatar
 
Join Date: Jan 2009
Location: Orange County, CA
Posts: 3,677
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by jmakin View Post
Think Iím doing a cultural fit interview today. What are some nonstandard questions? I have a list of what I think are ones i genuinely want to know the answer to but I donít want to get bull****ted. Weíre one toxic person away from being unable to function.
I honestly think you can learn a lot about how they approach answering "Tell me about yourself"
KatoKrazy is offline   Reply With Quote
Old 10-19-2018, 02:33 PM   #35821
jjshabado
Carpal Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 22,340
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I also like asking about actual situations they've had to deal with:

* Tell me about a time you had a disagreement with a co-worker and how you dealt with it
* Tell me about the best team you've ever worked on
* Tell me about a time you failed

Etc.
jjshabado is offline   Reply With Quote
Old 10-19-2018, 02:43 PM   #35822
Grue
Pooh-Bah
 
Grue's Avatar
 
Join Date: Mar 2004
Location: It is pitch black.
Posts: 5,399
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I've never asked those questions but when I've been asked them I feel like what I'm providing doesn't show any real insight or maybe doesn't have the possibility of showing any real insight.

I do like "tell me about yourself" though.
Grue is offline   Reply With Quote
Old 10-19-2018, 02:53 PM   #35823
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 88,478
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by RustyBrooks View Post
Not sure I understand how #3 would work, the rest of it sounds pretty standard

Like say I have 2 components, like, Person and Child. So my JSX for Person is like

Code:
<div>
{childlist.map((x) => <Child name={x}>)}
</div>
For this to work, Child needs to be imported into this JS file. If you move Child, then you have to change the import?

I guess I'd like to see a simple example of it if you have one (with routing, I feel like I am doing routing wrong because it does not work the way I'd like it to)
I'm talking about being able to move, renamed or delete stuff (currently only page-level components) w/o breaking import statements or component references off in other files. I know it seems like a little thing but I think that adds friction to good renaming, reorganizing and refactoring - which ultimately makes for crappier code. For example:



Once I got this system in place, I was able to move all the CustomUI stuff into a subfolder and nothing broke, no import statements had to be updated anywhere. I could also delete the whole folder and the only thing that would break are places the app is linking to or serving the pages.

So it's like the old days where you drop a JSP in a folder and it just works. Except better in that the route doesn't change.

The first step is an npm start script that creates a metadata file of everything in the /routes folder that matches - which is currently *.js but not *.test.js.

This script runs every time you call npm start:
Code:
const glob = require('glob');
const fs = require('fs');

loadRoutes('/src/routes', ['*.test.js']);

function loadRoutes(dir, excludes) {
  console.log('pre-start.js: loadRoutes called - dir: ' + dir + ', exclude: ' + excludes);

  const routes = [];
  glob.sync("**/*.js", { "ignore": excludes, cwd: './src/routes' })
    .forEach(function(file) { 
      console.log('pre-start.js: registered route: ' + file)
      routes.push(file); 
    });

  const file = {"IMPORTANT!": "GENERATED FILE - see pre-start.js", routes};

  fs.writeFile('src/route-metadata.json', JSON.stringify(file,0,2), function(err){
    if(err) console.error(err);
    else console.log('pre-start.js: src/route-metadata.json written')
  });
}
In my node version of this, that part was all done seamlessly because node has access to the file directory, which client-side JS does not. So the directory scan needs to be done when the react dev server starts. One issue I can see is that deciding whether to check in or just always generate route-metadata.json might get a little weird. I'll see how it plays out.

Here's how it dynamically loads the routes in the index.js file:
Code:
// dynamic routes are calculated by node on npm start - see ../pre-start.js
import routesMetadata from './route-metadata.json';

...

const App = () => {

  return (
    <BrowserRouter>

      <div className="sans-serif">
        <Switch>

          {routes.map((r) => {
            return <Route key={r.route} path={r.route} component={r.default}/>
          })}

         </Switch>
       </div>
    </BrowserRouter>
  )};

async function doRender () {
  routes = await utils.loadRoutes(routesMetadata);
  render(<App />, document.getElementById('root'));
}

doRender();
the files are dynamically imported in utils.js:
Code:
  loadRoutes: async routesMetadata => {
    const routes = [];
    for (let routeName of routesMetadata.routes) {
      const module = await import('./routes/' + routeName.substr(2));
      console.log("registering route: " + module.route);
      routes.push(module);
    };

    return routes.sort(compareRoutes);

    function compareRoutes(a, b) {
      const indexA = a.routeIndex || 0;
      const indexB = b.routeIndex || 0;

      // inverse sort
      if (indexA > indexB) return 1;
      else if (indexA < indexB) return -1;
      else return 0;
    }
  }
As you can see there's a convention that the component name and file name be the same. But we could always export an optional component name property if that couldn't be done for some reason.

I used BrowserRouter because it was the first router I stumbled across. It may be easier or harder with other types of routers. The routes also have optional routeIndex so they can be loaded in order if necessary ('/' has to come last, could be other wildcard matching routes if react supports that). If we get a bunch of routes, we will probably want to push sorting to the node step instead of the browser step. But that gets messy because node has to grep into the files to find out the route index. Currently this is just for my kitchen sink demo app that's basically a collection of stuff the devs can use.

And finally here's what a route component looks like:

Home.js:
Code:
import React, { Component } from 'react';
import { Auth } from 'aws-amplify';
import { withOAuth } from 'aws-amplify-react';
import { utils } from "util.js";
import './Main.css';

export const route = "/";
export const routeIndex = 1000; // optional - higher # indicates route is loaded last (like z-index)

class Home extends Component {

...

}

export default withOAuth(Home);
Most route components only have to export route and not routeIndex. At first I just added route as a static variable on the Home class. But in this case Home is wrapped in the higher-order-component withOAuth. There doesn't seem to be any way to get access to the wrapped class. So I had to add the extra export statement that the top.

Also by adding a .env file which points to the /src directory, the routes are able to use absolute path to import 'util.js' - this helps when reorganizing into subfolders.

This is all kinda hacky still - there are probably better ways to do some of the mechanics. But it works at least. I even tested on IE and everything's fine.

I will chip away at it as better ideas come for how to handle different pieces - as I did with the node OS framework over a couple years. By the end that app had some 200 routes, which were much easier to handle w/o import statements all over the place. The front end devs loved it because they could just create their node orchestration component to call our back end scala/play layer, w/o having to touch a bunch of other files.

The system that came after I left was more like a standard node app with a many to many service layer to route handler layer - and import statements scattered all over a router hierarchy. The same front end devs told me they wished they had yukon back. The new system pretty much required a full time node dev, whereas mine didn't.


tl;dr - suzzer likes component-based architecture combined with self-discovery and route handling done internally to the components - not orchestrated from central command.

Last edited by suzzer99; 10-19-2018 at 03:21 PM.
suzzer99 is offline   Reply With Quote
Old 10-19-2018, 03:38 PM   #35824
jjshabado
Carpal Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 22,340
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Grue View Post
I've never asked those questions but when I've been asked them I feel like what I'm providing doesn't show any real insight or maybe doesn't have the possibility of showing any real insight.

I do like "tell me about yourself" though.
I have no idea how you answer them, but you can definitely tell a lot from someone when they have to tell you about a problem they've faced and how they've dealt with it.

Sometimes its even interesting hearing them give what they think "the right" answer is.

Edit: Although, sure, like any question its not going to be the make or break question for most candidates. But its useful for a significant percentage of candidates. Which is all you can really ask for of an interview question I think.
jjshabado is offline   Reply With Quote
Old 10-19-2018, 03:46 PM   #35825
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 23,965
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I just had an hour long meeting with someone from HR. I'm trying to hire someone and he set up the meeting so we could talk about our process (which is half-assed) and what kind of person we're looking for etc.

It was a very uncomfortable meeting for me, but I think probably really worth while. He made me lay out in very concrete terms what I liked about my team members and what I thought we were missing and *specifically* what personality traits we wanted team members to have, and what those traits really mean.

I am so not good at this stuff, but his point was "everyone wants to hire someone intelligent, but if you don't SAY you want to, and define what intelligence means to you, then you won't ask the right questions or interpret the answers properly in order to achieve it"

I am not sold on the idea that you CAN definitely make a procedure that properly selects employees but I guess at least he's trying.

We're also using a service that analyzes your job posting to, I dunno, try to see how it will be received. This sounds a bit like woo to me but I dunno. It's supposed to report how inclusive your job posting sounds, how likely people are to read past the first line, etc.

Personally I would love to have SOME kind of framework that the whole company uses, right now we just flail around, everyone doing something different.
RustyBrooks is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Forum Jump


All times are GMT -4. The time now is 12:06 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © 2008-2017, Two Plus Two Interactive
 
 
Poker Players - Streaming Live Online