I need a little Golang assistance. I'm building a very basic REST API client (long story) and when I get the response from the API, the json decoder is not populating the object. How do I see the response body?
This is in a test case run inside a docker container against a BrowserStack instance, so there's no way to debug it. Otherwise I probably would have already figured this out.
Are you sure v is a pointer? I'd probably do a type assertion if you know what kind of pointer it should be.
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
0
Options
Ear3nd1lEärendil the Mariner, father of ElrondRegistered Userregular
I need a little Golang assistance. I'm building a very basic REST API client (long story) and when I get the response from the API, the json decoder is not populating the object. How do I see the response body?
This is in a test case run inside a docker container against a BrowserStack instance, so there's no way to debug it. Otherwise I probably would have already figured this out.
Are you sure v is a pointer? I'd probably do a type assertion if you know what kind of pointer it should be.
I'm fairly new to Go (and most of what I HAVE done has been test case scripts, so no actual development) and I haven't worked with pointers since the 90s. But I'm pretty sure this is being passed as a pointer, right?
c.do(req, &authenticationResponse)
0
Options
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
I need a little Golang assistance. I'm building a very basic REST API client (long story) and when I get the response from the API, the json decoder is not populating the object. How do I see the response body?
This is in a test case run inside a docker container against a BrowserStack instance, so there's no way to debug it. Otherwise I probably would have already figured this out.
Are you sure v is a pointer? I'd probably do a type assertion if you know what kind of pointer it should be.
I'm fairly new to Go (and most of what I HAVE done has been test case scripts, so no actual development) and I haven't worked with pointers since the 90s. But I'm pretty sure this is being passed as a pointer, right?
c.do(req, &authenticationResponse)
Yes, & is the reference operator and gives you the pointer for a struct value.
It's also important that the fields you are reading are actually exported (capitalized)
import (
"encoding/json"
"log"
"strings"
)
func poop(v interface{}) error {
return json.NewDecoder(strings.NewReader("{\"this\":\"is poop\"}")).Decode(v)
}
type mepoop struct {
This string
}
// Execute is going to get executed.
func Execute() {
var b, a mepoop
poop(a)
poop(&b)
log.Println(a)
log.Println(b)
}
Edit: it's just a reader, you can readAll, but that's not your problem.
You got me on the right track, thank you. I got the JSON value with this:
r, e := ioutil.ReadAll(resp.Body)
if e != nil {
fmt.Println(e)
}
fmt.Println(string(r))
Turns out I'm getting an authentication error. I've tested with the same payload in Postman and it works fine, so there must be a header value that is wrong. I'll compare the headers from the client with those in Postman and pester the guys who wrote the API if they match.
Thanks everyone, I appreciate the help.
+1
Options
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
Speaking of go, it's more or less official now that 1.13 is going to have nestable errors. Essentially they are going to add Wrap/Unwrap methods that can optionally store/fetch an underlying error. Kind of like Java exception "caused by" chains.
The error system still needs a lot of work, but this is certainly progress.
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
Except the `authorize` action on it is not working, broken, something. The template it renders says that @token is nil... but there's no way to get to authorize.html.erb with a nil token. So, wtf?
I've stripped my own controller using it down to this:
require 'oauth/controllers/provider_controller'
class MyOauthController < ApplicationController
include OAuth::Controllers::ProviderController
end
so not much to go wrong there. Is there some wonkiness with instance vars, views (or templates to me, being a django guy), and included controllers like that which I am unaware of? All of the googling is failing to produce anything useful.
What I really, really don't understand is that I can make my own `authorize` action, specifically define @token, and yet it STILL says that shit is null. But the stack trace shows that its definitely going to my controller. wtf?
Rails and all of its magic "I just do stuff" can go fuck itself. Please help me.
Except the `authorize` action on it is not working, broken, something. The template it renders says that @token is nil... but there's no way to get to authorize.html.erb with a nil token. So, wtf?
I've stripped my own controller using it down to this:
require 'oauth/controllers/provider_controller'
class MyOauthController < ApplicationController
include OAuth::Controllers::ProviderController
end
so not much to go wrong there. Is there some wonkiness with instance vars, views (or templates to me, being a django guy), and included controllers like that which I am unaware of? All of the googling is failing to produce anything useful.
What I really, really don't understand is that I can make my own `authorize` action, specifically define @token, and yet it STILL says that shit is null. But the stack trace shows that its definitely going to my controller. wtf?
Rails and all of its magic "I just do stuff" can go fuck itself. Please help me.
I think we'll need more information. Can you give us the whole error?
Speaking of go, it's more or less official now that 1.13 is going to have nestable errors. Essentially they are going to add Wrap/Unwrap methods that can optionally store/fetch an underlying error. Kind of like Java exception "caused by" chains.
The error system still needs a lot of work, but this is certainly progress.
We've been using github.com/pkg/errors for that. Looks like they'll pretty much roll that into the standard library.
Except the `authorize` action on it is not working, broken, something. The template it renders says that @token is nil... but there's no way to get to authorize.html.erb with a nil token. So, wtf?
I've stripped my own controller using it down to this:
require 'oauth/controllers/provider_controller'
class MyOauthController < ApplicationController
include OAuth::Controllers::ProviderController
end
so not much to go wrong there. Is there some wonkiness with instance vars, views (or templates to me, being a django guy), and included controllers like that which I am unaware of? All of the googling is failing to produce anything useful.
What I really, really don't understand is that I can make my own `authorize` action, specifically define @token, and yet it STILL says that shit is null. But the stack trace shows that its definitely going to my controller. wtf?
Rails and all of its magic "I just do stuff" can go fuck itself. Please help me.
I think we'll need more information. Can you give us the whole error?
ActionView::Template::Error (undefined method `client_application' for nil:NilClass):
1: <div class="container">
2: <h1>Authorize access to your account</h1>
3: <p>Would you like to authorize
4: <%= link_to @token.client_application.name, @token.client_application.url %>
5: (<%= link_to @token.client_application.url, @token.client_application.url %>)
6: to access your account?
7: </p>
app/views/my_oauth/authorize.html.erb:4:in `_app_views_my_oauth_authorize_html_erb__863932734616812666_80623260'
lib/invalid_uri_encoding_monster.rb:14:in `call'
There is of course a whole giant stack trace, but I can't dig through it to redact anything referencing client names, etc.
Debug info includes this, so I know it's not getting routed to some different controller or action than I think.
My best guess at this point is that there is a filter or middleware or something which is routing it to some other controller, but I have no idea how the hell to find out what that might be.
Speaking of go, it's more or less official now that 1.13 is going to have nestable errors. Essentially they are going to add Wrap/Unwrap methods that can optionally store/fetch an underlying error. Kind of like Java exception "caused by" chains.
The error system still needs a lot of work, but this is certainly progress.
We've been using github.com/pkg/errors for that. Looks like they'll pretty much roll that into the standard library.
Kind of like context.
I still hold out hope that x/sync/errgroup will also be brought in. Honestly, that pattern deserves direct language support, but I'd settle for it being in the stdlib.
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
It's especially bad if you don't have a flagship android like the pixel or a samsung one that you didn't buy directly from them.
Phone providers have special android images they can deploy with all their custom shitware, so you've got other stuff toying around inside. Good shit.
There is a real benefit to iOS sometimes.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
+3
Options
The Escape Goatincorrigible ruminantthey/themRegistered Userregular
Quick terminology Q: I'm doing javascript crimes as is my job description, this time involving putting up several popups requiring user input in a row and then another, separate popup afterwards. Since it's all got to be in order but our popup functions are asynchronous I'm hacking together a makeshift loop by having the function handling all the logic put itself as the callback to the popup creator. Thus, one popup only comes up after the last has been closed by the user, and there's an exit condition that deals with the final popup.
Does that count as recursion, even if the function is going through a middleman rather than directly calling itself?
So, I'm using this snippet of code that simply refuses to run correctly, not matter what I do (Python 3.7).
gamTPH=gamTPHp1
for n in range(np.size(gamTPH[0])):
for m in range(np.size(gamTPHp2[0])):
if gamTPHp2[0][m]==gamTPH[0][n]:
gamTPH[1][n]=gamTPH[1][n]+gamTPHp2[1][m]
For some odd reason, gamTPHp1 = gamTPH... after this executes. Can't figure it out, and I'm pretty sure it shouldn't do this. Maybe a bug?
Steam - Synthetic Violence | XBOX Live - Cannonfuse | PSN - CastleBravo | Twitch - SoggybiscuitPA
I'm not familiar with the syntax, but after a quick google I'm wondering is that the right way to get the size? Or is it supposed to be gamTPH[0].size?
So, I'm using this snippet of code that simply refuses to run correctly, not matter what I do (Python 3.7).
gamTPH=gamTPHp1
for n in range(np.size(gamTPH[0])):
for m in range(np.size(gamTPHp2[0])):
if gamTPHp2[0][m]==gamTPH[0][n]:
gamTPH[1][n]=gamTPH[1][n]+gamTPHp2[1][m]
For some odd reason, gamTPHp1 = gamTPH... after this executes. Can't figure it out, and I'm pretty sure it shouldn't do this. Maybe a bug?
You first line doesn't create a copy (if that's what you're going for), it just assigns both variables to the same object, so changing one also changes the other:
>a = [1,2,3]
>b = a
>b[0] = 3
>a
[3, 2, 3]
I haven't used numpy in forever, but I think you're looking for something like gamTPH = np.copy(gamTPH1)? There's some built in ways to do it, but I don't think they work on numpy objects if that's what gamTPH is.
So, I'm using this snippet of code that simply refuses to run correctly, not matter what I do (Python 3.7).
gamTPH=gamTPHp1
for n in range(np.size(gamTPH[0])):
for m in range(np.size(gamTPHp2[0])):
if gamTPHp2[0][m]==gamTPH[0][n]:
gamTPH[1][n]=gamTPH[1][n]+gamTPHp2[1][m]
For some odd reason, gamTPHp1 = gamTPH... after this executes. Can't figure it out, and I'm pretty sure it shouldn't do this. Maybe a bug?
gamTPH is a reference to gamTPHp1. They are pointing at the exact same object/space in memory. When you modify one, the other is also being modified because they are the same thing.
This is not how I would actually write this, but it's closer to what you've got up there than what I would do. In both cases I'd probably just iterate over the items directly along with using python's enumerate() if I need the index I am on... what np is for you might effect that, though.
>>> x = [1,2,3,4]
>>> y = x
>>> for n in range(len(x)):
... x[n] += 1
...
>>> x
[2, 3, 4, 5]
>>> y
[2, 3, 4, 5]
In python, if you want to copy the values but have a new list, use:
gamTPH = gamTPHp1[:]
Even that might net you the same issue since the main list will be new, but it'll have references to the same underlying lists, now that I think about it.
Depending on your data and end goal you might need this
Got a rails question my googling is failing at. If I set the rails cache to
config.cache_store = :mem_cache_store, "some server here"
and use the same memcached server across multiple, separate rails sites, does it prefix the keys or something to ensure each sites keys do not get intermixed or do I need to use a separate memcached server for each separate rails site?
Turns out the crash in my Android app was because of language settings. I was putting a timestamp in a filename without specifying formatting. In some languages dates have slashes in them. You know, like English.
Got a rails question my googling is failing at. If I set the rails cache to
config.cache_store = :mem_cache_store, "some server here"
and use the same memcached server across multiple, separate rails sites, does it prefix the keys or something to ensure each sites keys do not get intermixed or do I need to use a separate memcached server for each separate rails site?
You need to separate them explicitly yeah. Use the namespace param in the constructor of your cache.
So, I'm using this snippet of code that simply refuses to run correctly, not matter what I do (Python 3.7).
gamTPH=gamTPHp1
for n in range(np.size(gamTPH[0])):
for m in range(np.size(gamTPHp2[0])):
if gamTPHp2[0][m]==gamTPH[0][n]:
gamTPH[1][n]=gamTPH[1][n]+gamTPHp2[1][m]
For some odd reason, gamTPHp1 = gamTPH... after this executes. Can't figure it out, and I'm pretty sure it shouldn't do this. Maybe a bug?
You first line doesn't create a copy (if that's what you're going for), it just assigns both variables to the same object, so changing one also changes the other:
>a = [1,2,3]
>b = a
>b[0] = 3
>a
[3, 2, 3]
I haven't used numpy in forever, but I think you're looking for something like gamTPH = np.copy(gamTPH1)? There's some built in ways to do it, but I don't think they work on numpy objects if that's what gamTPH is.
So, I'm using this snippet of code that simply refuses to run correctly, not matter what I do (Python 3.7).
gamTPH=gamTPHp1
for n in range(np.size(gamTPH[0])):
for m in range(np.size(gamTPHp2[0])):
if gamTPHp2[0][m]==gamTPH[0][n]:
gamTPH[1][n]=gamTPH[1][n]+gamTPHp2[1][m]
For some odd reason, gamTPHp1 = gamTPH... after this executes. Can't figure it out, and I'm pretty sure it shouldn't do this. Maybe a bug?
gamTPH is a reference to gamTPHp1. They are pointing at the exact same object/space in memory. When you modify one, the other is also being modified because they are the same thing.
This is not how I would actually write this, but it's closer to what you've got up there than what I would do. In both cases I'd probably just iterate over the items directly along with using python's enumerate() if I need the index I am on... what np is for you might effect that, though.
>>> x = [1,2,3,4]
>>> y = x
>>> for n in range(len(x)):
... x[n] += 1
...
>>> x
[2, 3, 4, 5]
>>> y
[2, 3, 4, 5]
In python, if you want to copy the values but have a new list, use:
gamTPH = gamTPHp1[:]
Even that might net you the same issue since the main list will be new, but it'll have references to the same underlying lists, now that I think about it.
Depending on your data and end goal you might need this
import copy
gamTPH = copy.deepcopy(gamTPHp1)
Super big thanks to both of you.
Also, would never have figured that out. I'm switching from using MATLAB to do my analysis to Python, and in MATLAB, that first line always creates an explicit copy (that's why the results were confusing me).
Soggybiscuit on
Steam - Synthetic Violence | XBOX Live - Cannonfuse | PSN - CastleBravo | Twitch - SoggybiscuitPA
Turns out the crash in my Android app was because of language settings. I was putting a timestamp in a filename without specifying formatting. In some languages dates have slashes in them. You know, like English.
Got a rails question my googling is failing at. If I set the rails cache to
config.cache_store = :mem_cache_store, "some server here"
and use the same memcached server across multiple, separate rails sites, does it prefix the keys or something to ensure each sites keys do not get intermixed or do I need to use a separate memcached server for each separate rails site?
You need to separate them explicitly yeah. Use the namespace param in the constructor of your cache.
There we go, thank you. All of my googling kept resulting in information on using multiple memcached servers for one rails app rather than what I was looking for. Not sure how I missed just getting to the main rails docs on that in the first place.
For most of my projects/clients there's just one project and so one thing with a db, cache, queue broker, etc. New client who I'm fixing infrastructure for has enough separate systems which all use similar services that it seems to make more sense to share some of those things like Redis and Memcached (and I can probably just scrap Memcached and use Redis for everything in the end). No need to pay aws for 10 separate 2% used ElasticCache instances.
That just the equivalent of setting/including a particular SDK version vs "use the latest"? Sure seems like it, but...
Edit: Yeah I realise this seems like a dumb question. Even to me. But I am fundamentally reluctant to believe "it's simple" whenever the words "java" or "write once, run anywhere" are in the same zip code.
dporowski on
0
Options
thatassemblyguyJanitor of Technical Debt.Registered Userregular
If you’re using IntelliJ then I believe the intermixing is fairly transparent, but I seem to remember a few gotchas when configuring upfront.
Ugh. Xamarin.Forms 4 change from pre-10 to official release made way more drastic of changes than I'd expect from final RC to release and broke a bunch of shit with the new Shell stuff I've been using in my toy xamarin.forms app.
Unrelated update - having a bunch of fun yesterday and today at RVASec InfoSec conference.
Ugh. Xamarin.Forms 4 change from pre-10 to official release made way more drastic of changes than I'd expect from final RC to release and broke a bunch of shit with the new Shell stuff I've been using in my toy xamarin.forms app.
Unrelated update - having a bunch of fun yesterday and today at RVASec InfoSec conference.
That happened to me with Angular2. I feel your pain.
Work moved me to a new project. Reworking a legacy app into .Net WebAPI with a React front-end. Great!
Two weeks later they decide to scrap the rework, and just have the team work on the legacy app - which is VB WebForms on top of Oracle. I have zero Oracle experience and my exposure to Webforms is an Access front-end I wrote in 2008. I don't mind learning but... I really don't want to learn any of this.
I spent yesterday tracking down a data access bug in my code. Everything looked to be in place, but where there should have been data, there was none. I brought it up in today's meeting, and it turns out whoever cloned our dev database didn't clone everything - the interface was there but the code wasn't. In my native languages this is a 5 minute fix. In this new land it cost days.
I am getting paid waaaay too much to even think about quitting. But I do anyways.
Man, I suck at SQL. I could use some pointers here for Postgres stuff.
I have a table with domain data that looks something like this:
Or in other words, this tree structure, where red is invalid, and green is valid:
Based on this, I want to get all the highest-level domains that are valid. In this case, it should be A and C.B. If example.com was valid, only that should be returned.
Getting the whole tree I can do recursively:
WITH RECURSIVE valid_domains AS (
SELECT id, valid FROM domain
WHERE parent_id IS NULL
UNION ALL
SELECT d.id, d.valid FROM domain d
JOIN valid_domains vd ON d.parent_id = vd.id
)
SELECT * FROM valid_domains
The stumbling block is breaking the recursion when I hit a valid domain. I've looked at window functions, but can't quite get those. I haven't found any examples that use window functions recursively - maybe I'm approaching it wrong by starting with a recursion here?
WITH RECURSIVE valid_domains AS (
SELECT id, valid FROM domain
WHERE parent_id IS NULL
UNION ALL
SELECT d.id, d.valid FROM domain d
JOIN valid_domains vd ON d.parent_id = vd.id
WHERE NOT valid
)
SELECT * FROM valid_domains
I was just missing the "WHERE NOT valid" to stop going deeper into the branch.
Neat. I just learned about postgres recursive queries.
An as to my Xamarin.Forms 4 Shell stuff, it turned out to be two issues. The first was the pretty crazy backwards incompatible changes, but those were easily dealt with. But it seems like when updating dependencies from nuget it's possible to somehow get your dependencies into some sort of weird half updated state and so it was building most of the code against one version of Xamarin.Forms and then at runtime part of the app was trying to use an older version and I could see the old version was still referenced in the main .csproj file.
Ear3nd1lEärendil the Mariner, father of ElrondRegistered Userregular
Back in the day, I was writing a CMS and used a recursive SQL query to build the navigation tree. Then I wrote it in reverse for the breadcrumbs. It was kinda neat back then.
0
Options
thatassemblyguyJanitor of Technical Debt.Registered Userregular
Neat. I just learned about postgres recursive queries.
Strictly speaking it's implemented as an iteration, but the SQL people call it recursive in the language because reasons.
So I'm poking some stuff that sends data to Salesforce right now.
Me: *uses the upsert call in their API*
SF: OMG THIS ALREADY EXISTS ALERT ALERT SHIT THE BED
...that's not how an upsert works.
I'm at a loss.
Has UPSERT been kept from most implementations this long because of a patent issue, or is it because of SQL purists not realizing how shitty it is, in practice, to work around the missing functionality?
Posts
Edit: it's just a reader, you can readAll, but that's not your problem.
Are you sure v is a pointer? I'd probably do a type assertion if you know what kind of pointer it should be.
I'm fairly new to Go (and most of what I HAVE done has been test case scripts, so no actual development) and I haven't worked with pointers since the 90s. But I'm pretty sure this is being passed as a pointer, right?
Yes, & is the reference operator and gives you the pointer for a struct value.
It's also important that the fields you are reading are actually exported (capitalized)
https://play.golang.org/p/0xCoVSwpd1r
You got me on the right track, thank you. I got the JSON value with this:
Turns out I'm getting an authentication error. I've tested with the same payload in Postman and it works fine, so there must be a header value that is wrong. I'll compare the headers from the client with those in Postman and pester the guys who wrote the API if they match.
Thanks everyone, I appreciate the help.
The error system still needs a lot of work, but this is certainly progress.
Except the `authorize` action on it is not working, broken, something. The template it renders says that @token is nil... but there's no way to get to authorize.html.erb with a nil token. So, wtf?
I've stripped my own controller using it down to this:
so not much to go wrong there. Is there some wonkiness with instance vars, views (or templates to me, being a django guy), and included controllers like that which I am unaware of? All of the googling is failing to produce anything useful.
What I really, really don't understand is that I can make my own `authorize` action, specifically define @token, and yet it STILL says that shit is null. But the stack trace shows that its definitely going to my controller. wtf?
Rails and all of its magic "I just do stuff" can go fuck itself. Please help me.
I think we'll need more information. Can you give us the whole error?
We've been using github.com/pkg/errors for that. Looks like they'll pretty much roll that into the standard library.
There is of course a whole giant stack trace, but I can't dig through it to redact anything referencing client names, etc.
Debug info includes this, so I know it's not getting routed to some different controller or action than I think.
My best guess at this point is that there is a filter or middleware or something which is routing it to some other controller, but I have no idea how the hell to find out what that might be.
Kind of like context.
I still hold out hope that x/sync/errgroup will also be brought in. Honestly, that pattern deserves direct language support, but I'd settle for it being in the stdlib.
And it turns out things that work just fine on the Android emulator crashes on my phone.
I don't get Android.
"Write once, debug everywhere."
Phone providers have special android images they can deploy with all their custom shitware, so you've got other stuff toying around inside. Good shit.
There is a real benefit to iOS sometimes.
Does that count as recursion, even if the function is going through a middleman rather than directly calling itself?
For some odd reason, gamTPHp1 = gamTPH... after this executes. Can't figure it out, and I'm pretty sure it shouldn't do this. Maybe a bug?
You first line doesn't create a copy (if that's what you're going for), it just assigns both variables to the same object, so changing one also changes the other:
I haven't used numpy in forever, but I think you're looking for something like gamTPH = np.copy(gamTPH1)? There's some built in ways to do it, but I don't think they work on numpy objects if that's what gamTPH is.
gamTPH is a reference to gamTPHp1. They are pointing at the exact same object/space in memory. When you modify one, the other is also being modified because they are the same thing.
This is not how I would actually write this, but it's closer to what you've got up there than what I would do. In both cases I'd probably just iterate over the items directly along with using python's enumerate() if I need the index I am on... what np is for you might effect that, though.
In python, if you want to copy the values but have a new list, use:
Even that might net you the same issue since the main list will be new, but it'll have references to the same underlying lists, now that I think about it.
Depending on your data and end goal you might need this
and use the same memcached server across multiple, separate rails sites, does it prefix the keys or something to ensure each sites keys do not get intermixed or do I need to use a separate memcached server for each separate rails site?
You need to separate them explicitly yeah. Use the namespace param in the constructor of your cache.
Super big thanks to both of you.
Also, would never have figured that out. I'm switching from using MATLAB to do my analysis to Python, and in MATLAB, that first line always creates an explicit copy (that's why the results were confusing me).
Hah, at least it wasn't an emoji!
There we go, thank you. All of my googling kept resulting in information on using multiple memcached servers for one rails app rather than what I was looking for. Not sure how I missed just getting to the main rails docs on that in the first place.
For most of my projects/clients there's just one project and so one thing with a db, cache, queue broker, etc. New client who I'm fixing infrastructure for has enough separate systems which all use similar services that it seems to make more sense to share some of those things like Redis and Memcached (and I can probably just scrap Memcached and use Redis for everything in the end). No need to pay aws for 10 separate 2% used ElasticCache instances.
That just the equivalent of setting/including a particular SDK version vs "use the latest"? Sure seems like it, but...
Edit: Yeah I realise this seems like a dumb question. Even to me. But I am fundamentally reluctant to believe "it's simple" whenever the words "java" or "write once, run anywhere" are in the same zip code.
Unrelated update - having a bunch of fun yesterday and today at RVASec InfoSec conference.
That happened to me with Angular2. I feel your pain.
Two weeks later they decide to scrap the rework, and just have the team work on the legacy app - which is VB WebForms on top of Oracle. I have zero Oracle experience and my exposure to Webforms is an Access front-end I wrote in 2008. I don't mind learning but... I really don't want to learn any of this.
I spent yesterday tracking down a data access bug in my code. Everything looked to be in place, but where there should have been data, there was none. I brought it up in today's meeting, and it turns out whoever cloned our dev database didn't clone everything - the interface was there but the code wasn't. In my native languages this is a 5 minute fix. In this new land it cost days.
I am getting paid waaaay too much to even think about quitting. But I do anyways.
I have a table with domain data that looks something like this:
Or in other words, this tree structure, where red is invalid, and green is valid:
Based on this, I want to get all the highest-level domains that are valid. In this case, it should be A and C.B. If example.com was valid, only that should be returned.
Getting the whole tree I can do recursively:
The stumbling block is breaking the recursion when I hit a valid domain. I've looked at window functions, but can't quite get those. I haven't found any examples that use window functions recursively - maybe I'm approaching it wrong by starting with a recursion here?
I was just missing the "WHERE NOT valid" to stop going deeper into the branch.
An as to my Xamarin.Forms 4 Shell stuff, it turned out to be two issues. The first was the pretty crazy backwards incompatible changes, but those were easily dealt with. But it seems like when updating dependencies from nuget it's possible to somehow get your dependencies into some sort of weird half updated state and so it was building most of the code against one version of Xamarin.Forms and then at runtime part of the app was trying to use an older version and I could see the old version was still referenced in the main .csproj file.
Strictly speaking it's implemented as an iteration, but the SQL people call it recursive in the language because reasons.
So I'm poking some stuff that sends data to Salesforce right now.
Me: *uses the upsert call in their API*
SF: OMG THIS ALREADY EXISTS ALERT ALERT SHIT THE BED
...that's not how an upsert works.
Yep, I worked on that joke for an hour.
I'm at a loss.
Has UPSERT been kept from most implementations this long because of a patent issue, or is it because of SQL purists not realizing how shitty it is, in practice, to work around the missing functionality?
Hybrid update insert. Update the row if it exists, insert a new row if it does not.