[PHP] Re: yaf modules and plugins

2012-05-22 Thread Eduárd Moldovan
Hey Laruence,

I have another question about YaF.
Does it have any automated input cleaning? Like getting rid of XSS tricks,
cleaning $_POST, $_GET?

Thx,
-- 
*Moldován Eduárd*
boxed.hu
e...@boxed.hu
+36 30 691 2 691
skype: edimoldovan


Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)

2012-05-22 Thread rene7705
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)

2012-05-22 Thread rene7705
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)

2012-05-22 Thread rene7705
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)

2012-05-22 Thread rene7705
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)

2012-05-22 Thread ma...@behnke.biz


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)

2012-05-22 Thread rene7705
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



[PHP] Differences between PHP on LAMP and PHP on Windows Servers

2012-05-22 Thread Gates, Jeff
Can anyone tell me what differences I might encounter by working with PHP on a 
Unix server verses working with PHP on a Windows server. We use Windows 
production servers here but many of us would like to get more LAMP environments.

So, I'm wondering if I can use the hive mind here to get a sense of the pros 
and cons of each platform.

Thanks.

Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Differences between PHP on LAMP and PHP on Windows Servers

2012-05-22 Thread Ashley Sheridan
On Tue, 2012-05-22 at 14:15 -0400, Gates, Jeff wrote:

> Can anyone tell me what differences I might encounter by working with PHP on 
> a Unix server verses working with PHP on a Windows server. We use Windows 
> production servers here but many of us would like to get more LAMP 
> environments.
> 
> So, I'm wondering if I can use the hive mind here to get a sense of the pros 
> and cons of each platform.
> 
> Thanks.
> 
> Jeff
> 


The first difference I'd point out is things like filenames and paths.
*nix systems are case sensitive, so script.php and Script.php are two
totally different files which can happily exist within the same
directory, whereas on a Windows system this isn't true. This can affect
anything from front-end assets (images, CSS, Javascript files, etc) to
PHP includes and even MySQL tables depending on how the database is
configured (it tends to create database files based on the name of the
DB and it's tables)

Also, the path separator is different. Unix/Linux uses a forward slash
and Windows uses a back-slash. While these can be interchanged quite
often without the world imploding, sometimes they just refuse to, so
it's best to ensure you're using the right one for the script. PHP has
several constants defined to help you which change depending on the
system PHP is currently being run on, you can find out more about them
at http://php.net/manual/en/dir.constants.php 

After that, you have file permissions. In Unix, you have file, owner and
group permissions; Windows has read/write permissions and I believe on
newer versions you can get something similar to what Unix/Linux has had
for the last however many years but I'm not 100% sure on that one.

There are differences with setting up PHP to send emails. On Windows I
believe you have to use SMTP, but on Linux you tend to use the internal
sendmail with the choice of SMTP if you wish.

In the main, I'd say that you want your production servers to mirror the
live ones as closely as possible. There have been plenty of times where
I've moved a script to a different machine and things have stopped
working because of a different version of PHP or MySQL was installed,
and you run the risk further if the OS is different too. When you're on
a deadline, the last thing you want is to have to debug something that
you know works just fine!

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP]How to handle E_ERROR,E_PARSE with a user defined function

2012-05-22 Thread Yuchen Wang
Hi all,

How to handle E_ERROR,E_PARSE with a user defined function ?

-- 
*Yuchen Wang*


[PHP] w.r.t. mail() function

2012-05-22 Thread Ashwani Kesharwani
Hi ,

I have a query w.r.t. mail() function in php.

I have hosted my site and i have created an email account as well.

when i am sending mail to different recipient from my php script using
above function it is getting delivered to respective recipients as expected.

However if I want to see those mail in the sent folder of my email account
, i can not see those mails there.

How can I achieve this.

Any suggestions.

Regards
Ashwani


RE: [PHP]How to handle E_ERROR,E_PARSE with a user defined function

2012-05-22 Thread admin
-Original Message-
From: Yuchen Wang [mailto:phob...@gmail.com] 
Sent: Tuesday, May 22, 2012 10:19 PM
To: php-general Maillist
Subject: [PHP]How to handle E_ERROR,E_PARSE with a user defined function

Hi all,

How to handle E_ERROR,E_PARSE with a user defined function ?

-- 
*Yuchen Wang*






I suggest you try 
http://www.php.net/set_error_handler



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] w.r.t. mail() function

2012-05-22 Thread admin
-Original Message-
From: Ashwani Kesharwani [mailto:ashwani.kesharw...@gmail.com] 
Sent: Wednesday, May 23, 2012 12:13 AM
To: php-general@lists.php.net
Subject: [PHP] w.r.t. mail() function

Hi ,

I have a query w.r.t. mail() function in php.

I have hosted my site and i have created an email account as well.

when i am sending mail to different recipient from my php script using above
function it is getting delivered to respective recipients as expected.

However if I want to see those mail in the sent folder of my email account ,
i can not see those mails there.

How can I achieve this.

Any suggestions.

Regards
Ashwani

-


You can change the settings of sendmail
http://www.devshed.com/c/a/Administration/Getting-Started-with-Sendmail/12/

OR
You can log text or database each email.
$query = "INSERT INTO mail_log (`subject`,`to`,`from`,`message`,`mail_date`)
values ('".mysql_real_escape_string( $subject )."',
'".mysql_real_escape_string( $to )."', '".mysql_real_escape_string( $from
)."', '".mysql_real_escape_string( $message )."', '".date("Y-m-d H:i:s")."')
";









-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php