Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
rene7705 hat am 23. Mai 2012 um 14:55 geschrieben: > And please explain what you mean by "no log is loaded". No graph? No > $hits under "structure" tab, no $errors under same tab? As I wrote the mail to the list no tab had anything to display. Now it's working. No idea what changed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
rene7705 hat am 23. Mai 2012 um 14:46 geschrieben: > you're right, and i'm putting it on the top of my todo list. > > i take it you were referring to project_hd_root, or anything else as well? Yes. Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Wed, May 23, 2012 at 2:17 PM, ma...@behnke.biz wrote: > > > rene7705 hat am 23. Mai 2012 um 13:51 geschrieben: > >> I think I'll leave it untouched for a few days >> (http://mediabeez.ws/stats/ and > > > 404 on > http://mediabeez.ws/stats/code/libraries_rv/rajmvServiceLog-1.0.0/ajax_makeLogEntry.php?rajmvServiceLog_initialID=212.48.107.10__1337775183&project_hd_root=/var/chroot/home/content/69/8082269/html/sites/mediabeez.ws/stats/ > > Seen in firebug. No log is loaded. That 404 is also on my todo list, and will get fixed together with removal of project_hd_root from html or js output. And please explain what you mean by "no log is loaded". No graph? No $hits under "structure" tab, no $errors under same tab? This morning I fixed an error in the tabs component that was causing the entire app to fail sometimes. But you saw it after that update probably.. > > I know that you are not into optimizing bandwidth, but over 4 MB of image > data is a killer. It's entirely un-optimized at the moment, but I'll replace the tab page buttons with 70k instead of 2.5mb worth of art soon.. Easier than eating pie ;) > > Could you seperate you log api code from jquery? Currently it is delivered > in one file. Makes it hard to read. I thought putting many scripts in 1 call was the right thing to do. But you can also call .../get_rajmv_javascript.php?want=animatedJavascriptWidgets and .../get_rajmv_javascript.php?want=rajmvServiceLog to get the log api js code in a seperate file. Or, you can just search for "rajmv.serviceLog =" in the get_rajmv_javascript.php call that I use on the demos now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
rene7705 hat am 23. Mai 2012 um 13:51 geschrieben: > I think I'll leave it untouched for a few days > (http://mediabeez.ws/stats/ and 404 on http://mediabeez.ws/stats/code/libraries_rv/rajmvServiceLog-1.0.0/ajax_makeLogEntry.php?rajmvServiceLog_initialID=212.48.107.10__1337775183&project_hd_root=/var/chroot/home/content/69/8082269/html/sites/mediabeez.ws/stats/ Seen in firebug. No log is loaded. I know that you are not into optimizing bandwidth, but over 4 MB of image data is a killer. Could you seperate you log api code from jquery? Currently it is delivered in one file. Makes it hard to read. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Wed, May 23, 2012 at 10:17 AM, rene7705 wrote: > On Wed, May 23, 2012 at 10:09 AM, ma...@behnke.biz wrote: >> >>> my windowze dev box is completely frozen at startup now, before even >>> mounting the drive that had the slow write rate today. booted into >>> ubuntu which is still responsive, and ran disk utility to see that >>> smart status and self-check for both system drive and the other drive >>> that i noticed going slow today, is "good". >>> I wonder what's gotten my dev box ill.. Hope it aint a virus, but >>> can't start the virus scanner coz the thing is frozen... :S >> >> >> I guess that is the reason why your dev system is slow ;) >> > Well it's very strange. My system unfroze itself yesterday night, the > drive in question can copy a 100mb file at regular speedy speeds with > windows explorer, but writing 45mb of html to a file using (thousands > of) fwrite() calls takes about 10 minutes (bit slow to say the least). > The same fwrite()ing code on my hosted server, with nearly as much > html to write out, works comfortably fast as well. > > I'm very puzzled. Would appreciate any tips to test my home system further.. Forwarded to wampserver forums; http://forum.wampserver.com/read.php?2,84673,84673#msg-84673 Could have been the wampserver going haywire somehow yesterday... not a virus, coz virusses don't generally stop messing with you once they've started to, hehe. Anyways, I'd like to return to the point of my OP, which is to get some end-user feature requests for my analytics code. I think I'll leave it untouched for a few days (http://mediabeez.ws/stats/ and http://skatescene.biz/sites/mediabeez.ws/stats) to give ya'll a chance to view it without me introducing errors during more dev of my own. I've kinda run out of ideas, besides ofcourse serving slightly different stats and graphs for non-developer viewers, and the error details only to developers. That one's obvious. And another obvious one, I also think that plugging in location software by http://www.maxmind.com/app/geolitecity will be a good idea, altho I'd probably opt to work with their data in a sql table rather than the faster php mod that they offer, coz we can't use that from shared hosting (I think, plz correct me if I'm wrong). But maybe you can throw me some not so obvious ones to include in this free analytics software ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Wed, May 23, 2012 at 10:09 AM, ma...@behnke.biz wrote: > >> my windowze dev box is completely frozen at startup now, before even >> mounting the drive that had the slow write rate today. booted into >> ubuntu which is still responsive, and ran disk utility to see that >> smart status and self-check for both system drive and the other drive >> that i noticed going slow today, is "good". >> I wonder what's gotten my dev box ill.. Hope it aint a virus, but >> can't start the virus scanner coz the thing is frozen... :S > > > I guess that is the reason why your dev system is slow ;) > Well it's very strange. My system unfroze itself yesterday night, the drive in question can copy a 100mb file at regular speedy speeds with windows explorer, but writing 45mb of html to a file using (thousands of) fwrite() calls takes about 10 minutes (bit slow to say the least). The same fwrite()ing code on my hosted server, with nearly as much html to write out, works comfortably fast as well. I'm very puzzled. Would appreciate any tips to test my home system further.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
> my windowze dev box is completely frozen at startup now, before even > mounting the drive that had the slow write rate today. booted into > ubuntu which is still responsive, and ran disk utility to see that > smart status and self-check for both system drive and the other drive > that i noticed going slow today, is "good". > I wonder what's gotten my dev box ill.. Hope it aint a virus, but > can't start the virus scanner coz the thing is frozen... :S I guess that is the reason why your dev system is slow ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Tue, May 22, 2012 at 3:31 PM, ma...@behnke.biz wrote: > > > rene7705 hat am 22. Mai 2012 um 15:23 geschrieben: > >> Seems to be the writing of the html+json data to a file that's causing >> the delay on my dev server. >> >> Doing the totals calculation on my dev server for 3500 records takes >> about 2.5 seconds, with the old code. >> Will soon see how long it takes with the refactored code of today. >> >> Anyone got a clue about why a few ten thousand calls to fwrite() will >> slow down a wampserver so much?... > > Maybe the hdd is not caching properly and is constantly writing and > re-arranging the data? > Is your hdd a bit to much fragmented? > my windowze dev box is completely frozen at startup now, before even mounting the drive that had the slow write rate today. booted into ubuntu which is still responsive, and ran disk utility to see that smart status and self-check for both system drive and the other drive that i noticed going slow today, is "good". I wonder what's gotten my dev box ill.. Hope it aint a virus, but can't start the virus scanner coz the thing is frozen... :S > Just 2 guesses. > > >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > Marco Behnke > Dipl. Informatiker (FH), SAE Audio Engineer Diploma > Zend Certified Engineer PHP 5.3 > > Tel.: 0174 / 9722336 > e-Mail: ma...@behnke.biz > > Softwaretechnik Behnke > Heinrich-Heine-Str. 7D > 21218 Seevetal > > http://www.behnke.biz > > -- > 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
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
rene7705 hat am 22. Mai 2012 um 15:23 geschrieben: > Seems to be the writing of the html+json data to a file that's causing > the delay on my dev server. > > Doing the totals calculation on my dev server for 3500 records takes > about 2.5 seconds, with the old code. > Will soon see how long it takes with the refactored code of today. > > Anyone got a clue about why a few ten thousand calls to fwrite() will > slow down a wampserver so much?... Maybe the hdd is not caching properly and is constantly writing and re-arranging the data? Is your hdd a bit to much fragmented? Just 2 guesses. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Tue, May 22, 2012 at 2:54 PM, rene7705 wrote: > On Tue, May 22, 2012 at 12:32 PM, rene7705 wrote: >> On Tue, May 22, 2012 at 2:32 AM, tamouse mailing lists >> wrote: >>> On Mon, May 21, 2012 at 7:31 AM, rene7705 wrote: On Mon, May 21, 2012 at 1:17 PM, Simon Schick wrote: > Specially the function rajmvServiceLog_graphs_raphael_calculateData() > with a > code of ca. 280 lines is quite long ... 280 lines is long?! :) >>> >>> In general, yes. 280 lines is long. Too long, likely. Usually it >>> indicates you aren't designing your code in a top-down fashion, and it >>> is a high candidate for refactoring in order to break out into >>> reusable functions. A rule of thumb is no more than 50 lines per >>> function, most much less. Back in the day when we didn't have nifty >>> gui screens and an 24 line terminals (yay green on black!), if a >>> function exceeded one printed page, it was deemed too long and marked >>> for refactoring. >> >> Well, I split up that long function into several new functions (using >> pass-by-reference) this morning.. >> Problem is, now it won't work anymore due to memory consumption errors! :( >> >> I'd love to know what I'm doing wrong here. >> >> Demo at http://skatescene.biz/sites/mediabeez.ws/stats >> Code is attached to this mail. > > hmm, this might actually be an issue with my dev webserver... it's > taking 400mb of memory and over 10 minutes to process just 3500 > records. > My live hosting does 2200 records in 64M of memory and significantly less > time.. > > I'll keep digging. Seems to be the writing of the html+json data to a file that's causing the delay on my dev server. Doing the totals calculation on my dev server for 3500 records takes about 2.5 seconds, with the old code. Will soon see how long it takes with the refactored code of today. Anyone got a clue about why a few ten thousand calls to fwrite() will slow down a wampserver so much?... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Tue, May 22, 2012 at 12:32 PM, rene7705 wrote: > On Tue, May 22, 2012 at 2:32 AM, tamouse mailing lists > wrote: >> On Mon, May 21, 2012 at 7:31 AM, rene7705 wrote: >>> On Mon, May 21, 2012 at 1:17 PM, Simon Schick >>> wrote: Specially the function rajmvServiceLog_graphs_raphael_calculateData() with a code of ca. 280 lines is quite long ... >>> >>> 280 lines is long?! :) >> >> In general, yes. 280 lines is long. Too long, likely. Usually it >> indicates you aren't designing your code in a top-down fashion, and it >> is a high candidate for refactoring in order to break out into >> reusable functions. A rule of thumb is no more than 50 lines per >> function, most much less. Back in the day when we didn't have nifty >> gui screens and an 24 line terminals (yay green on black!), if a >> function exceeded one printed page, it was deemed too long and marked >> for refactoring. > > Well, I split up that long function into several new functions (using > pass-by-reference) this morning.. > Problem is, now it won't work anymore due to memory consumption errors! :( > > I'd love to know what I'm doing wrong here. > > Demo at http://skatescene.biz/sites/mediabeez.ws/stats > Code is attached to this mail. hmm, this might actually be an issue with my dev webserver... it's taking 400mb of memory and over 10 minutes to process just 3500 records. My live hosting does 2200 records in 64M of memory and significantly less time.. I'll keep digging. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Mon, May 21, 2012 at 4:40 PM, Matijn Woudt wrote: > On Mon, May 21, 2012 at 2:31 PM, rene7705 wrote: >> On Mon, May 21, 2012 at 1:17 PM, Simon Schick >> 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?! :) > > I haven't had a good look at your code yet, but let me comment on this > one anyway. > 280 lines is long. Take any big project, Linux kernel > (http://lxr.linux.no/linux), Wine (http://source.winehq.org), or an > large PHP project, for example Drupal, and you'll probably only find a > few functions that 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".. > > Why are you setting the error handler then? Are you trying to override > an error handler set by other scripts? > Yea, I have an error catcher component (http://mediabeez.ws/products/logAndHandler) that's used by all my code by default, that was misbehaving during development of this analytics code, so I bypassed it for now. >> >>> >>> 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. > > The mailing list probably removed it. You should never send > attachments to a mailing list, instead host them somewhere on the web > and link to it. I think there's a 2 attachments limit per mail sent to this list. > >> >>> >>> 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. > > Note that OOP is not always the best way to go. Haven't taken a close > look at the source so can't comment. I agree. Some OOP adds unnecessary complexity to code.. Other OOP is sweet :) > >> >> 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. >> > > Putting it on github makes it easier for people to have a look at your > code before deciding on using it or not. If you're only putting it > there, you don't have to worry about forks because they don't have > anything to do with your repo, that's up to the people who fork it. > Putting it on github will increase the popularity, and will probably > also make developers want to 'upgrade' your code. It's up to you. Ok, I'll start putting it on github starting with the next release then (may be a few weeks).. > > A few other comments: > - Maybe you should think about another name? rajmv.. is not easy to remember. It's my initials, I don't want to change it, and for the js rajmv.* components you can do var easierName = rajmv; > - You're formatting is confusing, for example function names. They > start with lowerCamelCase, and then you go on underscore_formatting.. Yea, that's my coding style and I don't want to change it, sorry. > - in json_encode_*, there's probably a better way to write > if ( > $c == ' ' || > $c == '"' || > $c == "'" || > > you could use in_array with a predefined array for example. > - Why do you have atleast 4 large encode functions? If you really need > 4 different, then you might want to think about moving shared code to > sub functions and call them instead of duplicating so much code > (especially the large if statements look ugly being duplicated
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Tue, May 22, 2012 at 2:32 AM, tamouse mailing lists wrote: > On Mon, May 21, 2012 at 7:31 AM, rene7705 wrote: >> On Mon, May 21, 2012 at 1:17 PM, Simon Schick >> wrote: >>> Specially the function rajmvServiceLog_graphs_raphael_calculateData() with a >>> code of ca. 280 lines is quite long ... >> >> 280 lines is long?! :) > > In general, yes. 280 lines is long. Too long, likely. Usually it > indicates you aren't designing your code in a top-down fashion, and it > is a high candidate for refactoring in order to break out into > reusable functions. A rule of thumb is no more than 50 lines per > function, most much less. Back in the day when we didn't have nifty > gui screens and an 24 line terminals (yay green on black!), if a > function exceeded one printed page, it was deemed too long and marked > for refactoring. Well, I split up that long function into several new functions (using pass-by-reference) this morning.. Problem is, now it won't work anymore due to memory consumption errors! :( I'd love to know what I'm doing wrong here. Demo at http://skatescene.biz/sites/mediabeez.ws/stats Code is attached to this mail. <> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Mon, May 21, 2012 at 7:31 AM, rene7705 wrote: > On Mon, May 21, 2012 at 1:17 PM, Simon Schick > wrote: >> Specially the function rajmvServiceLog_graphs_raphael_calculateData() with a >> code of ca. 280 lines is quite long ... > > 280 lines is long?! :) In general, yes. 280 lines is long. Too long, likely. Usually it indicates you aren't designing your code in a top-down fashion, and it is a high candidate for refactoring in order to break out into reusable functions. A rule of thumb is no more than 50 lines per function, most much less. Back in the day when we didn't have nifty gui screens and an 24 line terminals (yay green on black!), if a function exceeded one printed page, it was deemed too long and marked for refactoring. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
I see that the sql file didn't come through to the web archive of this list, so I'm posting it in-message here once more, for those interested; drop table if exists rajmvServiceLog; create table rajmvServiceLog ( id integer not null AUTO_INCREMENT, initial_id varchar(250), php_remote_addr varchar(20), php_time integer, php_referrer longtext, php_request_method varchar(10), php_script_filename longtext, php_script_name longtext, php_self longtext, php_request_uri longtext, php_query_string longtext, php_get_vars longtext, php_post_vars longtext, php_cookie_vars longtext, php_http_host longtext, php_http_connection varchar(250), php_http_user_agent longtext, php_http_accept varchar(250), php_http_accept_encoding varchar(250), php_http_accept_language varchar(250), php_http_cache_control varchar(250), php_http_accept_charset varchar(250), php_server_name varchar(250), php_server_addr varchar(20), php_server_port varchar(10), php_server_software varchar(250), php_context_json longtext, php_error_json longtext, js_location_href longtext, js_location_hash longtext, js_time integer, js_milliseconds_since_init_of_page integer, js_date_time_txt varchar(250), js_referrer longtext, js_screen_width integer, js_screen_height integer, js_browser_width integer, js_browser_height integer, js_error_message longtext, js_error_url longtext, js_error_line integer, primary key (id) ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Mon, May 21, 2012 at 2:31 PM, rene7705 wrote: > On Mon, May 21, 2012 at 1:17 PM, Simon Schick > 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?! :) I haven't had a good look at your code yet, but let me comment on this one anyway. 280 lines is long. Take any big project, Linux kernel (http://lxr.linux.no/linux), Wine (http://source.winehq.org), or an large PHP project, for example Drupal, and you'll probably only find a few functions that 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".. Why are you setting the error handler then? Are you trying to override an error handler set by other scripts? > >> >> 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. The mailing list probably removed it. You should never send attachments to a mailing list, instead host them somewhere on the web and link to it. > >> >> 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. Note that OOP is not always the best way to go. Haven't taken a close look at the source so can't comment. > > 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. > Putting it on github makes it easier for people to have a look at your code before deciding on using it or not. If you're only putting it there, you don't have to worry about forks because they don't have anything to do with your repo, that's up to the people who fork it. Putting it on github will increase the popularity, and will probably also make developers want to 'upgrade' your code. It's up to you. A few other comments: - Maybe you should think about another name? rajmv.. is not easy to remember. - You're formatting is confusing, for example function names. They start with lowerCamelCase, and then you go on underscore_formatting.. - in json_encode_*, there's probably a better way to write if ( $c == ' ' || $c == '"' || $c == "'" || you could use in_array with a predefined array for example. - Why do you have atleast 4 large encode functions? If you really need 4 different, then you might want to think about moving shared code to sub functions and call them instead of duplicating so much code (especially the large if statements look ugly being duplicated 4 times) - If you want people to comment on code, please be so kind to remove any unused commented code. Hope this helps, Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
On Mon, May 21, 2012 at 1:17 PM, Simon Schick 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 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
Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)
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 ... 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? 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? Please don't see that as destructive critic, but as hints what I would do if I get to do with this code. Bye Simon On Mon, May 21, 2012 at 12:46 PM, rene7705 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 >