Re: [PHP] preg_match
On Mon, August 22, 2005 8:13 am, Robin Vickery wrote: > On 8/22/05, Richard Lynch <[EMAIL PROTECTED]> wrote: >> On Sat, August 20, 2005 5:00 am, John Nichel wrote: >> > Personally, I have never used \\ in PCRE when looking for things >> like >> > spaces (\s), word boundraries (\b), etc. and it's all worked out >> fine. >> >> Personally, { >> I >> } have >> never { >> used >> proper >> indenting >> in >> my >> code } and >> it's >> all >> worked >> out >> fine; >> >> :-) > > Unnecessary backslashes make your regular expressions almost as > unreadable as those indents. > > You only ever need to escape a backslash in single-quotes if it's > before another backslash or a single-quote. > > In fact the manual itself explicitly says this: > > http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single > > So what benefit exactly do you see in doubling up all the backslashes > in a single-quoted regexp? It's certainly not helping readability, and > they don't actually do anything... The advantage that when I have to change the string to match the new/altered data, and that data has, oh, I dunno, something like ' or \ or 0, 1, 2, 3, ...9 in it, and then my Regex suddenly doesn't work because \abc7 won't work the same as \7abc but \\abc7 works the same as \\7abc I have to MAINTAIN this code, and when the input changes, as it inevitably will, I do *NOT* want to sit down and figure out that hairy Regex again. It was bad enough the first time. Hell, I had to spend a couple hours building it up iteratively to get it right. If I use \\ when I want \, then it will ALWAYS be correct, no matter what character I have to shove in after it to match "The New Data". If I use \ when I want \, maybe it works sometimes, maybe it doesn't when I have to match "the new data". (\t is tab) I guess I just like things that ALWAYS work instead of things that SOMETIMES work. Silly me. \\ always works \ only works sometimes, depending on what character follows it. PS A Regex is unreadable code by definition anyway. \\ isn't any more unreadable, with practice, than \, especially if you are CONSISTENT and use it in PHP all the time, not just in Regex. But the sheer number of weird character combinations and positional difference (^ inside [] and ^ outside [] and ^ at the beginning of either are all COMPLETELY different) make Regex unreadable no matter how long you stare at it. I dunno what masochist invented this Regex crap, but he oughta be shot :-) * I actually LIKE Regex when it's simple... But, man, you start adding in a lot of complexity, and it gets really ugly really fast. Oh well. It works. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files passing through
I'm using this method, works fine with 50mb+ files : if( $fd = fopen ($filepath, 'r')){ while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } Regards, Kim Steinhaug - - - - - - - - - www.easycms.no - Original Message - From: "Evert | Rooftop" <[EMAIL PROTECTED]> To: "PHP-Users" Sent: Monday, August 22, 2005 9:30 PM Subject: [PHP] Files passing through > Hi People, > > I want to use a PHP script to pass through a file to the browser [ right > after some processing ]. > What is the fastest way to do this? I know > echo(file_get_contents('myfile')); is not a good idea ;) > > Is fpassthrough the right choice? > maybe virtual, so it won't go through php but apache does the job? > there's also readfile > > Another question, how seriously does this affect the performance in > comparison to let apache handle it. Is the difference big at MB+ files? > or only significant when dealing with a lot of tiny files? > > Thanks for your help! > Evert > > -- > 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] Looking for CMS advice
You are referring to this page : http://www.opensourcecms.com/ Regards, Kim Steinhaug - - - - - - - - - - - - - http://www.easywebshop.no/ - Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: "Erik Gyepes" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, August 23, 2005 9:28 AM Subject: Re: [PHP] Looking for CMS advice > On Mon, August 22, 2005 3:48 am, Erik Gyepes wrote: > > Zachary Kessin wrote: > > > >> I am about to start on a project that seems like it would be right > >> for > >> a CMS system. It will be about 80% rather boring stuff with about > >> 20% > >> custom database work. I have looked at XOOPS and a few others. > >> However > >> I can not seem to find one rather important thing about XOOPS. I > >> understand how to use a module that someone else wrote, but I have > >> not > >> found any documentation on how to build my own blocks or application > >> components. > >> > >> I am not yet committed to XOOPS, so if there is different system > >> that > >> would be better that could work as well > > There is a pretty cool site "out there" that lets you kick the tires > on a BUNCH of different PHP/MySQL CMS products/projects. > > opencms.org or something like that. > > I always have a tough time finding it with Google and whatnot, but > it's there. > > Anyway, they basically installed a couple dozen CMS systems, and you > can set yourself up with your own sandbox install on THEIR server with > just a click of a button, then administer it and play with it, and > then they wipe it out in about 2 hours. > > So you get a chance to play with it to see if you like each CMS, and > you've got 2 hours to check it out -- Or more, since you can start > over with a new sandbox. They just don't want you to try to run your > site through theirs. > > I doubt that it will actually let you write/upload arbitrary PHP for > the missing 20%, but they MIGHT have some examples or user comments on > their site on these issues, and at least you can play with the 80% to > see if the features you need for that part are there. > > HTH > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > 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] Looking for CMS advice
> opencms.org or something like that. It is http://www.opensourcecms.com/ Raz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files passing through
Kim Steinhaug (php list) wrote: I'm using this method, works fine with 50mb+ files : if( $fd = fopen ($filepath, 'r')){ while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } Is there a reason why you assign the output of fread() to a variable and then print it? Why not just: print(fread($fd, 2048)); which would be faster because it doesn't need to assign to a variable, wouldn't it? Maybe I'm missing something.. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagestring to picture
On Mon, August 22, 2005 12:45 am, Andras Kende wrote: > I have a some colorful pictures, Would like to add white text with > black > background around the white text... > > I can add the text fine but could figure out how to add black > background.. > > > $textcolor = imagecolorallocate($destimg, 255, 255, 255); $black = imagecolorallocate($destimg, 0, 0, 0); imagefilledrectangle($destimg, 8, 8, 8 + 5 * strlen("test text"), 13, $black); > imagestring($destimg, 3, 10, 10, "test text", $textcolor); > imagejpeg($destimg); -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Special HTML characters question.
On Mon, August 22, 2005 6:29 am, Jay Paulson wrote: > I have a problem that I'm sure some of you have run into before, > therefore I hope you all know of an easy solution. Some of my users > are cutting and pasting text from Word into text fields that are being > saved into a database then from that database being displayed on a web > page. The problem occurs when some special characters are being used. > Double quotes, single quotes, and other characters like accents etc > have the special html code like "e; etc replacing the special > characters. What methods are being used to combat this issue? Is > there a solution out there to run text through some sort of filter > before submitting it to the database to look for these special > characters and then replacing them? You are not alone. There are innumerable User Contributed notes in the on-line manual on this topic, scattered through various function pages. Some of them have some rather nice functions for finding and replacing all the Microsoft crap with something that will work in all browsers. I would recommend doing this before you insert to the database. Yes, it's generally a Bad Idea to munge data before inserting, but in this case, you will never, ever, ever want those nasty characters again. They have no meaning outside the context of MS Word, except, of course, MS IE "embrace and extend" (cough, cough) will display them as well, so all the MS Word, FrontPage, IE users tend to use them, not realizing just how UGLY their site is for everybody else. So unless you want to abandon all other browsers, and turn into a Microsoft drone, you might as well replace them once, at insert, and be done with it. You don't need anything as fancy as a Regex, and the list of characters has already been painstakingly built for you by people in the User Contributed notes. For that matter, they wrote the function you can copy/paste as well. Here's the one I liked enough to steal: function un_microsuck($text){ static $chars = array( 128 => '€', 130 => '‚', 131 => 'ƒ', 132 => '„', 133 => '…', 134 => '†', 135 => '‡', 136 => 'ˆ', 137 => '‰', 138 => 'Š', 139 => '‹', 140 => 'Œ', 142 => 'Ž', 145 => '‘', 146 => '’', 147 => '“', 148 => '”', 149 => '•', 150 => '–', 151 => '—', 152 => '˜', 153 => '™', 154 => 'š', 155 => '›', 156 => 'œ', 158 => 'ž', 159 => 'Ÿ'); $text = str_replace(array_map('chr', array_keys($chars)), $chars, $text); return $text; } That's not going to be TOO horribly slow unless you've got a TON of data to run through. Feel free to benchmark it and see. I never have, since I'm only handling one or two INPUT fields from copy/paste at a time by a site administrator. If it's "too slow" you might be able to tweak it so the array_map() result is cached in the function body to get a bit more speed out of it. Everything else from MS Word copy/paste can be handled by htmlentities() upon OUTPUT to the browser. You may need to re-name the function for inclusion in a day-job corporate project/product... :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 COM strange behaviour
Hello NG, we have a script to create a word-document via COM which, so far, run pretty stable under php 4.3.7 Since we upgraded to php 5.0.3.3 the same script works only on the first run! On the following runs the same script causes a fatal error on the code below: Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word Description: Wrong Parameter.' in [Scriptname]:65 Stack trace: #0 [Scriptname](65): variant->GoTo('wdGoToField', 'wdGoToFirst', 1) #1 [SourceScript] include('[Scriptname]') #2 {main} thrown in [Scriptname] on line 65 Code : $NumberFields = $word->ActiveDocument->MailMerge->fields->Count; for ($CounterFields = 1; $CounterFields <= $NumberFields; $CounterFields++) { $word->Selection->Range->GoTo(wdGoToField, wdGoToFirst, $CounterFields); <-- Creates Fatal Error ... } When we reset the Apache-Service, the script runs again once! Subsequent calls create the same fatal error again ... we changed access-rights in dcomcnfg which didn't show any influence ... Environment: win 2003 server, Apache 2.0.53 I'm greatful for any hint ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Large URI request problem
On Mon, August 22, 2005 10:39 pm, Dean Maunder wrote: > I have a large string that I need to send to a script that creates an > image. > eg src='createimage.php?wp=321,43,23,12,43,12,342,54,765,87,3,23,etc etc > etc Woof. I'm surprised it took 3000 characters to become a problem... :-) You MAY want to try your HTML with src="createimge.php?wp=..." instead of the single quotes. Yeah, HTML 4.0 or whatever didn't care, but that new-fangled XML HTML crap it matters, I think. > Until now this hasnt been a problem just putting the data in the URL, > but now Im faced with a string that is over 3000 characterswhich > causes an issue and ends up displaying a red square on my page rather > than the nice data I requested. I cant seem to find a way around > this, > someone else suggested posting the data, but how can I post from > HTML?...can anyone help with another solution? In the script that writes out the HTML, don't write out all those numbers in the URL. Stick them in a database table, or put them in a session, or if speed/performance is a Big Issue, and those can't hack it, stick them in Shared Memory. http://php.net/shmop Then you can pass a small identifier like an ID from the database, or whatever you want for an array index in your $_SESSION, or a path and integer for the shared memory. If shmop isn't fast enough, then you're in real trouble :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files passing through
On Tue, August 23, 2005 12:48 am, Jasper Bryant-Greene wrote: > Kim Steinhaug (php list) wrote: >> I'm using this method, works fine with 50mb+ files : >> >> if( $fd = fopen ($filepath, 'r')){ >> while(!feof($fd)) { >> $buffer = fread($fd, 2048); >> print $buffer; >> } >> fclose ($fd); >> exit; >> } > > Is there a reason why you assign the output of fread() to a variable > and > then print it? Why not just: > > print(fread($fd, 2048)); > > which would be faster because it doesn't need to assign to a variable, > wouldn't it? Maybe I'm missing something.. You're not missing anything, but a 2 K string buffer assignment/print is probably not gonna save much... Benchmark it both ways and see. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match
On 8/23/05, Richard Lynch <[EMAIL PROTECTED]> wrote: > The advantage that when I have to change the string to match the > new/altered data, and that data has, oh, I dunno, something like ' or > \ or 0, 1, 2, 3, ...9 in it, and then my Regex suddenly doesn't work > because \abc7 won't work the same as \7abc but \\abc7 works the same > as \\7abc Ummm... no it doesn't. Both of these will fail to compile: preg_match( '/\\7abc/', $myString); preg_match( '/\7abc/', $myString); Both of these are fine: preg_match( '/\\abc7/', $myString); preg_match( '/\abc7/', $myString); In fact they behave *exactly* as if you hadn't doubled them up. You've not achieved anything, but you've made your regexp just a little more difficult to read and maintain. > I guess I just like things that ALWAYS work instead of things that > SOMETIMES work. Silly me. > > \\ always works > \ only works sometimes, depending on what character follows it. No it doesn't. Indiscriminately doubling up all your back-slashes is not an alternative to actually learning the proper syntax. > PS > A Regex is unreadable code by definition anyway. > > \\ isn't any more unreadable, with practice, than \, especially if you > are CONSISTENT and use it in PHP all the time, not just in Regex. Yeah, "with practice" you can get used to anything... Unfortunately I'm not the only developer here. There are three teams of programmers who would take umbrage with any need to practice before reading my code. > > But the sheer number of weird character combinations and positional > difference (^ inside [] and ^ outside [] and ^ at the beginning of > either are all COMPLETELY different) make Regex unreadable no matter > how long you stare at it. With practice... No, you're absolutely right. The way operators change meaning depending on context can be confusing, especially when you're getting started. They're addressing this already with the design of Perl 6. No doubt it'll trickle through to PHP in due course. http://dev.perl.org/perl6/doc/design/apo/A05.html#Too_compact_and_"cute"; But in the mean time, it's not *that* hard to learn the syntax of regular expressions. OK, they're rather terse. But apart from that, they're a lot simpler than a proper language like PHP and you don't seem to have problems with that. > I dunno what masochist invented this Regex crap, but he oughta be shot Computational Linguists, first up against the wall, come the revolution. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for CMS advice
On Mon, August 22, 2005 3:48 am, Erik Gyepes wrote: > Zachary Kessin wrote: > >> I am about to start on a project that seems like it would be right >> for >> a CMS system. It will be about 80% rather boring stuff with about >> 20% >> custom database work. I have looked at XOOPS and a few others. >> However >> I can not seem to find one rather important thing about XOOPS. I >> understand how to use a module that someone else wrote, but I have >> not >> found any documentation on how to build my own blocks or application >> components. >> >> I am not yet committed to XOOPS, so if there is different system >> that >> would be better that could work as well There is a pretty cool site "out there" that lets you kick the tires on a BUNCH of different PHP/MySQL CMS products/projects. opencms.org or something like that. I always have a tough time finding it with Google and whatnot, but it's there. Anyway, they basically installed a couple dozen CMS systems, and you can set yourself up with your own sandbox install on THEIR server with just a click of a button, then administer it and play with it, and then they wipe it out in about 2 hours. So you get a chance to play with it to see if you like each CMS, and you've got 2 hours to check it out -- Or more, since you can start over with a new sandbox. They just don't want you to try to run your site through theirs. I doubt that it will actually let you write/upload arbitrary PHP for the missing 20%, but they MIGHT have some examples or user comments on their site on these issues, and at least you can play with the 80% to see if the features you need for that part are there. HTH -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade
-Original Message- From: Larry Brown To: php Sent: 23/08/05 02:28 Subject: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then $subArray= array([0] = 'another',[1] = 'another') In other cases person might have some other value in the [1] position. (it is being used in a function to create a select statement). After the upgrade from 4.3 to 4.4 though each iteration gives... array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) You have an out-of-date code optimizer insatalled -- install the latest version of whichever one you are using. This is a known incompatibility -- a quick search in the bugs database would have found multiple entries about it (see, for instance, http://bugs.php.net/bug.php?id=30914, http://bugs.php.net/bug.php?id=31194, and at least a couple of dozen others). Cheers! Mike To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match
Robin Vickery wrote: Both of these will fail to compile: preg_match( '/\\7abc/', $myString); preg_match( '/\7abc/', $myString); Both of these are fine: preg_match( '/\\abc7/', $myString); preg_match( '/\abc7/', $myString); In fact they behave *exactly* as if you hadn't doubled them up. You've not achieved anything, but you've made your regexp just a little more difficult to read and maintain. You achieved something. You made your code syntactically correct, even if PHP lets you get away with things like \a inside single-quoted strings. \\ always works \ only works sometimes, depending on what character follows it. No it doesn't. Indiscriminately doubling up all your back-slashes is not an alternative to actually learning the proper syntax. The proper syntax is to double the backslash, not to rely on the fact that the character following it happens to not make it a special character. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files passing through
Richard Lynch wrote: On Tue, August 23, 2005 12:48 am, Jasper Bryant-Greene wrote: Kim Steinhaug (php list) wrote: I'm using this method, works fine with 50mb+ files : if( $fd = fopen ($filepath, 'r')){ while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } Is there a reason why you assign the output of fread() to a variable and then print it? Why not just: print(fread($fd, 2048)); which would be faster because it doesn't need to assign to a variable, wouldn't it? Maybe I'm missing something.. You're not missing anything, but a 2 K string buffer assignment/print is probably not gonna save much... Benchmark it both ways and see. I benched this with a 100 MiB text file (largest I could find at short notice). Buffer used for fread() calls was 2 KiB as above. Values are averaged over 100 runs (I would have liked to do more, but I don't have time). All values are to 4 significant figures. Assigning to a variable and then printing took 0.5206 sec Printing directly without assigning to any variable took 0.5178 sec readfile() took 0.4632 sec print(file_get_contents()) took 0.7037 sec Therefore, readfile() is the fastest, print(file_get_contents()) most definitely the slowest, and it makes -all difference between assigning the buffer to a variable and not, at least for files around 100 MiB. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match
On 8/23/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote: > Robin Vickery wrote: > > Both of these will fail to compile: > > preg_match( '/\\7abc/', $myString); > > preg_match( '/\7abc/', $myString); > > > > Both of these are fine: > > preg_match( '/\\abc7/', $myString); > > preg_match( '/\abc7/', $myString); > > > > In fact they behave *exactly* as if you hadn't doubled them up. You've > > not achieved anything, but you've made your regexp just a little more > > difficult to read and maintain. > > You achieved something. You made your code syntactically correct, even > if PHP lets you get away with things like \a inside single-quoted strings. They are both syntactically correct. Which is why you don't get a syntax error for either of them. As the manual explicitly says in section on single-quoted strings: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single "usually there is no need to escape the backslash itself." "variables and escape sequences for special characters will not be expanded when they occur in single quoted strings." There's no need to invent syntactic rules just to make life difficult. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mac OS X file name encoding problem
Hi all, I have a problem with a script when it is runs on a Mac OS X environment. a part of this script simply takes an upoloaded temporary file and writes it on the local system using ftp functions. something like: $filename = $TheNameToAssignToTheFile; $ftps = ftp_connect($ftpaddress); $ris = ftp_login($ftps,$ftpuser,$ftppassword); $fi = fopen($_FILES['file']['tmp_name'],"rb"); ftp_fput($ftps,$filename,$fi,FTP_BINARY); fclose($fi); The problem appears when $filename contains special characters, like accented chars, on Mac OS X the ftp_fput function returns me an error. I thinked that the problem could depend on the filesystem encoding, that on Mac OS X is Unicode, so I tryied this before: $filename = utf8_encode($filename); this way I have no more an error, but the file name of the uploaded file results anyway corrupted with strange chars. Any help is greatly appreciated, Giulio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac OS X file name encoding problem
Giulio wrote: I have a problem with a script when it is runs on a Mac OS X environment. [snip] The problem appears when $filename contains special characters, like accented chars, on Mac OS X the ftp_fput function returns me an error. I thinked that the problem could depend on the filesystem encoding, that on Mac OS X is Unicode, so I tryied this before: $filename = utf8_encode($filename); Wouldn't it be utf8_decode(), since you're trying to go *from* a Unicode filesystem (Mac OS X)? Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] instanceof ...
as of 5.1.1 instanceof will no longer call __autoload() (which maybe implemented as a handler/function chain by then?) Thank God/Angeline Jolie/My Cat/Other. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP developer in the UK
My company wants to relocate to the UK (London, specifically) from the US and I've been looking at various resources to try find out what my current salary would translate to. Most of the job listings I've seen are for junior or not very experienced developers. So I'm wondering if there are any developers on the list who have several (5+)years of experience and who live/work in/near London? I'm curious to know what the real world going rate, per year, would be for a developer with 8+ years of experience. If you could contact me offlist, it would be much appreciated! :) thnx, Chris
Re: [PHP] Looking for CMS advice
Everyone has already told you about opensourcecms.org, which is a really good site to test things out. However, about 6 months ago I had to do research for the same kind of thing. As of now with the split of the Mambo dev team from the parent company Miro I think I would go with Dupral because who knows when Mambo or whatever the fork of Mambo by the dev team is going to back on it's feet again. Even with that said I've been working with Mambo for about 6 months as well and I must say it's the easiest CMS that I have ever worked with. The component/module coding is a no brainer and the documentation is pretty good (it was getting better but with the dev team gone who knows). At any rate I would say check out Dupral, Mambo, and XOOPS. Then decide what you need and which one has the most features that you need. I choose Mambo for the fast development of customization of features, the huge community (that now seems split), and the vast number of 3rd party modules that have already been written. :) On Aug 21, 2005, at 6:16 AM, Zachary Kessin wrote: I am about to start on a project that seems like it would be right for a CMS system. It will be about 80% rather boring stuff with about 20% custom database work. I have looked at XOOPS and a few others. However I can not seem to find one rather important thing about XOOPS. I understand how to use a module that someone else wrote, but I have not found any documentation on how to build my own blocks or application components. I am not yet committed to XOOPS, so if there is different system that would be better that could work as well --Zach -- 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] Mac OS X file name encoding problem
Jasper, thanks for your answer, Il giorno 23/ago/05, alle ore 2:38 PM, php-general-digest- [EMAIL PROTECTED] ha scritto: Da: Jasper Bryant-Greene <[EMAIL PROTECTED]> Data: 23 agosto 2005 0:39:32 PM GMT+02:00 A: php-general@lists.php.net Oggetto: Re: [PHP] Mac OS X file name encoding problem Giulio wrote: I have a problem with a script when it is runs on a Mac OS X environment. [snip] The problem appears when $filename contains special characters, like accented chars, on Mac OS X the ftp_fput function returns me an error. I thinked that the problem could depend on the filesystem encoding, that on Mac OS X is Unicode, so I tryied this before: $filename = utf8_encode($filename); Wouldn't it be utf8_decode(), since you're trying to go *from* a Unicode filesystem (Mac OS X)? At the moment, just trying to isolate the problem, I assign the $filename value directly from the php script, and not from a posted form, so I assume that the variable content encoding is ISOLatin1 ( the encoding of PHP ). Anyway, trying utf8_decode I have gain an error on the ftp_fput function... Regards, Giulio Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade
Larry Brown wrote: I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=>$subArray) Now it displays as it previously did where $subArray is concerned. Is there something I'm missing here? Was I the only person not using "keys"? [snip] Has anyone seen this behaviour? I'd have to go back through my code, I'm using $key => $value in some places but not in others, but I didn't notice anything different in my code when I upgraded to 4.4 as far as the foreach loops are concerned. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade
I switched from 4.3 to 4.4 on a server with a huge web application using both foreach loops with and without the keys.. No problem whatsoever.. Evert Larry Brown wrote: I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=>$subArray) Now it displays as it previously did where $subArray is concerned. Is there something I'm missing here? Was I the only person not using "keys"? On Mon, 2005-08-22 at 21:28, Larry Brown wrote: I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then $subArray= array([0] = 'another',[1] = 'another') In other cases person might have some other value in the [1] position. (it is being used in a function to create a select statement). After the upgrade from 4.3 to 4.4 though each iteration gives... array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) I find it hard to believe that I must rewrite every foreach loop in my application to adjust to this. After all everything I've read states that the 4.4 release was just a bug and security fix release. Has anyone seen this behaviour? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP vs. ColdFusion
.. As long as we are doing stats; For an internal app our source code alone is 2MB zipped, using SQL Server, over 30 databases, about 1000 stored procedures, all tied together with PHP... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade
turck-mmcache? t Edward Vermillion wrote: Larry Brown wrote: I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=>$subArray) Now it displays as it previously did where $subArray is concerned. Is there something I'm missing here? Was I the only person not using "keys"? [snip] Has anyone seen this behaviour? I'd have to go back through my code, I'm using $key => $value in some places but not in others, but I didn't notice anything different in my code when I upgraded to 4.4 as far as the foreach loops are concerned. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting queries from files FYI
You may (or may not) remember me posting to the list a couple of weeks ago asking about using REGEX to get queries out of PHP files for a migration project. I had to let it go for several days, but started working on it again yesterday, here is the code (no REGEX was used in the making of this code); /* * CHA Query Finder * Jay Blanchard * August 2005 * NOT REALLY TOO EXTENSIBLE * * usage:call from command line, perform manual output to text file * i.e. php chaFinder.php > */ /* which directory will we be opening? this one, of course */ $theDirectory = $_SERVER['PWD']; /* array of things that identify beginnings of queries */ $arrQueryStarters = array('SELECT', 'INSERT', 'UPDATE', 'FROM'); /* cruise the directory looking for PHP files */ if (is_dir($theDirectory)) { if ($dh = opendir($theDirectory)) { while (($theFile = readdir($dh)) !== false) { $fileParts = explode('.', $theFile); /* we only want to look at PHP files */ if("php" == $fileParts[1]){ /* always echo the file name, even if no queries */ echo "filename: $theFile \n"; $lineNo = 0; /* cruise the file looking for queries */ $openFile = fopen($theFile, "r"); while(!feof($openFile)){ $fileLine = fgets($openFile, 4096); $lineNo++; /* loop through query starter array */ for($i = 0; $i < count($arrQueryStarters); $i++){ /* test if CHA is part of the query element */ if(strstr($fileLine, $arrQueryStarters[$i]) && strstr($fileLine, 'CHA')){ echo "Line Number: " . $lineNo . " " . $fileLine; } } } fclose($openFile); } } closedir($dh); } } This returns results that look like this ; filename: adminUsrMgmtVer.php filename: agRep.php filename: agRepExcept.php Line Number: 31 $sqlComm = "SELECT DISTINCT(`TmsCommission`) from `CHA`.`TMSUBS` "; Line Number: 61 $sqlAgImpact = "SELECT count(*) AS count FROM `CHA`.`TMSUBS` WHERE ... Line Number: 61 $sqlAgImpact = "SELECT count(*) AS count FROM `CHA`.`TMSUBS` WHERE ... Line Number: 65 $sqlAgTN = "SELECT `TmsMastPhoneNumber`, `Tm ... Line Number: 345$sqlBtnGBTR .= "FROM `CHA`.`TMARMAST` c "; Line Number: 372$sqlNew .= "FROM `CHA`.`TMARMAST` "; Given this you can see that with some more code I could find the beginning and/or end plus all of the lines in between so that the complete query can be seen and cataloged by file name and line number(s). This is very much what I was looking for. If you have any suggestions for improving this code, or see where I have done too much bull-in-the-china-shop/brute-force grepping they are very much appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 COM strange behaviour
Martin Staiger wrote: Hello NG, we have a script to create a word-document via COM which, so far, run pretty stable under php 4.3.7 are you using apache2 with php4? are you using the prefork version of apache2? (you should be!!) Since we upgraded to php 5.0.3.3 the same script works only on the first maybe try 5.0.2, 5.0.4 or 5.0.5beta ?? run! blooming odd - sounds like a thread[ing] related issue (which is why I say you should be using the orefork version of apache2) On the following runs the same script causes a fatal error on the code below: Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word Description: Wrong Parameter.' in [Scriptname]:65 Stack trace: #0 [Scriptname](65): variant->GoTo('wdGoToField', 'wdGoToFirst', 1) #1 [SourceScript] include('[Scriptname]') #2 {main} thrown in [Scriptname] on line 65 apparently the COM extension is designed to throw exceptions in php5 (sometimes). which, regardless of the fact that this exception is being thrown seems to be a complete error, would seem to mean that you are going to have to change your code slightly to incorporate at least one try/catch block around all your code in order to avoid uncaught exceptions. Code : $NumberFields = $word->ActiveDocument->MailMerge->fields->Count; for ($CounterFields = 1; $CounterFields <= $NumberFields; $CounterFields++) { $word->Selection->Range->GoTo(wdGoToField, wdGoToFirst, $CounterFields); are wdGoToField and wdGoToFirst actually constants? <-- Creates Fatal Error ... } When we reset the Apache-Service, the script runs again once! Subsequent calls create the same fatal error again ... we changed access-rights in dcomcnfg which didn't show any influence ... Environment: win 2003 server, Apache 2.0.53 I'm greatful for any hint ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Printing Error Help
Hi Richard, I am new as you can assume. Hence, I have no clue how to turn register_globals back "On" Is there any other place I can read more about creating Arrays? other than http://us2.php.net/manual/en/language.types.array.php The page is discussion: http://www.primarywave.com/BrokerOutpost_ContNAGHAM.php doesn't seem to send the email even Can you please shed some light? Thanks, C - Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: "Chirantan Ghosh" <[EMAIL PROTECTED]> Cc: "John Nichel" <[EMAIL PROTECTED]>; Sent: Tuesday, August 23, 2005 2:00 AM Subject: Re: [PHP] PHP Printing Error Help On Mon, August 22, 2005 12:56 pm, Chirantan Ghosh wrote: //[snip] You probably want to move into the relm of array's. For each one of your checkboxes, you can do this... /[/snip] I did look up ARRAY. I just didn't understand how I can insert a table( "InterestedNumber") in an arrey so I could put something like this for form processing: -- $value) { ${$indx}=$value; } foreach($HTTP_POST_VARS as $indx => $value) { ${$indx}=$value; } Gak. If you are going to do this, you might as well just turn register_globals back "On" You've got the SAME security problem -- You just are doing it to yourself instead of letting PHP do it to you. if($sendmessage == "yes"){ $mailBody .= "SelectedNumber: $SelectedNumber\n"; //I am thinking this is where I should put the Array??/ $mailBody .= "SelectedNumbers:\n"; $mailBody .= implode("\n", $InterestedNumbers); $mailBody .= "Comments: $comments\n\n\n"; -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Printing Error Help
[snip] I am new as you can assume. Hence, I have no clue how to turn > > register_globals back "On" > [/snip] Look in your php.ini file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting queries from files FYI
Jay Blanchard wrote: You may (or may not) remember me posting to the list a couple of weeks I am a goldfish. hi my name is 10second Tom ;-) ago asking about using REGEX to get queries out of PHP files for a migration project. I had to let it go for several days, but started working on it again yesterday, here is the code (no REGEX was used in the making of this code); seems like a nice little tool. I'm going to give it a go on my firebirdDB related projects... just too see if it works well (and if it does to see exactly how many queries I have :-) ... to that end I think I will have to extend the $arrQueryStarters array with: , 'EXECUTE', 'WHERE', 'ORDER BY', 'LEFT JOIN' and possibly a few more... also in cases where one has a single query string that is spread out over many lines then it would be nice to be able to have the script return the complete string (code snippet) as a whole rather than getting each line of the query piecemeal something to dig into... I'll let you know how I get on! rgds, Jochem /* * CHA Query Finder * Jay Blanchard * August 2005 * NOT REALLY TOO EXTENSIBLE * * usage:call from command line, perform manual output to text file * i.e. php chaFinder.php > */ /* which directory will we be opening? this one, of course */ $theDirectory = $_SERVER['PWD']; /* array of things that identify beginnings of queries */ $arrQueryStarters = array('SELECT', 'INSERT', 'UPDATE', 'FROM'); /* cruise the directory looking for PHP files */ if (is_dir($theDirectory)) { if ($dh = opendir($theDirectory)) { while (($theFile = readdir($dh)) !== false) { $fileParts = explode('.', $theFile); /* we only want to look at PHP files */ if("php" == $fileParts[1]){ /* always echo the file name, even if no queries */ echo "filename: $theFile \n"; $lineNo = 0; /* cruise the file looking for queries */ $openFile = fopen($theFile, "r"); while(!feof($openFile)){ $fileLine = fgets($openFile, 4096); $lineNo++; /* loop through query starter array */ for($i = 0; $i < count($arrQueryStarters); $i++){ /* test if CHA is part of the query element */ if(strstr($fileLine, $arrQueryStarters[$i]) && strstr($fileLine, 'CHA')){ echo "Line Number: " . $lineNo . " " . $fileLine; } } } fclose($openFile); } } closedir($dh); } } This returns results that look like this ; filename: adminUsrMgmtVer.php filename: agRep.php filename: agRepExcept.php Line Number: 31 $sqlComm = "SELECT DISTINCT(`TmsCommission`) from `CHA`.`TMSUBS` "; Line Number: 61 $sqlAgImpact = "SELECT count(*) AS count FROM `CHA`.`TMSUBS` WHERE ... Line Number: 61 $sqlAgImpact = "SELECT count(*) AS count FROM `CHA`.`TMSUBS` WHERE ... Line Number: 65 $sqlAgTN = "SELECT `TmsMastPhoneNumber`, `Tm ... Line Number: 345$sqlBtnGBTR .= "FROM `CHA`.`TMARMAST` c "; Line Number: 372$sqlNew .= "FROM `CHA`.`TMARMAST` "; Given this you can see that with some more code I could find the beginning and/or end plus all of the lines in between so that the complete query can be seen and cataloged by file name and line number(s). This is very much what I was looking for. If you have any suggestions for improving this code, or see where I have done too much bull-in-the-china-shop/brute-force grepping they are very much appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting queries from files FYI
[snip] heh Jay, I have been playing with this ... I rewrote your code abit (including removing the check for the string 'CHA' - cos that was limiting my search too much ;-) [/snip] Cool, I'll have a look. I was using the 'CHA' because I was looking for queries to the specific database. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting queries from files FYI
Jay Blanchard wrote: [snip] heh Jay, I have been playing with this ... I rewrote your code abit (including removing the check for the string 'CHA' - cos that was limiting my search too much ;-) [/snip] Cool, I'll have a look. I was using the 'CHA' because I was looking for queries to the specific database. I figured as much - I was think of adding an optional param so that you can optionally add such an extra limit e,g: cd /my/projects/stuff; php findqry.php --limit CHA > ./results.txt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting queries from files FYI
[snip] I figured as much - I was think of adding an optional param so that you can optionally add such an extra limit e,g: cd /my/projects/stuff; php findqry.php --limit CHA > ./results.txt [/snip] argv[] is always available Also, sweet move with the array_reverse... $fileParts = array_reverse(explode('.', $theFile)); if("php" == $fileParts[0]){ ...it prevents problems with funky file names containing more than one period. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI
Jay Blanchard wrote: [snip] I figured as much - I was think of adding an optional param so that you can optionally add such an extra limit e,g: cd /my/projects/stuff; php findqry.php --limit CHA > ./results.txt [/snip] argv[] is always available indeed - I'll add something for that... Also, sweet move with the array_reverse... $fileParts = array_reverse(explode('.', $theFile)); if("php" == $fileParts[0]){ ...it prevents problems with funky file names containing more than one period. hihi, I was just being pragmatic ... most of my files are named *.class.php, *.inc.php or *.funcs.php etc etc ... the script was running but finding nothing ;-) btw if my file names are funky I am too? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question on order of variables passed to a function
I'm writing a error handler for my scripts, so I went to : http:// us3.php.net/manual/en/function.set-error-handler.php I noticed something in the example 1 given there. and then: trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", E_USER_ERROR); ?> So, wouldn't this make $errno in the "myErrorHandler" be "log (x) " rather than E_USER_ERROR ? is this a typo on the website ? or am I not understanding how variables are passed to a function ? I always thought the variables needed to be passed in the same order as the signature of the function.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 COM strange behaviour
>> we have a script to create a word-document via COM which, so far, run >> pretty stable under php 4.3.7 > > are you using apache2 with php4? Yes ! > are you using the prefork version of apache2? (you should be!!) No - not to my knowledge. I couldn't really find out HOW to implement this prefork version !?!? It's off-topic here, but could you give me a hint, what to do/where to lookup? Is it just configuration or do we have to compile it ourselves? >> Since we upgraded to php 5.0.3.3 the same script works only on the first > > maybe try 5.0.2, 5.0.4 or 5.0.5beta ?? I'll try Apache 2 prefork first, since the changelog of PHP doesn't indicate any progress related to COM-operations recently. >> run! > > blooming odd - sounds like a thread[ing] related issue (which is why I say > you should be > using the orefork version of apache2) > >> On the following runs the same script causes a fatal error on the code >> below: >> >> Fatal error: Uncaught exception 'com_exception' with message 'Source: >> Microsoft Word >> Description: Wrong Parameter.' in [Scriptname]:65 >> Stack trace: >> #0 [Scriptname](65): variant->GoTo('wdGoToField', 'wdGoToFirst', 1) >> #1 [SourceScript] include('[Scriptname]') >> #2 {main} thrown in [Scriptname] on line 65 > > apparently the COM extension is designed to throw exceptions > in php5 (sometimes). which, regardless of the fact that this exception > is being thrown seems to be a complete error, would seem to mean that > you are going to have to change your code slightly to incorporate > at least one try/catch block around all your code in order > to avoid uncaught exceptions. We'll do so, after the core-problem is identified. >> Code : >> >> $NumberFields = $word->ActiveDocument->MailMerge->fields->Count; >> for ($CounterFields = 1; $CounterFields <= $NumberFields; >> $CounterFields++) >> { >> $word->Selection->Range->GoTo(wdGoToField, wdGoToFirst, >> $CounterFields); > > are wdGoToField and wdGoToFirst actually constants? yep. And they work usually. >> <-- Creates Fatal Error >>... >> } >> >> >> When we reset the Apache-Service, the script runs again once! Subsequent >> calls create the same fatal error again ... we changed access-rights in >> dcomcnfg which didn't show any influence ... >> >> Environment: win 2003 server, Apache 2.0.53 Thank you for the support ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI
[snip] > argv[] is always available [/snip] As an example you could something like this... $requestedDatabase = $argv[1]; so that [EMAIL PROTECTED]:/usr/myApp/whatever php chaFinder.php CHA > output.txt will have $requestedDatabase == 'CHA' [snip] btw if my file names are funky I am too? [/snip] Like a broke neck monkey; re: http://www.bumpcity.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting queries from files FYI
Jay Blanchard wrote: You may (or may not) remember me posting to the list a couple of weeks ago asking about using REGEX to get queries out of PHP files for a migration project. I had to let it go for several days, but started working on it again yesterday, here is the code (no REGEX was used in the making of this code); heh Jay, I have been playing with this ... I rewrote your code abit (including removing the check for the string 'CHA' - cos that was limiting my search too much ;-) I made it recursive + a few other tweaks, haven't look into the proper guts of 'grep' action yet - would be nice to clean that up a little. anyway another handy tool in the bag :-) here is the code btw: */ /* cruise the directory looking for PHP files */ function findTheQueries($theDirectory) { static $arrQueryStarters, $arrQueryStartersCnt, $dirSep; if (!isset($arrQueryStarters)) { $arrQueryStarters = array('SELECT ', 'INSERT ', 'UPDATE ', 'FROM ', 'EXECUTE ', 'WHERE ', 'ORDER BY ', 'LEFT JOIN '); $arrQueryStartersCnt= count($arrQueryStarters); // Determine OS specific settings $uname = php_uname(); if (substr($uname, 0, 7) == "Windows") { $dirSep = "\\"; } else if (substr($uname, 0, 3) == "Mac") { $dirSep = "/"; } else { $dirSep = "/"; } } if (is_dir($theDirectory)) { echo "Searching for queries in php files in: $theDirectory\n"; if ($dh = opendir($theDirectory)) { while (($theFile = readdir($dh)) !== false) { /* recurse subdirs */ if (is_dir($theDirectory.$dirSep.$theFile)) { if ($theFile != '.' && $theFile != '..') { findTheQueries($theDirectory.$dirSep.$theFile); } continue; } /* we only want to look at PHP files */ $fileParts = array_reverse(explode('.', $theFile)); if("php" == $fileParts[0]){ /* always echo the file name, even if no queries */ echo "Filename: {$theDirectory}{$dirSep}{$theFile}\n"; $lineNo = 0; /* cruise the file looking for queries */ $openFile = fopen($theDirectory.$dirSep.$theFile, "r"); while(!feof($openFile)){ $fileLine = fgets($openFile, 4096); $lineNo++; /* loop through query starter array */ for($i = 0; $i < $arrQueryStartersCnt; $i++){ if(strstr($fileLine, $arrQueryStarters[$i]) /* && strstr($fileLine, 'CHA') */){ echo "Line Number: " . $lineNo . " " . $fileLine; // if we find a line no need to find it again // because it contains more than one keyword. break; } } } fclose($openFile); } } closedir($dh); } else { echo "Could not open: $theDirectory\n"; } } else { echo "Bad directory: $theDirectory\n"; } } /* which directory will we be opening? this one, of course */ findTheQueries(getcwd() /* $_SERVER['PWD'] */); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [a proactive example of learning by hacking] Re: [PHP] Getting queries from files FYI
On 8/23/05, Jochem Maas <[EMAIL PROTECTED]> wrote: > Jay Blanchard wrote: > > > > Also, sweet move with the array_reverse... > > > > $fileParts = array_reverse(explode('.', $theFile)); > > if("php" == $fileParts[0]){ > > > > ...it prevents problems with funky file names containing more than one > > period. or you could just use glob('*.php') ? -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 COM strange behaviour
>>> we have a script to create a word-document via COM which, so far, run >>> pretty stable under php 4.3.7 >> >> are you using apache2 with php4? > > Yes ! Sorry - my mistake here : the problems are caused under PHP5. With PHP4 the script runs fine, so right now we are using PHP4, but due to other functionality we're forced to migrate to PHP5 pretty soon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs. ColdFusion
Quoting Rick Emery <[EMAIL PROTECTED]>: Ugh, we're *never* going to make a decision. My boss just sent me this email: A *huge* "THANK YOU!" to everybody who replied; it was extremely helpful and, after my meeting with my manager this morning, she seemed to accept that the article was dated and had inaccurate information. Unfortunately, I may be fighting an uphill battle. I'll give background for those who seemed interested in our progress, but it's pretty long, so feel free to delete this and move on to your regularly scheduled messages (though I'm secretly hoping that someone will have helpful information or suggestions). I wrote an application, using PHP5, that displays a list and refreshes every 30 seconds (the data is constantly changing, but a 30 second delay is acceptable). As I've indicated previously, we're a Microsoft shop, so the data comes from MS SQL Server 2000. No problems, the app worked great using my workstation as the server with a few clients running the app from it. It even worked when we moved it to a server and opened it up to everyone on our intranet (for a while). We have two different types of clients. Some use desktop computers, physically connected to our network, while others use mobile laptops connected to our network via cellular (using Sprint AirCards) using third-party VPN software (Padcom, in case anyone's familiar). We set the application up on a Windows 2000 Server with IIS (5, I think), and it would work fine for about a day. Then Padcom clients kept stopping. They'd request the page and, after a loong time, display a message that the request timed out. This would seemingly happen for all Padcom-connected clients at the same time, though the desktops continued to work fine. We restarted the server running the Padcom software with no effect. We restarted IIS on the web server with no effect. The only thing (seemingly) that cleared the issue was rebooting the server running IIS. I spent a day and a half looking at the issue with the network and server administrators, but nobody could find where the problem was. So, we moved it to a Windows 2003 Server with IIS 6; same problem. On my own, I set up a linux server with apache and placed the application there. They changed the DNS record to point to the linux server, and it has run flawlessly ever since (53 days, 22 hours, 11 minutes). Nobody has mentioned changing anything, until this morning. My manager informed me in our meeting that no language could be chosen unless it works under IIS. So, I'm faced with finding an obscur problem, running on obscur software (the vendor for Padcom, of course, insists that they've never seen this problem). I'm confident that the problem has *nothing* to do with PHP, but am forced by management to try to prove it. That's it in a nutshell. Thanks again to everybody for your help and support. Rick -- Rick Emery "When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return" -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs. ColdFusion
Ugh, we're *never* going to make a decision. My boss just sent me this email: A *huge* "THANK YOU!" to everybody who replied; it was extremely helpful and, after my meeting with my manager this morning, she seemed to accept that the article was dated and had inaccurate information. Thanks for the update! Unfortunately, I may be fighting an uphill battle. I'll give background for those who seemed interested in our progress, but it's pretty long, so feel free to delete this and move on to your regularly scheduled messages (though I'm secretly hoping that someone will have helpful information or suggestions). I wrote an application, using PHP5, that displays a list and refreshes every 30 seconds (the data is constantly changing, but a 30 second delay is acceptable). As I've indicated previously, we're a Microsoft shop, so the data comes from MS SQL Server 2000. No problems, the app worked great using my workstation as the server with a few clients running the app from it. It even worked when we moved it to a server and opened it up to everyone on our intranet (for a while). We set the application up on a Windows 2000 Server with IIS (5, I think), and it would work fine for about a day. Then Padcom clients kept stopping. They'd request the page and, after a loong time, display a message that the request timed out. This would seemingly happen for all Padcom-connected clients at the same time, though the desktops continued to work fine. We restarted the server running the Padcom software with no effect. We restarted IIS on the web server with no effect. The only thing (seemingly) that cleared the issue was rebooting the server running IIS. Have you tried PHP 4.x? Give that a shot and see what effects that has on the application. I spent a day and a half looking at the issue with the network and server administrators, but nobody could find where the problem was. So, we moved it to a Windows 2003 Server with IIS 6; same problem. On my own, I set up a linux server with apache and placed the application there. They changed the DNS record to point to the linux server, and it has run flawlessly ever since (53 days, 22 hours, 11 minutes). Nobody has mentioned changing anything, until this morning. My manager informed me in our meeting that no language could be chosen unless it works under IIS. You might want to post the code for your application on the list so we all can see it (remember to remove usernames, passwords, and ip #'s). It's too bad you have to use Windows and IIS. Just curious but why are they not wanting to use Linux? Do they know it's free and way less likely to be attacked? Also, I'm sure there are people on this list that are experienced with Windows and IIS that can help you determine if something with the setup of it needs to be changed in order for your code to work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for CMS advice
On 23 Aug 2005, at 14:05, Jay Paulson wrote: I would say check out Dupral, Mambo, and XOOPS. Drupal looks great, but whenever I've tried to get into it, nothing seems to work properly. Xoops is capable (I've used it on a couple of sites), but generally a complete mess internally. Both of them have massive, cryptic control panels and it's inordinately complicated to do simple things like "put this bit of text at the top of the front page". Unless you want your site to look and work like everyone else's Nuke clone, I'd steer clear of these. The majority of so-called content management systems actually fail dismally at managing content. I don't know why they even use the name. For simple sites, Website Baker is great, especially if the intended admin wants little hassle. It's one of the few that seems to put a strong emphasis on usability over feature bloat. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] string to .ZIP | sending report by email
I have a script that generate a XHTML report, but also i want to send that report by email, the problem is the file size its up to 4Mb, its too big to send by email (considering that some people still using hotmail).. how i can send it compressed by email? anyone knows a class that can help me? any suggestions are welcome :D thanks -- JOSUE ARANDA>>> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs. ColdFusion
At 01:44 PM 8/23/2005, Rick Emery wrote: Quoting Rick Emery <[EMAIL PROTECTED]>: Ugh, we're *never* going to make a decision. My boss just sent me this email: A *huge* "THANK YOU!" to everybody who replied; it was extremely helpful and, after my meeting with my manager this morning, she seemed to accept that the article was dated and had inaccurate information. Unfortunately, I may be fighting an uphill battle. I'll give background for those who seemed interested in our progress, but it's pretty long, so feel free to delete this and move on to your regularly scheduled messages (though I'm secretly hoping that someone will have helpful information or suggestions). I wrote an application, using PHP5, that displays a list and refreshes every 30 seconds (the data is constantly changing, but a 30 second delay is acceptable). As I've indicated previously, we're a Microsoft shop, so the data comes from MS SQL Server 2000. No problems, the app worked great using my workstation as the server with a few clients running the app from it. It even worked when we moved it to a server and opened it up to everyone on our intranet (for a while). We have two different types of clients. Some use desktop computers, physically connected to our network, while others use mobile laptops connected to our network via cellular (using Sprint AirCards) using third-party VPN software (Padcom, in case anyone's familiar). We set the application up on a Windows 2000 Server with IIS (5, I think), and it would work fine for about a day. Then Padcom clients kept stopping. They'd request the page and, after a loong time, display a message that the request timed out. This would seemingly happen for all Padcom-connected clients at the same time, though the desktops continued to work fine. We restarted the server running the Padcom software with no effect. We restarted IIS on the web server with no effect. The only thing (seemingly) that cleared the issue was rebooting the server running IIS. I spent a day and a half looking at the issue with the network and server administrators, but nobody could find where the problem was. So, we moved it to a Windows 2003 Server with IIS 6; same problem. On my own, I set up a linux server with apache and placed the application there. They changed the DNS record to point to the linux server, and it has run flawlessly ever since (53 days, 22 hours, 11 minutes). Nobody has mentioned changing anything, until this morning. My manager informed me in our meeting that no language could be chosen unless it works under IIS. So, I'm faced with finding an obscur problem, running on obscur software (the vendor for Padcom, of course, insists that they've never seen this problem). I'm confident that the problem has *nothing* to do with PHP, but am forced by management to try to prove it. That's it in a nutshell. Thanks again to everybody for your help and support. Rick -- Rick Emery Rick, Deepest sympathy. So you have a solution which works, for everyone, but doctrine dictates differently. I'd suspect VPN / IIS interaction. If I was your manager, I'd take comfort from the FACT that you were able to switch everything over to Linux and it ran w/o difficulty. Cripes, if you had this problem with ColdFusion you'd be sitting there, a lonely soul, amongst the finger-pointers, and nothing would be running. Best regards - Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP vs. ColdFusion
Have you tried PHP 4.x? Give that a shot and see what effects that has on the application. We have used PHP with IIS and SQL Server like you said, I can say from experience that PHP 5 had the same problems as the initial poster described. The pages would time out and hang randomly. I put a 4.x version of PHP on the machine and it's been working ever since. Also if you plan on using PHP with SQL Server and Linux we have been using 5 with no problems for over a year now. It gets pretty heavy use daily. The only gripe I have is FreeTDS only allows one connection at a time, I'd love to use a JDBC driver with PHP. We're looking at using PHP and Hibernate which would let us use JDBC.. Best of luck. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files passing through
Benchmark it both ways and see. I benched this with a 100 MiB text file (largest I could find at short notice). Buffer used for fread() calls was 2 KiB as above. Values are averaged over 100 runs (I would have liked to do more, but I don't have time). All values are to 4 significant figures. Thought it might be interesting to see what happens by changing the buffer size using the fread option. Hacked up your script to run 100 times for a variety of buffer sizes reading in a ~100mb file, writing it out to /dev/null. Each iteration would shuffle the buffer size array so that it didn't them in various orders (just cause). This is on a FreeBSD 4.x box 800mhz, scsi disk, completely idle. Looks like for my server, 32K is the fastest, but it also looks like it really doesn't matter much. And none of this was run through apache which might have an affect since it's going to cache data before sending it as well I expect. BUFSIZE AVERAGE MIN MAX STDEV 10241.161640766 0.750351191 2.089925051 0.343560356 20481.192794297 0.749926805 2.099468946 0.352989462 40961.175014074 0.750481129 2.094204187 0.340703504 81921.191642218 0.750271797 2.103453875 0.342129591 16384 1.179281006 0.750427008 2.103821039 0.294178021 32768 1.112951536 0.750751972 2.096071959 0.280774437 65536 1.121285999 0.750077009 2.084055901 0.281509943 131072 1.223868408 0.750341177 2.114228964 0.376586171 262144 1.195006318 0.750770092 2.094146013 0.307552031 524288 1.247279932 0.75097084 2.878097057 0.405213182 1048576 1.162287986 0.752273083 2.099447012 0.328753411 2097152 1.170556216 0.752089024 2.101628065 0.298650593 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP vs. ColdFusion
> We set the application up on a Windows 2000 Server with IIS (5, I > think), and it would work fine for about a day. Then Padcom clients > kept stopping. They'd request the page and, after a loong time, > display a message that the request timed out. Can they access other (non-php) pages on that server during one of these failures? Can they PING the server? I would bet a days pay ($5.25 - just got a raise!) that they can't. And if I'm right, this eliminates PHP as the cause and starts to smell more of a firewall/routing/DNS/VPN type problem. Have your network people had a look at a packet capture from the network during one of the failures? If they did, they would see what was happening. The fact that you say it is ONLY the padcom clients is enlightening because it means this is not a server failure, but a failure somewhere in between or at the client itself. In any case, I don't think your boss's requirement that whatever language is chosen must run on IIS (ack!) is violated, because PHP runs quite nicely on thousands (I'm sure) of IIS servers. JM "Windows: 32-bit extensions and a graphic shell for a 16-bit patch to an 8-bit OS originally coded for a 4-bit CPU, written by a 2-bit company that can't stand 1-bit of competition." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: string to .ZIP | sending report by email
Hello, on 08/23/2005 02:13 PM Ing. Josué Aranda said the following: I have a script that generate a XHTML report, but also i want to send that report by email, the problem is the file size its up to 4Mb, its too big to send by email (considering that some people still using hotmail).. how i can send it compressed by email? anyone knows a class that can help me? Here you may find several solutions for your problem: http://www.phpclasses.org/browse/class/42/top/rated.html -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php as standalone?
Hi there, I am going to take that chance now to ask if it is viable to create a standalone app with php and gtk+, fully realizing that this IS the php list ;-) I was thinking of php/gtk+ because I need that as a cross-platform application. What I really would like is to have .rpm's and .exe's created, so one can include them in the OS startup. Is this possible at all with php? Has anyone worked with php to create standalone apps? I essentially want to be able to auto update and synchronize a local xml based database with an online one (ok, plus doing some viewing and creating of reports, and so on, and so forth . ) Alternatives could be: mono, qt (arrgh), mozilla/xul (any done that?) or Java :-( . Any thoughts on that? Thomas
RE: [PHP] php as standalone?
[snip] I am going to take that chance now to ask if it is viable to create a standalone app with php and gtk+, fully realizing that this IS the php list ;-) [/snip] Check out http://www.priadoblender.com it may do exactly what you want. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question on order of variables passed to a function
Vidyut Luther wrote: and then: trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", E_USER_ERROR); ?> So, wouldn't this make $errno in the "myErrorHandler" be "log (x) " rather than E_USER_ERROR ? No, because you're calling trigger_error, not myErrorHandler. The order of parameters for trigger_error is as follows[1]: bool trigger_error ( string error_msg [, int error_type] ) trigger_error will, when called, either call your user-defined handler with the correct errno, errstr, errfile, errline etc, or, if you haven't defined one, it will use the error handling methods set up in PHP (log_errors or display_errors). HTH Jasper [1] http://www.php.net/trigger_error -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] possible to get a function from another domain
hi there! Is it possible in PHP to retrieve value from one domain to another than my own? Something like this: Other domain: function getValueForMp3Player() My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves value from other domain /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as standalone?
Damn... you said those words "cross platform".. But I'll still take this opportunity to plug Winbinder again. If you're just working with a Windows platform, Winbinder has it all!Fantastic interface, very self contained, just a great PHP standalone/app/etc extension all around. Eh.. check it out anyway. :) http://www.hypervisual.com/winbinder/ -TG = = = Original message = = = Hi there, I am going to take that chance now to ask if it is viable to create a standalone app with php and gtk+, fully realizing that this IS the php list ;-) I was thinking of php/gtk+ because I need that as a cross-platform application. What I really would like is to have .rpm's and .exe's created, so one can include them in the OS startup. Is this possible at all with php? Has anyone worked with php to create standalone apps? I essentially want to be able to auto update and synchronize a local xml based database with an online one (ok, plus doing some viewing and creating of reports, and so on, and so forth . ) Alternatives could be: mono, qt (arrgh), mozilla/xul (any done that?) or Java :-( . Any thoughts on that? Thomas ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible to get a function from another domain
I'm not sure I understand but: You define a function on one machine; You want to use that function on another machine; If I understand you correctly, then you should be able to just cp function_server.php function_server.txt , and include it over http and done On 8/23/05, Gustav Wiberg <[EMAIL PROTECTED]> wrote: > hi there! > > Is it possible in PHP to retrieve value from one domain to another than my > own? > > Something like this: > > Other domain: function getValueForMp3Player() > > My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves value > from other domain > > /G > @varupiraten.se > > -- > 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] possible to get a function from another domain
Gustav Wiberg wrote: Is it possible in PHP to retrieve value from one domain to another than my own? Something like this: Other domain: function getValueForMp3Player() My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves value from other domain What exactly do you mean by domain in this example? You can include() or require() the file with the function declaration in it... Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as standalone?
This is pretty cool stuff! This is compiled code for Windows only so no source is available? Therefore, making it so that people can't view your source? Damn... you said those words "cross platform".. But I'll still take this opportunity to plug Winbinder again. If you're just working with a Windows platform, Winbinder has it all!Fantastic interface, very self contained, just a great PHP standalone/app/etc extension all around. Eh.. check it out anyway. :) http://www.hypervisual.com/winbinder/ -TG = = = Original message = = = Hi there, I am going to take that chance now to ask if it is viable to create a standalone app with php and gtk+, fully realizing that this IS the php list ;-) I was thinking of php/gtk+ because I need that as a cross-platform application. What I really would like is to have .rpm's and .exe's created, so one can include them in the OS startup. Is this possible at all with php? Has anyone worked with php to create standalone apps? I essentially want to be able to auto update and synchronize a local xml based database with an online one (ok, plus doing some viewing and creating of reports, and so on, and so forth . ) Alternatives could be: mono, qt (arrgh), mozilla/xul (any done that?) or Java :-( . Any thoughts on that? Thomas ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- 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] possible to get a function from another domain
Hi! Njae I have a webshop and want to see a price from another webshop online (directly). Let's call my webshop - varupiraten.se and the other webshop - inwarehouse.se I want to be able to see what price inwarehouse.se has for a certain product directly. (without no copying). Of course I have to know the implemenation of the code that inwarehouse.se has given to varupiraten.se Do you understand what I'm trying to do? :-) /G @varupiraten.se - Original Message - From: "Rory Browne" <[EMAIL PROTECTED]> To: "Gustav Wiberg" <[EMAIL PROTECTED]> Cc: "PHP General" Sent: Tuesday, August 23, 2005 9:45 PM Subject: Re: [PHP] possible to get a function from another domain I'm not sure I understand but: You define a function on one machine; You want to use that function on another machine; If I understand you correctly, then you should be able to just cp function_server.php function_server.txt , and include it over http and done On 8/23/05, Gustav Wiberg <[EMAIL PROTECTED]> wrote: hi there! Is it possible in PHP to retrieve value from one domain to another than my own? Something like this: Other domain: function getValueForMp3Player() My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves value from other domain /G @varupiraten.se -- 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 -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.14/79 - Release Date: 2005-08-22 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] possible to get a function from another domain
[snip] I have a webshop and want to see a price from another webshop online (directly). Let's call my webshop - varupiraten.se and the other webshop - inwarehouse.se I want to be able to see what price inwarehouse.se has for a certain product directly. (without no copying). Of course I have to know the implemenation of the code that inwarehouse.se has given to varupiraten.se Do you understand what I'm trying to do? :-) [/snip] So, you do not own the other webshop? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible to get a function from another domain
Hi! Can I use require with http? My domain: www.varupiraten.se Other domain: www.webshop2.se Does this kind of code work? Code for my domain: http://www.webshop2.se/externfunctions.php); $x = getValueFromProduct('Inno AX5000'); //This function retrieves price from webshop2.se ? /G @varupiraten.se - Original Message - From: "Jasper Bryant-Greene" <[EMAIL PROTECTED]> To: Sent: Tuesday, August 23, 2005 9:47 PM Subject: Re: [PHP] possible to get a function from another domain Gustav Wiberg wrote: Is it possible in PHP to retrieve value from one domain to another than my own? Something like this: Other domain: function getValueForMp3Player() My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves value from other domain What exactly do you mean by domain in this example? You can include() or require() the file with the function declaration in it... Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.14/79 - Release Date: 2005-08-22 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible to get a function from another domain
Gustav Wiberg wrote: Hi! Njae I have a webshop and want to see a price from another webshop online (directly). Let's call my webshop - varupiraten.se and the other webshop - inwarehouse.se I want to be able to see what price inwarehouse.se has for a certain product directly. (without no copying). Of course I have to know the implemenation of the code that inwarehouse.se has given to varupiraten.se Do you understand what I'm trying to do? :-) If it was me, I'd just implement a little XML interface on inwarehouse.se that can be called like http://inwarehouse.se/xml?productID=54385 and returns some XML data for that product. Then call it from varupiraten.se and parse the XML. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] possible to get a function from another domain
[snip] Can I use require with http? My domain: www.varupiraten.se Other domain: www.webshop2.se Does this kind of code work? Code for my domain: http://www.webshop2.se/externfunctions.php); $x = getValueFromProduct('Inno AX5000'); //This function retrieves price from webshop2.se ? [/snip] Have you tried it? Really, unless you own the the other domain and have a way to access the data, you really cannot do this without some sort of screen scraping or URL munging. Let us say that you know the product listing for the other domain is something like http://www.webshop2.com/productInfo.php?product=Inno_AX5000 You could retrieve that data and manipulate it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as standalone?
What I've done with it hasn't included any compiling or code obscuring, but there are a number of PHP code protection schemes that may work with this. I havn't kept up on recent developments, but I've seen the question ask a number of times if you can compile or at least wrap a Winbinder/PHP project together to appear more like an application so someone may have something. I know Rubem's made a lot of effort to make Winbinder as compact as possible. Relying on SQLite as well as an alternative DB abstraction layer and a recompiled scaled down version of PHP that strips out all the web based features that are irrelevant to programming for a Windows app. If this catches anyone's eye, I'd definitely recommend digging through the forums, getting on the forum mailing/notification list, etc. And if anyone wants to contribute, Rubem's looking for some good C people as well as people good with documentation, code samples, etc to add to the project (fuel the fires so to speak :). He's done an incredible job so far but it's tough to maintain something this big with the small team of volunteers he's cobbled together. For me, a native Windows API extension was like a holy grail after playing with GTK and..err.. some other GUI for PHP that I forget. The project seemed so obvious yet it hadn't really been done to the degree that Winbinder has achieved. And of course there's the potential (not sure if Rubem has explored this yet) of making Winbinder more of a universal Windows API interface that could be used with PERL, Python, etc like some other projects have done. So much potential. Anyway, my thoughts and opinions, blah blah. -TG = = = Original message = = = This is pretty cool stuff! This is compiled code for Windows only so no source is available? Therefore, making it so that people can't view your source? > Damn... you said those words "cross platform".. But I'll still take > this opportunity to plug Winbinder again. If you're just working > with a Windows platform, Winbinder has it all!Fantastic interface, > very self contained, just a great PHP standalone/app/etc extension all > around. > > Eh.. check it out anyway. :) > http://www.hypervisual.com/winbinder/ > > -TG > > = = = Original message = = = > > Hi there, > > > > I am going to take that chance now to ask if it is viable to create a > standalone app with php and gtk+, fully realizing that this IS the php > list > ;-) > > I was thinking of php/gtk+ because I need that as a cross-platform > application. What I really would like is to have .rpm's and .exe's > created, > so one can include them in the OS startup. Is this possible at all > with php? > Has anyone worked with php to create standalone apps? > > > > I essentially want to be able to auto update and synchronize a local > xml > based database with an online one (ok, plus doing some viewing and > creating > of reports, and so on, and so forth . ) > > > > Alternatives could be: mono, qt (arrgh), mozilla/xul (any done that?) > or > Java :-( . > > > > Any thoughts on that? > > > > Thomas ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] possible to get a function from another domain
> [snip] > Can I use require with http? > > My domain: www.varupiraten.se > > Other domain: www.webshop2.se > > Does this kind of code work? > > Code for my domain: > require(http://www.webshop2.se/externfunctions.php); > $x = getValueFromProduct('Inno AX5000'); //This function > retrieves price > > from webshop2.se > ? > [/snip] > > Have you tried it? > > Really, unless you own the the other domain and have a way to > access the > data, you really cannot do this without some sort of screen > scraping or > URL munging. Let us say that you know the product listing for > the other > domain is something like > > http://www.webshop2.com/productInfo.php?product=Inno_AX5000 > > You could retrieve that data and manipulate it. > But even if you did, you're giving the other guy the power to break your site. All he has to do is change the URL or the format of the page, and BOOM, your site croaks. So a relevant question is: "Do you have control of the other site, or at least the cooperation of the other site's owner?" JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as standalone?
mybe this can help... http://www.dwebpro.com/ with this app you can us a CD or DVD like a stand alone for distributing your php script :D On 8/23/05, Thomas <[EMAIL PROTECTED]> wrote: > Hi there, > > > > I am going to take that chance now to ask if it is viable to create a > standalone app with php and gtk+, fully realizing that this IS the php list > ;-) > > I was thinking of php/gtk+ because I need that as a cross-platform > application. What I really would like is to have .rpm's and .exe's created, > so one can include them in the OS startup. Is this possible at all with php? > Has anyone worked with php to create standalone apps? > > > > I essentially want to be able to auto update and synchronize a local xml > based database with an online one (ok, plus doing some viewing and creating > of reports, and so on, and so forth . ) > > > > Alternatives could be: mono, qt (arrgh), mozilla/xul (any done that?) or > Java :-( . > > > > Any thoughts on that? > > > > Thomas > > > -- JOSUE ARANDA>>> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible to get a function from another domain
I withdraw my information in my earlier post. I was in a cybercafe in a hurry - and didn't have time to consider what was said, nor what I was saying myself. What I said before has little or not merit. You can make an experimental interface, and parse the html without the other domain owners co-operation(although it may be considered rude to do it without his consent). Your interface breaks when he changes his system. You can get him to create an XML page, that you can parse, if you have his co-operation, or you could possibly get him to create an XML-RPC or SOAP interface to his site. On 8/23/05, Jim Moseby <[EMAIL PROTECTED]> wrote: > > [snip] > > Can I use require with http? > > > > My domain: www.varupiraten.se > > > > Other domain: www.webshop2.se > > > > Does this kind of code work? > > > > Code for my domain: > > > require(http://www.webshop2.se/externfunctions.php); > > $x = getValueFromProduct('Inno AX5000'); //This function > > retrieves price > > > > from webshop2.se > > ? > > [/snip] > > > > Have you tried it? > > > > Really, unless you own the the other domain and have a way to > > access the > > data, you really cannot do this without some sort of screen > > scraping or > > URL munging. Let us say that you know the product listing for > > the other > > domain is something like > > > > http://www.webshop2.com/productInfo.php?product=Inno_AX5000 > > > > You could retrieve that data and manipulate it. > > > > But even if you did, you're giving the other guy the power to break your > site. All he has to do is change the URL or the format of the page, and > BOOM, your site croaks. > > So a relevant question is: "Do you have control of the other site, or at > least the cooperation of the other site's owner?" > > JM > > -- > 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] Hardware Detection
This works on Linux/Unix boxen. On windows... You're on your own. //generate the global array here so we can re-use it independant of output format $device['os_ver'] = exec("/bin/uname -a"); $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth0 | /bin/grep HWaddr"), -1, PREG_SPLIT_NO_EMPTY); $device['MAC_addr_eth0'] = $temp[4]; $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth0 | /bin/grep \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY); $device['dot_quad_ip_eth0'] = $temp[2]; $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth1 2>&1 | /bin/grep HWaddr"), -1, PREG_SPLIT_NO_EMPTY); $device['MAC_addr_eth1'] = $temp[4]; $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth1 2>&1 | /bin/grep \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY); $device['dot_quad_ip_eth1'] = $temp[2]; # look at /var for now as that seems to be where the bulk of our data is stored. $temp = preg_split("/\s+/",exec("/bin/df | /bin/grep hda1"), -1, PREG_SPLIT_NO_EMPTY); $device['hd_size'] = $temp[1]; $device['hd_used'] = $temp[2]; $temp = preg_split("/\s+/",exec("/usr/bin/free | /bin/grep Mem"), -1, PREG_SPLIT_NO_EMPTY); $device['ram_total'] = $temp[1]; $device['ram_used'] = $temp[2]; $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | /bin/grep 'model name'"), -1, PREG_SPLIT_NO_EMPTY); $temp1 = preg_split("/\s\s/",ltrim($temp[1]), -1, PREG_SPLIT_NO_EMPTY); $device['cpu_type'] = $temp1[0]; $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | /bin/grep 'cpu MHz'"), -1, PREG_SPLIT_NO_EMPTY); $device['cpu_mhz'] = ltrim($temp[1]); $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep 'VGA'"), 8), -1, PREG_SPLIT_NO_EMPTY); $device['video'] = $temp[1]; $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep 'Host'"), 8), -1, PREG_SPLIT_NO_EMPTY); $device['mobo'] = $temp[1]; $ethernet = `/usr/bin/lspci | grep 'Ethernet'`; $temp = split("\n",$ethernet); $temp1 = preg_split("/:/",substr($temp[0],8), -1, PREG_SPLIT_NO_EMPTY); $device['nic_eth0'] = substr($temp1[1],1); $temp1 = preg_split("/:/",substr($temp[1],8), -1, PREG_SPLIT_NO_EMPTY); $device['nic_eth1'] = substr($temp1[1],1); $device['proc_count'] = trim(`ps auxw | wc -l`); $device['someprocessd'] = trim(`ps axuw | grep "someprocessd" | grep -v "grep" | wc -l`); # Returns the uptime of a Linux system by parsing through /proc/uptime. # It returns a 4-field array (days, hours, minutes, seconds). # I typically use it like: # $ut = linuxUptime(); # echo "Time since last reboot: $ut[0] days, $ut[1] hours, $ut[2] minutes"; $ut = strtok( exec( "cat /proc/uptime" ), "." ); $days = sprintf( "%d", ($ut/(3600*24)) ); $hours = sprintf( "%2d", ( ($ut % (3600*24)) / 3600) ); $min = sprintf( "%2d", ($ut % (3600*24) % 3600)/60 ); $sec = sprintf( "%2d", ($ut % (3600*24) % 3600)%60 ); $device['uptime'] = $days."d ".$hours."h ".$min."m ".$sec."s"; //this version fails if the uptime is < 24 hours or 1 day since it's shown as 20:15 //$temp = preg_split("/:/",exec("uptime"), -1, PREG_SPLIT_NO_EMPTY); //$device['loadavg'] = substr($temp[2],1); preg_match("/load average: (.*)/",exec("uptime"), $temp); $device['loadavg'] = $temp[1]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as standalone?
You don´t need your linux or unix php app to be standalone, since putting a #!/usr/bin/php at the start of your script, means that most users won't know the difference. For RPM/DPKG you simply add a php dependency. On 8/23/05, Ing. Josué Aranda <[EMAIL PROTECTED]> wrote: > mybe this can help... > > http://www.dwebpro.com/ > > with this app you can us a CD or DVD like a stand alone for > distributing your php script > > :D > > > On 8/23/05, Thomas <[EMAIL PROTECTED]> wrote: > > Hi there, > > > > > > > > I am going to take that chance now to ask if it is viable to create a > > standalone app with php and gtk+, fully realizing that this IS the php list > > ;-) > > > > I was thinking of php/gtk+ because I need that as a cross-platform > > application. What I really would like is to have .rpm's and .exe's created, > > so one can include them in the OS startup. Is this possible at all with php? > > Has anyone worked with php to create standalone apps? > > > > > > > > I essentially want to be able to auto update and synchronize a local xml > > based database with an online one (ok, plus doing some viewing and creating > > of reports, and so on, and so forth . ) > > > > > > > > Alternatives could be: mono, qt (arrgh), mozilla/xul (any done that?) or > > Java :-( . > > > > > > > > Any thoughts on that? > > > > > > > > Thomas > > > > > > > > > -- > > > JOSUE ARANDA>>> > > -- > 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] exec ping
Here's one I wrote: /** * Checks the status of an address as being "U" or "D". * * @access public * @return "U" or "D" * @param$TargetRange the dotted quad address to check * @param$DEBUG debugging output. default is false. * @since3.0 */ function CheckIP($TargetRange, $DEBUG = false) { $Status = "?"; if (preg_replace("/[^0-9.A-Za-z]/","",$TargetRange) == $TargetRange) { $res = exec("ping -n -c 1 -w 1 -q ".escapeshellarg($TargetRange)); //if (preg_match("/round-trip min\/avg\/max\/mdev/",$res)) { $Status = "U"; } else { $Status = "D"; } if ($DEBUG) echo $TargetRange." ping = ".$res.""; if ( strstr($res,"100% packet loss") ) { $Status = "D"; //if ping fails, it could still be there, so try nmap as a sanity check. $res = exec("nmap -sP -n -r ".escapeshellarg($TargetRange)); if ($DEBUG) echo $TargetRange." nmap = ".$res.""; if ( strstr($res,"1 host up") ) $Status = "U"; } else $Status = "U"; } if ($DEBUG) { echo "CheckIP $TargetRange Status = ".$Status.""; echo str_pad(" ", 300); flush(); } return $Status; } //CheckIP > -Original Message- > From: Juan Pablo Herrera [mailto:[EMAIL PROTECTED] > Sent: Saturday, August 20, 2005 11:35 PM > To: Jasper Bryant-Greene > Cc: php-general@lists.php.net > Subject: Re: [PHP] exec ping > > On 8/21/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote: > > Juan Pablo Herrera wrote: > > > Thanks Jasper, > > > well, i need make a explode of results of the ping. The > idea is check > > > a host and when the host don´ t response send a email. > > > I don't explode the result of the ping. > > > > If it was me, I'd try opening a socket connection to the > host instead, > > and check to see if you can connect or not. Whether or not that is > > suitable to your application I don't know... > > > > Jasper > > > > Hi! > I did following script: > > // Exec a ping > exec('ping -c 5 192.168.236.3',$result); > // Take result from icmp seq = 2 > $icmp = strpos($result[2], 'time='); > > $icmp = $icmp + 5; > > $fin = strpos($result[2], 'ms'); > // This is my end > $fin = $fin - $icmp; > // I take only the ms time > $text = substr($result[2],$icmp,$fin); > // Strip whitespace > $ms = trim($text); > > if (!is_numeric($ms)) { > $a = '[EMAIL PROTECTED]'; > $asunto = "Servidor Caido"; > $mensaje = "Posible caida del servidor. No responde PING."; > mail($a, $asunto, $mensaje); > } > > ?> > > It's very simple, but i think that is working. I will add > other options. > > JP > > -- > 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] Hardware Detection
I misread the OP. No. you can't get information on the hardware of a CLIENT's machine via PHP. You may be able to do it through some JS or I'm pretty sure through some ActiveX control (on Microsoft brosers of course). We make an appliance that "phones home" for updates and such, and therefore we have the luxury of a PHP crontab script that sends this information back to us. To us, they are "clients" -- different definition of client than the OP though. ;-) > -Original Message- > From: Daevid Vincent [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 23, 2005 1:25 PM > To: php-general@lists.php.net > Cc: 'Saenal M' > Subject: RE: [PHP] Hardware Detection > > This works on Linux/Unix boxen. > > //generate the global array here so we can re-use it > independant of output format > $device['os_ver'] = exec("/bin/uname -a"); > > $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth0 | /bin/grep > HWaddr"), -1, PREG_SPLIT_NO_EMPTY); > $device['MAC_addr_eth0'] = $temp[4]; > > $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth0 | /bin/grep > \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY); > $device['dot_quad_ip_eth0'] = $temp[2]; > > $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth1 2>&1 > | /bin/grep > HWaddr"), -1, PREG_SPLIT_NO_EMPTY); > $device['MAC_addr_eth1'] = $temp[4]; > > $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth1 > 2>&1 | /bin/grep > \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY); > $device['dot_quad_ip_eth1'] = $temp[2]; > > # look at /var for now as that seems to be where the bulk of > our data is > stored. > $temp = preg_split("/\s+/",exec("/bin/df | /bin/grep hda1"), -1, > PREG_SPLIT_NO_EMPTY); > $device['hd_size'] = $temp[1]; > $device['hd_used'] = $temp[2]; > > $temp = preg_split("/\s+/",exec("/usr/bin/free | /bin/grep Mem"), -1, > PREG_SPLIT_NO_EMPTY); > $device['ram_total'] = $temp[1]; > $device['ram_used'] = $temp[2]; > > $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | > /bin/grep 'model > name'"), -1, PREG_SPLIT_NO_EMPTY); > $temp1 = preg_split("/\s\s/",ltrim($temp[1]), -1, > PREG_SPLIT_NO_EMPTY); > $device['cpu_type'] = $temp1[0]; > $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | /bin/grep 'cpu > MHz'"), -1, PREG_SPLIT_NO_EMPTY); > $device['cpu_mhz'] = ltrim($temp[1]); > > $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep > 'VGA'"), 8), -1, > PREG_SPLIT_NO_EMPTY); > $device['video'] = $temp[1]; > > $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep > 'Host'"), 8), > -1, PREG_SPLIT_NO_EMPTY); > $device['mobo'] = $temp[1]; > > $ethernet = `/usr/bin/lspci | grep 'Ethernet'`; > $temp = split("\n",$ethernet); > $temp1 = preg_split("/:/",substr($temp[0],8), -1, > PREG_SPLIT_NO_EMPTY); > $device['nic_eth0'] = substr($temp1[1],1); > $temp1 = preg_split("/:/",substr($temp[1],8), -1, > PREG_SPLIT_NO_EMPTY); > $device['nic_eth1'] = substr($temp1[1],1); > > $device['proc_count'] = trim(`ps auxw | wc -l`); > > $device['someprocessd'] = trim(`ps axuw | grep "someprocessd" > | grep -v > "grep" | wc -l`); > > # Returns the uptime of a Linux system by parsing through > /proc/uptime. > # It returns a 4-field array (days, hours, minutes, seconds). > # I typically use it like: > # $ut = linuxUptime(); > # echo "Time since last reboot: $ut[0] days, $ut[1] hours, > $ut[2] minutes"; > $ut = strtok( exec( "cat /proc/uptime" ), "." ); > $days = sprintf( "%d", ($ut/(3600*24)) ); > $hours = sprintf( "%2d", ( ($ut % (3600*24)) / 3600) ); > $min = sprintf( "%2d", ($ut % (3600*24) % 3600)/60 ); > $sec = sprintf( "%2d", ($ut % (3600*24) % 3600)%60 ); > $device['uptime'] = $days."d ".$hours."h ".$min."m ".$sec."s"; > > //this version fails if the uptime is < 24 hours or 1 day > since it's shown > as 20:15 > //$temp = preg_split("/:/",exec("uptime"), -1, PREG_SPLIT_NO_EMPTY); > //$device['loadavg'] = substr($temp[2],1); > preg_match("/load average: (.*)/",exec("uptime"), $temp); > $device['loadavg'] = $temp[1]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird results of "=="
Hello I have the following code: ($b + $c)) { // do the second thing } elseif ($a < ($b + $c)) { // do the third thing } ?> Each of the three variables is derived by some earlier calculation, but for testing purposes I have made sure that they end up being $a = $b and $c = 0. I have tested for three different values (of $a) and gotten all three results. That is, once the first block has executed, once the second block and once the third block. Am I missing something really obvious here? How do I execute only the first block if indeed $a == ($b + $c) ? Thank you for your help. Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird results of "=="
[snip] ($b + $c)) { // do the second thing } elseif ($a < ($b + $c)) { // do the third thing } ?> Each of the three variables is derived by some earlier calculation, but for testing purposes I have made sure that they end up being $a = $b and $c = 0. I have tested for three different values (of $a) and gotten all three results. That is, once the first block has executed, once the second block and once the third block. Am I missing something really obvious here? How do I execute only the first block if indeed $a == ($b + $c) ? [/snip] When I tested this code only the first block executed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird results of "=="
Brian P. O'Donnell wrote: ($b + $c)) { // do the second thing } elseif ($a < ($b + $c)) { // do the third thing } ?> Each of the three variables is derived by some earlier calculation, but for testing purposes I have made sure that they end up being $a = $b and $c = 0. I have tested for three different values (of $a) and gotten all three results. That is, once the first block has executed, once the second block and once the third block. Am I missing something really obvious here? This is an inherent problem with floating-point operations, especially comparison, and is not unique to PHP. Often numbers will be off by some miniscule amount, just enough to make them not equal. What I would do in this situation is create a function float_equals(), after deciding what delta is acceptable for your situation, like this: define('MAX_FLOAT_DELTA', 0.001); // Or whatever is acceptable for you function float_equals($a, $b) { return (abs($a - $b) <= MAX_FLOAT_DELTA); } Then use float_equals($x, $y) instead of $x == $y. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird results of "=="
What other values are you trying? I tested it and it seems to work the way it's supposed to. Changing just $a, I get the expected > or < results. Changing $a and $b so that $a always equals $b it always returns the first option. Your test values for $a and $b that yield odd results would be helpful here. -TG = = = Original message = = = Hello I have the following code: ($b + $c)) // do the second thing elseif ($a < ($b + $c)) // do the third thing ?> Each of the three variables is derived by some earlier calculation, but for testing purposes I have made sure that they end up being $a = $b and $c = 0. I have tested for three different values (of $a) and gotten all three results. That is, once the first block has executed, once the second block and once the third block. Am I missing something really obvious here? How do I execute only the first block if indeed $a == ($b + $c) ? Thank you for your help. Brian ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird results of "=="
That did the trick. Thanks a million. Brian "Jasper Bryant-Greene" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Brian P. O'Donnell wrote: > > > > > $a = 252.73; > > $b = 252.73; > > $c = 0; > > > > if ($a == ($b + $c)) > > { > > // do the first thing > > } > > elseif ($a > ($b + $c)) > > { > > // do the second thing > > } > > elseif ($a < ($b + $c)) > > { > > // do the third thing > > } > > > > ?> > > > > Each of the three variables is derived by some earlier calculation, but for > > testing purposes I have made sure that they end up being $a = $b and $c = 0. > > I have tested for three different values (of $a) and gotten all three > > results. That is, once the first block has executed, once the second block > > and once the third block. > > > > Am I missing something really obvious here? > > This is an inherent problem with floating-point operations, especially > comparison, and is not unique to PHP. Often numbers will be off by some > miniscule amount, just enough to make them not equal. > > What I would do in this situation is create a function float_equals(), > after deciding what delta is acceptable for your situation, like this: > > define('MAX_FLOAT_DELTA', 0.001); // Or whatever is acceptable for you > > function float_equals($a, $b) { > return (abs($a - $b) <= MAX_FLOAT_DELTA); > } > > Then use float_equals($x, $y) instead of $x == $y. > > Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] from database to links
You know on forums when you make a topic right away it makes like a new link to your topic. How do you do that in PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird results of "=="
Jasper Bryant-Greene wrote: Am I missing something really obvious here? This is an inherent problem with floating-point operations, especially comparison, and is not unique to PHP. Often numbers will be off by some miniscule amount, just enough to make them not equal. What I would do in this situation is create a function float_equals(), after deciding what delta is acceptable for your situation, like this: define('MAX_FLOAT_DELTA', 0.001); // Or whatever is acceptable for you function float_equals($a, $b) { return (abs($a - $b) <= MAX_FLOAT_DELTA); } Then use float_equals($x, $y) instead of $x == $y. Jasper Couldn't have said it better! Evert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade
On Tue, 2005-08-23 at 05:30, Ford, Mike wrote: > -Original Message- > From: Larry Brown > To: php > Sent: 23/08/05 02:28 > Subject: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade > > I had a foreach loop working on an array as such: > > $multiarray = array(array('person','person'),array('another','another')) > > the array was put through > > foreach($multiarray as $subArray){ > > do something with array > > } > > on each loop I would see $subArray= array([0] = 'person',[1] = 'person') > and then $subArray= array([0] = 'another',[1] = 'another') > > In other cases person might have some other value in the [1] position. > (it is being used in a function to create a select statement). > > After the upgrade from 4.3 to 4.4 though each iteration gives... > > array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and > array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) > > > > You have an out-of-date code optimizer insatalled -- install the latest > version of whichever one you are using. This is a known incompatibility -- > a quick search in the bugs database would have found multiple entries about > it (see, for instance, http://bugs.php.net/bug.php?id=30914, > http://bugs.php.net/bug.php?id=31194, and at least a couple of dozen > others). > > Cheers! > > Mike > > > To view the terms under which this email is distributed, please go to > http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade
Sorry, that last one went out without a comment. I think this is most likely the cause. I haven't dug back into it yet to verify, but it makes the most sense. Thanks everyone... Larry On Tue, 2005-08-23 at 05:30, Ford, Mike wrote: > -Original Message- > From: Larry Brown > To: php > Sent: 23/08/05 02:28 > Subject: [PHP] foreach loop changed after 4.3 -> 4.4 upgrade > > I had a foreach loop working on an array as such: > > $multiarray = array(array('person','person'),array('another','another')) > > the array was put through > > foreach($multiarray as $subArray){ > > do something with array > > } > > on each loop I would see $subArray= array([0] = 'person',[1] = 'person') > and then $subArray= array([0] = 'another',[1] = 'another') > > In other cases person might have some other value in the [1] position. > (it is being used in a function to create a select statement). > > After the upgrade from 4.3 to 4.4 though each iteration gives... > > array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and > array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) > > > > You have an out-of-date code optimizer insatalled -- install the latest > version of whichever one you are using. This is a known incompatibility -- > a quick search in the bugs database would have found multiple entries about > it (see, for instance, http://bugs.php.net/bug.php?id=30914, > http://bugs.php.net/bug.php?id=31194, and at least a couple of dozen > others). > > Cheers! > > Mike > > > To view the terms under which this email is distributed, please go to > http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with ' or "
I made a script that posts data into a database but it has a problem whenever I enter a ' or a ". How do I bypass this problem? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with ' or "
George B wrote: I made a script that posts data into a database but it has a problem whenever I enter a ' or a ". How do I bypass this problem? If it is MySQL, use mysql_real_escape_string() [1]. If any other database, have a look in the PHP manual [2] for the relevant function, or as a last resort use addslashes(). Jasper [1] http://www.php.net/mysql_real_escape_string [2] http://www.php.net/docs.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with ' or "
Jasper Bryant-Greene wrote: George B wrote: I made a script that posts data into a database but it has a problem whenever I enter a ' or a ". How do I bypass this problem? If it is MySQL, use mysql_real_escape_string() [1]. If any other database, have a look in the PHP manual [2] for the relevant function, or as a last resort use addslashes(). Jasper [1] http://www.php.net/mysql_real_escape_string [2] http://www.php.net/docs.php Where do I put the code in? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with ' or "
George B wrote: Jasper Bryant-Greene wrote: George B wrote: I made a script that posts data into a database but it has a problem whenever I enter a ' or a ". How do I bypass this problem? If it is MySQL, use mysql_real_escape_string() [1]. If any other database, have a look in the PHP manual [2] for the relevant function, or as a last resort use addslashes(). Jasper [1] http://www.php.net/mysql_real_escape_string [2] http://www.php.net/docs.php Where do I put the code in? Example: $value = mysql_real_escape_string($_POST['value']); $results = mysql_query("SELECT * FROM sometable WHERE field='$value'"); Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with ' or "
Jasper Bryant-Greene wrote: George B wrote: Jasper Bryant-Greene wrote: George B wrote: I made a script that posts data into a database but it has a problem whenever I enter a ' or a ". How do I bypass this problem? If it is MySQL, use mysql_real_escape_string() [1]. If any other database, have a look in the PHP manual [2] for the relevant function, or as a last resort use addslashes(). Jasper [1] http://www.php.net/mysql_real_escape_string [2] http://www.php.net/docs.php Where do I put the code in? Example: $value = mysql_real_escape_string($_POST['value']); $results = mysql_query("SELECT * FROM sometable WHERE field='$value'"); Jasper THANKS!! it works!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs. ColdFusion
On Tue, August 23, 2005 9:44 am, Rick Emery wrote: > Quoting Rick Emery <[EMAIL PROTECTED]>: > >> Ugh, we're *never* going to make a decision. My boss just sent me >> this email: > > I wrote an application, using PHP5, that displays a list and refreshes > every 30 seconds (the data is constantly changing, but a 30 second > delay is acceptable). As I've indicated previously, we're a Microsoft > shop, so the data comes from MS SQL Server 2000. No problems, the app > worked great using my workstation as the server with a few clients > running the app from it. It even worked when we moved it to a server > and opened it up to everyone on our intranet (for a while). > > We have two different types of clients. Some use desktop computers, > physically connected to our network, while others use mobile laptops > connected to our network via cellular (using Sprint AirCards) using > third-party VPN software (Padcom, in case anyone's familiar). > > We set the application up on a Windows 2000 Server with IIS (5, I > think), and it would work fine for about a day. Then Padcom clients > kept stopping. They'd request the page and, after a loong time, > display a message that the request timed out. This would seemingly > happen for all Padcom-connected clients at the same time, though the > desktops continued to work fine. We restarted the server running the > Padcom software with no effect. We restarted IIS on the web server > with > no effect. The only thing (seemingly) that cleared the issue was > rebooting the server running IIS. Just for a test case, write a 10-line ASP script that does something similar, if much simpler, and pound on it on the same box with the Padcom clients. I'm betting you'll have the SAME ISSUE, and that the problem has NOTHING to do with PHP whatsoever. PHP works fine with IIS and Windows. Or, rather, PHP doesn't make IIS and Windows any LESS stable than they already were without PHP. > has mentioned changing anything, until this morning. My manager > informed me in our meeting that no language could be chosen unless it > works under IIS. I'll say it again: There is *NOTHING* wrong with PHP and IIS. IIS and Windows are badly-broken, all on their own, without PHP. > So, I'm faced with finding an obscur problem, running on obscur > software (the vendor for Padcom, of course, insists that they've never > seen this problem). I'm confident that the problem has *nothing* to do > with PHP, but am forced by management to try to prove it. If you can prove it, showing the same problem in ASP, then what? Are they going to let you move the application back to a real server? In fact, you could probably get ahold of a Padcom and prove it to yourself in a days' work, and then get them to agree that if it's not PHP nor your script that's broken, but Windows+IIS, then maybe they should just leave the WORKING stuff alone. Probably won't work. But that's how office politics work. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] from database to links
On Tue, August 23, 2005 3:52 pm, George B wrote: > You know on forums when you make a topic right away it makes like a > new > link to your topic. How do you do that in PHP? $_POST[new_topic]"; } ?> http://php.net/mysql_insert_id is probably the piece of the puzzle you were missing. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as standalone?
On Tue, August 23, 2005 12:19 pm, Thomas wrote: > I am going to take that chance now to ask if it is viable to create a > standalone app with php and gtk+, fully realizing that this IS the php > list > ;-) There is a MUCH lower-volume PHP-GTK list you should probably subscribe to and ask on. I think it gets about one message a day, on average, so you could easily monitor that. Also check at http://gtk.php.net and any Wikis/Forums they've got going. I've been building a PHP GTK app, but it only has to live on one box, so haven't worried about making it cross-platform, much less bundling it all into a single deliverable. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php