open All Channels
seplocked EVE Technology Lab
blankseplocked Carebearing Statistics for Corporation
 
This thread is older than 90 days and has been locked due to inactivity.


 
Pages: [1] 2 3

Author Topic

Mikk36
Caldari
Posted - 2011.04.07 11:59:00 - [1]
 

Edited by: Mikk36 on 03/05/2011 12:16:39
Here's my iteration on carebearing statistics.
Information is pulled from the Corp Wallet Journal API, so a Full API key is required with sufficient permissions to access corp wallet journal.

Requirements: PHP 5 and MySQL

Download link
Google Code

Installation Guide:
Import data from carebear.sql to your database
Configure settings in configuration.php
Set up cron script to pull data at most every 30 minutes (*/30 * * * *)

Sample page: http://carebeardemo.mikk36.eu
Username: carebear
Password: demo

Donations are welcome as usual Smile

Baron Holbach
Gallente
Ammo and Tag
Posted - 2011.04.07 12:42:00 - [2]
 

Edited by: Baron Holbach on 07/04/2011 12:42:51
"beta" tester reporting in Cool

nice script, full-ajax, mikk has learned for my mistakes - his code is improved (vs my orginal ratter) also this actually seems nice for eys not only informative...

i like it :P

Squizz Caphinator
Woopatang
Posted - 2011.04.07 13:02:00 - [3]
 

Please include some data with your demo.

Mikk36
Caldari
Posted - 2011.04.07 13:08:00 - [4]
 

Edited by: Mikk36 on 07/04/2011 13:37:56
Originally by: Squizz Caphinator
Please include some data with your demo.
It's on the todo list.

Edit:
Modified script a bit, everything runs off the public folder now, so installation should be easier, and possible into a subfolder anywhere.

Database also gained a new table.
In case you already had data inserted, here's the sql code for it:
CREATE TABLE `croncheck` (
`id` int(11) NOT NULL,
`timestamp` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Kiree Chancel
Phantom Squad
Posted - 2011.04.10 20:11:00 - [5]
 

Edited by: Kiree Chancel on 10/04/2011 20:27:32
Ran into a bit of a problem with your cron.php

My host doesn't allow file_get_contents()

I've been trying to get it to work with curl instead, but with limited success. I'll post here if i can make some working code :)

Mikk36
Caldari
Posted - 2011.04.11 08:52:00 - [6]
 

Originally by: Kiree Chancel
Edited by: Kiree Chancel on 10/04/2011 20:27:32
Ran into a bit of a problem with your cron.php

My host doesn't allow file_get_contents()

I've been trying to get it to work with curl instead, but with limited success. I'll post here if i can make some working code :)
Updated cron.php to use cURL.

Nathan WAKE
Caldari
Osiris Entreprises
Posted - 2011.04.12 21:28:00 - [7]
 

Hi Mikk36,

Looks very nice on your demo site.

But on my installed version, the little "circle timer" goes on and on and on, and I never get any data... Either that, or a direct "No matching records found" when I modify the "host" part in 'mysql://username:password@host/database'.

I've tried both on a local site (with wamp) and on a live site. Curl is enabled, configuration.php set with all what's needed (I think) and my API key is a full one with sufficient permissions.

Any ideas ? Did I miss something ?


Nathan WAKE
Caldari
Osiris Entreprises
Posted - 2011.04.12 21:44:00 - [8]
 

Little precision :

I tested my API Key with the https://api.eve-online.com/corp/WalletJournal.xml.aspx?userID=myuserID&apiKey=myAPiKey&characterID=mycharID URL and got the journal OK.


Mikk36
Caldari
Posted - 2011.04.12 22:52:00 - [9]
 

If you only get the loading animation, then either the connection information provided in the DSN is incorrect or you haven't imported all the SQL data properly.
If you have access to Firebug extension or equivalent that shows the data from the AJAX response, you can propably find the answer there.
The API key does not matter in that part, since only the cron script uses that to import new entries to the wallet.
If you want, I could check out the page myself, send me access details in evemail in that case.

MrDrugs IGotMoney
Posted - 2011.04.13 01:42:00 - [10]
 

'Could not fetch data '

Director api user id and char id are set in the config file . not sure what the problem is

No07
Posted - 2011.04.13 06:53:00 - [11]
 

Edited by: No07 on 15/04/2011 06:27:29
Edited by: No07 on 13/04/2011 10:24:57
Very nice work, thanks for sharing.

I run it on a low-end server (1.2ghz atom cpu, 1gig ram) and the loading times are a bit slow.

Also, on the timeline there is a second, flat line. What is that showing? It seems redundant.

Update, the flat line is removed when using a timezone that does not have daylight saving, for example iceland.

7

Mikk36
Caldari
Posted - 2011.04.13 07:42:00 - [12]
 

Originally by: MrDrugs IGotMoney
'Could not fetch data '

Director api user id and char id are set in the config file . not sure what the problem is
"Could not fetch data" means that PHP could not get any data back from the API.
Have you tried both cURL and file_get_contents? (UseCURL setting in the config)
Originally by: No07
Very nice work, thanks for sharing.

