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 09-24-2018, 11:42 PM   #35451
PJo336
THRILLHOUSE!
 
PJo336's Avatar
 
Join Date: Mar 2007
Posts: 21,887
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by RustyBrooks View Post
This may be obvious to those of you who use AWS, but, although I knew "reserved EC2 instances" were cheaper, I did not quite realize they were like... 2/3 cheaper. So today I reserved 2 of them for personal project. I opted to spend the same amount but get about 4x the performance. I was using t2.smalls and running out of CPU credits a lot.

If you're using AWS and you feel confident about what instances you need, reserve that ****...
Haha WHERE WERE YOU RUSTY?! I just found this out as well, after paying for a couple EC2 and RDS instances for over a year. Could have easily payed 50% less
PJo336 is offline   Reply With Quote
Old 09-24-2018, 11:53 PM   #35452
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 24,355
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by jjshabado View Post
This is where the google model is way better. No up front capacity planning and reservations necessary and instead you get good usage based discounts.
I'm sort of all in on AWS tooling but I may try out google cloud some time. I assume they have a docker cloud thing?
RustyBrooks is offline   Reply With Quote
Old 09-24-2018, 11:55 PM   #35453
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 24,355
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by PJo336 View Post
Haha WHERE WERE YOU RUSTY?! I just found this out as well, after paying for a couple EC2 and RDS instances for over a year. Could have easily payed 50% less
The dumb thing is I *knew* it was cheaper because I'm always being pressured to tell our AWS guy which instances we can reserve for a year or more. I just didn't think it was that much.

Today after running out of CPU creds for like the 9th time this week I went to look into upgrading and I saw the reserved column on the AWS calculator and was like holy ****.

I mean we're talking about like a few cups of coffee a month, but still.
RustyBrooks is offline   Reply With Quote
Old 09-24-2018, 11:59 PM   #35454
PJo336
THRILLHOUSE!
 
PJo336's Avatar
 
Join Date: Mar 2007
Posts: 21,887
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by RustyBrooks View Post
The dumb thing is I *knew* it was cheaper because I'm always being pressured to tell our AWS guy which instances we can reserve for a year or more. I just didn't think it was that much.

Today after running out of CPU creds for like the 9th time this week I went to look into upgrading and I saw the reserved column on the AWS calculator and was like holy ****.

I mean we're talking about like a few cups of coffee a month, but still.
I wish RDS was cheaper for the lowest option, but yeah.

Google cloud mostly I just avoid because of the fatigue of learning everything from scratch. I've had almost 2 years in AWS now so its nice to just know how to get stuff up and running asap and use 20 diff tools within it. Guess that's not a good reason to not try new stuff, but I'm fatigued enough outside of work these days
PJo336 is offline   Reply With Quote
Old 09-25-2018, 12:30 AM   #35455
microbet
Solar Powered
 
microbet's Avatar
 
Join Date: Jan 2005
Location: SoCal
Posts: 53,072
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

You can not necessarily avoid visiting every spot, but in some cases you could avoid some spots. If you have a donut with a hole in the center that doesn't isn't at least 3 spots tall and at least 3 spaces wide. If you are on the edges that becomes 2 spaces square and in the corners it's a little triangle with 3 holes. This reminds me of Go/Wei Chi - the game.

Dunno how you're given the data, but say

grid = []
row = (1, 0, 1, 0, 0)
grid.append(row)
.
.
.
or some such.

Dunno if this has a good O number or not, but it seems to work. I only walk through the grid once, but it does between 1 and 6 comparisons for each point. There's a lot of ugly case testing, but maybe this is faster than building objects of islands separately?

Code:
#!/usr/bin/python

grid = []
row = (0, 0, 0, 0, 0, 0)
grid.append(row)
row = (0, 1, 0, 1, 0, 0)
grid.append(row)
row = (0, 1, 0, 1, 0, 0)
grid.append(row)
row = (0, 1, 0, 0, 0, 0)
grid.append(row)
row = (0, 0, 0, 0, 0, 0)
grid.append(row)
row = (0, 0, 0, 0, 0, 0)
grid.append(row)

i = 0 
j = 0 
islands = 0
forgetit = False

