« first day (1923 days earlier)      last day (3250 days later) » 

15:00
@ndugger Yesterday I built a sounding rocket designed for high above earth, but I didn't realize I didn't have RSS installed, and sent it way too fast before I knew what happened.
What's a good tool for running tasks at certain times in node? Is node-agenda any good?
@corvid I use later
2
@ssube that looks nice
it's worked well so far. Haven't used it intensively, just for scheduling in github.com/ssube/eveningdriver
easy to set up, worked right away, so I'm pleased thus far
Is there a way to render in react outside of a dom element?
15:08
the builder syntax + simple natural language + real cron is a nice touch, useful for code and config
Somewhat like document.createElement
Then I could append it later
React should handle most of the deferring for you, I think
Yeah but I'm mixing React with Vanilla js
you should see if @Loktar knows
don't you mix everything with vanilla.js?
15:10
@Luggage No, I'm reffering to the plain DOM Api for vanilla interaction
Isn't everything already mixed with vanilla js?
Hm, I don't get how you cancel jobs... node-agenda looks like it's backed by mongodb so seems a little more straight forward to re-reference jobs
Well I just explained so not exactly what I' meant.
"I'm mixing React with" Dom api*
@OliverSalzburg Looks similar to github.com/ncb000gt/node-cron
15:13
@BenFortune It is. I don't know why I chose schedule back then
It had a pretty nasty DST-related bug, which was kind of disappointing to say the least :P
Does a hidden div have no width?
But it's supposedly fixed now. So, yay
crl
crl
!!> var a=[1,2,3]; a._a=[2,1,3]; [...a,...a._a]
@crl "1,2,3,2,1,3"
@OliverSalzburg they had one around the same time too lol
Well, that last commenter did at least.
15:16
@corvid are you looking for a scheduler or a full-blown job queue?
because all of those libraries are for scheduling callbacks in-memory
@ssube Basically, a user needs to receive a text twice a day, and have the capability to reschedule it or cancel it
if you want jobs, you want something like bull or the equivalent of Quartz
@ssube Kue works nice.
ok, so you use something like later to kick off the "look up people who should be texted" every hour or so, then use bull to add those users to the job queue and actually send the messages
@BenFortune I think I tried that against Bull and didn't like it much
It's pretty heavy tbh.
15:19
this bull library kind of looks like it's for long-running tasks, no?
@corvid not at all
@BenFortune it has some cool features. I'll have to check it out again.
@ssube you got a moment?
@SterlingArcher no
(but actually yes)
._.
I don't think I'm redis'ing properly
So, overview - I want players to be stored in redis like: key : [array of Players]. The key is the game ID, but since each player is on a different session, will they all be added to the same redis thing? I'm getting an empty array atm.
store each player separately
15:22
What?
store the game as an array of player IDs or keys
game-1: [1, 9, 15, 24, 45], player-1: {x: 3, y: 2, etc}, player-9: {...}
I'm getting old and boring, I had to be reminded that my birthday is tomorrow
redis makes small r/w super fast
give them an ID when they join a game and the player only needs to write that player record from there on. Nesting hashes in arrays will be annoying, at best.
What methods would you do that in? Right now I'm using rpush and lrange
client.exists("game", (err, reply) => {
	//add player in game to redis
	if (reply !== 1) client.rpush(["game", socket.request.player], (err, reply) => {
		if (err) throw err;
	});
});
Right now I'm trying like this, but I guess that's hash storage
I would use a slightly higher-level redis client
also, if you go with IDs, make sure your game is a set
pushing an item to a set that already exists is idempotent
15:25
You would do something like..
client.sadd(["game-id", arrayOfPlayerIds, ArrayOfPlayerObjects], callback);?
Why does fetch throw an instance of TypeError when it can't connect the server ?
It makes it harder to properly handle the error...
Brave is so slow and buggy as fuck.
Slower than the average electron app.
1/22
Does the fact that fetch throws an instance of TypeError look as a but or not to you ?
@SterlingArcher client.sadd(`game-${id}`, thePlayerWhoJustLoggedIn)
add and remove when somebody joins/leaves a game
> A fetch() promise will reject with a TypeError when a network error is encountered, although this usually means permission issues or similar [...]
15:29
And that's just their ID, not their object
@SterlingArcher right
the player object would be a hash under player-N
redis is all about small objects, this isn't some giant mongo document
That part I don't quite get. Is the hash stored in the same game-id sadd?
Or is it in another redis key
another key
a game is a set of players, a player is a hash of location, health, etc
And the game keys will give me access to the player hash
15:30
I feel like there is almost never a reason to not use const... when do people use let?
@corvid when the value will be modified
@SterlingArcher you get the game set, then get each player, combine them into an array, and send it down to the client
user3119231
you know that you can enable timestamp option in console settings?
if you want to be dumb about it (which should work for your load)
user3119231
every console.log will be displayed with time
15:31
@littlepootis Yes but why ? This doesn't match the description of the TypeError
@ssube I think that makes sense. I'll give that a shot!
Thank you sir
just don't be dumb about your load all the time
Remember: condoms are webscale
Pft who uses condoms
no idea
> I wouldn't trust Sterling to pull out of a driveway...
user1596138
15:34
lmfao
@SterlingArcher When does that actually happen, when using mostly functional programming?
Beats me lol
@corvid FP should only need const. When you have branches, you might need let.
Oh okay, I guess I just use mostly functional
Typically you can take the branch and move it to a function and use return, but sometimes that's just silly.
15:39
@ssube lol
@ssube What do branches have to do with it?
/cc @SterlingArcher
user3119231
user3119231
muhahaha >:-) (added a nose to make it more realistic)
let foo; // not sure what foo will be
if (otherThing) {
  foo = 1;
} else {
  foo = notOtherThing();
}
which can be refactored into a method
15:41
@Maurice serially downvotes
@Denys My guess is that because ES has very few native Error types specified, all errors related to file permissions, network errors are thrown as TypeErrors (because they very loosely fit the description).
@littlepootis it has one Error type
user3119231
0
Q: how to create a toggle div with form button submit and display error on same div?

