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 Yesterday, 08:42 PM   #35751
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 23,886
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by suzzer99 View Post
Shouldn't this be a solved problem by now?
Yes, I feel like you should have solved this problem by now

There are a few places that are default binary locations, install stuff there and then you don't have to mess with your path. /usr/bin is where package managers usually put stuff, /usr/local/bin is where stuff you "manage yourself" usually gets put. You're probably installing the aws stuff with pip though, right? That should be in your path by default unless you installed python somewhere non-standard.

If there are 10 places you need to keep track of paths you're doing something wrong. I can think of... 2 or maybe 3. If you really have a lot then make a little bash script, like ~/.setpaths, set your paths in there, and source that anywhere that needs to have paths set.

bash is a programming language, not a config system, treat it like one - make programs/scripts/functions/libraries/etc
RustyBrooks is offline   Reply With Quote
Old Yesterday, 08:46 PM   #35752
jmakin
 
jmakin's Avatar
 
Join Date: Jan 2008
Location: Streaming
Posts: 28,662
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I've helped out on a few installation scripts, and install locations differ slightly between Mac and centOS, but not by that much.

windows - **** windows
jmakin is offline   Reply With Quote
Old Yesterday, 08:56 PM   #35753
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 87,652
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by RustyBrooks View Post
Yes, I feel like you should have solved this problem by now

There are a few places that are default binary locations, install stuff there and then you don't have to mess with your path. /usr/bin is where package managers usually put stuff, /usr/local/bin is where stuff you "manage yourself" usually gets put. You're probably installing the aws stuff with pip though, right? That should be in your path by default unless you installed python somewhere non-standard.

If there are 10 places you need to keep track of paths you're doing something wrong. I can think of... 2 or maybe 3. If you really have a lot then make a little bash script, like ~/.setpaths, set your paths in there, and source that anywhere that needs to have paths set.

bash is a programming language, not a config system, treat it like one - make programs/scripts/functions/libraries/etc
I just ran install AWS client like it told me to from here: https://docs.aws.amazon.com/cli/late...nstalling.html

Code:
pip install awscli --upgrade --user
But then I realized I guess I was on the linux instructions not MacOS. https://docs.aws.amazon.com/cli/late...all-macos.html

Code:
sudo /usr/local/bin/python2.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
And that one worked except my python was in a different place so I just replaced '/usr/local/bin/python2.7' with python.
suzzer99 is offline   Reply With Quote
Old Yesterday, 09:03 PM   #35754
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 87,652
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Question for all the react people. I'm using BrowserRouter like this:

Code:
  <BrowserRouter>
    <div className="sans-serif">
      <Switch>
        <Route path="/login" component={Login} />
        <Route path="/" component={Main} />
       </Switch>
     </div>
  </BrowserRouter>
http://localhost:3000/login works fine when navigating through the app on local and on s3. But if I hit refresh it only works on local where I am running the local webpack dev server. If I do a static build and upload to S3 it static webserver - it returns a 404 when I try to hit /login through deep link or refresh.

Also there is no 302 browser redirect in my network history.



So what's going on here - is the webpack dev server serving routes behind the scenes? Is a production webserver expected to do the same? If so that kinda breaks the idea of a fully static site.

The s3 and cloudfront fixes for this seem to be to redirect all 404 and 403 errors to index.html. This works I guess but it's terrible for SEO.

Edit: ok I guess what's happening is the webpack dev server is just sending anything it can't find to index.html. Unfortunately S3 or Cloudfront doesn't seem to want to do that w/o first showing a 404.

Edit edit: Ok I take that back. If I set the error page on S3 to it's showing the right content but with a status of 404. Because it thinks it's showing the error page. That is just weird and bound to cause problems.

Last edited by suzzer99; Yesterday at 09:14 PM.
suzzer99 is offline   Reply With Quote
Old Yesterday, 09:08 PM   #35755
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 23,886
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by suzzer99 View Post
Code:
pip install awscli --upgrade --user
This installs it for a single user - so it has to put it someplace in the user's home dir, which is a non-standard path. This is what you might do if you were on a multi-user system and didn't have root or didn't want it available for everyone, but it's absolutely not a normal case, and I don't really know why they lead with that.