# basically, if you are a zero, forget it.  If you are a 1, check all the upcoming
# adjacent spots and if they have a 1 don't count the island because you'll get it later
while i < len(grid):
   while j < len(row): 
      if grid[i][j] == 0:  
         j += 1
         forgetit = False
         continue 
      if j > 0 and i < len(grid) - 1: #down one and back one if exists
          if grid[i+1][j-1] == 1:
             j += 1
             forgetit = True
             continue
      if i < len(grid) - 1:  # look below if there is a below
         if grid[i+1][j] == 1: 
             j += 1
             continue
      if j < len(row) - 1 and i < len(grid) - 1: # down one and forward one, if there is such a place
         if grid[i+1][j+1] == 1:
             j += 1
             continue
      if j < len(row) - 1:  # look forward if there is a forward
         if grid[i][j+1] == 1: 
            j += 1
            continue
         if forgetit:  #it overcounts one case
            forgetit = False
            islands = islands - 1
      j += 1
      islands += 1
   j = 0
   i += 1

print("islands = ", islands)
I played around with a lot of different island shapes

(Do diagonals count? I counted diagonals.)

There's still a bug. I don't have time to fix it, but I don't think it'd be hard.

It's cases like this:

OXXXXO
XOXOO0

Last edited by microbet; 09-25-2018 at 12:49 AM.
microbet is offline   Reply With Quote
Old 09-25-2018, 12:57 AM   #35456
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

jmakin - nice work! Let us know how it turns out.
suzzer99 is offline   Reply With Quote
Old 09-25-2018, 12:58 AM   #35457
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I spent about 5 hours on this stupid problem and am still stuck in edge case hell. I like the idea though of taking the grid in slices and working down one row at a time.

All a 1D chunk of land cares about is a) do I border only water above or am I the top row? (new island), do I border only one island? (do nothing), do I border multiple "islands" that we now know are not islands since I touch both of them (there be dragons).
suzzer99 is offline   Reply With Quote
Old 09-25-2018, 01:21 AM   #35458
jjshabado
Carpal Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 22,554
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by PJo336 View Post
I wish RDS was cheaper for the lowest option, but yeah.

Google cloud mostly I just avoid because of the fatigue of learning everything from scratch. I've had almost 2 years in AWS now so its nice to just know how to get stuff up and running asap and use 20 diff tools within it. Guess that's not a good reason to not try new stuff, but I'm fatigued enough outside of work these days
Fatigue of learning everything from scratch is totally valid. But I've found it surprisingly easy to learn and most concepts from AWS still apply for GCP and the GCP way is often a slightly more intuitive way of applying the concepts.

I wouldn't recommend anyone that is already with AWS to switch to GCP though for any sort of small/medium sized project.
jjshabado is offline   Reply With Quote
Old 09-25-2018, 04:34 AM   #35459
microbet
Solar Powered
 
microbet's Avatar
 
Join Date: Jan 2005
Location: SoCal
Posts: 53,072
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I think this works and I think this is essentially how a human does this problem. I find the neighbors to any point and follow along finding neighbors, remembering to go back if it forks off. I start every point associated with 0 because it's not part of a "fam" family and when it has a neighbor it takes the family number from the neighbor.

Code:
#/usr/bin/python

grid = []
row = [[1,0], [0,0], [0,0], [1,0], [0,0], [1,0]]
grid.append(row)
row = [[1,0], [0,0], [0,0], [1,0], [1,0], [1,0]]
grid.append(row)
row = [[0,0], [0,0], [1,0], [0,0], [0,0], [1,0]]
grid.append(row)
row = [[0,0], [1,0], [0,0], [0,0], [1,0], [0,0]]
grid.append(row)
row = [[0,0], [0,0], [0,0], [1,0], [0,0], [0,0]]
grid.append(row)
row = [[1,0], [0,0], [1,0], [1,0], [0,0], [0,0]]
grid.append(row)

def pointexists(i, j):
    if 0 <= i < len(grid) and 0 <= j < len(row):
        return True
    else:
        return False

def doallthatchecking(loadcheckneighbors):
    for check in loadcheckneighbors:
        checkneighbors(check[0], check[1], check[2])

def checkneighbors(i, j, fam):
    loadcheckneighbors = []
    if pointexists(i, j+1):
        if grid[i][j+1][0] == 1 and grid[i][j+1][1] == 0:
            grid[i][j+1][1] = fam
            loadcheckneighbors.append([i, j+1, fam])
    if pointexists(i+1, j+1):
        if grid[i+1][j+1][0] == 1 and grid[i+1][j+1][1] == 0:
            grid[i+1][j+1][1] = fam
            loadcheckneighbors.append([i+1, j+1, fam])
    if pointexists(i+1, j-1):
        if grid[i+1][j-1][0] == 1 and grid[i+1][j-1][1] == 0:
            grid[i+1][j-1][1] = fam
            loadcheckneighbors.append([i+1, j-1, fam])
    if pointexists(i+1, j):
        if grid[i+1][j][0] == 1 and grid[i+1][j][1] == 0:
            grid[i+1][j][1] = fam
            loadcheckneighbors.append([i+1, j, fam])
    if pointexists(i-1, j):
        if grid[i-1][j][0] == 1 and grid[i-1][j][1] == 0:
            grid[i-1][j][1] = fam
            loadcheckneighbors.append([i-1, j, fam])
    if pointexists(i, j-1):
        if grid[i][j-1][0] == 1 and grid[i][j-1][1] == 0:
            grid[i][j-1][1] = fam
            loadcheckneighbors.append([i, j-1, fam])
    doallthatchecking(loadcheckneighbors)