I run it on a low-end server (1.2ghz atom cpu, 1gig ram) and the loading times are a bit slow.

Also, on the timeline there is a second, flat, line. What is that showing? It seems redundant.

7
Screenshot of that second flat line?
As for performance, it's mainly limited by the speed that the database queries are executed. I host it myself on a 2.33Ghz C2D E6550.

I have also updated the zip package. It contains some mine adjustments in the cron script, which were made to make the API fetching a bit more reliable and an additional column for a region on the last tab.

Nathan WAKE
Caldari
Osiris Entreprises
Posted - 2011.04.13 19:13:00 - [13]
 

Hello Mikk36

One thing I did not notice at first try : there was an error in the SQL syntax for creating the table "journal" (probably due to my version of MySQL : 5.0.32).

Instead of :


UNIQUE KEY `refID` (`refID`) USING BTREE,
KEY `date` (`date`) USING BTREE,
KEY `refTypeID` (`refTypeID`) USING BTREE

I had to write :

UNIQUE KEY refID USING BTREE (refID),
KEY date USING BTREE (date),
KEY refTypeID USING BTREE (refTypeID)

That created the table OK. (had to delete the 'rats' table first because of the foreign key constraint and recreate it after the 'journal' table)

Then I used the firebug extension to get the script and got the same result than on your page.


I think I'll accept your proposal and send you the address and details IG, so that you can have a look by yourself. I'm sorry for the fuss and I'm pretty sure it's nothing. But that "nothing", I can not put my hands on Confused

No07
Posted - 2011.04.14 06:28:00 - [14]
 

See my above post for link to image.

After updating to your latest cron.php version i get an import error. It seems that curl doesn't work as smoothly as the other variant. Disabling curl works fine.

Tes La
Amarr
Imperial Academy
Posted - 2011.04.14 18:03:00 - [15]
 

Edited by: Tes La on 14/04/2011 18:03:22
i have a while cron.php running:
Call to a member function RecordCount() on a non-object in
help pls

Kyle Cook
Posted - 2011.04.14 18:43:00 - [16]
 

Hi,

Imported the data - successful
Configured configuration.php file - successful
manually ran the cron.php file - failed

Quote:
<br />
<b>Warning</b>: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Unknown MySQL server host 'host' (1) in <b>/home/vtec/domains/vt-ec.co/public_html/cbear/adodb5/drivers/adodb-mysql.inc.php</b> on line <b>365</b><br />
Connection failed


Also, I might be being stupid but what are the default logins and where do you administer users (if thats a feature) I cant find anything about these details anywhere.

Thanks

Nathan WAKE
Caldari
Osiris Entreprises
Posted - 2011.04.14 19:03:00 - [17]
 

Hmmm, now that's embarrassing.Embarassed

Sorry Mikk36, your app works perfectly, I was just assuming that logging in was enough for updating the data.

I ran the "cron.php" and it works now.

My mistake.

Great app, and ISK donation on the way, you deserve it.

Cheers.

Nathan

Mikk36
Caldari
Posted - 2011.04.14 19:27:00 - [18]
 

Originally by: Tes La
Edited by: Tes La on 14/04/2011 18:03:22
i have a while cron.php running:
Call to a member function RecordCount() on a non-object in
help pls
What's the rest of the error?
Originally by: Kyle Cook
Hi,

Imported the data - successful
Configured configuration.php file - successful
manually ran the cron.php file - failed

Quote:
<br />
<b>Warning</b>: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Unknown MySQL server host 'host' (1) in <b>/home/vtec/domains/vt-ec.co/public_html/cbear/adodb5/drivers/adodb-mysql.inc.php</b> on line <b>365</b><br />
Connection failed


Also, I might be being stupid but what are the default logins and where do you administer users (if thats a feature) I cant find anything about these details anywhere.

Thanks
Fixed the config file in the zip
The auth setting is the one that specifies username and password combos.
The SQL setting is the DSN one in the config where you specify all four parts of the SQL setting: username, password, host and database name.

Tes La
Amarr
Imperial Academy
Posted - 2011.04.15 02:10:00 - [19]
 

with new-cron file:


Notice: Undefined property: Configuration::$DebugCron in /www/htdocs/carebears/cron.phpon line 160

Fatal error: Call to a member function RecordCount() on a non-object in /www/htdocs/carebears/cron.php on line 140

Mikk36
Caldari
Posted - 2011.04.15 05:59:00 - [20]
 

Edited by: Mikk36 on 15/04/2011 06:03:04
Originally by: Tes La
with new-cron file:


Notice: Undefined property: Configuration::$DebugCron in /www/htdocs/carebears/cron.phpon line 160

Fatal error: Call to a member function RecordCount() on a non-object in /www/htdocs/carebears/cron.php on line 140
The configuration file was also updated at that point.
It also seems that you don't have the croncheck table in your SQL server, look up the code from one of my previous posts in this thread. It's also included in the static_1 sql file.