Actually the weirdest part is that if you were going to install it for a single user, I'd put it in a virtualenv and have the virtualenv sourced in the bashrc.
RustyBrooks is offline   Reply With Quote
Old Yesterday, 09:30 PM   #35756
jmakin
 
jmakin's Avatar
 
Join Date: Jan 2008
Location: Streaming
Posts: 28,662
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I posted a while back about how atrocious the whole snapchat redesign was, and I just read this (2 months old but probably still relevant):

https://www.recode.net/2018/8/7/1766...am-user-growth

User base shrinking. Pretty lolsy, epic-level fail. Snapchat had a stranglehold on its market even though every competitor was trying to do what it was doing. I hope whoever was in charge of that redesign never works anywhere again, that was easily a multi-billion dollar mistake.
jmakin is offline   Reply With Quote
Old Yesterday, 09:32 PM   #35757
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 87,652
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Snapchat was the easiest short ever - except you still had to time it right like all shorts.

There is nothing harder than saying cool with teenagers. By definition you're not gonna be cool anymore when the younger generation comes up.

I'd bet that the numbers weren't working even with their stranglehold (although Instagram stories were eating in pretty well right?) - so they had to do a redesign to implement ways to make more $$ down the line.

Snapchat is interesting in that literally everyone came out with a snapchat like feature and completely polluted the experience. So annoying - oops I clicked or swiped something wrong - now I'm in the Facebook/IG/iMessage/Whatsapp/Twitter/Slack/iOS Photos App/etc. Snapchat knockoff experience - no idea how to get back to reality.

It's looking pretty grim for another social media giant to come along in the current climate. All the existing sites will just clone them to death and ruin it for everyone - which they're fine with obviously.

Last edited by suzzer99; Yesterday at 09:39 PM.
suzzer99 is offline   Reply With Quote
Old Yesterday, 09:36 PM   #35758
jmakin
 
jmakin's Avatar
 
Join Date: Jan 2008
Location: Streaming
Posts: 28,662
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

It's hard to put into one post how bad the major redesign was, and how much it misunderstood its own success and its userbase.

It left a huge gap in the market for IG to snap up, and now, it's no longer relevant. It'll probably be mostly gone in 2 years, maybe less. My stories get 4x the views in IG than they do in snapchat, with the same number of followers. A year ago it'd be unheard of for someone to primarily post stories in IG.

it still remains a MUCH better photo editing app/primary camera app than IG - it should try to capitalize on that, but I know it won't. It's probably the biggest case of CEO hubris that the world has seen so far. The potential was unreal.
jmakin is offline   Reply With Quote
Old Yesterday, 09:40 PM   #35759
jmakin
 
jmakin's Avatar
 
Join Date: Jan 2008
Location: Streaming
Posts: 28,662
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

But really my main point back then was usability/UI for an app is EVERYTHING.
jmakin is offline   Reply With Quote
Old Today, 12:30 AM   #35760
goofyballer
 
goofyballer's Avatar
 
Join Date: Jun 2005
Posts: 64,443
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Craggoo View Post
I'm starting to wonder if I should just try and spend the time to go through a book like

Quote:
Cracking the Coding Interview
I expect I would need to spend a little time in Java first before anything in the book would make sense. Does this seem like a worthwhile endeavor?
I'm also curious if there's feedback on this book - was talking with a tech company recruiter who recommended it to prepare for interviews.