i=0
j=-1
fam = 0
while i < len(grid):
    while j < len(row) - 1: 
        j += 1
        if grid[i][j][1] != 0:
            continue
        if grid[i][j][0] == 1:
            fam += 1
            grid[i][j][1] = fam
            checkneighbors(i, j, fam)            
    i += 1
    j = -1

print("number of islands: ", fam)
microbet is offline   Reply With Quote
Old 09-25-2018, 11:35 AM   #35460
Victor
Carpal \'Tunnel
 
Victor's Avatar
 
Join Date: Jul 2003
Posts: 61,324
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

well, I feel pretty stupid. she had only nice things to say to me. did say she noticed me being frustrated and wanted to make sure I was ok and that I could talk to her for advice if needed.

I think maybe I am a bit stressed out about the regular office grind and I proly oughta take a week off and take a step back.

thanks for all the feedback from you guys.
Victor is offline   Reply With Quote
Old 09-25-2018, 11:38 AM   #35461
RustyBrooks
Carpal \'Tunnel
 
RustyBrooks's Avatar
 
Join Date: Feb 2006
Location: Austin, TX
Posts: 24,355
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Victor View Post
well, I feel pretty stupid. she had only nice things to say to me. did say she noticed me being frustrated and wanted to make sure I was ok and that I could talk to her for advice if needed.

I think maybe I am a bit stressed out about the regular office grind and I proly oughta take a week off and take a step back.

thanks for all the feedback from you guys.
Well that went better than expected

In my first job, I once got very frustrated with a coworker and sent a very acerbic and expletive filled email to my boss, which I accidentally copied to my coworker. Ooops.

About 2 minutes later my boss calls me and tells me we're going to have to have a meeting, me him and the other guy. ****. So I walk in and my boss and coworker are already there.

Before I can even say anything my coworker says "I am *so* sorry, I hadn't realized that you felt so strongly about blah blah"

Sometimes stuff works out
RustyBrooks is offline   Reply With Quote
Old 09-25-2018, 11:39 AM   #35462
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Yes - zen garden time.

I find a bender helps drain all the angry chi. Almost worth being suicidal for a few days afterwards.
suzzer99 is offline   Reply With Quote
Old 09-25-2018, 11:48 AM   #35463
jjshabado
Carpal Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 22,554
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Victor, glad to hear it.

I've been remote for close to a decade now and I still keep relearning the same lesson that its really hard for people to communicate tone properly over text chat mediums.

At this point I basically use emojis like a 14-year old in most of my chat/email messages.
jjshabado is offline   Reply With Quote
Old 09-25-2018, 03:04 PM   #35464
Larry Legend
Celtic Pride
 
Larry Legend's Avatar
 
Join Date: Jul 2009
Location: Kyrie's earth
Posts: 42,696
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I feel like as described Victor ran like the sun.
Larry Legend is offline   Reply With Quote
Old 09-25-2018, 04:15 PM   #35465
Victor
Carpal \'Tunnel
 
Victor's Avatar
 
Join Date: Jul 2003
Posts: 61,324
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Things got even better as we have decided to assign entire cards to a single developer rather than attempting to slice the cards into tasks and assign those as we had been doing.
Victor is offline   Reply With Quote
Old 09-26-2018, 09:05 PM   #35466
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Well I've been cruising right along on my gitlab -> AWS CI/CD flow, and then of course get hung up on seemingly the simplest thing.

I know I can upload a zip file with my lambda code to S3, then upload that as the lambda source, then publish. All I want to do is automate this when the zip file appears in S3.

1) Some magic happens where a trigger is set up on a specific "auto-deploy" S3 bucket pointing to one specific lambda.
2) The S3 bucket sits empty.
3) A file named archive.zip, containing the source code for oue lambda, is dropped there - doesn't matter how it get there.
4) A trigger then deploys that code to the attached lambda, and publishes the lambda with the new code.
5) The file is then renamed or moved so it won't trigger another build.

This seems like something that shouldn't be too hard? But google is getting me nowhere.

