#code-talk

2 messages ยท Page 15 of 1

fickle aurora
#

what site is it

fickle aurora
#

well if it's a website, you almost have no choice but to connect via hostname, but if it is server based with no virtual hostnames then you are better off using ip directly

#

if you are resolving hostname that is where the issue lies, because you can resolve a hostname to both ipv4 and/or ipv6

pure sierra
#

back later

fickle aurora
#

what I mean by virtual hostname is like this - you can have one IP address and one port hosting many domain names

#

the way the server determines which site you connect to is based on quite literally the hostname text you resolved

#

traditionally, most of the internet services are 1 IP and port to one service, whereas HTTP servers are mostly 1 IP and port to multiple services (domain names)

#

that is also why you can have so many security issues with websites, you never, ever want to have secure customer data on a website that shares the same IP/port with another website, essentially you want that IP/port dedicated to one domain (or only -your- domains if you do decide to use virtual hostnames)

#

one great example of a security hole from virtual hostnames in this situation is certificate spoofing, since certificates use IP to hostname verification as one of the main verifications

pure sierra
#

@fickle aurora sorry but im pretty sure u cant have more than one service/server on a ip\port

long raft
#

its not that they cant figure out ipv6, its that nobody cares about ipv6 anymore

pure sierra
#

isnt it atleast for a shortage of ip

long raft
#

we were supposed to run out years ago

#

ipv6 became unnecessary as everyone relied on NAT and nat-punching

#

it doesnt really offer 95% of people anything they want

#

if it were a drop-in replacement for ipv4 it would expose you to the internet, and if you set it up properly the configurations are more complicated than ipv4

#

also its poorly implemented, like the specification said IPSEC encryption was mandatory but nobody does it

pure sierra
#

error 11004

#

WSANO_DATA (11004) Valid name, no data record of requested type

Berkeley description: The requested name is valid, but does not have an Internet IP address at the name server. This is not a temporary error. This means another type of request to the name server will result in an answer.

#

WinSock description: Same as Berkeley for host resolution. For protocol and services resolution, the name or number was not found in the respective database.

#

identical to WSANO_ADDRESS (11004)* No address, look for MX record

#

ESocketException: connect: WSocketResolveProto: Cannot convert protocol
'tcp', Error # 11004

You can change Proto with '6' insteand of 'tcp'. However it is the tcp stack that is not properly
installed or they have messes around with it. In C:\WinNT\System32\drivers\etc there is a file
'protocol' (without extention) that holds all the proto's. Eventually you can just copy it from
another machine.

pure sierra
#

@lunar cobalt @fickle aurora @zealous sonnet @long raft @lean forum I just fixed a second players network problems ( @proud mirage ) he used to be able to play but not for some months. He could get into home region but not travel, and had error in top right small text saying 'War Service connection failed. Error: Connection Failed could not initialize connection' .
After trying different things, I reviewed hes War.log and found several lib web socket errors, the first being 'getprotobyname() failed with error 11004' after some googling as to the origin and function of getprotobyname() it seems it is not a lws function but a native c one, and found it relates to C:\Windows\System32\drivers\etc\protocol file, infact it seems getprotobyname uses and relies on the protocol 'index' file. And it turned out this players file was missing for what ever reason, so i gave him a copy from a win10 machine i have and just like magic it started working again, and he`s very happy to be able to try out all the new content and changes. ๐Ÿ˜

long raft
#

nuts

#

icanari maybe you could post the file and description in tech chat

#

i must admit ive never seen or looked at this index file

pure sierra
#

pretty weird, no idea why missing

lunar cobalt
pure sierra
#

thats it

lunar cobalt
#

It's literally just a list of different protocols

#

windows why are you like this

pure sierra
#

its like dns but between common alpha name and the index numbers

#

so you can do getprotobyname(TCP) or getprotobyname(6)

lunar cobalt
#

I hate it

pure sierra
#

or getprotobyname(MYPROTOCOL) if there is an entry for it

lunar cobalt
#

It's a good idea

#

But I hate it

#

Because windows does it badly

pure sierra
#

i laughed at the copyright line too, hasnt changed in a while

lunar cobalt
#

yeah

#

That's XP

#

And Server 2003

#

Vista was '07

#

So you wonder why windows just doesn't install it sometimes

pure sierra
#

not sure, i googled, and cant find any results of others with the missing file so, maybe some 3rd party thing did it

lunar cobalt
#

maybe something tried to add a protocol to it and corrupted it so windows just deleted it?

pure sierra
#

or just scandisk coz it happened to get corrupt from power reset

zealous sonnet
#

@pure sierra Thanks, we'll investigate.

pure sierra
#

so its not so much a problem your end,

#

nor sure if/how many others have had the problem

#

just something to keep in mind if it comes up again

#

or you could just use getprotobyname(6) to maybe avoid relying on the file

lunar cobalt
#

wouldn't that just grab it from the same file though

pure sierra
#

from what i can tell the protocol file is a link between the alpha names and numeric index

lunar cobalt
#

The file also has the numbers in it though

#

So I'm guessing if you said getprotobynum(6) it would check what 6 is on this file, and then keep going

pure sierra
#

6 is not anything in the file, its kinda one way

lunar cobalt
#

ip         0     IP           # Internet protocol
icmp       1     ICMP         # Internet control message protocol
ggp        3     GGP          # Gateway-gateway protocol
tcp        6     TCP          # Transmission control protocol```
#

tcp 6 TCP #Transmission Control Protocol

pure sierra
#

A text file that provides resolution of protocol names into their respective RFC-defined protocol numbers on a TCP/IP network.

#

it goes from name or alias/s to number

long raft
#

my thinking is they would have these problems everywhere not just foxhole, wouldnt they?

pure sierra
#

ud think so, but maybe the file is not relied on as much

lunar cobalt
#

I'm guessing a lot of stuff either bypasses it or brings its own definition

long raft
#

shouldnt it be used for every single socket that gets opened?

pure sierra
#

it would seem not, as afaik had no other problems

#

and was using browser/discord and even got into the home region

#

test, delete own file and find out ;p

fickle aurora
#

hayden what I was saying is that with apache you can do virtual hosts which allows you to host multiple domain names or websites on one IP and port - this is how it's done on many large scale cheap operations, but at the same time it introduces a lot of security issues

pure sierra
#

ah ok, got it

fickle aurora
#

that is why businesses need to be weary about how their website is hosted

pure sierra
#

why is there security vulnerability to using vhosts and same ip

fickle aurora
#

because if you use SSL then someone else with another website on the same IP as virtual host can spoof easily

#

then again, the hosting provider themselves could be spoofing all the clients website certificates and basically steal all encrypted data

#

also on the topic of nat, nat only really is deployed with home routers or in businesses... most people still largely all have an assigned public IP on their modem... IPv6 is already widely deployed for mobile internet and asia/europe for internet service, but again, if you are not actually using ipv6 yourself it is best disabled to avoid problems

pure sierra
#

sure, but within a vps where you are the only ip user for different websites than is ther still a risk ? assuming you are only one in dev control of the websites

lunar cobalt
#

no need to disable ipv6 at least on my ISP, it only sends ipv6 info if asked specifically for it

fickle aurora
#

yeah it depends though, if your ISP supports ipv6 but does not actually route ipv6, that is really where the issue lies

lunar cobalt
#

All major american ISPs route ipv6

fickle aurora
#

if it is only half implemented that is when you have connectivity issues, if it is disabled completely, then the OS will ignore it and just use ipv4

#

you'd be surprised how badly implemented american ISPs have done it

lunar cobalt
#

No i wouldn't be surprised

fickle aurora
#

well in canada anyway, it is a nightmare on Bell, if you are on Bell in certain areas, it is really mucked up - I don't know who they hire at their centers, but it is plain junk - I found Rogers implemented it just fine however

lunar cobalt
#

