|
its been a while since i did any objc/swift but iirc you have to put UI updates on the main thread so probably the macos implementation of SDL only does that when poll for events?? total guess tho also yea i put a black square there first now to clear out the surface buffer before the loop: code:
thx all
|
# ? Mar 21, 2020 07:53 |
|
|
# ? Apr 26, 2024 00:35 |
|
hmm no i set a breakpoint & stepped through it. looks like everything is on thread 1 so idk anyway it works Carthag Tuek fucked around with this message at 09:13 on Mar 21, 2020 |
# ? Mar 21, 2020 09:11 |
|
need a bit of design rubberducking. dominions 5 is an async game where players submit their turns whenever and then once all players have (or the usually 24 hour timer ticks over) then the server generates the next state and everybody submits their next turn. i wrote a discord bot that checks the server state on a loop and then 1) allows players to query the state, and 2) sends PMs to players when a game they're in rolls over. currently the design is: there's a shared mutex containing a hashmap for all servers to their state. one thread updates this in a loop, and then when players query the bot in the other thread they query the saved state so they they're not querying the server each time. the main thing i struggle with is notifying the players. currently the update thread just does this if it notices that the server has advanced. this is less than ideal for a few reasons: 1) it prevents updates from happening while sending like 10 PMs, 2) if any of those calls fail it's handled poorly, 3) sometimes the game server decides to capture tcp connections forever which prevents all games from updating and requires a manual restart despite my efforts to put timeouts into my tcp calls, 4) duplicate pings are also happening for ??? reasons 5) the updates happen one at a time so when the bot starts you might have to wait for 20 other calls before your game has info like what should this design look like? the update thread actually spawning child threads 1 per server it needs to look at? some kind of queue of notifications to go out so that the update thread(s) don't care about actually sending the PMs? rust specific but should i just stick with thread::spawn or start messing with futures? serenity (the discord library i'm using) doesn't support async but i can just run it in a threaded executor's spawn_blocking if i needed. the original idea was to be super simple and it's just kind of grown organically and now things are starting to interact poorly
|
# ? Mar 22, 2020 12:49 |
|
gonadic io posted:need a bit of design rubberducking. Ideally you'd have some lightweight tasks/futures library backed by a thread pool. Then the update thread manages the tasks lifecycles. The C# thread pool has a separate set of UI threads; I'd check the docs to see if rust's is similar. So yes; futures.
|
# ? Mar 22, 2020 13:14 |
|
I think id probably use a timer lib like Quartz and generate a cron style job per server its checking. That job can then spawn a thread to check the server state and send the messages to a queue to be sent out.
|
# ? Mar 22, 2020 19:35 |
|
I don't know much about C++ and avoided learning it at every opportunity, but this vid was still quite interesting... https://www.youtube.com/watch?v=j0_u26Vpb4w
|
# ? Mar 22, 2020 20:25 |
|
serverless
|
# ? Mar 22, 2020 20:41 |
|
kafka
|
# ? Mar 22, 2020 20:41 |
|
Aramoro posted:I think id probably use a timer lib like Quartz and generate a cron style job per server its checking. That job can then spawn a thread to check the server state and send the messages to a queue to be sent out. quartz is a really good rec for this type of thing
|
# ? Mar 22, 2020 20:45 |
|
ctps: wayfinding, started a new project.log. I have no idea what I'm doing and I hate all GIS software and developers already.
|
# ? Mar 23, 2020 21:20 |
|
GIS is a huge field. I agree though, like all software, it is absolutely terrible. You are in the lucky position to choose your flavour of terrible though. If you go into more academic software the UI gets more insane. And you risk pulling in the ocean of terrible tools that is related to mapping. Like, GMT is extremely widely used and extremely powerful, but holy gently caress is it bad. It beats ffmpeg in terms of insane options. It is more convoluted than the openssl CLI. And as you go into more commercial sections you'll run into people who will want everyone interacting with your tool to use a USB dongle. Yes, even for web poo poo.
|
# ? Mar 24, 2020 10:16 |
|
if the terminals are stationary it seems like a waste to use gis
|
# ? Mar 24, 2020 13:53 |
|
Using standard GIS tools (meaning the desktop Qgis/GRASS/ArcGIS software) is probably not the way to go for custom interactive stuff. You probably want to ask yourself if GIS-based tools [edit: anything that uses a global spatial reference system, not just the desktop GUI software] even make sense if what you're doing is all at the building scale and mostly on the interior. It may make sense if you want to easily integrate with existing survey data, off-the-shelf mapping tools, or expect some deployments to cover a large area. Last time I built a web frontend for custom GIS stuff (years ago when I was basically a self-employed junior dev so grain of salt) I used: - PostGIS/postgres for the database/geoprocessing - Django with GeoDjango for the webserver layer - Leaflet for frontend mapping - D3 for custom interactive elements PostGIS is a great tool for doing annoying computational geometry stuff like making buffers, doing spatial queries, and storing/converting georeferenced data. You'll want to bone up on basic GIS concepts like spatial reference systems, each of which has an SRID you can specify when pushing/pulling data from postgis. Every major jurisdiction is going to have a set of their own reference systems (usually at the state level) denominated in some linear unit from a reference point (e.g. feet). There's a bunch and they're all localized because what they're trying to do is map a euclidean grid to a segment of an oblate spheroid, so once you start moving from the origin point the error (difference between reference coordinates and real coordinates) starts to build up. The global reference systems (usually WGS84 or NAD83 datums) use coordinates in lat/lon and account for the measured shape of the earth, but you'll want to do your computations on a flat plane if possible. If you're deploying in multiple states or even different cities that may affect how you do your processing. You absolutely 100% want to use something like PostGIS for these operations if you're moving between e.g. google maps WGS84 lat/long coordinates (SRID 4326) and the building's survey data in e.g. EPSG:2260 - New York East coordinates (SRID 2260), which are in feet and referenced to the NAD83 datum. This is all different from projections, which is how the map gets displayed (e.g. mercator, lambert, etc), but which probably won't make a big difference at the scales you're working at. You'll have to choose one though, and make sure if you're doing overlays with different tools (like D3) that they're using the same projections. Note I am probably using some terminology wrong, but my last GIS class was in like 2009. The other option is just defining your own coordinate systems based on the Revit models or whatever BIM tool you're pulling your data from and ignoring the GIS stuff entirely. You'll lose access to some cool off-the-shelf algorithms but that may or may not matter for what you're doing. Spime Wrangler fucked around with this message at 17:31 on Mar 24, 2020 |
# ? Mar 24, 2020 17:25 |
|
My targets are 1: University of Texas, Houston, however starting with only one building, not the entire campus, 2: The NBA offices in NYC, and 3: Dallas Fort Worth Airport. These are all at the level of not having to care about outdoors and mapping services, but it's 2020 and you expect some maturity in products. One angle would be TinyOWS with Postgres/Postgis, and either OpenLayers or Leaflet. Just looking at something simple that would not be painful to grow in the future. There are 2D things like d3 floorplan but 3D is a desired goal, at least for extruding rooms from a floor plan. I want a mechanism to define waypoints on a map, to start building up a graph for path routing. It's probably quite simple but this domain makes it look complicated.
|
# ? Mar 24, 2020 18:24 |
|
ecommerce partner is complaining that our message queue is 'hammering' their api and i should slow it down he sent me a log excerpt with the comment 'look at all the calls it made just in the last minute!'. 38 requests/min, truly a DDOS-grade attack
|
# ? Mar 24, 2020 19:17 |
|
as i'm sure you're well aware, all ecommerce systems, and everything adjacent, are pure, molten garbage
|
# ? Mar 24, 2020 23:13 |
|
redleader posted:as i'm sure you're well aware, all ecommerce systems, and everything adjacent, are pure, molten garbage yeah but im pretty sure in this case they just never learned to grep their own logs and they were frantically wearing out their scroll wheels
|
# ? Mar 24, 2020 23:49 |
|
I told an offshore dev to actually write some comments and format the code so it's not just one mega worker.cs file that jumps around calling itself so they've just started putting \\\ summary blocks on every statement and now have two class files that jump around calling themselves with no discernible pattern this service just polls for updates, gets a list of records to update and runs through them, so you'd expect an out worker to call a method to build a list of wrapper objects around each update then loop over each item in it, calling a process method on it. instead it's a wild ride of lists intancing objects that then get added to more lists that pass to methods that return bools that modify the original state of the object and pass it to other methods
|
# ? Mar 25, 2020 12:00 |
|
to save money we shut down our azure development environment overnight. this morning it failed to boot up because azure has run out of capacity in the entire north europe region. loving owned.
|
# ? Mar 25, 2020 12:04 |
|
Chalks posted:to save money we shut down our azure development environment overnight. lol that loving owns. Gonna suggest to our DevOps they turn off Azure at night now.
|
# ? Mar 25, 2020 12:16 |
|
Chalks posted:to save money we shut down our azure development environment overnight. hahaha
|
# ? Mar 25, 2020 12:27 |
|
oh cool they've never actually debugged or run the service they wrote because as soon as you start it it blows up with missing config errors, that's a good start!
|
# ? Mar 25, 2020 13:07 |
|
woops I forgot to shut down the dev cluster last night
|
# ? Mar 25, 2020 14:01 |
|
About two hours after breakfast, I'm gonna flush the dev cluster.
|
# ? Mar 25, 2020 14:06 |
|
Holy poo poo I said "this needs to be refactored so it's not just one mega worker class, it should have separate classes" and what has he done? he's c&p'd the worker.cs content into two separate files under a new class then just.... Made the base worker inherit the new file what in the gently caress
|
# ? Mar 25, 2020 15:23 |
|
Chalks posted:to save money we shut down our azure development environment overnight. i remember looking into this when i first experimentally set up a couple VMs on the monthly msdn free credit at the time azure offered an option to shut down vms at a certain time every day, but it didn't have the corresponding option to also turn them back on, you had to write a cronjob with the azure shell yourself i remember wondering why the gently caress they would offer such a literally half-assed feature now i guess i have an idea
|
# ? Mar 25, 2020 15:28 |
|
Powerful Two-Hander posted:Holy poo poo I said "this needs to be refactored so it's not just one mega worker class, it should have separate classes" and what has he done? Sounds like a failure in the specification of the task there. He's done exactly what you asked like like a spiteful Code Djinn.
|
# ? Mar 25, 2020 15:32 |
|
Aramoro posted:Sounds like a failure in the specification of the task there. He's done exactly what you asked like like a spiteful Code Djinn. this code is like the platonic ideal of bad. there are functions called LoadFoo that call procedures called getFoo that read or write data depending on what you called them with. zero comments on methods but random summary blocks dotted around on try{} statements it's impossible to follow
|
# ? Mar 25, 2020 16:10 |
|
class count sounds like the least of your problems. in general pointing out typically-used indicators of "bad" code isn't much of a diagnosis. what's the actual problem with the code?
|
# ? Mar 25, 2020 16:19 |
|
Powerful Two-Hander posted:Holy poo poo I said "this needs to be refactored so it's not just one mega worker class, it should have separate classes" and what has he done? lol i love stories like this because it makes me appreciate how minor the dumb disagreements i have at work are with generally competent coders
|
# ? Mar 25, 2020 16:27 |
|
sounds like you're getting exactly what's being paid for
|
# ? Mar 25, 2020 16:27 |
|
pokeyman posted:class count sounds like the least of your problems. in general pointing out typically-used indicators of "bad" code isn't much of a diagnosis. what's the actual problem with the code? Well, it didn't actually run so there's that, once the immediate issues were fixed (bad references, missing config etc.), it's clearly been written as "I am going to read the design spec and write one big long procedural list of statements" which is OK ish as a start point, but this has been worked on for a month now and the output at that stage should be possible to follow for someone else "oh but it works" is not good enough, it needs to be maintainable and a 400 line class called "database access" that handles update polling, sending emails and reading/writing mixed records and has random internal class properties that are written to and from on each operation to use as temp storage is not maintainable edit: and who writes a stored proc that takes a bool to decide whether it will return a list of records or write an update to one records Edit 2: the service doesn't actually manage its run process properly, if it runs out of things to do it just quietly dies instead of sleeping and checking for updates later Powerful Two-Hander fucked around with this message at 16:52 on Mar 25, 2020 |
# ? Mar 25, 2020 16:31 |
|
can someone please tell me why the gently caress code:
why is that a thing.
|
# ? Mar 25, 2020 17:12 |
|
thats p commonC code:
Python code:
|
# ? Mar 25, 2020 17:17 |
|
also in obj oriented languages its usually used to check if a variable points to an object or not
|
# ? Mar 25, 2020 17:19 |
|
NecroBob posted:can someone please tell me why the gently caress if(!email) { alert("set an email address you dumbdumb"); } null evaluating to false is pretty useful
|
# ? Mar 25, 2020 17:22 |
|
okay, that makes more sense EDIT: I work in C#, so assigning null to something that could be evaluated as a boolean type seems wrong. Additionally, code:
NecroBob fucked around with this message at 17:32 on Mar 25, 2020 |
# ? Mar 25, 2020 17:28 |
|
why is there a static mail sender method sitting in the program wrapper around the service is adding a new class file so hard?
|
# ? Mar 25, 2020 17:38 |
|
Powerful Two-Hander posted:why is there a static mail sender method sitting in the program wrapper around the service is adding a new class file so hard? easier to ctrl-f in a single file
|
# ? Mar 25, 2020 17:45 |
|
|
# ? Apr 26, 2024 00:35 |
|
Krankenstyle posted:easier to ctrl-f in a single file this sounds like something from a "javascript best practices guide" honestly the layout of this is one big anti pattern. like how do you get the current object state before updating? Oh obviously you call a method named "sendupdatemail" and it will either throw an error, end an email or update a class property
|
# ? Mar 25, 2020 17:48 |