On Mon, May 21, 2012 at 1:17 PM, Simon Schick <simonsimcity@xxxxxxxxxxxxxx> wrote: > Hi, Rene > > I took a quick look over your code ... > > I kind-of like the idea having all logging at one place, but the code is a > bit too messy if you ask me :) > If you would have put it on github and I would fork it - the first thing I'd > do is trying to get rid of the hm-lib and rewriting all in a bit more > object-oriented style, but that's just personal taste ;) > Specially the function rajmvServiceLog_graphs_raphael_calculateData() with a > code of ca. 280 lines is quite long ... 280 lines is long?! :) > Additionally I think that setting an error-handler who's just returning > false is not a good way. Why not disable error-handling or write code that > produces no errors? returning false in an error handler means "do the default error handler plz".. > > I think it would be good to mention that you're using the library adodb > (http://adodb.sourceforge.net/) and sitewide_rv (is it > that? http://mediabeez.ws/) or am I guessing wrong? > > You're talking about a sql-file ... has my anti-virus-program removed > something here? Could have, I did include it as an attachment in my OP. > > Please don't see that as destructive critic, but as hints what I would do if > I get to do with this code. I don't think your words are destructive criticism ;) > > Bye > Simon Yes, this rajmvServiceLog is tied into other components of mine that I've opensourced at http://mediabeez.ws And I agree it's not perfect yet by any standard.. hm.php is used for it's memory-efficient json encoding routines, to write out the results without building up a large text string with json_encode(). I'm not inclined to make the PHP code object oriented at this time, but once released I would allow anyone to OOP it. I will OOP the javascripts though. I also don't think I'm going to host my opensourced code (including this analytics code) on github, I put out a .zip on http://mediabeez.ws instead, but you can still fork as far as I'm concerned. I often develop new code that updates older components in the package, and maintaining forks on github seems like a bit of a headache to me.. But I'll gladly incorporate improvements made by others back into my own code base, with credits of course. > > On Mon, May 21, 2012 at 12:46 PM, rene7705 <rene7705@xxxxxxxxx> wrote: >> >> Hi. >> >> I wasn't happy with the fact that Google Analytics doesn't record many >> of the hits on my sites, so I decided to roll my own analytics >> software, and opensource it. >> It's now in a state where I can request early comments. >> You can view a demo at http://mediabeez.ws/stats (under construction, >> may fail at times) (browser compatibility may be an issue, I built it >> with chrome, should work in firefox too, but won't (ever) in IE.) >> If you click on the graph while the details for a given day are >> visible, you will see the errors for that day in a DIV below the >> graph. >> >> Normally you'd hide the error details and $hits for anyone's who's not >> registred as a developer, of course. I've turned it on for all at the >> moment, so you can comment on that feature and review my results array >> $hits. >> >> I've opted, for simplicity of design, to store all settings I thought >> could be remotely interesting in a mysql db (see attached sql init >> file) (which is filled from PHP every time a page is delivered, and >> again from JS when the page has initialized fully, or does a HTML5 >> History API location.href change), and then use PHP to retrieve all >> rows for a given datetime-range, and do the totals calculations in a >> php loop. >> I'm only keeping 1 row from the db in memory at any given time, but >> I'm building up a large deep array with the totals information in the >> php loop that goes over the rows. >> I'm wondering if this is a good approach, though. Maybe I should let >> the totals be calculated by the mysql server instead. >> >> I was thinking to let the totals calculations stay in php, and be >> executed from a cron job every hour. Only for the current month would >> you need to re-calculate every hour. >> I haven't figured out yet how to for instance only re-calculate the >> last hour, store results per hour, and then calculate the day and >> month totals from that "hourly cache" data when needed. >> I don't have a clue about how big companies do their totals >> calculations (for sites that get way more hits than mine, which is >> something i'd like to be able to support with my own analytics code), >> and would like to know how big companies do this. >> >> I've included the relevant draft code as attachment files to this >> mail, for your review. Please let me know if I have forgotten to >> include relevant code.. >> >> As always, thanks for your time, >> Rene >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php