You're talking about american ISPs

#

I expect the worst possibly version of anything from them

fickle aurora
#

on Rogers you have to force the apn on mobile to use IPv6 though, it defaults to ipv4

#

the only beef I had with them was their throttling of certain things

#

when I traveled I used verizon and family mobile, and of course verizon ended up being superior

pure sierra
#

funny when you talk of throttling of services, as when i was googling the protocol file, some where modifying it among other changes to change the way bittorrent traffic was routed to avoid service shaping/tiering by isp

fickle aurora
#

I never used bittorrent, it was mostly things like steam that they throttled

lunar cobalt
#

I've never had steam throttled

#

Maybe you were just running into your bandwidth cap

fickle aurora
#

it was fiber to the home

lunar cobalt
#

all the fiber offerings near me are bullshit

fickle aurora
#

you'll get good readings from all the major speed test sites, but then you go back to steam and all of a sudden you're back to stone age speeds

lunar cobalt
#

oh yeah all the major speed test sites are complete BS

fickle aurora
#

Rogers also admitted publicly in a case that they had throttled World of Warcraft, but not all of us go that far to get them to change their ways lol

long raft
#

throttled world of warcraft? i wonder why, im sure it barely used any bandwidth

lunar cobalt
#

downloads maybe?

proud mirage
#

Honestly thanks to all you guys @pure sierra @lunar cobalt @long raft for all the help guys, was a weird and convoluted issue but you guys were patient with me thanks again.

long raft
#

sounds like it was all hayden

#

i guarantee i never would have figured that out

lunar cobalt
#

^

proud mirage
#

It's true hayden was especially helpful but I appericiate y'all taking a shot

pure sierra
#

i really didnt think it would be so easy such that we could fix it, so got lucky

kind glacier
#

