These are chat archives for arenanet/api-cdi

29th
Sep 2017
shawngmc
@shawngmc
Sep 29 2017 01:24
@lye Could you 'pad' the world and make it a power of two - either leaving the origin in the corner or center it within? I feel like the math is SLIGHTLY easier for the former, but the latter allows for growth in any direction (i.e. you don't have to tell us, and maybe GW1 had an answer for this, but is there anything west of Meguma or north of Shiverpeaks?) For the unused areas, you could just use a texture - fog-of-war (mists?), a parchment paper, nondescript brushstrokes, or leave it transparent so that API users could decide? The API could then also return the actual 'world extent' based within that larger grid...
Archomeda
@Archomeda
Sep 29 2017 07:14
omg i can't stop laughing... a new bridge here in the Netherlands that replaced an old bridge 2 years ago, called the Botlekbrug, just had its 100th malfunction a few hours ago :joy:
on average, that's 1 malfunction every week :joy:
and this tweet is hilarious (if you're dutch): https://twitter.com/Rijkswaterstaat/status/913627717467361280
smiley
@codemasher
Sep 29 2017 10:02
ok, my dutch is def not the best (who knew? xD) so what does it say without getting lost in translation?
Archomeda
@Archomeda
Sep 29 2017 10:39
A bridge with moving parts without malfunctions doesn't exist. The new Botlekbrug without malfunctions too is sadly an utopia. We are working hard to prevent and solve.
they just don't want to admit that the bridge is costing way more than should have been, and is basically a fiasco :P
those responses on that tweet though :')
smiley
@codemasher
Sep 29 2017 10:55
haha
smiley
@codemasher
Sep 29 2017 12:16
so the Telekom technician just let me know that it's not possible to add 2 phonebook entries with the same name on that new VoIP software they just installed.
i'm gonna introduce guild wars like names for our customers now
"XXX Customer whatever XXX"
(protip: just don't buy small business VoIP solutions)
Archomeda
@Archomeda
Sep 29 2017 12:20
lol
shawngmc
@shawngmc
Sep 29 2017 12:29
Give them descriptive honorifics? John Smith the Late-Paying, John Smith the Liar, John Smith the Ideal Customer, John Smith the Unreachable... hell, that last one is actually useful on caller ID. :)
smiley
@codemasher
Sep 29 2017 12:32
lmao
the problem is that i have ca 1200 phone numbers to import (which is easy via CSV) but guess how many people are in there who share the same name...
damn, programmers
Archomeda
@Archomeda
Sep 29 2017 12:34
what is the most common german name? :D
smiley
@codemasher
Sep 29 2017 12:34
get out of your basements and see how that thing called "life" works xD
like... Hans Müller or so?
Archomeda
@Archomeda
Sep 29 2017 12:34
hmm, sounds plausible
smiley
@codemasher
Sep 29 2017 12:35
i mean, i could add the company they work for as an extension
but that would defeat the purpose i guess
Enno G.
@SchoolGuy
Sep 29 2017 13:01
Depends on the region guys we have a lot of common names :D
Dominic
@DomGrieco
Sep 29 2017 14:46
Has it been discussed that Firebrand tome abilities are dead in the API?
ChieftainAlex
@ChieftainAlex
Sep 29 2017 15:55
can't we discuss what lives in the API instead?
might be quicker
Archomeda
@Archomeda
Sep 29 2017 16:36
image.png
aw yeah
Eearslya Sleiarion
@Eearslya
Sep 29 2017 16:37
best hub
Archomeda
@Archomeda
Sep 29 2017 16:41
ah yes, very few players...
image.png
Archomeda
@Archomeda
Sep 29 2017 16:49
inb4 we get a SAB hub in april
Eearslya Sleiarion
@Eearslya
Sep 29 2017 16:50
oh jeez
Archomeda
@Archomeda
Sep 29 2017 16:50
if it will have permanent access to SAB, i'll buy it
Archomeda
@Archomeda
Sep 29 2017 16:56
or, 1000 gems to get a world 3 preview, i'll buy it
Edgar Doiron
@Coffee4cr
Sep 29 2017 17:01
lol
oh man
I'll buy it too
even If i have the mistlock one too
Dominic
@DomGrieco
Sep 29 2017 17:02
need a vendor to trade old gem store items into for gems
I have 8 copper and silver salvage kits
Eearslya Sleiarion
@Eearslya
Sep 29 2017 17:05
oh, wow
Archomeda
@Archomeda
Sep 29 2017 17:11
:/
Edgar Doiron
@Coffee4cr
Sep 29 2017 17:13
@DomGrieco I think you can open a ticket for those
I got doubles of those refunded by support

Could you 'pad' the world and make it a power of two - either leaving the origin in the corner or center it within?

@shawngmc Hmm, explicitly bumping the map size up to the nearest power of two would do the trick -- that'd pad with black -- but I don't think that'd fix the coordinates being wrong

Eearslya Sleiarion
@Eearslya
Sep 29 2017 17:18
just go tell the art department to make it 65536 and do some broad brush strokes
smiley
@codemasher
Sep 29 2017 17:20
i'd almost recommended that yesterday - just bump to 64k and break the loop at 49k :D
oh wait
you're stepping down
no break then xD
what the hell
unsigned int v; // compute the next highest power of 2 of 32-bit v

v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v++;
I'm just sitting here like pow(2, ceil(log2(v)))
smiley
@codemasher
Sep 29 2017 17:28
i'm currently not in bit-flipping mode... :D what does it do?
refer to the comment :P
smiley
@codemasher
Sep 29 2017 17:29
heh
math hard
what does v-- return when its declared without value? (never even tried that in php)
-1?
v -= 1
smiley
@codemasher
Sep 29 2017 17:35
int(1)
hmm, the coordinates work via %'s of the map size, so changing the map size makes the coordinates totally wrong
smiley
@codemasher
Sep 29 2017 17:39
wait, you've been shifting right
smiley
@codemasher
Sep 29 2017 17:40
$v= 1;

$v |= $v << 1;
$v |= $v << 2;
$v |= $v << 4;

$v++;
var_dump($v);
for($y = 0; $y < (1 << $zoom); $y++)
smiley
@codemasher
Sep 29 2017 17:46
(just wondering if php is so much different than c in bit mode or if i'm just doing it wrong)
Eearslya Sleiarion
@Eearslya
Sep 29 2017 17:52
@codemasher in C, if you don't initialize a variable, it's just complete
/shrug
Quaggan BooOOoot
@QuagganBooOOoot
Sep 29 2017 17:52
¯\_(ツ)_/¯
shawngmc
@shawngmc
Sep 29 2017 17:52
Manual bit shifting is only faster if your compiler doesn't compile pow(2, ...) to a bit shift.
Eearslya Sleiarion
@Eearslya
Sep 29 2017 17:52
it could be 0, it could be 763489574
smiley
@codemasher
Sep 29 2017 17:53
oh, ok
well, in php you gotta initialize it if you care about notices being thrown
Eearslya Sleiarion
@Eearslya
Sep 29 2017 17:53
that's why 99% of compilers will have a warning if you read a variable before initialization
smiley
@codemasher
Sep 29 2017 17:54
^^
uhh
v is initialized to the input you'd like
smiley
@codemasher
Sep 29 2017 17:54
seems i gotta get more into c :D
i mean, php is quite similar in so many things, but then again so different
  1. both procedural languages
  2. uhh
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:00
yeah, object orientation and some syntax is about all they've got
smiley
@codemasher
Sep 29 2017 18:00
well, php is a c derivate (like uhh... JAVAscript)
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:00
well
C isn't object oriented, C++ is
smiley
@codemasher
Sep 29 2017 18:01
php is php++ since 5.4 or so :D
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:01
most languages share that kind of syntax anyway
if you know one language, you're pretty good in most of them
smiley
@codemasher
Sep 29 2017 18:02
php <> js is almost copy/paste nowadays... ALMOST
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:02
C is a powerful language but it will not hold your hand
Archomeda
@Archomeda
Sep 29 2017 18:06
indeed, you would need either an interpreter or a compiler that compiles it to language byte-code that is being compiled on the fly whenever it runs, or something
they call that a VM for java
right?
anyway, i recall seeing a page/image/diagram somewhere that illustrated which languages are inspired by others
or deviated from
David Reeß
@queicherius
Sep 29 2017 18:13
Archomeda @Archomeda sees var and Array()
Archomeda @Archomeda shudders
smiley
@codemasher
Sep 29 2017 18:17
@queicherius yup, seen that already
David Reeß
@queicherius
Sep 29 2017 18:17
I wonder if there is something in the other direction too
smiley
@codemasher
Sep 29 2017 18:18
funny tho that is uses the shorthand array notation on the php side which is literally the same in JS xD
also, a self-respectin php'er uses var_dump
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:21
print_r
smiley
@codemasher
Sep 29 2017 18:21
only for prettyprint
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:22
C is fun to program in, but there's some quirks that come with running close to the hardware
like that 'uninitialized variable' thing
It'll pick an address at runtime and it will not zero it for you
smiley
@codemasher
Sep 29 2017 18:23
BOOM, BLUESCREEN
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:23
Nah, just unintended behavior
like...
int i;
for (i; i < 32; i++) {
  do_something();
}
there's no telling how many times that will iterate
smiley
@codemasher
Sep 29 2017 18:24
pretty sure this would break in php
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:25
depends on how php treats uninitialized varaibles
though with a loosely-typed language, hmm
smiley
@codemasher
Sep 29 2017 18:26
PHP Notice:  Undefined variable: i in $vindex.php on line 39

PHP Stack trace:
Notice: Undefined variable: i in $vindex.php on line 39

Call Stack:
PHP   1. {main}() $vindex.php:0
    0.0000     352392   1. {main}() $vindex.php:0

PHP Notice:  Undefined variable: i in $vindex.php on line 39
foo
PHP Stack trace:
Notice: Undefined variable: i in $vindex.php on line 39

PHP   1. {main}() $vindex.php:0
Call Stack:
    0.0000     352392   1. {main}() $vindex.php:0

foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo
Process finished with exit code 0
for($i; $i < 32; $i++) {
    print_r('foo');
}
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:27
see, it notices, but doesn't crash
probably treats $i as 0
smiley
@codemasher
Sep 29 2017 18:27
yea
null
so it'll become 0
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:30
also something you guys in PHP don't have to deal with
the almighty, ever-present, and ever-frustrating SIGSEGV
@lye can probably attest; hours of debugging are lost to that one little error
smiley
@codemasher
Sep 29 2017 18:32
oh hey, there's a ton of other things tho
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:32
or even worse, you over-run an array and it DOESN'T segfault, but you intrude on another variable's values
@Eearslya not really
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:32
@lye you're supposed to back me up here, man D:
code more defensively :P
smiley
@codemasher
Sep 29 2017 18:32
lmao
also valgrind will find array overruns
smiley
@codemasher
Sep 29 2017 18:33
(i was about to say "I'm too cautious" earlier)
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:33
valgrind is unusable in some scenarios
i can't think of any scenarios that can't be avoided
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:34
I was doing an advent of code project that involved MD5 hashing; had to find the first hash with six zeroes in the front
valgrind on a program doing millions of MD5 hashes would take hours
so write some unit tests that have high code coverage
smiley
@codemasher
Sep 29 2017 18:35
ask xdebug... :D
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:35
unit tests in C are..also something I've never gotten the hang of
I use libcheck
it's not that bad
def takes some getting used to
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:36
I mean...how, though? I had to strip all my code out of main and use preprocessor directives to undefine main from the actual program
and I just feel that's wrong
test/main.c is included to build a test binary, src/main.c is included to build a real binary
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:37
well, yeah, when it's a lib you're testing
but what about a standalone program itself?
see above -- you exclude src/main.c when building the test binary
src/main.c should be fairly empty
(or -- rephrased -- everything in src/main.c should be easily composible into tests)
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:38
int main(void) {
   real_main();
}
that works too
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:39
I guess it just feels weird to me to do that
It feels like a hack rather than a solution
more like
int main(int argc, char *argv[]) {
    my_args_t *args = my_args_parse(argc, argv);
    my_daemon_t *daemon = my_daemon_alloc();

    // set various args and stuff

    my_daemon_run_forever(daemon);
    my_daemon_free(daemon);
    my_args_free(args);
}
I've also got like, main thread event loops just inlined into main as well
(for things that are rendering to a window or something)
the event dispatching logic isn't interesting; the tests are going to synthesize events anyway
shawngmc
@shawngmc
Sep 29 2017 18:41
Use a language that makes sense for what you want to do. If you're doing web stuff, use Java/JS/Go which all have solid string handling (since they're a huge class of vulnerabilities and errors). If you're doing heavy CPU work, well-written C/C++ is SLIGHTLY faster than well-written Java/C# which is moderately faster than JS/Python/PHP/etc.
C99 is clearly the superior language for all domains
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:42
my API scraper was going to be in C
shawngmc
@shawngmc
Sep 29 2017 18:43
@lye, I appreciate your hard work on this nicely documented API; don't make me dislike you. :P
@Eearslya OK, why C?
windwarrior
@windwarrior
Sep 29 2017 18:43
mine was going to be written in rust, but then the borrow checker complained, and complained, and complained
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:43
1) it's one of the languages I know best
2) speed, mostly
smiley
@codemasher
Sep 29 2017 18:43
@lye haskell?
windwarrior
@windwarrior
Sep 29 2017 18:44
dunno, C feels like trying to slice bread with a chainsaw, indeed very fast
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:44
don't get me wrong @shawngmc I'm not gonna go out and write a website in C
I'll probably write a website in C
smiley
@codemasher
Sep 29 2017 18:44
i know someone who did that
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:44
it is a tempting prospect, but more as a learning experiment
Need to integrate http-parser into my stack though
shawngmc
@shawngmc
Sep 29 2017 18:44
Reason 1 I'm down with, although it might be a good reason to add another to your repertoire. Reason 2? Ehhh..... You're IO-blocked by the network anyway.
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:45
I know C isn't meant to be a website, but it'd be fun to make it do that
@Eearslya there's libfastcgi which is kind of cheating but it expedites things
windwarrior
@windwarrior
Sep 29 2017 18:45
how does a language cater towards websites
except for PHP
smiley
@codemasher
Sep 29 2017 18:45
see php?
shawngmc
@shawngmc
Sep 29 2017 18:45
It's still less crazy than Steve Gibson, who does Windows API programming in Assembly.
I feel like if you're writing an application server in C you might as well have it handle everything after TLS termination
smiley
@codemasher
Sep 29 2017 18:45
This message was deleted
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:46
lets not forget Chris Sawyer
windwarrior
@windwarrior
Sep 29 2017 18:46
the author of RCT had to write some C code for rollercoaster
...
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:46
XD
windwarrior
@windwarrior
Sep 29 2017 18:46
because DirectX was a pain to work with in assembly
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:47
but yeah, I like the control C gives me, the speed that bytecode provides... it really makes me feel like it's my program, and not just a collaboration of library functions
windwarrior
@windwarrior
Sep 29 2017 18:48
there are people way smarter than me writing awesome libraries
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:48
as for speed comparisons between C and Java... I'd say that depends on the application
I personally dislike the heavy layer of abstraction Java gives
I like to know exactly what's happening
shawngmc
@shawngmc
Sep 29 2017 18:50
@windwarrior Better automatic string management (string overflows are a common class of web app bug). Standardized, mature, heavily used network libraries that handle all common HTTP status codes and the whole TLS handshake in a straightforward way. Easier unit testing. Better deployment systems (for example, Java WAR applications can be a pain in the butt, but ultimately they make it simple to push out new versions of your web app and monitor status). The ability to move your code between hardware platforms with a minimal amount of pain.
TLS needs to be terminated outside of the application code, to be sure.
I don't think that's specific to the language the application is written in.
windwarrior
@windwarrior
Sep 29 2017 18:51
I write my webserver stuff in Python/Django ^^
because if I write something, it doesnt have to be blazingly fast
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:52
Anyone who rolls their own TLS implementation clearly shouldn't handle secure data
windwarrior
@windwarrior
Sep 29 2017 18:52
and Django is just a nice batteries included webframework that does most things right
shawngmc
@shawngmc
Sep 29 2017 18:52
^ True, but a good library makes it easy to set up that TLS connection. I'm thinking about the complexity of setting it up in Java (which is complex) vs. C (where you're going to have to directly interface with OpenSSL and REALLY know what you're doing).
windwarrior
@windwarrior
Sep 29 2017 18:53
we have webservers for this that are way better at dealing with the complexity of TLS
In both you'd be better served by having nginx/haproxy/stunnel.
Even if you're using a super easy-to-use well-tested TLS lib (e.g., Go's TLS libs) you shouldn't have your application terminate TLS
It really just boils down to "do you really want your application code to have access to your domain's private key"
for HTTP in C, there's https://github.com/nodejs/http-parser and libcurl (depending on whether you're a server or client) -- though to be fair it's about 90x more work for practically no gain.
shawngmc
@shawngmc
Sep 29 2017 18:55
Agreed. That said, 2-way PKI for authentication - which is more common than you might think - means that at least the TLS implementation has to at least hand over the DN from the client cert.
(IE, it's fine for your TLS to be unwrapped before the application, but your application may make user decisions based on that user's identity.)
Eearslya Sleiarion
@Eearslya
Sep 29 2017 18:58
I've been tempted on several occasions to write an IRC server in C
shawngmc
@shawngmc
Sep 29 2017 19:00
Still, I agree with you and @Eearslya - I led a crypto study group at one of my employers, and the first rule of Crypto Club was 'you don't implement your own encryption'. Coincidentally, that was the second rule as well. This was really to help people understand the concepts behind it - the various ciphers, why some were weak, etc. - and properly secure things before releasing them. :)
Eearslya Sleiarion
@Eearslya
Sep 29 2017 19:01
Yeah, it's crazy when you start learning about things like timing attacks and realize just how many hundreds of factors need to be taken into account for security
It's far more than just 'take these bytes and scramble them'
shawngmc
@shawngmc
Sep 29 2017 19:03
Yup. And then Heartbleed shows us how poorly OpenSSL was being audited. X_X
Eearslya Sleiarion
@Eearslya
Sep 29 2017 19:13
Does OpenSSL have unit tests? I feel like that should've been one
It does have unit tests, but it's hard to test timing and side channel attacks
TLS additionally has a huge surface area, so it'd be a nightmare to get high test coverage
Darqam
@Darqam
Sep 29 2017 20:20
Do you guys know if there's any way to get the gem store art off the pages like view-source:https://2gemstore.staticwars.com/const/gw2/build82548/GemStore/en/catalog.1c8b19fb.js ? I see imageHash for some entries, but not sure if that's something usable outside the client
the tests I'm seeing seem to only cover the happy paths
Eearslya Sleiarion
@Eearslya
Sep 29 2017 20:21
that's a horrible way to test
but you're right, it's a big project to test
@Darqam easiest way to find out is to look at the JS code
var webImagesBase = GW2.imageBase;
// ...
var imageBase = webImagesBase + "/" + (item.imageHash || "44e4c6dd");
// uhh in configs
    imageBase     = https://services.staticwars.com/gw2/img/content
