Fork me on GitHub
#off-topic
<
2021-03-18
>
idiomancy12:03:47

does anyone happen to be a geolocation pro? im trying to figure out if ip addresses follow rules such that i could geolocate on only, eg the first two blocks of an ip address -- to just get a narrowed down location, like the country or even continent of origin like 71.59.66.61 -> 71.59.xx.xx -> USA

idiomancy12:03:47

basically i want to bin these ips in some way that reduces the number of geolocation calls I have to make

idiomancy12:03:05

because i have 500k or so

idiomancy12:03:38

(analysing activity logs to find regional patterns)

idiomancy13:03:01

seems like its not that simple

seancorfield16:03:51

@idiomancy Definitely no simple patterns, Iā€™m afraid. We have a huge database of IP ranges to locations, and we also use https://ipinfo.io to supplement that.

šŸ‘ 3
emccue16:03:50

I had a java lib somewhere that did a rough lookup

idiomancy17:03:48

yeah i ended up grabbing a free databaae, loading it up locally into a dataframe, and left outer joining it to my ip list, which i quantized into nearest "allocated ip range for country" cutoff

dpsutton20:03:02

a fun day because

update a = null,
       b = (case a ...)
where a is not null
in postgres and h2 uses the pre-updated version of a (ie, before it is "set" to null) whereas mysql uses the updated version of a so its null in the case statement

šŸ¤Æ 6
dpsutton21:03:37

So thanks to everyone who works on transaction consistency and fighting tearing reads

borkdude21:03:34

mysql is wrong

šŸ˜† 7
dpsutton21:03:36

i agree and i didn't like it

dpsutton21:03:04

and it took a while to track down why it could be failing. and it "works" if you select because there's no overwriting. which makes it even harder to diagnose lol

dpsutton21:03:21

ie select what your update will do rather than actually set things

phronmophobic22:03:23

it might also depend on your mysql settings and if you're using InnoDB? https://dev.mysql.com/doc/refman/5.7/en/innodb-transaction-isolation-levels.html

dpsutton22:03:28

quite possibly. locally its just brew install and let 'er rip. but that is what customer environments could look like as well. but was just super surprising and did not endear mysql to me