Script Registry -- for script authors; track your script usage

fronobulax

Developer
Staff member
Everything working fine on the back end? I seem to recall a couple php errors going by. I've been trying to register a URL but it doesn't seem to show up in the report. Ditto with a couple users. Some output below.

Checking for updates (running Script Registry ver. 1.7)...
Running Script Registry version: 1.7 (current)
Registering Winterbay for 'ManageAlice.ash'...
Success! Winterbay is now registered as a user of your 'ManageAlice.ash' script.
Registering Asturia for 'ManageAlice.ash'...
Success! Asturia is now registered as a user of your 'ManageAlice.ash' script.
Deleting processed mail...
2 messages deleted.
Printing report...
Script Registry report for fronobulax: 7 scripts, 31 users.

Followed by this report that doesn't seem aware that ManageAlice just picked up two users.
Script Registered URL? Users
DCQuest.ash 3/13/10 yes 12
alice.ash 5/25/11 yes 12
DC2Wiki.ash 7/12/11 no 1
DCPrune.ash 7/18/11 no 4
AliceNoPull 11/21/11 no 1
Stuffies.ash 12/23/11 no 1
ManageAlice.ash 3/22/12 no 0

Thanks.
 

Theraze

Active member
For fun, check if alice.ash is registered with your new URL and users. This could be the same bug I was seeing when trying to unregister The Sea and register TheSea.ash in post 97 here.
 

Bale

Minion
zarqon, please reassure me that you haven't completely lost the database of script registrations!

Obviously your site is messed up right now and I'm sure that you are busy fixing it. What troubles me is not my current inability to register new users, but the fact that it won't display the users that have already been registered.
 

zarqon

Well-known member
What?! I didn't even know this was happening until I saw your message just now. Maybe the data file got too big or something. Or maybe someone uploaded something evil, on purpose or accidentally. I'll start investigating this tonight.

If it is a data file corruption of some sort, since my host does nightly backups the worst case is that I would revert to the last uncorrupted data file and some registrations would be lost.

Ugh. I hate when code that has worked for years breaks without me doing anything. I'm more used to breaking it myself -- which often gives me a clue how to fix it. I hope I commented my code enough. ;)
 

zarqon

Well-known member
Yes, because the variable which should have been holding all the data was empty.

I have so far figured out that it's a file size problem. The unserialize() function which I was using to easily load all the data into a nice nested array structure evidently can't handle strings larger than 100000 bytes (which the data file has recently become). I'll need to find an alternative to serialization -- and I'll probably also need to revert to earlier data, since the present serialized data file evidently can't be unserialized.

Blargh!
 

Bale

Minion
Since you suddenly cannot help diving into the database, I was wondering if you'd be willing to add a feature. I always wanted to be able to click on a user's name and see a page listing all the other scripts that he is using.
 

bumcheekcity

Active member
Yes, because the variable which should have been holding all the data was empty.

I have so far figured out that it's a file size problem. The unserialize() function which I was using to easily load all the data into a nice nested array structure evidently can't handle strings larger than 100000 bytes (which the data file has recently become). I'll need to find an alternative to serialization -- and I'll probably also need to revert to earlier data, since the present serialized data file evidently can't be unserialized.

Blargh!

This sounds like an interesting way of handling it. How are you currently managing the database structure, if you don't mind my asking?
 

zarqon

Well-known member
It's just a single big PHP array, which I save as a flatfile using serialize(), and load using unserialize(get_file_contents()), for great simplicity.

So far as I can tell, json_encode() does not have the 100KB string wonkiness, so I'll try that instead, perhaps also with gzip compression, to push the problem far into the future. A time when I will be smarter, more available, and bursting with mental coding energy.
 

Bale

Minion
Please!

I don't want to sound like I'm pressuring you out of a sense of increasing panic, but HELP! My kMail inbox is bursting and I'm afraid it will take a small part of the Kingdom with it when it blows!
 

Bale

Minion
Yeah, these notifications are pretty annoying without them being deleted on login. I never noticed that :D

When I first started scripting I experimented briefly with the notification feature. Then I promptly stopped using it until zarqon created this registry script. This script is the only thing that turns notification into a feature.

If zarqon doesn't fix it soon, I'm going to have to write a script that copies the registrations into a map and saves them as a file and deletes the originals. Or maybe you could write that script since I don't have the time right now. We can read from the mapfile into his registry later when he fixes it.

Pretty soon our combined kMail boxes will blow and destroy the Kingdom's post office if we don't take such action.
 

Bale

Minion
I can't find my towel and my kMail inbox is now over 200 messages! How can I keep from panicking without a towel!1!! How's it going zarqon? Is this likely to be solved in another day or two?
 

bumcheekcity

Active member
Zarqon, any word on an ETA - I don't want to push or anything, but I might need a contingency plan if it's going to be long.
 

zarqon

Well-known member
Sorry, all -- I haven't even been able to play my main in the last week (aside from some simple automated turn-burning), much less think about coding anything. Where does the time go? Sigh.

