[PHP] Re: preg_match problem
Off the top of my head: /form[1-6]\.php/ AJ www.deployview.com [EMAIL PROTECTED] wrote: hi. I have to check if the script file belongs to any ov form1.php to form6.php files. Need something like: preg_match('/form*.php/', $_SERVER['PHP_SELF']) wher * kan be any number between 1 and 6. Thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match problem
I think this pattern would also match form16.php etc, which I think is not what afan wanted. Dave Goodchild wrote: On 21/08/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: hi. I have to check if the script file belongs to any ov form1.php to form6.php files. Need something like: preg_match('/form*.php/', $_SERVER['PHP_SELF']) wher * kan be any number between 1 and 6. Thanks for any help. the pattern is form[1-6]+\.php. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regex
If what you mean is a db table, then it would seem to me that you should not be using a regex. PHP has rawurlencode() for this sort of thing. But - you should learn regex ;-) Try something like (untested and late at night) function urlme($location) { $enc=rawurlencode($location); $spc=htmlspecialchars($location); return "$spc"; } AJ www.project-network.com www.deployview.com www.funkifunctions.blogspot.com M. Sokolewicz wrote: Nadim Attari wrote: Hello, I have some text in a table... the text contains hyperlinks (but not html coded, i.e. plain "Some text...http://www.something.com";) When i retrieve these texts from the table, i want the hyperlinks to become clickable, i.e. "Some text...href="http://www.something.com";>http://www.something.com" I know this sould be done using Regex, but i don't know regex. Any help (links, examples, etc) Thanks Nadim Attari You don't know Regex. Well, that's simple then, TRY to learn it. Noone will (or should) give you any answers if it's absolutely clear that you're not putting any effort into trying to find one yourself. "I know this should be done using Regex, but I don't know regex.", wouldn't you think it'd be a good idea to look up a tutorial somewhere or try to find out what this "regex" exactly is? Try to type regex in the php doc, see the notes for the various functions? really, a little more effort goes a long way. - tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overriding core functions
It may be possible to override the core function - I don't actually know. If you just define a new function with the same function it might work OK. The snag I see coming at you like a tonne of bricks is 'how do you call the original function once you have overridden it.'. This like like calling SUPER. in Java. AJ Peter Lauri wrote: Yes, that could solve it. However, my question was if I can override the core functions :) Similar that I can do Parent::myFunction() in a subclass, I want to do that, but with core functions :) -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 22, 2006 7:27 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Overriding core functions Peter Lauri wrote: Hi, I want to add some functionality when calling the mysql_query(): function my_query($Query) { //do stuff before mysql_query($Query); //do things after } // or something like: class PeteDB { var $conn; function PeteDB($db, $usr, $pwd, $etc) { $this->conn = mysql_connect($db, $usr, $pwd, $etc); if (!is_resource($this->conn)) die('db is useless'); // trigger_error() } function query($qry/*, $args*/) { // do stuff $r = mysql_query($qry, $this->conn); // do more stuff return $r; } } /* tada! hint: always use some kind of wrapper for things like db related functions (because it allows for stuff like this and, for instance, makes it alot easier to switch dbs - because you only have to change code in one place, not counting any db-specific sql floating around your app) */ This would just be for one project where I want to record all Queries and the result of them, creating an own logging function. I did a lot of Google, but no article that I found that take care of this subject. /Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Why small > big?
M Sokolewice got it nearly correct. However, the situation is a little more complex than he has discussed. The % compression figure for jpeg is translated into the amount of information stored in the reverse cosine matrix. The size of the compressed file is not proportional to the % you set in the compressor. Thus 100% actually means store all the information in the reverse cosine matrix. This is like storing the image in a 24 bit png, but with the compressor turned off. So at 100% jpeg is quite inefficient. The other issue is the amount of high frequency information in your images. If you have a 2000x2000 image with most of the image dynamics at a 10 pixel frequency, and you reduce this to 200x200 then the JPEG compression algorithm will 'see' approximately the same amount of information in the image :-( The reality is not quite as simple as this because of the way JPEG uses blocks etc, but it is an easy way of thinking about it. What all this means is that as you reduce the size of an image, if you want it to retain some of the detail of the original but at a smaller size, there will be a point at which 8 or 24 bit PNG will become a better bet. Clear as mud? AJ M. Sokolewicz wrote: I'm not quite sure, but consider the following: Considering the fact that most JPEG images are stored with some form of compression usually ~75% that would mean the original image, in actual size, is about 1.33x bigger than it appears in filesize. When you make a thumbnail, you limit the amount of pixels, but you are setting compression to 100% (besides that, you also use a truecolor pallete which adds to its size). So, for images which are scaled down less than 25% (actually this will prob. be more around 30-ish, due to palette differences) you'll actually see the thumbnail being bigger in *filesize* than the original (though smaller in memory-size) - tul P.S. isn't error_reporting( FATAL | ERROR | WARNING ); supposed to be error_reporting( E_FATAL | E_ERROR | E_WARNING ); ?? tedd wrote: Hi gang: I have a thumbnail script, which does what it is supposed to do. However, the thumbnail image generated is larger than the original image, how can that be? Here's the script working: http://xn--ovg.com/thickbox And, here's the script: imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output & Content type header('Content-type: image/jpeg'); imagejpeg($image_p, null, 100); /* end buffered output */ ob_end_flush(); ?> --- Thanks in advance for any comments, suggestions or answers. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & BEA Weblogic 8.
I agree that it is probably pretty non standard! You could write a bean to drive it using the java version of fcgi. But then the app server will hate you for ever as beans are not supposed to do things like open sockets etc. I am very very interested in why you want to do such a thing :-) AJ Andrew Kreps wrote: Given that Weblogic is an application server, I don't think you're going to have much luck. PHP is typically installed directly on the web server (Apache, or similar). On 8/20/06, BKruger <[EMAIL PROTECTED]> wrote: Could anyone please direct me to installation instructions for PHP on BEA Weblogic 8.1? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Where to download APC for windows?
At the risk of being flamed to death, I thought it was in ext in the standard windows distro. If it is not, I am stuffed if I can remember where I got it from (blush). AJ steve wrote: I used to have a bookmark on where to download APC for windows. Anyone have a link? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Why small > big?
mention is probably the discrete cosine transform (DCT) matrix where the x, y pixels of an image file have a z component representing color. From that you can translate the data into the frequency domain, which actually generates more data than the original. However, the quality setting is where you make it back up in compression ratio's by trimming off higher frequencies which don't add much to the data. Unlike the FFT, the algorithm does not address phasing, which I found interesting. However, the answer to my question deals with the quality statement. In the statement: imagejpeg($image_p, null, 100); I should have used something less than 100. I've change the figure to 25 and don't see any noticeable difference in quality of the thumbnail. It seems to me there should be a table (or algorithm) somewhere that would recommend what quality to use when reducing the size of an image via this method. In this case, I reduced an image 62 percent (38% of the original) with a quality setting of 25 and "see" no difference. I think this (the quality factor) is programmable. As for png images, I would probably agree (if I saw comparisons), but not all browsers accept them. I belive that at least one IE has problems with png's, right? tedd At 4:45 PM +0100 8/23/06, Alex Turner wrote: M Sokolewice got it nearly correct. However, the situation is a little more complex than he has discussed. The % compression figure for jpeg is translated into the amount of information stored in the reverse cosine matrix. The size of the compressed file is not proportional to the % you set in the compressor. Thus 100% actually means store all the information in the reverse cosine matrix. This is like storing the image in a 24 bit png, but with the compressor turned off. So at 100% jpeg is quite inefficient. The other issue is the amount of high frequency information in your images. If you have a 2000x2000 image with most of the image dynamics at a 10 pixel frequency, and you reduce this to 200x200 then the JPEG compression algorithm will 'see' approximately the same amount of information in the image :-( The reality is not quite as simple as this because of the way JPEG uses blocks etc, but it is an easy way of thinking about it. What all this means is that as you reduce the size of an image, if you want it to retain some of the detail of the original but at a smaller size, there will be a point at which 8 or 24 bit PNG will become a better bet. Clear as mud? AJ M. Sokolewicz wrote: I'm not quite sure, but consider the following: Considering the fact that most JPEG images are stored with some form of compression usually ~75% that would mean the original image, in actual size, is about 1.33x bigger than it appears in filesize. When you make a thumbnail, you limit the amount of pixels, but you are setting compression to 100% (besides that, you also use a truecolor pallete which adds to its size). So, for images which are scaled down less than 25% (actually this will prob. be more around 30-ish, due to palette differences) you'll actually see the thumbnail being bigger in *filesize* than the original (though smaller in memory-size) - tul P.S. isn't error_reporting( FATAL | ERROR | WARNING ); supposed to be error_reporting( E_FATAL | E_ERROR | E_WARNING ); ?? tedd wrote: Hi gang: I have a thumbnail script, which does what it is supposed to do. However, the thumbnail image generated is larger than the original image, how can that be? Here's the script working: http://xn--ovg.com/thickbox And, here's the script: imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output & Content type header('Content-type: image/jpeg'); imagejpeg($image_p, null, 100); /* end buffered output */ ob_end_flush(); ?> --- Thanks in advance for any comments, suggestions or answers. tedd -- 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] Re: Why small > big?
As I promised, here is the writeup with examples: http://nerds-central.blogspot.com/2006/08/choosing-file-format-for-small-web.html Cheers AJ tedd wrote: Alex: Excuse for top posting: You said: Clear as mud? Well actually, it's simperer than I thought. After your reply, I did some reading on jpeg and found it's simply a transform, not unlike FFT where two-dimensional temporal data is transformed from the time domain to the frequency domain -- very interesting reading. The reverse cosine matrix you mention is probably the discrete cosine transform (DCT) matrix where the x, y pixels of an image file have a z component representing color. From that you can translate the data into the frequency domain, which actually generates more data than the original. However, the quality setting is where you make it back up in compression ratio's by trimming off higher frequencies which don't add much to the data. Unlike the FFT, the algorithm does not address phasing, which I found interesting. However, the answer to my question deals with the quality statement. In the statement: imagejpeg($image_p, null, 100); I should have used something less than 100. I've change the figure to 25 and don't see any noticeable difference in quality of the thumbnail. It seems to me there should be a table (or algorithm) somewhere that would recommend what quality to use when reducing the size of an image via this method. In this case, I reduced an image 62 percent (38% of the original) with a quality setting of 25 and "see" no difference. I think this (the quality factor) is programmable. As for png images, I would probably agree (if I saw comparisons), but not all browsers accept them. I belive that at least one IE has problems with png's, right? tedd At 4:45 PM +0100 8/23/06, Alex Turner wrote: M Sokolewice got it nearly correct. However, the situation is a little more complex than he has discussed. The % compression figure for jpeg is translated into the amount of information stored in the reverse cosine matrix. The size of the compressed file is not proportional to the % you set in the compressor. Thus 100% actually means store all the information in the reverse cosine matrix. This is like storing the image in a 24 bit png, but with the compressor turned off. So at 100% jpeg is quite inefficient. The other issue is the amount of high frequency information in your images. If you have a 2000x2000 image with most of the image dynamics at a 10 pixel frequency, and you reduce this to 200x200 then the JPEG compression algorithm will 'see' approximately the same amount of information in the image :-( The reality is not quite as simple as this because of the way JPEG uses blocks etc, but it is an easy way of thinking about it. What all this means is that as you reduce the size of an image, if you want it to retain some of the detail of the original but at a smaller size, there will be a point at which 8 or 24 bit PNG will become a better bet. Clear as mud? AJ M. Sokolewicz wrote: I'm not quite sure, but consider the following: Considering the fact that most JPEG images are stored with some form of compression usually ~75% that would mean the original image, in actual size, is about 1.33x bigger than it appears in filesize. When you make a thumbnail, you limit the amount of pixels, but you are setting compression to 100% (besides that, you also use a truecolor pallete which adds to its size). So, for images which are scaled down less than 25% (actually this will prob. be more around 30-ish, due to palette differences) you'll actually see the thumbnail being bigger in *filesize* than the original (though smaller in memory-size) - tul P.S. isn't error_reporting( FATAL | ERROR | WARNING ); supposed to be error_reporting( E_FATAL | E_ERROR | E_WARNING ); ?? tedd wrote: Hi gang: I have a thumbnail script, which does what it is supposed to do. However, the thumbnail image generated is larger than the original image, how can that be? Here's the script working: http://xn--ovg.com/thickbox And, here's the script: imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output & Content type header('Content-type: image/jpeg'); imagejpeg($image_p, null, 100); /* end buffered output */ ob_end_flush(); ?> --- Thanks in advance for any comments, suggestions or answers. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ssl.
It would appear that the root of the page has not gone back to http. Is it possible that this is a one of those cases when two things get changed at once by accident? I would suggest downloading the IE developer's tool bar (or the firefox equivalent) and then when you get to the page you think should be http, but is sticking on https, view the DOM. By carefully going through the DOM there is a good chance that you will find that, for example, the PHP you have redirected to http is indeed running in a frame or some such. AJ João Cândido de Souza Neto wrote: Hy everyone. Since we change our ssl key from 128kb to a 256kb i notice that something´s going wrong. In my e-commerce, part is secure and part isn´t. when i join into the secure part of the site, everithing works fine. But, when the sale is finishes and my script run header("Location: http://www.?";) to exit from the secure part, the browser gives me a notice that some parts of the page i´ve been led to a non-secure region and ask me if i realy want to do that (it never had happened before). Thought i confirm by clicking in yes buttom, i doesn´t goes away from https. Now my question: Has some difference between 128kb e 256kb ssl key? There´s some way to fix it? Thanks a lot in advance for any tips... -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ssl.
João, Surely the issue is to find why it is not working now. Why it did work in the past is only of interest if you want to stop the problem re-occurring in the future. Thus, the correct approach is to find why it is not working now, fix it and then see if you can work out what has change between the past and now. It is just possible that changing the key length has resulted in a different connection encryption escalation process between the server and the client. I am a little rusty on this :-( However, if that is the case, I would suspect that what you are seeing is a bug that has always been there but did not show up before. This might revolve around which port is being used (as you can map both https and http to one port if you use escalation - or at least I seem to remember that is possible with TLS). In summary, find out what is broken now and all will be clear. To find out what is wrong now you should find out the exact structure of the returned page. Good luck AJ João Cândido de Souza Neto wrote: Nothing was changed at the code, just the ssl key was changed. Why it was working fine with the old ssl key? "Tim Traver" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] João Cândido de Souza Neto wrote: Hy everyone. Since we change our ssl key from 128kb to a 256kb i notice that something´s going wrong. In my e-commerce, part is secure and part isn´t. when i join into the secure part of the site, everithing works fine. But, when the sale is finishes and my script run header("Location: http://www.?";) to exit from the secure part, the browser gives me a notice that some parts of the page i´ve been led to a non-secure region and ask me if i realy want to do that (it never had happened before). Thought i confirm by clicking in yes buttom, i doesn´t goes away from https. Now my question: Has some difference between 128kb e 256kb ssl key? There´s some way to fix it? Thanks a lot in advance for any tips... João, This shouldn't have anything to do with the certificate. It most likely has to do with something being loaded on the exit page that is not secure. For example, if there is a hard coded link to an image, or an included javascript link to an outside source. If anything on the page is not secure, then you will get that error. Tim. -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ssl.
João, Please try and find out why it is not working now. Once you have that worked out, it will be much easier to find out what has changed. There are a few subtle methods by which changing the key length might interact with PHP. However, in general, PHP is not involved with the encryption of the socket. It will be near impossible to guess what might have gone wrong. It will be much easier to work it out once you know the structure of the page that is causing the trouble. AJ www.deployview.com João Cândido de Souza Neto wrote: Nothing was changed at the code, just the ssl key was changed. Why it was working fine with the old ssl key? "Tim Traver" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] João Cândido de Souza Neto wrote: Hy everyone. Since we change our ssl key from 128kb to a 256kb i notice that something´s going wrong. In my e-commerce, part is secure and part isn´t. when i join into the secure part of the site, everithing works fine. But, when the sale is finishes and my script run header("Location: http://www.?";) to exit from the secure part, the browser gives me a notice that some parts of the page i´ve been led to a non-secure region and ask me if i realy want to do that (it never had happened before). Thought i confirm by clicking in yes buttom, i doesn´t goes away from https. Now my question: Has some difference between 128kb e 256kb ssl key? There´s some way to fix it? Thanks a lot in advance for any tips... João, This shouldn't have anything to do with the certificate. It most likely has to do with something being loaded on the exit page that is not secure. For example, if there is a hard coded link to an image, or an included javascript link to an outside source. If anything on the page is not secure, then you will get that error. Tim. -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ssl.
Mourad, I think that you might have misread the original post. The snag appears not to be the leaving of a secure site. The snag is that root document is secure but some of the embedded urls (images, frames, iframes etc) are unsecured. Whilst this again is a standard warning, it is one that should be avoided at all cost as it scares the stuff out of customers! AJ www.deployview.com Mourad Boulahboub wrote: Hi João, this is the standard alert message from internet explorer. Because you go from https to http it get show up. This is no bug in your script or either in the certificate. Try it by surfing to a secure website (not yours) with https and then leave it by typining a non secured website into the browser. You will get the same alert message from internet explorer João Cândido de Souza Neto schrieb am 24.08.2006 22:26: Hy everyone. Since we change our ssl key from 128kb to a 256kb i notice that something´s going wrong. In my e-commerce, part is secure and part isn´t. when i join into the secure part of the site, everithing works fine. But, when the sale is finishes and my script run header("Location: http://www.?";) to exit from the secure part, the browser gives me a notice that some parts of the page i´ve been led to a non-secure region and ask me if i realy want to do that (it never had happened before). Thought i confirm by clicking in yes buttom, i doesn´t goes away from https. Now my question: Has some difference between 128kb e 256kb ssl key? There´s some way to fix it? Thanks a lot in advance for any tips... -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ssl.
My understanding is that the message said that the page had a mix of ssl and non ssl and that the root remained https. This root did not remain https before the key change. Mourad Boulahboub wrote: Hi Alex, Alex Turner schrieb am 25.08.2006 09:55: Mourad, I think that you might have misread the original post. The snag appears not to be the leaving of a secure site. The snag is that root document is secure but some of the embedded urls (images, frames, iframes etc) are unsecured. Whilst this again is a standard warning, it is one that should be avoided at all cost as it scares the stuff out of customers! this is the part the answer is depending on: But, when the sale is finishes and my script run header("Location: http://www.?";) to exit from the secure part, the browser gives me a notice this is also the part, that João get confused by ;) He says that everythign works fine until he leaves the secure site. Maybe the notice got shown before the change of the key to 256kb, and get accepted to not show again in the future. Now after the change the notice come again because it is a 256 key instead of 128kb. I don't know if IE makes a difference in that AJ www.deployview.com regards Mourad -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ssl.
You're right, but I am impatient ;-) :-) Best wishes - AJ Mourad Boulahboub wrote: Hi alex, Alex Turner schrieb am 25.08.2006 10:36: My understanding is that the message said that the page had a mix of ssl and non ssl and that the root remained https. This root did not remain https before the key change. maybe João will throw light on this ;) we should wait for an answer. greets Mourad -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: functions classes
Bigmark, I have been involved in the evolution of the development process and architecture called functional normalization. I do intend to post some detail on this at funkifunctions.blogspot.com very soon. Anyhow, using this method might help you some what. The trick being to look through your script and see if the same thing is being done in more than one place. For example, if you find a piece of code that converts a string into a URL and that piece of code is REPEATED through thes script, then place that code in a function and replace the instance of the code with function calls. Over a period of time you will see more and more of your code turn into functions. Once this process has started you will be able to predict to some extent what new pieces of code could be re-used in this way and hence write them as functions also. This approach has proved to be extremely successful in advancing the careers and coding practices of developers inside and contractors to the project network (www.project-network.com). If you would like, I am very happy to take a script from you and convert it over to functions. I will also let you know when more material on FN is posted to the blogsphere. As for classes. I would recommend avoiding thinking about these yet. Function level re-use is a better start discipline that class level re-use IMHO. I know this is an contentious issue. Having been an avid OO programmer for many years I have evolved away from this, other people have different views (yes really, I did a lot of OO work with Java/Weblogic/C++/iTCL etc etc etc - please don't flame - not interested!). For more thoughts on what I don't like about OO: http://deployview.com/blog/2006/08/object-oriented-poison.html Best wishes and good luck AJ Mourad Boulahboub wrote: Hi Bigmark, Bigmark schrieb am 25.08.2006 11:39: Can anyone tell me if it is relatively an easy process for an experienced coder (not me) to convert a php script to mainly functions/classes. I have my own script that i would like to make more streamlined as it is becoming very difficult to work with. it's not impossible, but can take a lot of time to pick the script to pieces and get it converted to a script (ore more coherent scripts) with functions and/or classes. It depends on the script itself. Greets Mourad -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] functions classes
Larry, I have hit similar global names space issues in the past and it is a pain in the behind! One remedial method that can get it stable enough to start to work on is to stick the whole messy lot into classes (NOT OBJECTS!) and then the global name space becomes the local namespace (ie $MyVar becomes $GarbageCode::MyVar). Once you have done this, you can put accessors functions around the class local variables. This means that all new code calls the accessors. $newVar=GarbageCode::GetMyVar(); Thus, if you improve the internal representation of the garbage code, code outside the old garbage code will no longer be impacted by the change. From an FN point of view, you are reducing the access to the variable to a single function point rather than many function points distributed throughout the code base. Cheers AJ PS - if you knew all this before hand - please accept my apologies :-) Larry Garfield wrote: On Friday 25 August 2006 04:39, Bigmark wrote: Can anyone tell me if it is relatively an easy process for an experienced coder (not me) to convert a php script to mainly functions/classes. I have my own script that i would like to make more streamlined as it is becoming very difficult to work with. That really depends on the nature of the code. I've some code I have to work with now that is built around dumping all kinds of stuff into the global namespace, even from functions. If I ever manage convince the author what an insanely bad idea that is, it will still be hell to fix because of the way it's built. Most code probably isn't quite that bad, though. Your code could already break down into functions quite nicely, or it could be easier to just start from scratch. No way to tell without seeing the code. -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Brain Death - [PHP] functions classes
I don't know what I was on when I wrote the previous post! In php you cannot create static class variables in this way (doh) or at least I never have managed. So when faced the this problem I replace what in C++ would be a class variable with a class function comme ca: class MyClass { function MyVar($val = null) { static $datum; if(is_null($val)) { return $datum; } $dataum=$val; } } I definitely need more coffee! AJ Alex Turner wrote: Larry, I have hit similar global names space issues in the past and it is a pain in the behind! One remedial method that can get it stable enough to start to work on is to stick the whole messy lot into classes (NOT OBJECTS!) and then the global name space becomes the local namespace (ie $MyVar becomes $GarbageCode::MyVar). Once you have done this, you can put accessors functions around the class local variables. This means that all new code calls the accessors. $newVar=GarbageCode::GetMyVar(); Thus, if you improve the internal representation of the garbage code, code outside the old garbage code will no longer be impacted by the change. From an FN point of view, you are reducing the access to the variable to a single function point rather than many function points distributed throughout the code base. Cheers AJ PS - if you knew all this before hand - please accept my apologies :-) Larry Garfield wrote: On Friday 25 August 2006 04:39, Bigmark wrote: Can anyone tell me if it is relatively an easy process for an experienced coder (not me) to convert a php script to mainly functions/classes. I have my own script that i would like to make more streamlined as it is becoming very difficult to work with. That really depends on the nature of the code. I've some code I have to work with now that is built around dumping all kinds of stuff into the global namespace, even from functions. If I ever manage convince the author what an insanely bad idea that is, it will still be hell to fix because of the way it's built. Most code probably isn't quite that bad, though. Your code could already break down into functions quite nicely, or it could be easier to just start from scratch. No way to tell without seeing the code. -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Brain Death - [PHP] functions classes
Cool! That is a very good point - I'll remember to use '=== null' in future. Then at least my code will have enough coffee even if I don't! Thanks - AJ Alexander J Turner Ph.D. www.deployview.com www.nerds-central.blogspot.com www.project-network.com -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: 26 August 2006 17:25 To: Alex Turner Cc: php-general@lists.php.net Subject: RE: [PHP] Brain Death - [PHP] functions classes On Sat, 2006-08-26 at 16:51 +0100, Alex Turner wrote: > Rob, > > I'd go along with the setting a var to null issue (in the cases > I have worked so far on, there has not been a need to set variables > to null). Maybe so, but if a variable ever happens to contain null and you're not aware of it, the value won't get updated. > However, what is wrong with is_null()? As a function call it's an order of magnitude slower than === null since it incurs the overhead for a function call. There's nothing wrong with your use of the is_null() function, but === null is just as clear, and much faster so I thought I'd throw at you in line with your coffee comment :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Brain Death - [PHP] functions classes
Rob, I'd go along with the setting a var to null issue (in the cases I have worked so far on, there has not been a need to set variables to null). However, what is wrong with is_null()? >From the php manual chm: >>>>> (PHP 4 >= 4.0.4, PHP 5) is_null -- Finds whether a variable is NULL Description bool is_null ( mixed var ) Finds whether the given variable is NULL. Parameters var The variable being evaluated. Return Values Returns TRUE if var is null, FALSE otherwise. <<<<< And to be very pedantic - as null does not have a type then actually 'x === null' should evaluate to absurdity, but PHP is more pragmatic than that ;-) Cheers - AJ Alexander J Turner Ph.D. www.deployview.com www.nerds-central.blogspot.com www.project-network.com -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: 26 August 2006 16:42 To: Alex Turner Cc: php-general@lists.php.net Subject: Re: [PHP] Brain Death - [PHP] functions classes On Sat, 2006-08-26 at 12:49 +0100, Alex Turner wrote: > I don't know what I was on when I wrote the previous post! > > In php you cannot create static class variables in this way (doh) or at > least I never have managed. So when faced the this problem I replace > what in C++ would be a class variable with a class function > > comme ca: > > class MyClass > { > function MyVar($val = null) > { > static $datum; > if(is_null($val)) > { > return $datum; > } > $dataum=$val; > } > > } > > I definitely need more coffee! Talking about coffee... your above code could use some. Try this: But also I'd recommend fixing the the problem whereby you can't set $datum to the null value, otherwise you may run into unexpected issues down the road. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Brain Death - [PHP] functions classes
Right or wrong - C does not actually have NULL :-) NULL in C is simply mapped to zero. It is useful in logic to sometimes use mapping of logical sentence letters to numbers and use mathematics to perform proof, but that is a special case. In languages like C, there is no special method of marking a variable as true NULL. Thus, the language has no way of processing three state logic. In SQL, there is a special flag to note that variables are truly null and so it can process three state logic. PHP is odd because it does have a special NULL state but it does not fully support three state logic. But hey - it is a web scripting language - it would be a shame if PHP got all theoretical on us! BTW: >Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and NULL == NULL === TRUE It is NULL === NULL == absurd. So - my approach: I may well use is_null() in low traffic areas on PHP, but then when in an inner loop etc, use === null and maybe comment what it means. Cheers to all AJ Alexander J Turner Ph.D. www.deployview.com www.nerds-central.blogspot.com www.project-network.com -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: 26 August 2006 19:24 To: Robert Cummings; tedd Cc: Alex Turner; php-general@lists.php.net Subject: RE: [PHP] Brain Death - [PHP] functions classes At 2:30 PM -0400 8/26/06, Robert Cummings wrote: >On Sat, 2006-08-26 at 12:41 -0400, tedd wrote: > > At 4:51 PM +0100 8/26/06, Alex Turner wrote: >> >And to be very pedantic - as null does not have a type then actually > > >'x === null' should evaluate to absurdity, but PHP is more pragmatic >> >than that ;-) >> >> That's a very good point. >> >> While one NULL variable in php can be compared to another NULL >> variable and produce true, it's not so in MySQL. >> >> In MySQL NULL does not equal NULL -- such comparisons produces NULL >> and not true. Instead you have to use IS_NULL or NOT NULL to check >> for NULL. >> >> So, it's probably best to get into the habit of using is_null. > >I strongly disagree... If I'm writing SQL then I adhere to the language >constructs of SQL, if I'm coding in PHP then I adhere to the language >constructs of PHP. There is no reason why one should forgo better >constructs just because they don't appear in other languages. When in >Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and >last I checked C predates SQL. > >Cheers, >Rob. Rob: As the old woman who kissed the cow said "To each their own." My reasoning is simple and I don't strongly agree, or disagree, with other methodologies. I write in several languages, such as php, js, mySQL, css, and others -- and each have their own constructs. As such, I try to use similar constructs where ever possible. My memory isn't what it used to be. Besides, what Alex Turner said about NULL is correct -- it's absurd to have NULL evaluate to anything. Just because one language allows absurdity doesn't mean you have to practice it. Your mileage may differ and that's Okay. :-) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] display a single thumb per gallery
Here is one way of doing it: Group by gallery and return max for image id. Place the resultant Gallery and Image values in an array of arrays. SELECT Gallery, Max(Image) FROM Thumbnails GROUP BY Gallery Then loop over the outer array returning the entire thumbnail row where gallery and image match the values in the inner array SELECT * FROM Thumbnails WHERE Gallery=XXX AND Image=XXX This all assumes there is a column called Image that uniquely identifies each row - if there is not - errr. Cheers AJ Dave Goodchild wrote: To find out how many unique galleries: SELECT DISTINCT gallery FROM table Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Eaccelerator
All, I have just had some very pleasing success with Eaccelerator on windows. Has anyone else been trying this on windows. Has anyone had production experience with this? Thanks for any feedback. I have written up the work I have done so far at http://nerds-central.blogspot.com/2006/08/eaccelerator-rocks.html Cheers AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Functions vs html outpuit
Dave Goodchild wrote: Thanks, that was what I needed to hear. Cheers. On 03/09/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote: On Fri, 01 Sep 2006 16:44:19 +0200, M. Sokolewicz wrote: > Dave Goodchild wrote: >> Hi all, this may seem like a silly question, but I am creating a library of >> html form element generation function, for example a textarea fucntion that >> takes rows and cols as parameters, a function that generates a day, month >> and year select box, etc. My question is - is it significantly to switch >> off >> the parser and emit raw html than calling a function? If it is faster to >> just allow the server to send the html I will not bother. >> > > I'm not quite sure I understand your question. Are you asking if it's > faster to parse and process a php script vs. a page of raw HTML? > > In that case, OF COURSE SERVING A RAW HTML FILE IS FASTER!!! > Does the server have to do *anything* with the contents of the HMTL file? no > Does the server have to do *anything* with the contents of the PHP file? > yes! of course! it needs to parse and process it BEFORE it can actually > server the RESULT of that script. > > So, if possible, stick to raw HTML files. > - tul That said, if you feel that it saves you a lot of development time (like me) to use such functions, and you're writing a basic app that will not likely attract lots of hits, then go for it. I use a viewForm() function, that takes an array as a argument describing the required form, for all of my projects. Surely it's faster for the server if you just write the HTML, but this is much easier for me to create, edit and re-use in other projects... Just my 2 cts. Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It does seem to me that a lot a pages end up with PHP in them to do stuff that could be put in raw HTML. The reason being to make the pages easier to manage and port. I would go for the optimize late philosophy. Once you have a site running, load testing it with - eg - JMeter. If a PHP page is taking a lot of the time and it could easily be converted to static HTML, do it at that point. If you code raw HTML everywhere, then you might find that you have spent a day messing with a page that only gets hit once a day :-( Best wishes AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crazy behavior...
Peter Lauri wrote: Just figured out that it seams to happen when the request is done via AJAX. But it does not make any sense to me that there should be any difference. /Peter -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: Sunday, September 03, 2006 1:53 PM To: php-general@lists.php.net Subject: [PHP] Crazy behavior... Hi, This is really odd. I use this code to retrive value from a database table. When the field is empty, it cracks the HTML code some how, the PHP script seam to not break. function getInfo() { $html = ""; $html.= "Name".$this->getName().""; $html.= "Description".$this->getDesc().""; $html.= "Priority".$this->getPriorityText().""; $html.= ""; return $html; } The function getDesc is like this (I have made it overly complicated because I am trying to fix the problem): function getDesc() { $Query = sprintf("SELECT todotext FROM teamtodo WHERE id=%d LIMIT 1", $this->getID()); $Result = mysql_query($Query); if(mysql_num_rows($Result)>0) { if($Roww = mysql_fetch_array($Result)) { if($Roww['todotext']!='') return $Roww['todotext']; else return ''; } else return ''; } else return ''; } When the database field is not empty it works fine, but as soon as the field todotext is empty the $html seam to break, but the value of $html until the $this->getDesc() is still being returned by the function (can see half of the table). Is this a bug, or am I just stupid? If I just insert some blank spaces it works, hrm. /Peter Can you send an example of the broken HTML? What are the symptoms of the html being broken. Finally, in what way are you using AJAX. This looks like html output - so is it really AJAH? My first guess is that something about the context at the browser end makes - an empty table element - cause trouble. Cheers AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crazy behavior...
Peter, When it arrives at the browser, via ajax, I am guessing that you then put it into the page view .innerHTML or some other method. I suspect your problem revolves around asking the browser to do stuff it should not really have to do. There are two issues I would like to highlight with the html. 1) You are mixing TH and TD on the same row. You should be using styles to set the different presentations of the elements. 2) You have placed a paragraph section between the table tag and the first tr tag. This is wrong. I suspect that the browser is managing to cope with this markup when presented as a static page but is unable to figure out how to update an existing page with it. If you fix the html to be standards compliant then the chances are all will be well. If it is not - by all means get back to me :-) Best wishes AJ Alexander J Turner Ph.D. www.deployview.com www.nerds-central.blogspot.com www.project-network.com -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: 03 September 2006 17:20 To: Alex Turner; php-general@lists.php.net Subject: RE: [PHP] Crazy behavior... [snip] Can you send an example of the broken HTML? What are the symptoms of the html being broken. Finally, in what way are you using AJAX. This looks like html output - so is it really AJAH? My first guess is that something about the context at the browser end makes - an empty table element - cause trouble. Cheers AJ [/snip] This is really odd. I wrote the $html variable that I send back to the browser via AJAX, and that code is like this when I pushed it into a temporary database table: Close Nameasdf Description Assigned to Created byPeter Lauri(Farang) Due date Start date PriorityNormal Creation dateSun, 03 Sep 2006 23:09:44 +0700 However, if I just use that output all is shown until the empty tag. Then I tried to check what is actually captured by the browser, and it was showing only until the and then nothing more. So this should maybe be posted to the JavaScript list :) I have temporary solved by NOT allowing empty strings into those fields, but the description should be able to be empty :) /Peter -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crazy behavior...
Peter, That is very odd! When you say 'breaks' do you mean, just stops? Is it possible that a 0x00 character is getting in there somehow? It would be good to actually see what is going between the client and the server. Have you ever used JMeter? If you were to proxy between the two with JMeter then we would have an 'independent third party' to see what is going on. Cheers - and good sleeping! AJ Alexander J Turner Ph.D. www.deployview.com www.nerds-central.blogspot.com www.project-network.com -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: 03 September 2006 18:02 To: Alex Turner Cc: php-general@lists.php.net Subject: RE: [PHP] Crazy behavior... Just thought one thing. I did do a alert() on the http.responseText, and that breaks in on the too, so the response that is sent back probably just ends there... weird... /Peter -Original Message----- From: Alex Turner [mailto:[EMAIL PROTECTED] Sent: Sunday, September 03, 2006 11:31 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: RE: [PHP] Crazy behavior... Peter, When it arrives at the browser, via ajax, I am guessing that you then put it into the page view .innerHTML or some other method. I suspect your problem revolves around asking the browser to do stuff it should not really have to do. There are two issues I would like to highlight with the html. 1) You are mixing TH and TD on the same row. You should be using styles to set the different presentations of the elements. 2) You have placed a paragraph section between the table tag and the first tr tag. This is wrong. I suspect that the browser is managing to cope with this markup when presented as a static page but is unable to figure out how to update an existing page with it. If you fix the html to be standards compliant then the chances are all will be well. If it is not - by all means get back to me :-) Best wishes AJ Alexander J Turner Ph.D. www.deployview.com www.nerds-central.blogspot.com www.project-network.com -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: 03 September 2006 17:20 To: Alex Turner; php-general@lists.php.net Subject: RE: [PHP] Crazy behavior... [snip] Can you send an example of the broken HTML? What are the symptoms of the html being broken. Finally, in what way are you using AJAX. This looks like html output - so is it really AJAH? My first guess is that something about the context at the browser end makes - an empty table element - cause trouble. Cheers AJ [/snip] This is really odd. I wrote the $html variable that I send back to the browser via AJAX, and that code is like this when I pushed it into a temporary database table: Close Nameasdf Description Assigned to Created byPeter Lauri(Farang) Due date Start date PriorityNormal Creation dateSun, 03 Sep 2006 23:09:44 +0700 However, if I just use that output all is shown until the empty tag. Then I tried to check what is actually captured by the browser, and it was showing only until the and then nothing more. So this should maybe be posted to the JavaScript list :) I have temporary solved by NOT allowing empty strings into those fields, but the description should be able to be empty :) /Peter -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Video uploading with PHP -> convert to flash on the fly?
Merlin wrote: Hi there, looks like video uploading goes mainstream. Loads of sites are adding video upload capabilities. That is what I would like to add to my webapp as well. Currently only picture upload is available via PHP and image functions. Can somebody please point me to a start on how to convert the video files on the fly during upload into flash video? Similar to the image functions available with php? Is there a modul available, any 3rd party software you would recommend? Thank you for any hint, Merlin If you are windows, maybe you could have a look at the swf encoder in camstudio: http://www.camstudio.org/ AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crazy behavior...
Yes - I see your point - however, when something does not work, I generally try and get is as close the accepted norms as possible and then work backwards. Alexander J Turner Ph.D. www.deployview.com www.nerds-central.blogspot.com www.project-network.com -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 04 September 2006 22:43 To: Alex Turner Cc: Peter Lauri; php-general@lists.php.net Subject: Re: [PHP] Crazy behavior... Alex Turner wrote: > Peter, > > When it arrives at the browser, via ajax, I am guessing that you then put it > into the page view .innerHTML or some other method. > > I suspect your problem revolves around asking the browser to do stuff it > should not really have to do. > > There are two issues I would like to highlight with the html. > > 1) You are mixing TH and TD on the same row. You should be using styles to > set the different presentations of the elements. TD and TH are not about 'presentation of elements' but about the semantics of the elements. TD and TH are allowed in a single row. -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this unsecure?
Peter Lauri wrote: Isn't that just to send a username and password with the request? Or is the username and password protected somehow in that process? -Original Message- From: Paul Scott [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 05, 2006 4:08 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Is this unsecure? On Tue, 2006-09-05 at 16:04 +0700, Peter Lauri wrote: I have bumped into a problem. I need to use a web service that is located on server B from server A. The server B will execute a script when the web service is accessed and an email is sent as an parameter. The problem is, if I only have the email as incoming parameter, anyone can just figure out the url for the web service, the name, and then just send the email to that address. Why not just use SOAP envelope authentication? --Paul Peter, The approach is fairly secure. But it would be much better to use the output buffer to append a chunk of characters to the whole page and then md5 that. This makes it much less likely that a snooper could bruit force attack the system. The next stage beyond that is just to AES encrypt the whole communication. As you have access to both ends, there is no requirement for asymmetric cryptography. Then simply put a known phrase as the start of the request then the other end checks for after decryption and if it is not there it rejects the message. Crank that up to 256Bit encryption and you have a commercial spec system :-) Cheers AJ PPS as MD5 is now part cracked, if you are truly paranoid, use SHA. -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OT - PHP Hosting Service in UK?
Miles Thompson wrote: I have a Canadian client, presently living in England, who is setting up a vary basic web site. The business is located in the UK, it makes sense to have the web hosting service in the UK as well. Would anyone who is happy with a UK hosting service offering PHP (preferably 5) and MySQL please make a suggestion. (I'm willing to accept one or two outages a years, more importantly, if there is a problem with email, etc., are they responsive?) Regards - Miles Thompson (902) 440-2010 "Ask the fruitful question." Miles, I use: http://websitters.co.uk/hosting.php AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: OT - PHP Hosting Service in UK?
tedd wrote: I use: http://websitters.co.uk/hosting.php AJ Interesting that they display compliance, but fail validation (89 errors?). tedd May I quickly say that I have no involvement in this company other than having sites hosted with them! (blush) I will raise it with them! Thanks for pointing that out. AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: OT - PHP Hosting Service in UK?
tedd wrote: I use: http://websitters.co.uk/hosting.php AJ Interesting that they display compliance, but fail validation (89 errors?). tedd Are - the answer is that they recently updated all the pages, and the buttons for validation should only be on the front page. AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: IE session problem on one server only
Larry Garfield wrote: Another issue. :-) I've another site I've built that uses PHP sessions for user authentication. When the user logs in with a user/pass, that is matched against a record in the database and, if found, that user object is stored in the session along with various other tracking data like the IP address, and the session key is stored in the user table. Then when viewing a page, the systems compares the session key against the user table and the IP address of the request against the saved IP address. If anything doesn't match up properly, the user is kicked out. OK, all fine and dandy. It works correctly in both IE and Firefox on our test server. On the live site, however, it works only in Firefox. In IE, it accepts the initial login and displays the first page, but then the next time the user clicks a link they are asked to login again, as if the session is not being sent or saved properly. Both servers are running Linux and PHP 4.3.x. We had issues before with the session not working correctly in IE, but I fixed those with info from the php.net manual user comments. I'm at a loss as to why it's only happening on the one server and not the other now. If it were the other way around I wouldn't care, but the live site shouldn't break. :-) Any idea what could be the problem? It sounds like the IE is putting different security/cookie settings for your local and remote site. AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Testing PHP sites with JMeter
All, Sorry if this is a little off topic. I have been writing tutorials on load and regression testing web applications with JMeter. I have just posted the first. These are being do to help people in TPN, but I am able to make them public. As the testing is all being done on PHP based web apps, I thought it might be of interest. Cheers AJ The first is here, there will be more as time goes on: http://nerds-central.blogspot.com/2006/08/pushing-envelope-with-jmeter.html -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How could I make the browser to send a command to a cash register...
Man-wai Chang wrote: > to open its drawer? > That 100% depends on how the cash register works. Is it an NT cash register, or an propitiatory one? Is it rs232 or on a network? Basically, find out how the cash register can be controlled, then make a php script that can fire that control. If you find out more about the register we might be able to help a little more ;-) Cheers AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Ajax and PHP: XMLHTTP
Micky Hulse wrote: Can I replace the above with some sort of XMLHTTP request? Googling now... thought I would ask here first. Any good links to tuts that might cover that sort of thing? Kinda thinking about plugging some Ajax into a random image php script. TIA. :) Cheers, Micky I think that is a javascript question is it not? Unless you mean to use curl or some such. AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How would you do this ?
Jad madi wrote: I'm building an RSS aggregator so I'm trying to find out the best way to parse users account feeds equally so Lets say we have 20.000 user with average of 10 feeds in account so we have about 200.000 feed How would you schedule the parsing process to keep all accounts always updated without killing the server? NOTE: that some of the 200.000 feeds might be shared between more than one user Now, what I was thinking of is to split users into 1-) Idle users (check their account once a week, no traffic on their RSS feeds) 2-) Idle++ (check their account once a week, but got traffic on their RSS feeds) 2-) Active users (Check their accounts regularly and they got traffic on their RSS feeds) NOTE: The week is just an example but at the end it’s going to be dynamic ratio so with this classification I can split the parsing power and time to 1-) 10% idle users 2-) 20% idle++ users 3-) 70% active users. NOTE: There is another factors that should be included but I don’t want to get the idea messy now (CPU usage, Memory usage, connectivity issues (if feed site is down) in general the MAX execution time for the continues parsing loop shouldn’t be more than 30 minutes 60 minutes) Actually I’m thinking of writing a daemon to do it “just keep checking CPU/memory” and excute whenever a reasonable amount of resource available without killing the server. Please elaborate. I would suggest using a queue/pool system. Have one mechanism the loads request for update into a queue and anther that takes the requests out of the pool at the fixed rate (or several at once over different threads/processes). You then limit the rate the messages are consumed to the maximum you want the server to use up. You can then add update requests into the queue based on how often the user checks their feed. That way, the more often they check it, the more often it is updated. OK - this needs a bit of polishing, but I suspect it would do what you wanted. A database table would make a nice queue as you insert at the bottom and read/delete off the top and let the DB engine synchronize up the separate threads of action. Cheers AJ -- www.deployview.com www.nerds-central.com www.project-network.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] COM Dlls not unbinding
Hi All, I am doing a lot of PHP work with COM. The system uses php 4.3.3.3 and php is being driven via FCGI from our own web server (TAG). We create an instance of an in-process COM server using the following technique: function GetFactory() { static $obj; static $objSet = 0; if($objSet==0) { $obj=new COM("TPN_Obj.JDCom_Factory"); $objSet=-1; } return $obj; } The returned COM object is then used as a factory to all our other COM objects. The snag is that the binding to the COM dll is not being released at the end of script execution. This is visible using ProcessExplorer from SysInternals. If I call com_release the returned ref-count is zero. To ensure that php's garbage collector was not the culprit, I tried repeatedly calling com_release at the end of the script - no change. The upshot of this issue is that each PHP process in the FCGI process pool gradually gets bigger as more and more dlls are bound :-( Any ideas are welcome; I have gone through the php source but cannot quite figure the problem. Changing the C code is OK for our application. Thanks! Dr Alexander J Turner Project Network +44 (0) 7917 065072 Con Call: 0870 241 3425/3342654#
[PHP] COM dlls not unbinding at script end
I am doing a lot of PHP work with COM. The system uses php 4.3.3.3 and php is being driven via FCGI from our own web server (TAG). We create an instance of an in-process COM server using the following technique: function GetFactory() { static $obj; static $objSet = 0; if($objSet==0) { $obj=new COM("TPN_Obj.JDCom_Factory"); $objSet=-1; } return $obj; } The returned COM object is then used as a factory to all our other COM objects. The snag is that the binding to the COM dll is not being released at the end of script execution. This is visible using ProcessExplorer from SysInternals. If I call com_release the returned ref-count is zero. To ensure that php's garbage collector was not the culprit, I tried repeatedly calling com_release at the end of the script - no change. The upshot of this issue is that each PHP process in the FCGI process pool gradually gets bigger as more and more dlls are bound :-( Any ideas are welcome, I have gone through the php source but cannot quite figure the problem. As we are going over to our own build of 4.4.1 asap, a C level fix would be great :-) Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Managing upload files in multiple servers(pawns)
Why not use php to copy the file over to the other box? You could do this either by ftp, nfs etc, or by making a the php script communicate with the upload script on the other box as though it was a client. Cheers AJ Srinadh Sannidhanam wrote: Thanks Duncan, thanks for the suggestions, I will try them and come back.. Please suggest me if you know any file synchronization tools over different servers other than rsync. I like if syncronization triggers immediately after uploading the file automatically rather than using cron. Thanks, S.Srinadh. On 12/31/05, Duncan Hill <[EMAIL PROTECTED]> wrote: On Saturday 31 December 2005 02:06, Srinadh Sannidhanam wrote: Hi All, We have a site in php and two web servers(pawns) to balance the load. There is a page in the site through which user can upload images. When a user uploads an image, the request goes to only one of the two servers. So the image will be uploaded to only one server. Use a shared file system such as NFS for upload storage. Use some form of session management/balancing that ensures a client browser that upload ends up on the same server immediately afterwards, and use something like rsync to keep the image area in sync. Shared storage is probably the better bet - perhaps with clever code that tries a local disk first, then the shared storage if not found on local. If found shared and not local, pull to local. -- 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