I'm currently signed up for Interview Cake, which you have to pay for but it feels worth it - it's kind of like the coding challenge sites that are everywhere, but for every problem they have, they talk through solving it (with some hints at the start if you're stuck) in the context of how you should approach it in an interview type setting, and how to apply common strategies to different problems.

Actually, checking again, it must be popular or something because the price went wayy up since I got it ($80 for a year of access back in March, now $250???)
goofyballer is offline   Reply With Quote
Old Today, 12:51 AM   #35761
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 87,652
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I bought CCtI - the first version. Seemed useful but at the time my takeaway was Lol Facebook, Google, etc. and their silly interview processes.

Fast forward 8 years and now every startup thinks they're Facebook. I bought the newest version. Didn't read it of course but if I hadn't landed a gig soon I probably would have.
suzzer99 is offline   Reply With Quote
Old Today, 12:54 AM   #35762
blackize5
old hand
 
Join Date: Sep 2012
Posts: 1,257
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by goofyballer View Post
I'm also curious if there's feedback on this book - was talking with a tech company recruiter who recommended it to prepare for interviews.

I'm currently signed up for Interview Cake, which you have to pay for but it feels worth it - it's kind of like the coding challenge sites that are everywhere, but for every problem they have, they talk through solving it (with some hints at the start if you're stuck) in the context of how you should approach it in an interview type setting, and how to apply common strategies to different problems.

Actually, checking again, it must be popular or something because the price went wayy up since I got it ($80 for a year of access back in March, now $250???)
You got a great deal. Interview cake must be doing some pricing tests or something. It has been around $200 since I first looked at it a couple years ago and when I paid for it last year.

Cracking the coding interview is pretty similar to IC except it's not interactive in the same way and looking up hints and solutions is a pain in the ass. It has some good content on how to approach interviews in general and some more general job hunting advice too. It seemed a little more tailored to Google style interviews where things are underspecified than IC where problems are presented more in a more straightforward manner.

You don't need to be fluent in Java to get a lot out of it. The Java language features used are very easy to follow if you know basic for loops, array operations, and hashmaps. Where Java implementations of things are significant it's mostly called out for you.
blackize5 is offline   Reply With Quote
Old Today, 01:10 AM   #35763
microbet
Solar Powered
 
microbet's Avatar
 
Join Date: Jan 2005
Location: SoCal
Posts: 50,043
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

This may be just because I'm a newbie, but uploading a file and using node/express to get the file, then read a json file to figure out what to name the uploaded file, then putting the file where I want it was hard. Lotta asynchronicity. But, done!
microbet is offline   Reply With Quote
Old Today, 01:15 AM   #35764
suzzer99
Carpal \'Tunnel
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 87,652
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Look into async/await to avoid callback hell. Feel free to paste your code.
suzzer99 is offline   Reply With Quote
Old Today, 01:42 AM   #35765
microbet
Solar Powered
 
microbet's Avatar
 
Join Date: Jan 2005
Location: SoCal
Posts: 50,043
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by suzzer99 View Post
Look into async/await to avoid callback hell. Feel free to paste your code.
I made a couple passes at async, await, but not in earnest. I want to understand it the "old fashioned" way first. I didn't really want to use multer or anything like it, but apparently fileupload was taken out/deprecated from express and you have to use something third party. I don't quite get the role of 'cb' in there. I don't know if that's just because I don't get it or because it's obscured in multer.

Code:
var storage = multer.diskStorage({
	destination: function (req, file, cb) {
		cb(null, '../solarreact/public/img')
	},
	filename: function (req, file, cb) {
		fs.readFile('../solarreact/src/ImageData.json', 'utf8', (err, data) => {
			if (err) throw err;
			imgDataArr = JSON.parse(data);
			const filename = imgDataArr[imgDataArr.length-1][2].toString() + '_' + imgDataArr[imgDataArr.length-1][0].toString() + '.jpg';
			imgDataArr.push([imgDataArr.length+1, "./img/" + filename, imgDataArr[imgDataArr.length-1][2], "this would be the caption here"]);
			console.log(JSON.stringify(imgDataArr));
			writeImageData(imgDataArr);
			cb(null, filename);
		});
	}
});

var upload = multer({ 
	storage: storage
});
app.post('/api/imgupload', upload.single('image'), function(req, res, next) { 
	res.send('this is post route upload');
});
Code:
function writeImageData(jsondata) {
	fs.writeFile('../solarreact/src/ImageData.json', JSON.stringify(jsondata), (err) => {
		if (err) throw err;
		console.log('the file has been written');
	});
}
edit: added the last function there

Last edited by microbet; Today at 01:50 AM.
microbet is offline   Reply With Quote
Old Today, 01:42 AM   #35766
Barrin6
Carpal \'Tunnel
 
Barrin6's Avatar
 
Join Date: Dec 2005
Location: beyond legal blindness
Posts: 6,834
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by suzzer99 View Post
My boss literally told a dev he had to use a gui git client and not the command line. I can't imagine if that had happened to a ton of posters itt.

To be fair this guy is pretty raw - not some command line rock star like everyone here
Quote:
Originally Posted by river_tilt View Post
This happened to me. Apparently, command will scare our clients.

I know what I am doing with command line. What my boss can't see won't hurt him. On a completely unrelated note, he works in a different building to me at the moment.
Wtf, this is such a weird policy. Are they just saying that because they are afraid you guys don't know what you are doing with the command line?
Barrin6 is offline   Reply With Quote
Old Today, 03:41 AM   #35767
goofyballer
 
goofyballer's Avatar
 
Join Date: Jun 2005
Posts: 64,443
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by blackize5 View Post
You got a great deal. Interview cake must be doing some pricing tests or something. It has been around $200 since I first looked at it a couple years ago and when I paid for it last year.
Interesting - for me it was $100, then after the 7 day email newsletter thing they included a "special, if you act now!" 20% off deal.

Do you feel like it prepared you pretty well for interviews? Like, when companies hit you with their questions, any major curveballs or did you mostly feel like "I got this"?

Random fun story: my manager, when he does interviews, literally asks people "implement the C strstr function" (find a substring from within a larger string and return where it occurs) and he says like 70% of people **** it up, which blows my mind. Like ~every IC question is harder than that.
goofyballer is offline   Reply With Quote
Old Today, 06:13 AM   #35768
_dave_
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK (or what remains of it)
Posts: 12,755
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by suzzer99 View Post
Question for all the react people. I'm using BrowserRouter like this:

Code:
  <BrowserRouter>
    <div className="sans-serif">
      <Switch>
        <Route path="/login" component={Login} />
        <Route path="/" component={Main} />
       </Switch>
     </div>
  </BrowserRouter>
http://localhost:3000/login works fine when navigating through the app on local and on s3. But if I hit refresh it only works on local where I am running the local webpack dev server. If I do a static build and upload to S3 it static webserver - it returns a 404 when I try to hit /login through deep link or refresh.

Also there is no 302 browser redirect in my network history.



So what's going on here - is the webpack dev server serving routes behind the scenes? Is a production webserver expected to do the same? If so that kinda breaks the idea of a fully static site.

The s3 and cloudfront fixes for this seem to be to redirect all 404 and 403 errors to index.html. This works I guess but it's terrible for SEO.

Edit: ok I guess what's happening is the webpack dev server is just sending anything it can't find to index.html. Unfortunately S3 or Cloudfront doesn't seem to want to do that w/o first showing a 404.

Edit edit: Ok I take that back. If I set the error page on S3 to it's showing the right content but with a status of 404. Because it thinks it's showing the error page. That is just weird and bound to cause problems.
You do this with .htaccess on Apache, basically set it to serve /index.html for all paths. I am not sure if redirects will work to preserve the route, but if they do then good I guess!

Here's some example server configs: https://github.com/ReactTraining/rea...ng-your-server

This article has some changes to webpack to get it working locally, then sets S3 error page as index.html and says it works fine https://medium.com/@ervib/how-to-set...s3-d3dffa6ae43 (he's probably at the same spot as you and not bothered by the 404 response if it looks working, I guess?)

Personally I use the react-router <HashRouter> instead of <BrowserRouter> since that seems to work just as well and supports working out of arbitrary folders / subfolders perfectly with no reconfiguration, it seems to me the only cost being a hash in the middle of the visible url. For this ability to dump a HashRouter page in any folder on any server, add:
Code:
"homepage": ".",
to the top level of package.json in your project.

Last edited by _dave_; Today at 06:21 AM.
_dave_ 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 09:23 AM.


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