Edit: well google just discovered this, sounds promising: https://aws.amazon.com/blogs/compute...or-aws-lambda/

Quote:
Bonus Section: Lambda Auto-Deployer
Wouldn’t it be nice if there were a microservice that would watch for code zips being uploaded to S3 and then automatically deploy them to Lambda for you? Let’s build it – with the new S3 upload capability in Lambda and the existing S3 bucket notifications that can call Lambda functions, it’s really easy:
Ok yeah, nailed it. I'll tackle this tomorrow I think.

Last edited by suzzer99; 09-26-2018 at 09:10 PM.
suzzer99 is offline   Reply With Quote
Old 09-27-2018, 01:40 AM   #35467
OmgGlutten!
Pooh-Bah
 
OmgGlutten!'s Avatar
 
Join Date: Aug 2016
Posts: 4,996
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

What is that this startup does again, Suzzer?
OmgGlutten! is offline   Reply With Quote
Old 09-27-2018, 09:37 AM   #35468
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

It's a major university - donor relations.
suzzer99 is offline   Reply With Quote
Old 09-27-2018, 10:46 AM   #35469
well named
poorly undertitled
 
well named's Avatar
 
Join Date: Jun 2007
Location: esse est coesse
Posts: 75,953
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

When you're done with this project (or even now) I'm curious to hear what you think the benefits are of using the tools you're using over something more "serverfull", so to speak. I understand that you are going for serverless somewhat just to explore how it works, but my impression so far makes me wonder whether all the extra complexity is really worth it.
well named is offline   Reply With Quote
Old 09-27-2018, 11:55 AM   #35470
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Yeah we'll see. But as someone who barely knows anything about linux and gets hives when you say I need to SSH into the instance and [do something], I'm digging lambda so far.

I went down a freaking rabbit hole just trying to tar up my directory yesterday. The example I found had --exclude at the end of the command, which doesn't work on my flavor of linux apparently.



I'll be happy when knowing linux is in the same league as programing a chip. Everything runs on it, and *someone* needs to know it, but not me.
suzzer99 is offline   Reply With Quote
Old 09-27-2018, 12:12 PM   #35471
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Has anyone else noticed that Mac two-finger swipe to go back stopped working on vBulletin after the big Chrome upgrade? At least I swear it used to work. Doesn't work here or Chiefsplanet - the page just annoyingly bounces a little. Works on other pages It works on Mac Firefox on 2p2.
suzzer99 is offline   Reply With Quote
Old 09-27-2018, 12:14 PM   #35472
jmakin
 
jmakin's Avatar
 
Join Date: Jan 2008
Location: Streaming
Posts: 28,506
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I hate that ****ing swipe. I do it on accident all the time while Iím trying to scroll.
jmakin is offline   Reply With Quote
Old 09-27-2018, 12:15 PM   #35473
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I hate having to click back.
suzzer99 is offline   Reply With Quote
Old 09-27-2018, 05:14 PM   #35474
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I really hate it when I see IAM in my tutorials: "This operation requires permission for the lambda:UpdateFunctionCode action."

Ok. Where? On the lambda calling updateFunctionCode or the lambda being updated? Do I put it in a role or policy? Do I edit it in the lambda console directly? On the lambda itself - what's the difference between Function Policy and Execution Role? Once I dig into one of those - where the hell do I put this thing?

How am I supposed to translate "This operation requires permission for the lambda:UpdateFunctionCode action" to something that looks like this?

Code:
    {
      "Sid": "f8ae84c0-399b-4b52-9763-19c47522d69d",
      "Effect": "Allow",
      "Principal": {
        "Service": "apigateway.amazonaws.com"
      },
      "Action": "lambda:InvokeFunction",
      "Resource": "arn:aws:lambda:us-west-2:906624224980:function:cy-store-data",
      "Condition": {
        "ArnLike": {
          "AWS:SourceArn": "arn:aws:execute-api:us-west-2:906624224980:iagz1uefr1/*/POST/compare-yourself"
        }
      }
    },
I just want IAM for dummies every time.

Everything else seems pretty straightforward and I'm amazed how quick I can spin things up from the tutorials - unless IAM is involved, then there's all this assumed knowledge and I'm ****ed.
suzzer99 is offline   Reply With Quote
Old 09-27-2018, 06:19 PM   #35475
suzzer99
Save the Cheerleader, Save the World
 
suzzer99's Avatar
 
Join Date: Nov 2005
Location: on top of the bell curve
Posts: 92,117
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Ok well learn-by-complaining seems to have worked. I'm S3-code-dropping to my lambda all up in this *****.
suzzer99 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 01:50 AM.


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