Eearslya Sleiarion
@Eearslya
Sep 29 2017 20:33
Out of curiosity, I've seen people use the chrome-style "inspect" window on the TP. Is that at all possible in live builds?
should be disabled on live builds
(at least the ones y'all get)
it's possible to compile a live client that has the debugging stuff still in
Eearslya Sleiarion
@Eearslya
Sep 29 2017 20:35
Do the GMs actually get slightly different builds with the dev menu?
I've no idea
Darqam
@Darqam
Sep 29 2017 20:47
@lye thanks, didn't realise the hash fit in there
windwarrior
@windwarrior
Sep 29 2017 20:50
Dear gitter, why can I only scroll in code on landscape
How did you even media query this
Oh no it’s just wonky in general
I also spent way too much time wondering why you would ‘or’ with
44e4c6dd before realizing it was not Boolean or
Eearslya Sleiarion
@Eearslya
Sep 29 2017 21:01
I mean, it sort of is
a null value will register as false with a boolean operator
windwarrior
@windwarrior
Sep 29 2017 21:06
Uhh sorry meant to say bitwise or, I was thinking that it served as a bit of obfuscation
|| for null coalescing is pretty standard javascript
Eearslya Sleiarion
@Eearslya
Sep 29 2017 21:52
I think PHP and Ruby and a few others can do it too
never knew it was called 'coalescing'
I picked the term up from SQL where the operator is COALESCE
I still don't know what Haskell's spaceship operator <=> does
Eearslya Sleiarion
@Eearslya
Sep 29 2017 22:04
oh
that's usually used in sorting functions
returns a -1, 0, or 1
-1 meaning less than, 0 meaning equal, 1 meaning greater than
makes sense
shawngmc
@shawngmc
Sep 29 2017 22:36
Oh, so it's basically Java's Comparable interface, compareTo function? Good to know...
Eearslya Sleiarion
@Eearslya
Sep 29 2017 22:42
that's also what somewhat annoys me about Java
factories and interfaces and this and that
I know this is an exaggeration, but it's a funny example: gitter
annoyingly, the way the tiles are cut, the south/east borders bleed way out of the floor bounds
so zoomed in tiles chop off all those bits
I guess I could crop them but also I kind of want to be done with this forever so rip
I don't know what I changed to fix the bug here. I feel like I didn't change anything and it just magically worked in debug mode
Running the whole thing now with all zoom layers (not just the lowest 3) in release -- going to laugh/cry if it doesn't generate working tiles
Eearslya Sleiarion
@Eearslya
Sep 29 2017 23:10
prepare the harddrive wiper
im-pickle-rick.png
did you think I wouldn't notice
please-help-the-memes-have-taken-over.jpg
Eearslya Sleiarion
@Eearslya
Sep 29 2017 23:13
I have yet to start season 3
I should
shawngmc
@shawngmc
Sep 29 2017 23:37
See, but that's 'enterprise' code to a fetishistic level.
In moderation, these things are good.
I mean, as an example, I think Java's OO model is easier than Javascript's.
And OO, when not used to simply be OO, but to describe objects, is good.
what's wrong with Javascript's OO? It's practically Java
class Rectangle {
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }

  get area() {
    return this.calcArea();
  }

  calcArea() {
    return this.height * this.width;
  }
}
ES2015 brought a lot of new shiny toys
shawngmc
@shawngmc
Sep 29 2017 23:51
True, I forget about ES2015 because I'm so used to not being able to use it safely. I didn't want to transpile/shim myself into oblivion.
fair