kenn<div id="butontogle"> this div is toggled by button <form> <input type="text" name="username"> <input type="password" name="password"> <button type="submit" name="submit">Submit</button> <button type="reset">Cancel</button> </form <?php echo $erormsg; ?> </div> When th...

user3119231
dafuck? Am I the only one who understands train station?
client.sadd(["game-1", socket.request.session.player.id], reply);
client.sadd(["player-set-1", socket.request.session.player], reply);

client.smembers("game-1", replyWithLog);
client.smembers("player-set-1", replyWithLog);
15:42
@ssube pls
@ssube much cleaner
thank you!
@Abhishrek ping ping what time tonight ping
How's 7?
@ssube const foo = otherThing ? 1 : notOtherThing();
@littlepootis Probably (or maybe because it's implementation spec leaking, see ReadableStream here) but it's still lame to not have proper errors.
which is how FP tends to work
15:43
@KendallFrey ternaries are worse than let IMO
@SterlingArcher too early
how about 8 ?
@ssube I didn't realize we were talking about best practice
That's too late D:
Wat ?
what are you like 3 ?
oh wait nevermind, I figured
@KendallFrey I'm always talking about best practices. Never real code. :P
15:44
I have to get potential emergency shit for the storm and get ready for work :(
getting told by an indian with tubular ears
> tubular ears
user3119231
tubala rasa*
!!> kendallFreysDad
I don't have my rental, so I'd have to uber home, then uber back out, then back home
15:45
@Abhishrek "ReferenceError: kendallFreysDad is not defined"
user1596138
@SterlingArcher Aren't you "Mr Public Transportation"
@ton.yeung trasiva
user1596138
You used to never drive anyway :P
user3119231
@ton.yeung @Trasiva
@jhawins I was, but there's no bus between work and where I live now
I moved remember lol
15:46
@ssube yeah this Later thing works perfectly well with a bit of restructuring of my application, thanks for the help
user3119231
@corvid love your picture :D
caw caw
@SterlingArcher Lets have a call at 7
@ton.yeung No, he's there
I still have to do the "business presentation" ;-)
15:47
@DenysSéguret JavaScript error messages never make sense anyway
and we were planning to do that at 6:30 - 7
Oh god that's going to be fun lol
If you can make it at like 7:30 I can do that
Leave around 8:30 and still have time to do my nightly stuff
@SterlingArcher I will call you at 7:15
Kewl, I'll be at the bar waiting
if I do not call, that means you need to check emergency
rooms
okay ? // just kidding
@SterlingArcher ping me with the place again.
15:49
lol ok
you can't just check emergency rooms around DC
not only are there like 500, you'll get shot
I am going to go buy a baseball helmet and kevlar now, see you!
um
well then
have fun
@ssube do I need to JSON.stringify my objects before saving in redis? My reply is just [ 'object Object' ]
It looks like a string
@SterlingArcher probably yeah
15:52
depends on your client
I'd create a method on the Player and Game to do that
toRedis()
and a static method fromRedis() to hydrate them again
Good idea
@ton.yeung that's how toString is defined for Object. You can override it (super useful, print out a summary of the object)` and/or provide a toJSON type method.
@ssube let {foo = notOtherThing()} = [otherThing];
I will abuse destructuring where ever possible :D
toRedis would be a simple object (POJSO), toJSON is the stringified toRedis, toString is a formatted summary
that's not as useful in JS as Java or something
@OliverSalzburg just got around to watching it
how the fuck is putting someone under 10g's "humane"
:P
15:59
more humane than electric chair
@ton.yeung that's not quite right. You're better off not using nested objects.
Nested objects are bad in a full-blown document database
like, they screw mongo royally, because of how they change size

« first day (1923 days earlier)      last day (3250 days later) »