(There's 2 hard problems in computer science: Naming things, Cache Invalidation, and off-by-one errors).
HBjoy

barren quarry
#

invented a trick for myself, idk if its commonplace

#

when you need to compare a variable with multiple constants, say, (x === 1 || x ===2)

#

you can instead write ([1,2].includes(x))

#

this was like a revelation to me

hollow gyro
#

ah ha! - Yea I've done that too, technically it's creating an Array Object to do the check but it reads soo mich nicer than a multi-OR-IF

pure sierra
#

php has in_array

long raft
#

yea new int[]{1,2}.Contains(y) something you see in c# too

#

managed languages arent afraid to allocate an array for a test

vague otter
#

Not only allocate, but also iterate all of it's 2 elements ๐Ÿ˜ฑ

craggy pebble
#

J

cold dune
#

101000010111010101010101010001010100100100010

tough goblet
lunar cobalt
#

no

#

no no no

fickle aurora
#

welcome to unicode

lunar cobalt
#

@tough goblet if I could reach through discord and slap you I would

barren quarry
#

stale memes

long raft
#

its a funny idea but youd delete it and retype ; like very first thing, right?

#

it would take seconds to fix

#

you wouldnt just keep hitting build and going ๐Ÿค”

lunar cobalt
#

unless you're using one of those IDEs which don't tell you what the error is on the line

long raft
#

Doesn't sound life much of an IDE

barren quarry
#

God bless eslint

#

automatically placing all semicolons for you

#

automatically indenting

timber onyx
#

automatic
hbquestions

#

if you dont instinctively put the semicolon you don't deserve to code

long raft
#

do you use semi colons in javascript? you know its optional?

fickle aurora
#

assembly does not use semicolon

pure sierra
#

@long raft i know, i like to add them

pure sierra
lunar cobalt
#

@pure sierra Rest in peace half the fucking web

languid harness
#

๐Ÿฆ€

kind glacier
#

rip newgrounds, long live newgrounds

timber onyx
#

newgrounds got their own thing

#

they'll be fine

kind glacier
#

hence the long live newgrounds

fickle aurora
#

long live perl and cgi-bin scripting

young pilot
#

Updated the foxhole war map to the new version that is now heavily optimized, using the reactJS web framework (the previous war map was basically just a heap of code stacked on top of each other that made little sense)

#

it's completely feature-empty though containing only the bare minimum to work, i'll add more features over coming months

pure sierra
#

seems to run pretty smooth

young pilot
long raft
#

loads pretty quick!

long raft
#

consider webp instead of png for the map, its like half the size

lunar cobalt
#

whoa, loads way faster

#

Also that ^

long raft
#

i have found leaflet is just awful on mobile browsers. open to tips to speed it up

barren quarry
#

Awful as in?

long raft
#

very slow and sometimes freezes the phone for seconds or minutes

#

you havent noticed that?

lunar cobalt
#

Leaflet doesn't pre-load different zoom levels well I think

#

So it has to re-grab a bunch of images from the server when you change zoom

long raft
#

leaflet usually completely chokes my phone

lunar cobalt
#

Huh, only issue I have with it on mobile most of the time is it loads zoom levels really slowly

young pilot
#

leaflet is mobile-friendly and lightweight in general. the bigger issue is with the colossal number of map icons that the browser has to load for the war map

kind glacier
#

we worked with leaflet once

#

it worked, and that's all we had to say about it

pure sierra
#

i like leaflet

long raft
#

any of you into DSP? trying to figure out why my high pass filter doesnt work

timber onyx
#

have you tried turning it off and on again?

long raft
#

figured you of anybody might be into dsp, disk

timber onyx
#

well yes but actually no

#

i had to flunk the class where i learned about it due to covid julianlol

#

ask me again next semester

#

i could try to give you some theoretical shit i have about it

#

@long raft ok i have the stuff in front of me, what exactly is your problem

long raft
#

so I built a working low-pass filter for audio, tested it, sweet. great.

#

I do spectral inversion on it, but it doesn't work as a high pass

#

lets everything through

long raft
#

after normalizing the low pass filter, i just reverse the sign, add 1 to the middle sample, and voila, right? but no worky

#

And since I've never implemented a working high pass filter before I'm not certain I'm doing it right

#

oh I'm using a windowed sinc filter with a blackman window
@timber onyx

languid harness
#

Idk why but doesnt sound right

#

Can you show the original spectrogram, the inverted and the two filtered? @long raft

#

Perhaps the clue can already be found visually

long raft
#

Oh I haven't drawn it, that's a good idea, might take me some time to do

pure sierra
hollow gyro
#

2:14am UTC

long raft
#

aha, spectral inversion is changing every other value's sign, not every value. think I found my problem

languid harness
#

see

#

sometimes, you can just eyeball things

pure sierra
#

@barren quarry stats tab still broken ?

barren quarry
#

i made a decision to not touch foxhole global hq anymore, its shit code that is impossible to maintain

pure sierra
#

a lot of work for sure

barren quarry
#

i dont even know which features are half made and which are complete

pure sierra
young pilot
#

lol i too made a decision to not touch the old foxhole war map, instead i just completely redid it from scratch. fortunately the project is not large in scale

#

btw what's icon 54, something to do with the dead harvest?

hollow gyro
#

99 little errors in the code, 99 little errors, track one down, patch it and now...105 errors in the code

pure sierra
#

@young pilot maybe the font of balor portal. i couldnt find it in one endpoint i checked , but maybe it is there, or was added...

pure sierra
#

yes it is font of balor

#

i just reused the last dead harvest icon for it

warm lintel
neat fossil
#

Yes, javascript does

#

Use some kind of other code instead

timber onyx
#

all code sucks

fickle aurora
#

people invented extra languages for no reason other than to say they are special because they made a new language, but the vast majority of the web still uses perl

#

remember, new language == reinventing the wheel ... if the new wheel sucks compared to the old one, don't bother

long raft
#

but you think computer science peaked in 1970

#

github list javascript as the #1 language on their site, and perl as #21

fickle aurora
#

it peaked around 2004, nothing great ever came after that

#

you may as well use visual basic over C# anyway since anything you can do in C# you can perform more smoothly with less performance drain in visual basic

#

also most windows software that supports macros will only accept VB 6.0 programming for those macros

long raft
#

im looking for anything correct in what you said but i cant find it

fickle aurora
#

perhaps Delta V Operate software? it's quarter million dollar software so I don't think a lot of people own it, but it's used in a lot of manufacturing facilities

pure sierra
#

javascript sucks but jquery rulez

long raft
#

not a huge fan of jquery, ive found so many things people use jquery for can be done with vanilla.js so easily, without the additional 100k-1000k library

pure sierra
#

never heard of it so it must suck, jk

#

is it newer than 1975, then it must suck. also wa jk

long raft
#

well its an interpreted language, so it must have 0 value to humanity

pure sierra
#

assembly is everything

long raft
#

too high level. electrical impulses is the only way to really maximize your CPU

pure sierra
#

also, why the hell is your name green again ? you bad boi

long raft
#

because ive complained about team imbalance for ... 3 straight years

barren quarry
#

lmao jquery

#

what century do you live in

long raft
#

kastow is fancy electron man

pure sierra
#

jquery does what i need so i dont need any better

#

and its used by most cms i use

#

@long raft so you figured you would do something about it

long raft
#

hmm not really. ive only played 1 night. but at least i dont have feelings of guilt or wait times in queue when i do

#

also its good to see colonials i know

#

and ya know foxhole global is a colonial exclusive now...

pure sierra
#

i would feel so dirty if i tried green man

long raft
#

oh i think ... itd be good for you

#

people would be like "are you the hayden who made foxholestats?"

#

youd have some inter-faction celebrity status there

#

bathe in tomato juice and it will remove any 82dk scent you may still have on you

pure sierra
#

i never played one op with them, but did slave away building thier defences

#

not best clan for au

long raft
#

nah. but hey anzac is going colonial next war i think

pure sierra
#

i would maybe join anzac, but not sure i could join a non-warden-only clan

long raft
#

anzac is ... warden

#

i think its just the pop issue

pure sierra
#

but u say they may play green

long raft
#

yah like first time ever

pure sierra
#

what pop issue ๐Ÿ˜‰

long raft
#

thats how bad the imbalance is lately

#

moorep saw me last week and said "oh derp's here, that must mean its really bad"

pure sierra
#

lol

#

so @barren quarry are you really only 20 ish ?

barren quarry
#

turned 25 on the 18th

pure sierra
#

you are a young bun

barren quarry
#

how old are you?

pure sierra
#

late 30's

barren quarry
#

jesus christ you guys are hella old

pure sierra
#

i must say i dont think ive met anyone over 50 in foxhole

barren quarry
#

id bet minibar is pretty close

pure sierra
#

heheh, is minibar maybars baybe ?

barren quarry
#

minibar is the leader of 3SP

long raft
#

you mean we're hella smart and mature and wise

barren quarry
#

if that makes you feel better

#

old man

pure sierra
#

do they start programming in elemetry school in russia ?

long raft
#

yes.

#

oh you mean computer programming? julianlol

pure sierra
#

lol

#

good one

barren quarry
#

the first time i programmed was like in middle school but very basic stuff

#

like fucking delphi

long raft
#

im having flashbacks of having to sing patriotic songs in grade school

#

delphi is ... basic?

barren quarry
#

from what i remember delphi is like glorified pascal

long raft
#

yea thats right. and pascal was straight up badass

#

and delphi is even better

pure sierra
#

Delphi in legend previously called Pytho in ancient times was a sacred precinct that served as the seat of Pythia

long raft
#

it was a very respected language

#

not the oracle, hayden

pure sierra
#

Boreland is a village in Dumfries and Galloway, Scotland, which is located in Eskdale about 7 miles (11 kilometres) north of Lockerbie on the B723 road to Eskdalemuir. The village has a small primary school.

barren quarry
#

boreland

long raft
#

isnt the company borland?

barren quarry
#

yes

pure sierra
#

Defunct April 5, 2015

long raft
#

imagine paying for your compiler or IDE these days... nuts

#

man who was it here who was selling me on vs code a few months ago? I've really gotten into it, god damn its pretty amazing from the last time i used it

#

Have you guys seen code-server? It's vs code in a browser...

pure sierra
#

what is vs code

long raft
#

can even run it from your android phone...

barren quarry
#

i use vs code on a daily basis so could have been me

long raft
#

oh microsoft visual studio code is a rewrite of a development environment for many languages - open source

#

its fairly good, not every feature of visual studio, but its cross platform, and it has many features visual studio doesnt have

barren quarry
#

it competes with jetbrains

#

i use pycharm for python but i think the interface is a bit wack

long raft
#

my mind was rather blown by code-server, i know that kind of stuff is possible i just never see it executed well

#

very cool to have an entire IDE on your phone

barren quarry
#

coding on a phone is stage 4 colon cancer

long raft
#

meh not for me

#

i can just broadcast it to my TV or computer screen, and i can just pull out a bluetooth folding keyboard

barren quarry
#

oooh that makes sense

#

the keyboard is the deciding factor

long raft
#

oh, for sure...

#

that would be miserable without it

pure sierra
#

if i traveled much i would try that maybe

long raft
#

i want to start doing my development inside containers, so i think im gonna head down this remote coding route

pure sierra
#

shipping containers ?? why...

long raft
#

peace and quiet

pure sierra
#

easy to focus

long raft
#

yah when you get locked in, youre really in the zone

barren quarry
#

watch in awe as docker eats your entire ssd

pure sierra
#

dont connect the net, just have a set of encyclopedia britanica

lunar cobalt
#

our SSD comrade @barren quarry

long raft
#

docker? please. like im gonna give root access to my containers

#

k8s or podman, brother.

#

@pure sierra yea a shipping container with a mobile phone IDE and programming books that dont go past 2004

pure sierra
#

wildman heaven

long raft
#

makes me want to go purge my book shelves of anything pre-2004

void marlin
long raft
#

what am i looking at. is that yaml?

#

is that a php object?

void marlin
#

it is a laravel Object Dump from my 500 and 200 responses

#

yes, php

long raft
#

why is ETag an array? shouldnt it just be a string?

#

not familiar with laravel

void marlin
#

it is just the representation. the data is properly handled, this is Guzzle a HTTPClient package

long raft
#

and i dont see you passing the etag in the second request

#

am i just blind?

void marlin
#

yes, if i dont pass it, i get the right response. if i do, i 500 the foxhole server

long raft
#

ok so its just a small error

#

so an etag is unique to the API call, I think

#

you cant use the same etag for different kind of API requests, as far as i know

void marlin
#

the foxhole api docs state that i should send the key, i get from the header in the 200 response.
https://github.com/clapfoot/warapi#rate-limiting-and-caching

that is what i do. first i dont have one. so i send none.
it works, i get one.
then i start sing it, and i get 500...

long raft
#

its a cache mechanism

void marlin
#

i know

#

my jo is to work in webDev.

long raft
#

so youre doing the exact same query twice? but the second time uses the etag?

void marlin
#

yes

long raft
#

ok i see why i didnt see the etag

#

its the If-None-Match tag

void marlin
#

yes

long raft
#

perhaps the casing is wrong

void marlin
#

I use what they state. it is also what Mozilla defines:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag

long raft
#

it sure looks right to me...

void marlin
#

do the Devs look at this?

long raft
#

I think uhh ... adam does, sometimes

#

im not sure ...lots of people here know the api tho

void marlin
#

so maybe someone in #code-talk can help me? ๐Ÿ˜„

long raft
#

@pure sierra has used the api using php im pretty sure

#

perhaps not laravel specifically

#

i dont use a user-agent, i wonder if that could make any difference

#

otherwise i see no difference, not sure if theres any way you can take a look at the raw request headers that get sent to curl or whatever is making that http call

#

perhaps theres some mangling between guzzle and the remote web server

lunar cobalt
#

Could use wireshark to grab the packets

long raft
#

@void marlin i notice in your example the first request gives back "317", but then you respond with 300. Also note the additional set of quotation marks - this may be important, I know I just copy it as-is, meaning with the quotations

#

3 commends says its the additional quotation marks that are needed

void marlin
#

the 300 would be a client that didnt ask the api for maybe 1hour or so. should work. 300 was an old valid etag.
i just tried with 324 ( i got it and send it directly after. got 500 as well. tried with quotation mars and without.

barren quarry
#

xmlhttprequest onreadystatechange 2 if etags match abort

#

thank you for attention

#

That is if you're using js

long raft
#

hes using php

barren quarry
#

I thought php is dead

#

Apparently not

long raft
#

not even a little

#

facebook is keeping it relevant

void marlin
#

@barren quarry please dont be a dick. if you think you know the answer, and it is easy explain it nice.

#

@barren quarry the documentation states that i should get a 304 Not Modified response.

barren quarry
#

i'm a javascript programmer so i answered in javascript

#

i have never seen php so i cant help very much with that

#

the mechanics of xhr is that you get response tags first and then decide if you want to continue

#

and if etags match the previous response, you abort the request

long raft
#

he has all the mechanics right, its just some fine detail thats having issue

#

have you tried without a user agent, yet?

#

i do not believe that header is required and it might be causing the issue, i know i dont use it

#

and again, the quotations should be copied

#

can confirm its working fine for me.
"341"

#

i get the 304 response as expected

#

lets see if it works without quotes...

#

mine blows up if i strip the quotations out

#

pretty sure thats your issue, or that and a combination of the user-agent

void marlin
#

sorry, i gut the response it is 500.

long raft
#

the quotes are necessary

#

i cannot stress it enough

void marlin
#

it is in quotes

long raft
#

"\"342\""

#

there is an extra set of quotes

#

literal quotes in the string

#

look at the etag you get back on the first request, it has extra quotes - you have to copy those

#

i think you are saving it somewhere as an integer but it needs to be kept as a string

void marlin
#

lol

#

i did. but the package did ignore them. i hat to use ' "300" ' as "300" would become 300... thank you.

long raft
#

yep

pure sierra
#

Yes I use php and etags

#

I can look at my code later when im home

long raft
#

it was the quotes

pure sierra
#

he got it going ?/

#

war over already... geez

long raft
#

yes

steep surge
void marlin
#

Oh, Minibar, such a nice guy. And 3SP... The best Crew ๐Ÿ˜‰

void marlin
#

I thought php is dead
@barren quarry looking at the way you write DB stuff in Node... trust me there is a reason for PHP Laravel ๐Ÿคฃ

barren quarry
#

@void marlin that code was written 1.5 years ago

#

when i knew almost nothing about javascript

#

i myself consider that code a pile of garbage

#

but there is really no competition

#

so for some reason some people like it

void marlin
#

I like it as well. I will use the UI as part of my wardenHQ ๐Ÿ™‚

#

with a new backend.

barren quarry
#

ui is horrible as well

#

everything is horrible

#

i am ashamed of it

void marlin
#

dont be. people live it.

#

but maybe, how do i init the sqlite and what does the .env need? i think that is missing.

chilly burrow
#

im proud of the UI ๐Ÿ˜ฅ

fickle aurora
#

for all the preppers out there with mechanical clocks the time has rolled back one hour if your area uses daylight savings time

long raft
#

Lol

coral sundial
#

My digital clock doesn't roll back an hour

long raft
#

time to get new clocks huh

timber onyx
#

daylight savings is a scam, fun fact

#

people actually die from daylight savings

#

the only reason we have it is because some rich guys a long time ago wanted to have more time to stroll outside during the day

pure sierra
#

i wish we didnt have it

fickle aurora
#

it gives us something to do in the spring when the boss calls and says we're 1 hour late for work

long raft
#

i have oft considered moving to arizona or hawaii

fallen canopy
#

PNW

#

Get lost in the rainforests

#

Off grid forest hut

#

Elon's satellite internet comes through and you've got 100mbps at decent ping

#

Plenty enough to live your life in the middle of nowhere and play foxhole, only seeing people when you journey out for the monthly resupply

long raft
#

no i just dont like changing clocks

fickle aurora
#

satellite and decent ping don't fall into the same sentence

#

this is coming from someone who has used satellite internet since late 90s

#

low earth orbit is around 600ms latency, the companies will lie and tell you it's down to 300ms, and they can legally get away with lying, because, well, yeah, 300ms is for the signal going one direction

#

so yes you can ping the gateway at 300ms but if you want to actually ping anything other than the gateway in the sky, it will be 600ms

#

regular satellites out in high orbit are about 1000-1500ms latency

lunar cobalt
#

@fickle aurora in presentations to the FCC, which companies are under oath for, starlink has been tested at under 50ms latency to the internet.

#

As well, people who have been testing the service recently during the beta have been getting around that latency.

fickle aurora
lunar cobalt
#

Damnit

#

link didn;t work

#

that one did

fickle aurora
#

I would be very surprised if starlink can actually beat that, likely the 50ms they are advertising is from cellular tower based mobile internet, not from satellite

lunar cobalt
#

.. no

#

Starlink doesn't do cell tower mobile internet

fickle aurora
#

if you really think you can get 50ms on satellite.. I have a moon to sell ya

#

it's just not possible

lunar cobalt
#

Starlink doesn't run their satellites in the normal geostationary orbits

#

They're way closer to earth

fickle aurora
#

I know they use low earth orbit

lunar cobalt
#

340km above the surface

fickle aurora
#

my satellite internet service aka xplornet recently switched us from regular orbit satellites to low earth orbit

#

the difference in ping was huge but not 50ms I can say that

lunar cobalt
#

Xplornet satellites sit in a band 35785km above the surface

fickle aurora
#

they don't own satellites

#

it is provided by other companies

lunar cobalt
fickle aurora
#

they resell the satellite service from other companies man they literally don't own the whole satellite

#

it used to be provided by hughesnet long ago I am not sure now

lunar cobalt
#

Starlink satellites sit 105 times closer to earth than the satellites you're using

coral sundial
#

starlink is just a decadent attempt at providing internet for americans

#

fight me

lunar cobalt
#

It very much is yes

coral sundial
#

I said fight me

fickle aurora
#

lol

lunar cobalt
#

No

#

So yeah, the reason Starlink has that low latency is because they're really really close to earth compared to other satellite providers.

fickle aurora
#

yes that is called low earth orbit satellites aka what xplornet sells service from now

lunar cobalt
#

No.

coral sundial
#

someone needs to snap mr musk out of his delusions and tell him he needs to invest in a fiberglass internet company

fickle aurora
#

the one you are quoting really far from earth is the old outdated system

#

in the past 15 years we had changed satellites 3 different times

#

the original one was 1500ms

lunar cobalt
#

From what you said, you're currently using Via Sat 2

#

Or maybe ViaSat 3, but they're both Geosync'd at 35K km

fickle aurora
#

I would have to check on my account and see what it is hooked to now

#

the old modems were viasat modems but every time they switch satellites they have to change out the modem

#

the same internet provider has 4G LTE which probably has 50ms latency, but I can already get better unlimited internet plans from other cell providers

lunar cobalt
#

Xplornet currently operates Satellite Internet from 2 satellites, ViaSat 2 and EchoStar XIX

pure sierra
#

prices/speeds etc in this

lunar cobalt
#

Both of those satellites sit in a Geosynchronous orbit at 35,786km above Earth's equator.

#

The reason most internet satellites aren't in LEO is that they don't have a large view of the planetary surface, so you need a lot of them.

long raft
#

what kind of transfer caps do they have?

lunar cobalt
#

Starlink?

pure sierra
#

none yet

long raft
#

yea

lunar cobalt
#

Haven't heard anything about any

pure sierra
#

$99/m

lunar cobalt
#

There probably will be some, because satellite gets fucky without transfer caps, but that's being partially mitigated with the fact that there's just a fuckton of satellites to send data at, so they can handle more incoming and outgoing data

fickle aurora
#

ok I think you are right, they haven't actually moved over to low earth orbit yet

lunar cobalt
#

They won't

#

The only feasible way to run satellite internet in low earth orbit is through a constellation of microsats

fickle aurora
#

well we already signed up for it but we were told it won't be active until next year

lunar cobalt
#

So unless they go to microsats, you'll never get consistent coverage from the LEO satellites

#

It'll be switching back and forth from the Geostat ones to the LEO ones

fickle aurora
#

but at 600ms, gaming is nearly implausible, most websites that use jsnode end up failing to load due to timeout, lots of problems

lunar cobalt
#

Yep, that's the problem with satellite that Starlink is aiming to solve

fickle aurora
#

I had to change MTU packet size long ago to make the old system work on websites

#

most people leave it at 1.5kb per packet

long raft
#

remember the old days where cable internet was download only and it was dial-up for the upload?

fickle aurora
#

I remember that for one way satellite

#

then two-way satellite came out and there were 2 cables connected from modem to the dish

#

now it's one cable, I am guessing serial transfer

#

the mining company uses synchronous transfer, so upload and download are same speed on their satellite connection

#

the latency was absolutely terrible on that and in the evening everyone using the net to check email or whatever after work made it slow like a crawl

lunar cobalt
#

Starlink you just stick an ethernet cable into the ground terminal and it goes

fickle aurora
#

interesting because every other satellite system uses coax connected to a modem

#

unless they are referring to plugging the ethernet cable into the modem

#

there will probably be lots of angry customers over starlink when they find out how bad satellite is

lunar cobalt
#

Doubt it

fickle aurora
#

I can bet they will lock people into 10 year contracts like xplornet did long ago

#

now they can only do maximum 2 or 3 year contracts

lunar cobalt
#

As much as I hate saying "oh this is revolutionary", starlink is literally revolutionizing the entire system of satellite internet.

fickle aurora
#

once people are locked into paying for it, musk isn't going to care, the money will cover the cost of the business end and as for quality of service, they will just give you a telephone number to some call center offshore

#

like every other internet provider does

#

then they will spend millions hiring people to comb through the internet for negative feedback and launch massive lawsuits to stop people from reviewing their bad service

fallen canopy
#

Oops I forgot that this conversation was in code-talk rather than in general

lunar cobalt
#

ยฏ_(ใƒ„)_/ยฏ

fallen canopy
#

Yes the ping is decent, it's very close to earth, and closer to earth than say, the ISS. The lower the altitude, the smaller the distance between sat to sat, and receiver-to-receiver. 75ms falls far short of what hypothetical values say it could be, but when pricing in everything else, it's pretty damn good

#

It's also worth noting that consumer customers won't be the only ones using the network, but high value contracts are forming between financial trade hubs and stock markets to make use of those potential low pings if they can be put into practice

#

It's significant.

#

As for contracts and consumer support, eh

fickle aurora
#

I think if I was trading stock every day I would just move to toronto and use fiber, I wouldn't rely on a connection that stops working every time a cloud passes over

fallen canopy
#

Can't be worse than what already exists for rural customers

#

That's the thing, it's not day traders

lunar cobalt
#

It's AI

#

It's AIs that make trades based on millisecond differences between the different trading hubs

fallen canopy
#

It's whole institutions, who can't move, already have operations, and already have those operations automated via the net

lunar cobalt
#

Line 10ish years ago a company literally laid a line of fiber optic between chicago and New York at the cost of 300 million plus for a 3 millisecond faster route

long raft
#

such absurdity

lunar cobalt
#

And they're making billions out of renting the use of that line, and even more off the trading margins.

fickle aurora
#

I think what will enhance this the most will be 5G, because of more bandwith capability, but I am very skeptical on the actual latency

lunar cobalt
#

Starlink doesn't have to really worry about making a ton of money from residential consumers, because they can charge truly massive amounts of money from large corporations and traders to reduce their latency to the NYSE & CSE

fallen canopy
#

According to FCC stats for initial testing, apparent max sat throughput per satellite is 20Gbps, with an initial total constellation size of 12'000 and plans for 30'000 on top of that

#

For residential consumers, it's going to be significant even if it's not as fast as the average in a city with fibre

lunar cobalt
#

Most US cities don't have good fiber

fallen canopy
#

They won't care about it being great as long as it's better than rural cable

lunar cobalt
#

Yup.

timber onyx
#

i still find it funny how old people treat fiber optics as this new technology

#

the classes i took on the basics of fiber optics are themselves more than 10 years old

#

and yet even my professors talked about it like it's this revolutionary new technology

fallen canopy
#

It's the gap between introduction and widespread implementation

timber onyx
#

yeah, that and recent technological improvements

#

the fiber optic itself is old shit but what you can do with it is getting a lot of attention

#

my first intern job was at a tiny company that only sold a device they bought the patent to, by making a fiber optic turn in a specific way you can increase the quality of the signal by a pretty significant margin

#

maybe i still have the video

fallen canopy
#

Egh. Memories of optics classes still put me in a bad mood, and I just graduated this year

#

But yeah, some US towns have services that cap at 25Mbps for $145/month

#

Or worse for similar prices, with no alternatives

timber onyx
#

there we go

#

this effect was achieved by only manipulating the fiber optic itself

kind glacier
#

french?

timber onyx
#

yup

kind glacier
#

bon

#

we still have copper

#

and the area is too rural to justify anything more

timber onyx
#

so i'll take a guess that it isn't the government that pays for fiber optic installations?

fallen canopy
#

Depends on the government, depends on the area. Here in the UK, there are national projects, and county projects, from what I recall it's similar in the US but with more granularity for states/counties/etc

kind glacier
#

so i'll take a guess that it isn't the government that pays for fiber optic installations?
Dunno, might be the municipality

#

Nah, looks like it's commercial companies that do it

timber onyx
#

then that explains why they would deem some places not "worthy" of getting installations

fallen canopy
#

Talking of which, I'm still mad that my apartment building still hasn't been connected to the city's fibre net

kind glacier
#

still get just shy of 10MB/s usually

fickle aurora
#

in canada bell fiber is what most people try to get

timber onyx
#

i get like 50MB/s and i live in a suburb, shit sucks

kind glacier
#

At least it's not 450KB/s anymore. I remember downloading BF3 for a full day

timber onyx
#

bell can suck a dick

fickle aurora
#

lol

timber onyx
#

price fixing assholes

kind glacier
#

shit man, 50MB/s is blazingly fast compared to 10MB/s

fickle aurora
#

robbers is not much better

timber onyx
#

they're all bad

fickle aurora
#

I mean rogers

#

but everyone calls them robbers

timber onyx
#

canadians pay the most out of literally any country in that stuff

fallen canopy
fickle aurora
#

for a while we paid about 150/mo for satellite

timber onyx
#

when you look at it all the companies in canada offer pretty much the same prices too, it's legal price fixing

fickle aurora
#

price has gone down a lot

fallen canopy
#

City's fibre network is 500Mbps
My building is only connected to old copper broadband

fickle aurora
#

and it used to be 1mbps for that 150/mo

#

if there was an alternative it would have been used

timber onyx
#

there is an alternative, it's called the government stepping in

fickle aurora
#

I was going to get shaw leased line for 450/mo but they were going to bill for the cost of putting lines in which was prohibitively expensive

#

but for that I could provide service to a few people

timber onyx
#

i don't know what's with canada and its monopolies but fuck is it annoying

lunar cobalt
#

US throws money at the telecom providers / ISPs to install fiber, they take the money then don't install fiber

timber onyx
#

at least you dont have to pay the highest rates in the world

fickle aurora
#

I know disk but you are lucky if you are in a city

#

northern remote mines in canada don't have these luxuries unless you are willing to pay for it

lunar cobalt
#

For cable, the US pays more on average than Canada

timber onyx
#

who pays for cable though

fickle aurora
#

but when you make the wage of a miner you can buy lots of things that city folks would cry over

lunar cobalt
#

Cable internet*

timber onyx
#

bruh miners make so much money

fickle aurora
#

but you have to suffer the inconveniences of bad internet service

timber onyx
#

suffering bad internet for a few months then coming back rich? i'll take that

lunar cobalt
#

Just have some books and you'll be fine

long raft
timber onyx
#

that's slower than i thought california internet would be

long raft
#

odd numbers mean bad internet, right?

timber onyx
#

gotta get those bits derp

#

make sure every hole is filled

long raft
#

i grew up on dial up with ...350-400ms latency

timber onyx
#

why didnt you just buy a better internet like seriously smh

long raft
#

i got the 1gbps package at the office

timber onyx
#

christ that's fast

#

cant believe that tech actually exists now

#

could download a modern game in less than a minute

#

and just thinking about the fact that 5G is even usable with internet. maybe one day updates wont take fucking hours

lunar cobalt
#

doubt it

#

they'll make sure updates take a long time so they can force you to buy preferred connections

timber onyx
#

fuck it then i'll just go to china

long raft
#

in singapore 2gbps synchronous is like ... 75 sgd/mo lol

#

something ridiculous

#

when the internet cant keep up with you

#

10 gbps lan is now affordable option

neat fossil
#

Fumoffu! โค๏ธ

pure sierra
#

@neat fossil ๐Ÿ‘บ wardenlol

neat fossil
#

@pure sierra ๐Ÿ’‹

kind glacier
#

Now that I have time on my hands, I should get back to trying to get the war api to work in unity

half cradle
#

Does mapName change or is it pretty consistent from war to war?

pure sierra
#

where is this ?

half cradle
#

To refrence the different hexes in api

barren quarry
#

map names dont change

#

one day i asked phil

#

why doesnt it have "hex" in the end? change pls

#

and he said that changing it would be really painful

pure sierra
#

also DeadLands ....

half cradle
#

Thanks!

minor swallow
#

goddamn bro making states in HOI4 without the nudge editor is tedious

#

i been making states for nearly 2 hours and only have like four

#

i need to find a fix on github or something

warm lintel
pure sierra
#

its tough i know

barren quarry
#

KEY ERROR

kind glacier
#

Other languages:
*write to console*
Python:
p r i n t

lunar cobalt
#

no

pure sierra
#

echo

timber onyx
#

you don't realize how important it is to name your functions logically until you have to use somebody else's code that has random words used

long raft
#

all of my functions are foo####

#

thats how i was taught from my 1970s books

languid harness
#

@kind glacier what ya mean? Just use the anaconda compiler, then you don't even have to use print

coral sundial
#

You mean LCD_print_GPGGA_data(int message)

#

Not to be confused with the LCD_puts(char)

languid harness
#

lol

#

But that feels like a specific command used for a display on a microcontroller or something

#

@coral sundial ya lego mindstorm freak

coral sundial
#

oh

#

no

#

well it is for an LCD display

#

but GPGGA is a nmea GPS data code

#

and the function just blurts that out on an LCD

#

well afcourse after I go over it and add some context xD

languid harness
#

hmmmmm

summer bobcat
#

did someone say lego mindstorms

long raft
#

ah those nice visual studio colors are so great

coral sundial
#

Ahahaha

#

I just went straight to an already existinf library

#

Couldnt be arsed and wanted to play with the usart

pure sierra
#

"back in the 70's you wrote your own libraries, you cant share them coz no net..." @fickle aurora ( @long raft wardenlol )

long raft
#

hmm kind ... of true

#

i mean there were no libraries

#

kind of close to reality tho

pure sierra
#

"real coders dont use libraries" - also @fickle aurora (tongue in cheek)

long raft
#

i imagine in his world real coders write 1000 lines a year

pure sierra
#

(make sacrifice to assembly gods)

#

*no (new) lines in assembly" julianlol

long raft
#

so hayden, people are complaining there is no faction neutral way of calculating storm cannons anymore

#

dunno if you are interested in adding a feature to foxholestats julianlol

pure sierra
#

oh

long raft
#

its not really a stats thing, but its also not a logi thing so i didnt do it

pure sierra
#

i know nothing really of sc

#

ah you mean the range thing

long raft
#

its ... pretty easy

#

dunno if you have any thoughts.

#

or maybe sethfire would add it...

pure sierra
#

well it would seem it would fit in easier at sethfire, but ive from time to time considered integrating his map into my site as well

long raft
#

oh?

#

interested in the roads too? julianlol

pure sierra
#

yeah that would be fine

long raft
#

i must admit my code is a little messy - ive got technical debt and it makes me not want to make new changes

#

nothing about node.js is ... enjoyable

kind glacier
#

So uhh, how do you tell from the API which map item is the Abandoned Ward townhall?

barren quarry
#

icontype 5 6 7

#

sort static data by pythagoras theorem

#

pick [0]

#

actually no the other way around

#

you get the point

kind glacier
#

you get the point
no I don't actually

barren quarry
#

you have static data

#

static data is the array of labels

#

you pick whatever label you want

#

get its coordinates

#

then you have dynamic data

#

you filter icontypes 5 6 7

#

which are town halls of three levels

kind glacier
#

So I need to match static with dynamic

barren quarry
#

you calculate the distance to each town hall using the pythagoras theorem with coordinate differences

#

and sort by ascending

kind glacier
#

distance from where?

barren quarry
#

from the text label to the town hall

kind glacier
#

now you've lost me completely

barren quarry
#

you know how api works even?

kind glacier
#

that's what I'm trying to figure out

barren quarry
#

here is your label

#

here is your dynamic data

#

you take every town hall

#

(and relic bases?)

#

town halls have icon type 5, 6, or 7

#

you find delta x and delta y

#

for every town hall

#

apply pythagoras theorem to find the distance

#

you know what pythagoras theorem is right?

kind glacier
#

Yeah, but so far this is making no sense

barren quarry
#

and when you find the distance to every town hall, you simply pick the town hall with the least distance

#

thats how everyone calculates what town hall is named what

kind glacier
#

They couldn't have just named them :/

barren quarry
#

@kind glacier do you understand the process?

kind glacier
#

tbh no

#

right now though, I'm trying to get the API working in the first place. I had it somehow figured out before but I lost the files.

#

From what I understand, I take the Abandoned Ward label, slap it onto a Hex picture of deadlands using the x and y coordinates and then throw on all the townhall icons and do the math to figure out which is closest to the label

#

but I gotta get the API data first to even attempt the rest

barren quarry
#

@kind glacier that depends on what you're trying to do, find what is abandoned ward or what is town hall

kind glacier
#

I'm trying find which is the abandoned ward townhall

barren quarry
#

right

kind glacier
#

right now I just want an icon to turn green or blue depending on who holds the townhall

#

trying to place all of the hexes into a big map and drawing all the icons onto them comes after

long raft
#

save yourself a square root, sort by distance squared, the results are the same

#

the coordinates dont match up - so you have to search the list for the closest one

#

wouldnt it be easy if the dynamic api matched the static api, or if they used some sort of unique ID

barren quarry
#

hah actually derp is right

kind glacier
#

I can't for the life of me figure out how I managed to do it before

#

Going to try more in the morning

#

I gotta find me an example cuz this is not working

pure sierra
#

hang on

#

They couldn't have just named them :/
@kind glacier julianlol wardenlol julianlol wardenlol

#

@barren quarry @long raft i just screenshot it so u cant just copy pasta and have to read it julianlol wardenlol julianlol wardenlol ๐Ÿ˜

long raft
#

again, you dont need the sqrt, the results are the same. save the computation time

pure sierra
#

ok, but its not a time sensitive application

long raft
#

x < y => x^2 < y^2

#

you wouldnt just put +0 on all your if statements, right?

#

sorry, graphics programmer here, cant tolerate extra sqrts

barren quarry
#

looks like you have a bit of OCD

pure sierra
#

dude, its not a casio calculator

long raft
#

i grew up when they were expensive.

#

but if you took it out, it would work exactly the same

pure sierra
#

its a fair point, but maybe in the future you will want the actual distance

long raft
#

then you would calculate it once, at the end, instead of every iteration of the loop

#

you cant expect the compiler (lol php) to optimize a sqrt out. it might be smart enough to optimize a division out but not sqrt

pure sierra
#

like i said, i dont need the speed so its fine, but its a novel suggestion

long raft
#

its free real estate, hayden

pure sierra
#

in a free world

long raft
#

im being lenient. i can barely even tolerate an O(n^2) algorithm

pure sierra
#

so whats this +0 thing ?

long raft
#

a notation for an algorithm's complexity, big O notation

#

generally algorithms fall into a growth scheme thats known, like O(n) (linear time), or O(1) (constant time), O(n^2) (like an exponential time based on data size), O(n log n) or O(log n) are common optimized algorithms, and the worst case O(n!)

#

so if you were searching a list of size n, this algorithm would take O(n) time where O is the function that determines how long it takes

#

if you had m lookups, it would be O(n * m) which is generalized to O(n*n) -> O(n^2)

pure sierra
#

ok ease up wildallen

#

$distance = ($user=='derp'? ($a + $b) : sqrt($a + $b) );

long raft
#

hahaha

#

its still an extra conditional statement, but at least it will be faster for me

#

alan seems more like a computer science 200 guy, algorithm complexity is more computer science 300

pure sierra
#

if($userIP = $derpIp)

#

actually its not client side so it wont work like that

long raft
#

if you were to make a dictionary with cities - and you generated a key that was the latitude and longitude, but maybe you rounded it to 1 digit

#

that would be a primitive geohashing algorith, and you could find the nearest point in O(1) time

#

its not accurate tho, but it can be used to speed up that O(n) algorithm

#

theres like 50 towns tho so who cares

#

but i shit you not, C/c++ famously has slow memory allocations and they are often touted as being as slow as a square root

barren quarry
#

aaactually

#

there are like 10 major text labels per region

#

since we... well, dont include town halls from other regions when calculating which belongs to the label

#

the most i can find is 12 items

#

you cant have trouble with a 1x12 comparison

#

maybe in like 1919

pure sierra
#

or if it was actually in the game code when calculation optimisation matters

fervent spear
#

im being lenient. i can barely even tolerate an O(n^2) algorithm
Here, i just ran a
O( 45^(N)*9^(Nยฒ) )
Algorithm

long raft
#

wtf

fervent spear
#

I am doing combinatory

#

This shit is outside NP

long raft
#

wtf do you run that with

#

the data set cant be of any significant size

fervent spear
#

With 6 it only took 1 minute. It is random so it could have been luck, tough

long raft
#

but then like 7 is gonna take 400x longer

solar sierra
#

Help me change faction in Foxhole a friend plays for the Wardens and I for the Colony help me play with him

kind glacier
#

Welp, managed to get the static info again

#

now I just need to get it into a format that I can actually read

#

no idea how I'm supposed to do that

#

it literally just comes back as

{"regionId":3,"scorchedVictoryTowns":0,"mapItems":[],"mapTextItems":[{"text":"Abandoned Ward","x":0.4065897,"y":0.4973474,"mapMarkerType":"Major"},{"text":"Biting Tarn","x":0.82187194,"y":0.70537686,"mapMarkerType":"Minor"} ...

kind glacier
#

sigh

#

I'm getting nowhere

stone void
#

Parse the whole thing as a string and split it by commas?

barren quarry
#

no need to split

#

the whole thing is a json response

#

just use JSON.parse() if you are a javascript peasant like me

kind glacier
#

not a javascript peasant

#

And from what I can tell it comes in as an array of objects

#

and that's after doing the .parse

#

Even just taking the first entry returns

{"text":"Abandoned Ward","x":0.4065897,"y":0.4973474,"mapMarkerType":"Major"}
as an object

stone void
#

Then youโ€™ve got an array of objects that all follow the same format? Though it appears to be a dictionary

kind glacier
#

Well I've got no clue on how to get a list or array out of it

stone void
#

A for each loop that cycles [โ€œtextโ€,โ€xโ€,โ€yโ€,โ€MapMarkerTypeโ€] whichโ€™ll return abandoned ward, .406,.49, Major?

kind glacier
#

Really I just want an array out of mapTextItems

#

from static

stone void
#

If you can get it into dictionary format, you can just call the index โ€œtextโ€ and it should return the text

kind glacier
#

each of the 41 integers being a list with name and location

#

and major/minor

stone void
#

Is it a list or dictionary? The curly brackets I thought signified dictionary

kind glacier
#

if I knew how to make a dictionary

#

I though the curly brackets meant object?

stone void
#

Check your languageโ€™s definition of dictionaries

kind glacier
#

It's all too much of a mystery to me

stone void
#

It may be the answer, the idea is that the key on the right of the colon is what you call, and the return is whateverโ€™s on the right. Dictionaries then also cannot be changed, cannot be called by the right side, arenโ€™t actually lists, and the key must always be a string. I am assuming itโ€™s Java though, @kind glacier?

kind glacier
#

Nope

#

C#

#

mostly

stone void
#

Then it should be similar.

vague otter
#

if I knew how to make a dictionary
@kind glacier
var dict = new Dictionary<T1, T2>();?

#

It seems like we're talking about json serialization

kind glacier
#

That's how you make a new dictionary, but how do you make a dictionary out of the api info?

vague otter
#

So
The API info is a JSON string (Javascript Standard Object Notation or something like that)

#

There is a couple ways to deserialize JSON objects

#

You can use Newtonsoft.Json (available as a nuget package)

#

Or use the built-in System.Text.Json package form .NET

kind glacier
#

last time I tried nuget I fucked my entire project

vague otter
#

Then maybe try the built-in version

kind glacier
#

hm, this time it did work

#

guess I did it wrong last time

vague otter
#

๐Ÿ‘

kind glacier
#

now to figure out how that even works

vague otter
#

If you'd want to do a call I could walk you through it lol

#

Though their documentation is pretty detailed

kind glacier
#

probably faster if I can read it somewhere

vague otter
kind glacier
vague otter
#

The ppl who make it are called newtonsoft json, and the product is called json.net i think

#

But I use those two names interchangeably xd

#

And if you're using System.Text.Json from Microsoft it's the link I sent earlier

kind glacier
#

Product product = new Product();
wth is "Product"

vague otter
#

It's an example class

#

So replace that with whatever class you want to deserialize into

#

So if you have a JSON like this

"prop1": "hello", 
"prop2": "bye"
}```
you want your class to look like this

public class NameOfTheClass
{
public String Prop1 { get; set; }
public String Prop2 { get; set; }
}```

and that will be the class you use instead of the example

kind glacier
stone void
#

Lmao

#

Capitalize String

kind glacier
#

So how do I use text then

#

keeps telling me it doesn't exist in this context

stone void
#

You call the function to get text?

kind glacier
#

Now I'm confused

vague otter
#

Ah sry m8 was busy for a bitr

#

Ill give you an example on .netfiddle

vague otter
vague otter
#

Smh
Not even using high level APIs to do the resource management for you

kind glacier
#

It's gonna take me a while to decipher that example

vague otter
#

Take your time :)

kind glacier
#

welp, now I've lost the json entirely

#

webrequest turning up null

pure sierra
#

C for this ? like Why.... Did you see the code iposted for you @kind glacier

kind glacier
#

@pure sierra I did, and it looks like the code for trying to figure out which townhall belongs where

#

From what I can tell it's supposed to be working

#

but isn't

pure sierra
#

its for assigning the static labels to dynamic items

kind glacier
#

I'm not even near that step yet

pure sierra
#

well u were talking about it with kastow b4

kind glacier
#

true, but I had to take a step back to even get the requested json into a format I can work with

pure sierra
#

php easy: $regions = json_decode($regions, true);

kind glacier
#

but now I've lost the json entirely

#

it should be working, but it just isn't

pure sierra
#

so again, why c?

long raft
#

ah thats a good example

#

have you started using nullable reference types yet, @vague otter?

vague otter
#

Yes
Gave it a try

#

It's nice having nullable safety, though the implementation is too high-level to actually be a big thing

#

But gives you more compile-time goodies

long raft
#

.net 5 is properly using nullable reference types throughout the api now

#

the number of warnings in my code dropped by like half

kind glacier
#

so again, why c?
Because I'm not trying to make a website

vague otter
#

What are you using to make your API calls?

kind glacier
#

how do you mean?

vague otter
#

Well
You have to get the foxhole war data from somewhere, right?

#

What are you using to send requests to Clapfoot's API?

kind glacier
#

UnityWebRequest

vague otter
#

I see
You're using Unity

kind glacier
#

What would you have me do, use UE4?

#

I like Unity. It's simple enough for what I want to do

vague otter
#

Well
I didn't know what you were doing
Still don't
So I was just curious xD

kind glacier
#

that's okay

#

some just like to shit on unity and I don't really understand why

#

Even looking at the tutorials I was using, my webrequest checks out but still returns null

vague otter
#

I've never used it so cant help you there >.<

kind glacier
vague otter
#

Whats the url it calls?

vague otter
#

weird

#

Only thing I can imagine is paralellism fuckery

#

But I don't know unity enough to give any insight

kind glacier
pure sierra
#

so why unity ? what u makin

kind glacier
#

Foxhole HQ except 3d and clientside (until I can figure out how multiplayer works, anyway).

#

trying to

#

Had a whole talk and brainstorm about it in this channel a good 2 months ago

#

mostly wishful thinking

pure sierra
#

was i talking to you about the radio generals games

kind glacier
#

let's scroll up

pure sierra
#

it was back a few months

kind glacier
#

Yeah, it was in September

#

But now that I've actually finished my internship I have the time

pure sierra
#

i did buy the first one a played a fair bit of it

kind glacier
#

my first plan was to just have a gameobject turn green or blue depending on who holds the Abandoned Ward townhall

#

but now I can't even get the info from the API anymore

long raft
#

could it be https? ๐Ÿค”

#

the request is null or the result of SendRequest is null?

kind glacier
#

Can't really tell the two apart, but it seems like the result of the SendRequest

long raft
#

you're using this example?

IEnumerator GetText(string url, Action<string> result)
{
    UnityWebRequest www = UnityWebRequest.Get(url);
    yield return www.SendWebRequest();

    if (www.isNetworkError || www.isHttpError)
    {
        Debug.Log(www.error);
        if (result != null)
            result(www.error);
    }
    else
    {
        Debug.Log(www.downloadHandler.data); // this log is returning the requested data. 
        if (result != null)
            result(www.downloadHandler.text);
    }
}
#

couldnt understand why its being yield returned instead of returned

#

like, its 1 url input, so there can only be one response output, right? why would it return an iterator of them

vague otter
#

Might be a string enumerator

#

Like a stream but not good

long raft
#

it would be return, not yield return

#

this might be a convoluted example

vague otter
#

yield just means its an iterator no?

long raft
#

yea

#

i mean it means youre inside an iterator method

#

you can still use return in those if you return another iterator

#

err IEnumerable, not iterator

#

ok so my guess is that maybe you dont need to set the downloadHandler

kind glacier
#

Seems similar to me

string staticURL = BaseURL + "/worldconquest/maps/" + Mapname + "/static";
        UnityWebRequest RequestStatic = UnityWebRequest.Get(staticURL);
        RequestStatic.downloadHandler = new DownloadHandlerBuffer();
        yield return RequestStatic.SendWebRequest();

        if (RequestStatic.isNetworkError || RequestStatic.isHttpError)
        {
            Debug.Log(RequestStatic.error);
            yield break;
        }

        JSONNode StaticInfo = JSON.Parse(RequestStatic.downloadHandler.text);
        Debug.Log("2 " + StaticInfo);```
#

the debug only returns the 2

vague otter
#

do you get anything in RequestStatic.downloadHandler.text?

pure sierra
#

yeah

#

dump that

kind glacier
#

do you get anything in RequestStatic.downloadHandler.text?
I used to

#

then I broke it

vague otter
#

This yield stuff is too big brain for me

long raft
#
string staticURL = BaseURL + "/worldconquest/maps/" + Mapname + "/static";
UnityWebRequest RequestStatic = UnityWebRequest.Get(staticURL);
RequestStatic.SendWebRequest().Wait();
if (RequestStatic.isNetworkError || RequestStatic.isHttpError)
{
      Debug.Log(RequestStatic.error);
      yield break;
}
JSONNode StaticInfo = JSON.Parse(RequestStatic.downloadHandler.text);
Debug.Log("2 " + StaticInfo);
#

SendWebRequest returns an async operation - so you have to wait for it before you check downloadHandler.text

#

oh and I haven't seen any other example of someone setting the downloadHandler, I assume it's set already

kind glacier
#

Can't add Wait

#

he don't like that

long raft
#

ah it has to be async?

kind glacier
#

yes

#

it worked like this before

#

removing the downloadhandlerbuffer doesn't do anything either

long raft
#

oof there are nice ways to do this in c# 7.1 but not 6

#

.ContinueWith( ) is a really easy way of doing it

vague otter
#

I mean
Do you get any error logs? Seems obvious but Im asking anyway

kind glacier
#

None

#

just nothing from the request

long raft
#

anyway it's ienumerable because it's returning tasks... it was hard to tell without the function header

kind glacier
#

lemme try dynamic

long raft
#

well you could try doing wait to see if thats causing your problem

kind glacier
#

null too

long raft
#

yah its kind of what i would expect

#

if the task hasnt run then its going to be empty

#

c# async and unity all at once huh? ooof thats a lot to figure out at once

kind glacier
long raft
#

I think this is how I'd write the async, but I'm not sure if it'd work because I don't have unity

protected static async Task<JSONNode> Query(string URL)
{
    return new Task( async () => { 
        UnityWebRequest RequestStatic = UnityWebRequest.Get(URL);
        await RequestStatic.SendWebRequest(); 
        if (RequestStatic.isNetworkError || RequestStatic.isHttpError)
        {
            lock(Debug)  
                Debug.Log(RequestStatic.error);
            return null;
        }
        lock(Debug)
            Debug.Log("Response: " + RequestStatic.downloadHandler.text);
        return JSON.Parse(RequestStatic.downloadHandler.text);        
    });
} 
#

and on the outside:

var api_result = await Query(...);
kind glacier
#

even a fresh script doesn't work

#

I'll try your thing

long raft
#

is unity like async all over the place? I haven't used unity since before async was popular

kind glacier
long raft
#

oh uhh

#

i guess i need async before (), i changed the code. also made Debug thread safe

#

my async knowledge is purely academic

kind glacier
#

even when I copy a working example 1:1 it doesn't seem to want to work

long raft
#

yah those are the hardest things to debug

kind glacier
#

Welp

#

I got it back

long raft
#

heh back to 0