I'll put this at the top of the list for tomorrow, though. Tomorrow, if I'm unable to fix it properly in time, I'll simply remove the data file and you'll have to re-register your scripts to successfully parse your kmails. Then, when I do fix it properly, I'll merge all the old data back in.

That would be a pretty big hassle though (for me more than you, even), so hopefully I can just figure out how to recover the data properly tomorrow when I have some time to look at it.

EDIT: Blah, my experimenting got me locked out of the server again. I'm probably my host's only client who does any sandboxing -- I'd dare say all of his clients are running CMS's or static pages -- and if they aren't, they're not interested in anything they'd have to develop themselves -- so he runs a tight ship, security-wise. This is actually the third time I've gotten my own IP blocked, hehe.

Since the ball is now in his court before I can proceed with fixing this, I'll give you a hackish temporary workaround.

PHP:
import <zlib.ash>

string inbox = visit_url("api.php?for=scriptregistry&what=kmail&count=100&format=json");
string[int] inbits = split_string(inbox,"\\{");
if (count(inbits) == 1) vprint("Inbox is empty.",0);
foreach n,t in inbits
   if (!contains_text(t,"\"message\":\"I have opted to let you know that I have chosen to run ")) remove inbits[n];
if (count(inbits) == 0) vprint("Inbox contains no notifications.",0);
inbox = "["+join(inbits,"{");
// 1) as a relay script: write(inbox);
// 2) to save to text: string[string] blah; blah['1']=inbox; map_to_file(blah,"myfilename.txt");

That's some test code from the rewrite. My plan is for the server-side half of the Script Registry to accept your entire inbox in JSON format, thus enabling the Registry to do all its stuff in a single server hit rather than one hit per kmail. So, for ease of use once the script is operational again, you can use the above code to get your inbox into the format which will be submitted by the ASH script. Then, when it's rewritten and working, it will be very easy to plug back into the Registry when it's rewritten.

By the end of the above code, the inbox variable contains the string which will be submitted to the server. If you save that info on your computer, you can delete all the notification kmails without fear of notifications being lost.
 
Last edited:

Bale

Minion
Did you know that visit_url( "api.php?for=scriptregistry&what=kmail&format=json" ) will only provide the most recent 10 messages? That's seriously weird since I would have expected 11. What is up with that? Is this a recent change?
 

bumcheekcity

Active member
Code:
> call scripts\test.ash

[{{"id":"113951775","type":"normal","fromid":"1485019","azunixtime":"1340084051","message":"I have opted to let you know that I have chosen to run <relay_bumcheekascend.ash>. Thanks for writing this script!","fromname":"Arminas","localtime":"06\/19\/12 06:34:11 AM"},{"id":"113950937","type":"normal","fromid":"2258681","azunixtime":"1340080466","message":"I have opted to let you know that I have chosen to run <snapshot.ash>. Thanks for writing this script!","fromname":"sleightmind","localtime":"06\/19\/12 05:34:26 AM"},{"id":"113950891","type":"normal","fromid":"2258681","azunixtime":"1340080350","message":"I have opted to let you know that I have chosen to run <bumcheekascend.ash>. Thanks for writing this script!","fromname":"sleightmind","localtime":"06\/19\/12 05:32:30 AM"},{"id":"113950839","type":"normal","fromid":"2231313","azunixtime":"1340080199","message":"I have opted to let you know that I have chosen to run <snapshot.ash>. Thanks for writing this script!","fromname":"mondemon","localtime":"06\/19\/12 05:29:59 AM"},{"id":"113949096","type":"normal","fromid":"2138164","azunixtime":"1340076350","message":"I have opted to let you know that I have chosen to run <snapshot.ash>. Thanks for writing this script!","fromname":"Parastra","localtime":"06\/19\/12 04:25:50 AM"},{"id":"113948945","type":"normal","fromid":"2256546","azunixtime":"1340075727","message":"I have opted to let you know that I have chosen to run <snapshot.ash>. Thanks for writing this script!","fromname":"Transmogro","localtime":"06\/19\/12 04:15:27 AM"},{"id":"113948742","type":"normal","fromid":"99232","azunixtime":"1340074629","message":"I have opted to let you know that I have chosen to run <snapshot.ash>. Thanks for writing this script!","fromname":"RICKErscotT","localtime":"06\/19\/12 03:57:09 AM"},{"id":"113948093","type":"normal","fromid":"677767","azunixtime":"1340071773","message":"I have opted to let you know that I have chosen to run <bumcheekascend.ash>. Thanks for writing this script!","fromname":"mute21","localtime":"06\/19\/12 03:09:33 AM"},{"id":"113948076","type":"normal","fromid":"1868500","azunixtime":"1340071651","message":"I have opted to let you know that I have chosen to run <snapshot.ash>. Thanks for writing this script!","fromname":"trOubLefacE","localtime":"06\/19\/12 03:07:31 AM"}]

That's what it gives me. I have about six pages of messages - is that what I'd expect?
 

bumcheekcity

Active member
Also, zarqon, I have some free hosting I could give you if you need. It's full reseller hosting, so it's pretty much like paid.
 
Top