Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

09-24-2018 , 11:53 PM
Quote:
Originally Posted by jjshabado
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?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-24-2018 , 11:55 PM
Quote:
Originally Posted by PJo336
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-24-2018 , 11:59 PM
Quote:
Originally Posted by RustyBrooks
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
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 12:30 AM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 12:57 AM
jmakin - nice work! Let us know how it turns out.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 12:58 AM
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).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 01:21 AM
Quote:
Originally Posted by PJo336
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 04:34 AM
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)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 11:35 AM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 11:38 AM
Quote:
Originally Posted by Victor
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
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 11:39 AM
Yes - zen garden time.

I find a bender helps drain all the angry chi. Almost worth being suicidal for a few days afterwards.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 11:48 AM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 03:04 PM
I feel like as described Victor ran like the sun.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-25-2018 , 04:15 PM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-26-2018 , 09:05 PM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 01:40 AM
What is that this startup does again, Suzzer?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 09:37 AM
It's a major university - donor relations.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 10:46 AM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 11:55 AM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 12:12 PM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 12:14 PM
I hate that ****ing swipe. I do it on accident all the time while I’m trying to scroll.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 12:15 PM
I hate having to click back.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 05:14 PM
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.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 06:19 PM
Ok well learn-by-complaining seems to have worked. I'm S3-code-dropping to my lambda all up in this *****.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2018 , 07:51 PM
IAM is confusing as ****. Just know, a Role is just a thing that holds multiple policies. Policies allow access to a given resource.

So I can make a Role SQSAdmin, and give it a Policy that says it can read or delete anything on SQS. Then I can give that Role to a lambda function, and the lambda function can now call code talking to SQS. Role is just a collection of policies to "supposedly" make it clearer what you're doing
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m