[Utility] Collection Analysis

Discussion in 'Card Hunter General Chat' started by neoncat, Feb 1, 2014.

  1. The problem with PHP is that it is almost impossible to tell what went wrong if you aren't the system's administrator. You can't see the files before PHP has done its magic (okay, no problem here as I know the files very well) and the (error) log is also kept secret. All I can do is describe the symptoms and deduce what might have happened.

    To give you some hints:

    If you open up the Cheat Sheet, there are a bunch of links in there to showcase the different filters. Those links point to the "Card and Item Query" tool. If you click such links, the query tool opens and the filter you clicked on gets inserted into the top text-box. This is done by PHP-code working on url-parameters (the "?id=xx&gender=m"-like things) and everything is fine. Another working PHP-code example is the signature badge on the top of each page (the dark gray one with the forum-link). This html-segment is inlined from an XML-file that is available locally.

    In contrast, all (!) tools that rely on the game server's csv-files aren't working because while loading those pages from your server the PHP-preprocessor is recognizing the PHP-code segments, removes them but replaces them with nothing (instead of the csv-file's content). If the PHP-preprocessor isn't completely messed up, the error log should mention why it wasn't able to load those files from the game's servers (probably a firewall/network issue). And this should be true for every single time someone requests one of the utils' pages, meaning there should be hundreds of errors logged (and you can trigger them yourself by loading the collection analysis for example, such that you know which time-stamp to look for). If the logs are empty perhaps restarting PHP could help.

    The weird thing here is, that there was a version, where this all worked right. And since then, the tools haven't changed significantly (at least in this aspect). So, if you haven't reconfigured your PHP-environment, I can't tell why this came up (now). At least my PHP-(development-)environment (that hasn't changed since the first time I used it) was able to correctly parse all tools. Otherwise, the non-dev version archive would be broken, too.

    If everything else fails (and assuming that it is - unfortunately - very unlikely that there will be many new adventures, card and items in the future) you could use the non-dev versions for those that rely on the server files. They are relatively easy to spot because the references to server files are always the last thing in each tool (pm me, if I should provide you a list). Sticking to the dev-versions for the remaining tools would be preferable. But that would also mean that auto-updates aren't possible anymore, sadly.
     
    Sir Veza and ParodyKnaveBob like this.
  2. Blizzrd33

    Blizzrd33 Kobold

    Is this still a chance of being resurrected?
     
  3. Sir Veza

    Sir Veza Farming Deity

    The stand-alone (non-dev) version still works.
    Note: I had to use Firefox to get PHP to run. I tried Opera, Chrome, and Iron, but they just opened the PHP file for editing. Possibly a setup problem on my machine, but once I found a fix I didn't worry further. If you have the same problem, it might be your fix.
     
    Blizzrd33 and ParodyKnaveBob like this.
  4. Blizzrd33

    Blizzrd33 Kobold

    Thanks heaps for this, I also had tried other browsers with no success but have it working now with Firefox.
     
    Sir Veza likes this.
  5. Hey Blizzrd and probably others with the same question,

    I can understand that you would like to have the working tools back, but I'm not in the position to accomplish this. As far as I know (or think) the tool's code is perfectly fine and the problem is "somewhere" in the hosting. So if Stexe (or someone else) tells me that there is in fact some error in the tool's logic I'll fix them but until then I - as the tool's coder - am incapable of improving the current situation.

    You can always use the non-dev version - like Sir Veza said - but this obviously isn't the perfect solution either. For example you'll have no auto-updates there, too (sure, no big deal given that the last new item is several months old). But other aspects won't work either. And that the tools only work with Firefox proves me right to use and stay with Firefox for years now. ;)

    If someone else volunteers to host the tools on their site, I'll do my best to help with this as far as I can. But - honestly - I doubt that besides Stexe there will be someone else willing to - sorry for the term - waist bandwidth and memory for tools related to an almost dead game (at least this is my opinion but we'll see whether we get any sessional events (Birthday, Halloween, Christmas) this years, if not - again - I have very little hope).
     
    Sir Veza likes this.
  6. Sir Veza

    Sir Veza Farming Deity

    Have you tried it with any browsers other than Firefox? I understand not having too many browsers installed, which is why I use a portable copy of Firefox on an external drive to run your utils.
    Thanks again for your work!
     
  7. Thanks to not being a professional Web developer I have the option to choose my browser freely and I make use of this choice. I don't have/use IE and Edge as they are just not worth the time (I'm an adult and want to have options to configure stuff and want to visit any web pages without the browser telling me that Microsoft missed some browser features to properly display and run this particular page; at least this is the image those two have). I don't have Chrome because I never really trusted Google and have even recently stopped to use Google's web search most of the time. I do have Opera and use it because on my system flash runs a bit more smooth there sometimes. I don't even use an official Firefox anymore but a fork. And Safari is no real option to me simply because of Apple. And I don't try out every single one of the new browsers that come into existence, I guess no-one has this time.

    Therefore, I can tell that Opera should work (at least my old version 44 does when I drag and drop the index page into it). But given that the tools won't change much in the near future (at least I guess so) there is always the possibility to make the files more "browser-friendly": First, rename all files from ".php" to ".html". php-files are only in the root-directory and in one additional level so if you open a folder and don't see php-files, you don't have to go in any deeper. After that open every former php-file and replace all occurrences of ".php" with ".html". Notepad++ is capable of processing whole folder trees at once. After that what you got are proper web page formats and even double-clicking the index page should immediately open up your browser. In this stage every browser should behave correct.

    If you don't make use of the index page but load every tool directly from file, you could omit the second step and stop after renaming the files themselves. But be warned that clicking some links might cause error messages then.
     
    Last edited: Jul 18, 2019
    Sir Veza and nchan090124 like this.
  8. ParodyKnaveBob

    ParodyKnaveBob Thaumaturge

    Hm. I've never seen a browser choke on a file just for having the .php extension - and by never, I mean in the last couple decades where it's relevant, lol. I'll be interested to hear if that makes a difference for anyone.
     
  9. Sir Veza

    Sir Veza Farming Deity

    Renaming to html works for me.
    I should probably research the current Firefox forks. I used the mozilla based K-Meleon browser years ago because it was so customisable. ATM, Opera is my default, but I use portable versions of others in order to have a different browser for each of my four cardhunter accounts.
     
    ParodyKnaveBob likes this.
  10. ParodyKnaveBob

    ParodyKnaveBob Thaumaturge

    Priorities!

    (lol $X^ D )
     
  11. Drakkan

    Drakkan Ogre

    Sir Veza .. you should not rename PHP files .. you need to have a http server (like WAMP for windows, it has a folder "www" where you put that utils_20190525 folder) and then open your PHP files that are server (processed) by it ( go to chrome and open http://localhost/utils_20190525) and the tool will open and work
    I tried it on my laptop and all works fine..

    Best bet here is that Stexe removes that folder from his server and uploads everything from scratch .. I really doubt its a firewall as it worked a day before that upload .. so @Stexe , can you try to remove and upload tool again?

    EDIT. I just saw that dev version is the newer one with autoupdate feature .. that one works on my laptop as well.. btw, if the dev version doesn't work after Stexe reuploads it, he should upload the standalone version .. we aren't getting much new content anyways?
    Or someone else with hosting can upload the dev version..
     
    Last edited: Jul 20, 2019
    Sir Veza likes this.
  12. @Drakkan I appreciate that you have a running PHP-environment for the tools, but please don't suggest to others that this is the only feasible way to go. I won't mind if you tell others how to set it up (and for all others interesting to have auto updating tools locally, there are also other services that do the same, like XAMPP and please don't use this thread to discuss pros and cons of each such software, I just wanted to name XAMPP because it is probably the most widely used one and I've never heard of WAMP before ;) ) but as you said for Stexe, if the tools don't need future updates, then renaming and using them as static pages is just as good as using a local web server and you wouldn't even need another windows service running (and Windows is running a LOT of services without you making use of them, so why just start the next unnecessary one).

    Regarding your guess what went wrong with Stexe's page: please visit http://stexe.com/CardHunter/guides/custom-filter.php#Syntax and click on any of the example filters (e.g. the Boots-selector). The Card and Item Query tool that will open up has this filter inserted. If PHP wouldn't run at all, this won't be possible. So I doubt that the PHP-service was stopped completely.

    @Sir Veza I guess you have a good reason for running four browsers but the game runs fine with several accounts in different tabs/windows of the same browser. Technically you don't need a second browser. Although I admit, if Flash crashes in one tab, then all accounts are gone (at least for me). ATM, I run the (portable) Waterfox and I'm really happy with it. Don't know yet how it will perform, but I'm about to test Falkon (which - to be clear - is no Firefox fork) because of its simplicity.
     
    Sir Veza likes this.
  13. Drakkan

    Drakkan Ogre

    It's a misunderstanding.. I'm not suggesting that only feasible way is for everyone to install the app locally.. but SirVeza is my old friend, I know how much this tool means to him so I wanted to explain him that .php files shouldn't be opened by browser but put on server (local or remote) for processing and then opened on the way I suggested. And you can open them in any modern browser, that's not the issue.

    Also, PHP on Stexe's host works well, othervize this link (http://stexe.com/CardHunter/utils/collection-analysis.php) wouldn't open at all .. the issue is that
    PHP:
    file_get_contents('http://live.cardhunter.com/data/gameplay/Cards/Cards.csv')
    is not working for some reason (and the get equipment.csv isn't working as well) .. that part is an autoupdate feature that is getting files from servers .. but now it fails to get it and then tool doesn't have necessary data .. everything else works well

    At first I thought that this autoupdate was the change and guessed that's the reason its not working .. but now I see that previous dev version had the update as well.. can anyone describe which version was on stexe hosting befor this one? did it have an autoupdate? what was the change for this one?

    If the previous version had the autoupdate then this one should work (as the code is good) .. he then just needs to clear that Cardhunter folder on his hosting and re-upload everything.

    But if the previous version didn't have the autoupload ..then it will be tricky to debug, I guess its php config (
    allow_url_fopen = On
    allow_url_inclure = On)
     
    Last edited: Jul 20, 2019
    ParodyKnaveBob and Sir Veza like this.
  14. If you take into account that PHP-files don't loose their extension after being preprocessed by a PHP-environment this statement is a bit odd. The browser will at some point receive a PHP-file and display it. So why not open a local and already preprocessed PHP-file directly? But let's end this discussion here as we are mostly on the same track.

    And even without any PHP-setup a server can offer PHP-file for download so why shouldn't a browser be able to access any PHP-based tool when there weren't a PHP-environment? It's just a file that a browser wants to access, similar to any browser can load your account-avatar or any badges without the server having some jpg-based service running.

    I won't (again) look up the exact versions, but if you carefully read this thread you'll find them easily. What I can and will recall is the following:
    - Initially we (or I) had a version without auto-updates
    - Then I reintroduced them and Stexe hosted them
    - The previous version that Stexe had uploaded was again one without updates (he just picked the wrong archive)
    - At the moment we have again a version that should auto-update but doesn't.

    So you can see, the situation is a bit complex and I agree that I cannot really debug and fix without Stexe's help ;)
     
  15. A small addition: I haven't seen Stexe react at all in the near past and I don't want to tag him always because that won't help either, I guess. But if he isn't able to debug this properly for whatever reason (but would agree on one more upload of his server) I could create a version without auto-updates but with all other PHP-features working. As far as I have seen his server working, I expect this to solve all our current problems without loosing functionality except of course the auto-update.
     
  16. Drakkan

    Drakkan Ogre

    It might seem odd but browser actually never gets the PHP file .. it just sends requests on server, server does the processing and returns pure HTML/JSS/CSS to browser .. and that's what browser understands and uses to render a page.

    So we never had a working version with autoupdate? If that's the case, then it might be a PHP config that I said.. and I guess stexe doesn't have access to php config so we cannot really do anything there. Someone else might host it.

    Or we can upload a version without autoupdate.
    Or even better .. you can download those 3-4 csv files and put them into some folder .. then have a PHP looks for them there rather than on cardhunter servers.
    Then if we ever need an update, Stexe could download those 3-4 CSV files and overrite the old ones on his servers ..
     
    Sir Veza and ParodyKnaveBob like this.
  17. Sir Veza

    Sir Veza Farming Deity

    This sounds good to me. The csv files are simple to download. If we know which are needed, even I can explain the process to someone who has questions.
     
  18. The file still is named ".php" (just look at the URL!) but it doesn't contain any php-related code anymore. So technically, it's still php and it isn't at the same time. And exactly this is what the non-dev version is. If you rename them to html it's exactly what you claimed how it works, only that it is done manually (first preprocessed and then sent to browser as (renamed) html).
    This was the working version. And iirc, we even had several working versions.
    You know some?
    Isn't this exactly what I suggested?
    Yes, this was what I thought about to do! But technically this has no AUTO-update.
     
  19. Blizzrd33

    Blizzrd33 Kobold

    I just finished the Steam achievement, without the devs doing anything.
    Like you, I had found myself one short of the set of uncommons for a long time. The tools function said I had all 389 uncommons, but Steam didn't think I did.
    Then one day I won a chest and accidentally clicked take all instead of sell all, which I had meant to select.
    Turns out when at that moment I picked up my second copy of Opalesque Ornament (L13 Uncommon treasure), I got the achievement! Does not make any sense to me, but the other excess items I won were all common so it couldn't have been any of them.
    Just in case this helps you, I thought I'd post my experience.
     
  20. It was probably one of the common items, though, as we have agreed on in this thread already:
    I once knew where the information about the two post-release balance events were supposed to be found, but I haven't needed them for a while. If you want to know, I'd guess to search through the blog posts. But some cards got assigned a different rarity and hence, some items changed, too. The Steam achievements still use the out-dated item lists.

    Although, if you tend to play Card Hunter both via Steam and say Browser, Steam might have missed some drops and the award may actually be postpone until you find some item the second time. Like with the Loot Fairy. Even if you found it via Browser, Steam will only award you if you find it while playing via Steam. The collection achievements might work similarly that you don't get them immediately if you found the last missing item while playing via browser.
     

Share This Page