Kari Trace
Caldari
Nox Imperium
Posted - 2011.04.19 05:40:00 - [21]
 

I may be over looking this as its pretty late atm but...

I've successfully gotten everything installed on a WAMP stack and even cron.php executing via task scheduler...

Enter my problem, whats the default log in data?

Mikk36
Caldari
Posted - 2011.04.19 08:45:00 - [22]
 

Originally by: Kari Trace
I may be over looking this as its pretty late atm but...

I've successfully gotten everything installed on a WAMP stack and even cron.php executing via task scheduler...

Enter my problem, whats the default log in data?
/**
* Valid logins for auth
* @var array
*/
public $Auth = array(
'username' => 'password'
);

Kari Trace
Caldari
Nox Imperium
Posted - 2011.04.19 11:38:00 - [23]
 

Edited by: Kari Trace on 19/04/2011 11:44:31
Doh! Functioned as expected.
So I am able to log in, everything looks nice, Characters shows data, Daily Graph looks awesome, everything after that is loading...possibly bad db? Reloaded it. Ideas?

Side note: the server is a pretty beefy machine so that is probably not an issue, plus I let it sit for 5mins with no change...

Mikk36
Caldari
Posted - 2011.04.19 13:34:00 - [24]
 

Edited by: Mikk36 on 19/04/2011 13:34:48
Originally by: Kari Trace
Edited by: Kari Trace on 19/04/2011 11:44:31
Doh! Functioned as expected.
So I am able to log in, everything looks nice, Characters shows data, Daily Graph looks awesome, everything after that is loading...possibly bad db? Reloaded it. Ideas?

Side note: the server is a pretty beefy machine so that is probably not an issue, plus I let it sit for 5mins with no change...
I'd check the AJAX response form the server with Firebug or equivalent (Google Chrome's Developer Tools, IE's Developer tools etc).
The other option is to provide me with access so that I can take a look myself.

Tes La
Amarr
Imperial Academy
Posted - 2011.04.19 17:15:00 - [25]
 

Its working!!!
Perfect!

But.. how i can collect statistic from two or three corp in one DB?:)

Kari Trace
Caldari
Nox Imperium
Posted - 2011.04.19 18:54:00 - [26]
 

Should have checked that, plus you stated that above as well.
JSON returns the array of data...ah here it is:

Fatal error: Call to a member function FetchRow() on a non-object in C:\xampp\htdocs\ni\handler.php on line 553

From my quick research it's to deal with the ADOdb binding variables...
(source: http://www.webdeveloper.com/forum/showthread.php?t=179835)

I've got a few ideas, you?

Kari Trace
Caldari
Nox Imperium
Posted - 2011.04.20 05:12:00 - [27]
 

Ok, I think I could the issue. No error tolerance when the tables (and conversely the rows) are not present in the db. I dumped the db and reinstalled it using all 3 SQL files in order. All ran correctly.
I then edited the corn.php as needed, ran is via the CLI: no errors.
Annnd, all was well. Just a point for clarity: When installing run ALL the SQL files, IN ORDER, before checking the application for functionality.

Now that it all works, looks nice man. BTW, where'd you learn PHP?

Mikk36
Caldari
Posted - 2011.04.20 06:50:00 - [28]
 

Originally by: Tes La
Its working!!!
Perfect!

But.. how i can collect statistic from two or three corp in one DB?:)

I haven't written in such functionality specifically.
If you're not seeking for differentiation between corps (it doesn't store the corporation for characters in the DB), then it would propably work with multiple configuration files for seperate cron files.
Just set up the config files for each cron file and modify then the cron file for each corp to include that specific corp config.
Making the cron script support multiple entries would not be that hard, would just have to modify the configuration for the API credentials and then create a loop for multiple entries in the cron.
Originally by: Kari Trace
BTW, where'd you learn PHP?
Everything has been learnt the hard way: following the PHP documentation line by line.

Kari Trace
Caldari
Nox Imperium
Posted - 2011.04.20 11:33:00 - [29]
 

Originally by: Kari Trace
BTW, where'd you learn PHP?
Everything has been learnt the hard way: following the PHP documentation line by line.


Thats how you do it! Props to you buddy; kep up the good work.

Mikk36
Caldari
Posted - 2011.04.20 12:27:00 - [30]
 

Originally by: Mikk36
Originally by: Tes La
Its working!!!
Perfect!

But.. how i can collect statistic from two or three corp in one DB?:)

I haven't written in such functionality specifically.
If you're not seeking for differentiation between corps (it doesn't store the corporation for characters in the DB), then it would propably work with multiple configuration files for seperate cron files.
Just set up the config files for each cron file and modify then the cron file for each corp to include that specific corp config.
Making the cron script support multiple entries would not be that hard, would just have to modify the configuration for the API credentials and then create a loop for multiple entries in the cron.
Agh, just remembered what was the thing from stopping me doing it that as easily and smoothly: One would need to add another column to the journal table for checking the latest refID for that particular corporation.


Pages: [1] 2 3

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only