IT/Software career thread: Invert binary trees for dollars.

  • Guest, it's time once again for the hotly contested and exciting FoH Asshat Tournament!



    Go here and fill out your bracket!
    Who's been the biggest Asshat in the last year? Once again, only you can decide!

Mist

Eeyore Enthusiast
<Gold Donor>
30,275
22,008
Every time you su to root do you feel a tiny bit more powerful for a split second?
 
  • 1EyeRoll
Reactions: 1 user

ShakyJake

<Donor>
7,598
19,181
Angular or front end design bros. Let's say you have a simple to-do list app. You delete an item from a list and want the app to reflect that.. After a http delete call would you make another API call to get the updated list or store a copy of the notes in an array locally in a service class and just splice it? What would be the most often used route to go about this?

Seems like it's more of a trade-off on performance versus data integrity.
You can have your HTTP DELETE return a response with the updated list. Obviously, this is a bad idea if you have a massive list. But for small lists it's fine.

But I would NOT manipulate an in-memory list of items and "assume" that the back-end call completed successfully. What if the db crapped out for some reason? etc.
 

The_Black_Log Foler

Stock Pals Senior Vice President
<Gold Donor>
42,786
40,014
You can have your HTTP DELETE return a response with the updated list. Obviously, this is a bad idea if you have a massive list. But for small lists it's fine.

But I would NOT manipulate an in-memory list of items and "assume" that the back-end call completed successfully. What if the db crapped out for some reason? etc.
Right. Mirror the list on the front end, if delete returns a 200 or 204 then splice that deleted one our of your array in the front end side. I mean obviously changing the in memory values would be dependent on checking for successful http return codes. No?
 

ShakyJake

<Donor>
7,598
19,181
Right. Mirror the list on the front end, if delete returns a 200 or 204 then splice that deleted one our of your array in the front end side. I mean obviously changing the in memory values would be dependent on checking for successful http return codes. No?
Personally, I think you should either return a refreshed list with the 200 response from your DELETE -or- perform a GET request to re-fetch the list. I really don't like splicing arrays. Granted, this will work fine with a simple 'TODO' app. However, think in real-world scenarios where you might have a multi-user application. You don't know if the in-memory list has become stale. For example, what if other operations from other users (adds, updates, deletes) have been fired off in the meantime?
 
  • 1Like
Reactions: 1 user

The_Black_Log Foler

Stock Pals Senior Vice President
<Gold Donor>
42,786
40,014
Personally, I think you should either return a refreshed list with the 200 response from your DELETE -or- perform a GET request to re-fetch the list. I really don't like splicing arrays. Granted, this will work fine with a simple 'TODO' app. However, think in real-world scenarios where you might have a multi-user application. You don't know if the in-memory list has become stale. For example, what if other operations from other users (adds, updates, deletes) have been fired off in the meantime?
Ahh ok I get you. Maybe just make a deleteAndGetList endpoint? I still want to expose just a delete endpoint. I think you just gave me the solution.
 

Khane

Got something right about marriage
19,789
13,298
What technology would be the easiest/fastest way to automate opening and clicking a link in an email?

I get emails for golf event signups one month before each event at 6am. Problem is there are a limited number of slots available and the old timers are all awake at 6am and get in before I bother to drag my ass out of bed. Would like to automate this signup process so I can sleep in.

Keep in mind I'm a .NET guy. That doesn't mean I have to do this using something in the .NET stack but it's something I'm more familiar with and already have development tools and the IDE for it so might make that part easier.

It's been about 16 years since I did any web development.
 

ShakyJake

<Donor>
7,598
19,181
Ahh ok I get you. Maybe just make a deleteAndGetList endpoint? I still want to expose just a delete endpoint. I think you just gave me the solution.
Well, if you follow the "rules" of REST API, all you should have is GET, POST, PUT, DELETE endpoints. Don't create endpoints that act like function calls.
 
  • 1Like
Reactions: 1 user

ShakyJake

<Donor>
7,598
19,181
What technology would be the easiest/fastest way to automate opening and clicking a link in an email?

I get emails for golf event signups one month before each event at 6am. Problem is there are a limited number of slots available and the old timers are all awake at 6am and get in before I bother to drag my ass out of bed. Would like to automate this signup process so I can sleep in.

Keep in mind I'm a .NET guy. That doesn't mean I have to do this using something in the .NET stack but it's something I'm more familiar with and already have development tools and the IDE for it so might make that part easier.

It's been about 16 years since I did any web development.
Is this for Outlook (desktop app, not web)?
 

The_Black_Log Foler

Stock Pals Senior Vice President
<Gold Donor>
42,786
40,014
Well, if you follow the "rules" of REST API, all you should have is GET, POST, PUT, DELETE endpoints. Don't create endpoints that act like function calls.
Ok then I'll just call a delete, if successful return http code then a get call. Thanks shaky.
 
  • 1Like
Reactions: 1 user

Khane

Got something right about marriage
19,789
13,298
Personal gmail account accessed via chrome. I suppose I could set it up in a desktop email app if I wanted to/it made it that much easier.
 

TJT

Mr. Poopybutthole
<Gold Donor>
40,701
102,086
What technology would be the easiest/fastest way to automate opening and clicking a link in an email?

I get emails for golf event signups one month before each event at 6am. Problem is there are a limited number of slots available and the old timers are all awake at 6am and get in before I bother to drag my ass out of bed. Would like to automate this signup process so I can sleep in.

Keep in mind I'm a .NET guy. That doesn't mean I have to do this using something in the .NET stack but it's something I'm more familiar with and already have development tools and the IDE for it so might make that part easier.

It's been about 16 years since I did any web development.

Well do you get work emails on a gmail type setup or something with a decent API?
 

TJT

Mr. Poopybutthole
<Gold Donor>
40,701
102,086
Personal gmail account accessed via chrome. I suppose I could set it up in a desktop email app if I wanted to/it made it that much easier.

Easy then, call your inbox for everything with a timestamp your looking for at the time you expect. Parse out the hyperlink within it and invoke it. Unless there are more steps than that?

Throw that shit on a Lambda for nothing in AWS and have it scan once a month when you expect it to happen. Something like that.
 

Khane

Got something right about marriage
19,789
13,298
Well I was asking more what language(s) might make this easier/have built in functionality/libraries to facilitate this type of automation.
 

ShakyJake

<Donor>
7,598
19,181
Well I was asking more what language(s) might make this easier/have built in functionality/libraries to facilitate this type of automation.
If you're a .NET guy, then I think it should be fairly trivial to create a simple console app that makes a periodic call to a gmail API, looking whatever, and, lke TJT said, invoke the link. Unless you have to do more on the link's end?

BTW:
.NET Quickstart | Gmail API | Google Developers
 

Khane

Got something right about marriage
19,789
13,298
Yea just realized there is the gmail API and also a G Suite developer apps script for gmail. That works, thanks.
 
  • 1Like
Reactions: 1 user

The_Black_Log Foler

Stock Pals Senior Vice President
<Gold Donor>
42,786
40,014
Yea just realized there is the gmail API and also a G Suite developer apps script for gmail. That works, thanks.
That's sick. Had no idea there was a Gmail api. I'll have to check this out later
 

TJT

Mr. Poopybutthole
<Gold Donor>
40,701
102,086
Yea just realized there is the gmail API and also a G Suite developer apps script for gmail. That works, thanks.

I'd personally just use python and maybe the beautiful soup library and the basic http requests library to do this.

No need to make a console app.