Hacker Timesnew | past | comments | ask | show | jobs | submit | lep's commentslogin

I have written a lua interpreter in JASS (the language used for WarCraft 3 maps). It's useless because at that point WC3 gained native lua support.


I haven't looked too closely yet so please excuse me for asking this question but how dynamic can i make the timed events? I have two use-cases in mind:

1. I would like to run a task each day 30 minutes before dawn so i have to compute that time at some point.

2. I run a task normally every hour but if something happens i want to run it 20 minutes after that event.


Given the "before dawn" constraint here I'm going to assume this is somehow related to home/building automation, in which case you should go look at Home Assistant, which has built in support for things like "do this every hour, or 20 minutes after device X was triggered" and indeed "do this 30 minutes before sunrise".


Well it's a mixed bag. The dusk/dawn stuff would just be like nice-to-have. I would like to be reminded 30m before dawn to for example walk the dog while the sun is _just_ still out. The other for example could be used for handling "social" events. Like some games only happen during evening hours where i check more often than in off-hours but if any game happens whenever i would like to handle it after the regular game time.

Now, nothing of that would be too hard to implement myself but these task runners pop up every so often and i would like to leverage other peoples work. Home assistant just feels a bit big for this. Do note that i currently do neither of those but i always try to evaluate these use-cases for these task-runners.


Celery supports solar scheduling, though it's not obvious how you would do +/- some time from the solar event. You would probably need to extend their implementation, but I don't think that would be too hard.

https://docs.celeryq.dev/en/stable/reference/celery.schedule...

EDIT: I think you just need to provide a nowfun that offsets datetime.now() by the desired timedelta.


https://sunrise-sunset.org/api

I used this myself for my father's chicken coop, it's quite easy to use.


Thanks but computing the time aint the hard part (modules are available for many languages). I'm more interested in how easy it is to fit this task into the scheduler.


Well, unless you like running in rain you'd have to feed it weather info too.

On other side it would allow it to be fancy, like rescheduling it earlier if rain is close to the sunset


I'm not 100% sure, but take a look at the section on "Manipulating Other Tasks" https://rocketry.readthedocs.io/en/stable/cookbook/controlli... It seems like what you could do is have a task that runs at some regular interval which would compute the 30 minutes before dawn each day and then add the task with the correct start time directly on the rocketry.args.Session: session.create_task(func=before_dawn_task, start_cond=some_condition)


You can build arbitrary conditions (the example given is `file_exists`) that can run whatever code and only need to return True or False.

If you can write the condition in English, it would seem to me you can build a custom Rocketry condition to suit it.


For #2, you want an event driven scheduler that can coordinate between events.

We've built this at https://www.inngest.com. You can run functions based off of schedules or events, with things like "when this event happens, run 20 minutes after the event". Or, "run, wait for another thing to happen, then continue".

Event driven schedulers do all the regular scheduling, but with a few benefits:

- It's reactive

- You can fan-out, so one event runs many functions

- You can store all events for debugging, replay, local testing, typing, etc.

We could plumb in an event source for #1 which indicates sunrise and sunset. Heh.


Nice project and good looking page. Just fyi but the "s" in "background jobs" is a bit cut off for me (Chrome on Pixel 6 Pro) https://ibb.co/42j18fk


Isn't it better to fetch dawn times everyday then set accordingly?


I'm also using fts5 for some small projects but i haven't looked too deeply into it so i'm wondering if you have any interesting insights. Like what kind of index/options do you use? Maybe the trigram index? And your "across boundaries" mode is just word* in fts syntax?


Yes. Acute observation. It’s actually two separate indexes. A trigram index for sub word searching. Word* is exactly right and the other is a Unicode61 index with porter stemming (also remove diacritics). Trigram tends to work well with abbreviations and such. Whereas porter works well for general searches.


Interesting. I might play around using two indexes and try to combine both search results. This could be nice for my less technical users.


I can only advise everybody to run your C program under OpenBSD. I maintain a tool which is probably run against million lines of code and which i tested under FreeBSD, Windows and Linux where it worked. But recently i ran it the first time under OpenBSD and it SEGFAULTed almost immediatly. Of course it was an error on my side. It was a beautiful experience.


ghci also gives you a list of names if it can't find the variable you typed wrong. I'm not certain but i assume they use Levenshtein aswell. I definitivly use Demarau-Levenshtein for the same feature in pjass.


GHC also uses Demarau-Levenshtein [0]. The fuzzy lookup function gets re-used for a couple places too (including whatever you encountered in GHCi).

[0]: https://github.com/ghc/ghc/blob/25977ab542a30df4ae71d9699d01...


No. We mostly played by the rules in wc3. Back in the day we used the so called return bug which years later was shown to be able to be used for arbitrary code execution. This was quickly fixed but we got new natives to account for this loss. [1] Not as long ago there was another bug found which could be abused to run arbitrary bytecode [2] but that again was fixed a patch or two later and nowadays i don't know of any way to run any non-jass/non-lua code. We mostly get changes in the natives provided by wc3 in newer patches which sometimes break backwards compability. [3]

[1]: https://en.wikipedia.org/wiki/JASS#Return_Bug_Security_Vulne...

[2]: https://www.hiveworkshop.com/threads/accessing-memory-from-t...

[3]: https://www.hiveworkshop.com/threads/1-28-x-era-versions-bre...


If you consider strings as list of characters you can abstract levenshtein to work on any two lists. For example i use this with list of types to provide a hoogle-like search for some programming languages stdlib. Ironically i don't know what hoogle actually uses but i think they atleast considered such an approach.


Geez, if only there were a protocol with as good encryption but federated so that everybody could host their own server which would make it way harder to block…

https://xmpp.org/extensions/xep-0384.html


Eh, you'd have to operate a server in the country, and TLS in and out of Egypt is MITMed and outright blocked in many areas from what I've seen when playing with VOIP over there.


At least they would have proper encryption within their country. Apparently, depending on central services outside their country makes it too easy to block.


Then you have to deal with regulations inside the country itself, I doubt its a free for all inside Egypt network wise.


E2E encryption via OTR would largely mitigate that as long as keys could be exchanged out of band.


If countries will block messaging services why do you think they won't raid / shut down servers?

I really don't understand the hating on Signal for not fulfilling all of everyone's use cases. There is an SMS/ MMS fork called Silence (available on F-Droid). If that's a feature users want they have an option.


Or just setup Tor and keep using whatever they were using before.


XMPP is really hard to scale. It's a very chatty protocol, with tons of XML overhead.



[citation needed]


Ofcourse if i (or anybody else) would write a chat protocol today i would make changes. But i'm not even sure if i would abandon xml. I'm in the same boat as you and think xml is too verbose and all that other stuff but i've recently programmed some xmpp projects and i came to the conclusion that xml actually realy does work well. And i didn't even use a library like sleekxmpp because i wanted to know everything. I'll just say: good luck designing something that'll be able to grow for 20 years and still work today. You can realy feel where the X in XMPP comes from.

I have to mention the Conversations people. For me they are a big reason why i use xmpp. It's not only the client which is very good, but the stuff like http-uploads fix some very real problems in very little amount of code.

Also once axolotl-xmpp works and prosody 0.10 is released i see no reason not to use xmpp honestly, which i will regardless, even if everybody uses something else (like WhatsApp) i will simply write myself a transport server and continue to use Conversations.

While i don't use it, projects like biboumi are realy cool. With a simple combination of biboumi[1] and httpuploadcomponent[2] you now can share files in irc-rooms.

I still have more to say. I hope that once i have my perfect chat-setup i will write about it.

[1]: https://github.com/louiz/biboumi [2]: https://github.com/siacs/HttpUploadComponent


I'm probably fighting windmills but here it goes: DotA did not start the AoS genre which is now called MOBA. In fact the first AoS map was the map Aeon of Strife, made for StarCraft. There were tons of AoS maps before and tons of AoS maps after DotA. But i agree when you say DotA mad the AoS genre popular even though there were other very well known AoS maps beside DotA (EotA, AotZ, DoE, ToB, AoS GT, etc.).


I think you're understating Dota's influence. Its predecessors were tiny blips in comparison. Dota professionalized the genre and had huge popularity, which was only limited by Blizzard's poor infrastructure and support. Many people wondered why Blizzard didn't embrace the mod that far surpassed the popularity of its own games (the answer is probably "WoW"). League of legends took it to the next level with the infrastructure the genre needed.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: