php-general Digest 27 Oct 2007 16:02:08 -0000 Issue 5095
php-general Digest 27 Oct 2007 16:02:08 - Issue 5095 Topics (messages 263744 through 263746): Re: returning an array from a function? 263744 by: info.phpyellow.com Re: system command 263745 by: Instruct ICC libgmailer.php 263746 by: arash moosavi Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hello List, Your help produced a refined function. The function converts a Google Map latitude and longitude into an equivalent Microsoft Virtual Earth latitude and longitude. Here is an example of how the function works, along with source code: http://www.globalissa.com/articles/convert_google_to_mve_array_doc.php Thank you to Ted and others who helped. sincerely, Rob At 12:09 AM -0700 10/26/07, [EMAIL PROTECTED] wrote: Hello all, function convert( $latitude, $longitude ) { $mve_latitude = $latitude; // actually other processing within this function determines this $mve_longitude = $longitude // actually other processing within this function determines this $mve_both = $mve_latitude . , . $mve_longitude; // prepare return values $mve_array[0] = $mve_latitude; $mve_array[1] = $mve_longitude; $mve_array[2] = $mve_both; return $mve_array; } // function $latitude = 23.263400; $longitude = 80.110030 convert( $latitude, $longitude ); print_r( $mve_array ); .. the above does not return a value in the array. What do I have to change to receive an array with global scope from this function? I read several pages of docs on php.net but the light didn't go on... Sincerely, Rob. Rob: Why use a global? Plus, your function is returning an array, but you're not catching it. $mve_array = convert( $latitude, $longitude ); Example: http://www.webbytedd.com/bbb/array-function/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- Maybe something to do with the last line (but I get several lines) Return Values Returns the last line of the command output on success, and FALSE on failure. I have within a web page: $a=system('/usr/bin/lynx -dump http://api.hostip.info/country.php?ip='.$aa); ? . later I pickup the variable $a again ... The problem for me is that the line $a=system('/usr/bin/lynx -dump http://api.hostip.info/country.php?ip='.$aa); prints (before ) the result ($a). I need the variable within the program, but do not want to display it. It seems that 'system' includes an 'echo' I always go back to the manual: http://php.net/system Maybe that built-in echo is related to this: The system() call also tries to automatically flush the web server's output buffer after each line of output if PHP is running as a server module. Check out the other Program Execution Functions functions http://php.net/exec particularly http://php.net/manual/en/function.exec.php _ Peek-a-boo FREE Tricks Treats for You! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us---End Message--- ---BeginMessage--- I Need an example code of using Libgmailer.php for reading mails from gmail. I can login to the gmail with this Class(libgmailer.php) but I can not find its string output of emails text. Thank all ---End Message---
Re: [PHP] returning an array from a function?
Hello List, Your help produced a refined function. The function converts a Google Map latitude and longitude into an equivalent Microsoft Virtual Earth latitude and longitude. Here is an example of how the function works, along with source code: http://www.globalissa.com/articles/convert_google_to_mve_array_doc.php Thank you to Ted and others who helped. sincerely, Rob At 12:09 AM -0700 10/26/07, [EMAIL PROTECTED] wrote: Hello all, function convert( $latitude, $longitude ) { $mve_latitude = $latitude; // actually other processing within this function determines this $mve_longitude = $longitude // actually other processing within this function determines this $mve_both = $mve_latitude . , . $mve_longitude; // prepare return values $mve_array[0] = $mve_latitude; $mve_array[1] = $mve_longitude; $mve_array[2] = $mve_both; return $mve_array; } // function $latitude = 23.263400; $longitude = 80.110030 convert( $latitude, $longitude ); print_r( $mve_array ); .. the above does not return a value in the array. What do I have to change to receive an array with global scope from this function? I read several pages of docs on php.net but the light didn't go on... Sincerely, Rob. Rob: Why use a global? Plus, your function is returning an array, but you're not catching it. $mve_array = convert( $latitude, $longitude ); Example: http://www.webbytedd.com/bbb/array-function/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command
Maybe something to do with the last line (but I get several lines) Return Values Returns the last line of the command output on success, and FALSE on failure. I have within a web page: $a=system('/usr/bin/lynx -dump http://api.hostip.info/country.php?ip='.$aa); ? . later I pickup the variable $a again ... The problem for me is that the line $a=system('/usr/bin/lynx -dump http://api.hostip.info/country.php?ip='.$aa); prints (before ) the result ($a). I need the variable within the program, but do not want to display it. It seems that 'system' includes an 'echo' I always go back to the manual: http://php.net/system Maybe that built-in echo is related to this: The system() call also tries to automatically flush the web server's output buffer after each line of output if PHP is running as a server module. Check out the other Program Execution Functions functions http://php.net/exec particularly http://php.net/manual/en/function.exec.php _ Peek-a-boo FREE Tricks Treats for You! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] libgmailer.php
I Need an example code of using Libgmailer.php for reading mails from gmail. I can login to the gmail with this Class(libgmailer.php) but I can not find its string output of emails text. Thank all
Re: [PHP] libgmailer.php
On 10/27/07, arash moosavi [EMAIL PROTECTED] wrote: I Need an example code of using Libgmailer.php for reading mails from gmail. I can login to the gmail with this Class(libgmailer.php) but I can not find its string output of emails text. Thank all Arash, You've been asking the same vague questions over and over again. You need to find a list or forum that deals with libgmailer.php. This is not a PHP-specific question. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] returning an array from a function?
At 5:38 AM -0700 10/27/07, [EMAIL PROTECTED] wrote: Hello List, Your help produced a refined function. The function converts a Google Map latitude and longitude into an equivalent Microsoft Virtual Earth latitude and longitude. Oh no, don't tell me that I helped the Dark-side -- there is a disturbance in the force, Luke. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Java And PHP
Hi, I want to use Java in my PHP scripts. I installed PHP 5.2 on windows. From extensions I choosed Java plugin. But Java is not working with PHP 5.2. I have Java installed in C:\Porgram Files\Java\ . I tried to give right jvm.dll path correct C:\Porgram Files\Java\JDK\JRE\bin\server\jvm.dll or C:\Porgram Files\Java\JDK\JRE\bin\client\jvm.dll in php.ini, but I got windows system error when try to call Java in my PHP scripts. If you configured java to work with PHP 5.2 please give me hint. Thank you, Gevorg Harutyunyan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Slashes, include, AJAX? {SOLVED}
On 10/26/07, Rodrigo Poblanno Balp [EMAIL PROTECTED] wrote: Nathan Nobbe wrote: On 10/26/07, Rodrigo Poblanno Balp [EMAIL PROTECTED] wrote: I get something like divthis is the content\/div it seems like the '/' is being escaped, but I need it as HTML. how are you using the json object on the client-side after its sent by the server? below is a json snippet from an application of mine, many of the tags look the same as what youve shown (because theyve been encoded the same way). ive have not encountered the problem you have, that is, the escape characters do not pass though when i splice them into the DOM. im using the same encoding technique i recommended within PHP. on the client side i instantiate the json object as follows: var htmlUpdates = eval(( + transport.responseText + )); if you use a string directly on the client side, the escape characters will pass through, however, if you run it through eval(), the escape characters will be stipped out by the javascript interpreter. im not sure whats going on, but im starting to think its something on the client side.. -nathan {prevUpperNavId:0:0,nextUpperNavId:1:1,breadcrumb:,leftContent:p\nPHP is very interesting . One of it's greatest strengths is the gradient of development\npossibilities. A new PHP writer can easily publish their first dynamic page in a matter\nof minutes. Using PHP's integrated templating system, PHP scripts can be escaped at any time.\nSo escaping them simply outputs anything text directly as it appears in the script. By adding\nscript tags into large pages of code and dropping in PHP function calls, dynamic pages are easily\nobtained.br\/\nbr\/\nAlthough handy, this isnt often the greatest technique for developing highly reusable or readable code.\nPHP offers many options for templating HTML . This is just the beginning. As a PHP developer, you will\nfind yourself needing to know a lot of technologies.\n\/p,rightContent:div\np\n\tHere is a small list of terms and acronyms one might encounter working with PHP;\n\thow many do you recognize?\n\/p\n\tul\n\t\tli\n\t\t\tObject Oriented Programming\n\t\t\/li\n\t\tli\n\t\t\tDesign Patterns\n\t\t\/li\n\t\tli\n\t\t\tMVC\n\t\t\/li \n\t\tli\n\t\t\tORM\n\t\t\/li\n\t\tli\n\t\t\tZend\n\t\t\/li\n\t\tli\n\t\t\tCMS\n\t\t\/li \n\t\tli\n\t\t\tShared Nothing\n\t\t\/li\n\t\tli\n\t\t\tAJAX\n\t\t\/li\n\t\tli\n\t\t\tJSON \n\t\t\/li\n\t\tli\n\t\t\tUnit Test\n\t\t\/li\n\t\tli\n\t\t\tSOAP\n\t\t\/li\n\t\/ul\n\/div } Ok Nathan, that's correct. Once the object is decoded the \/ pairs go away. But this is something to note, only after it is decoded. I was testing only the creation of the JSON object and printing it, not the associative php array. So that's why I got the annoying \/. This is nothing to be afraid then, once the text is used, there's no need to think about the pairs. It is not even necessary to eliminate the \r\n windows puts in, that way the html snippet will be formated. i was only thinking to strip the newlines on the server as a last resort; the downside would be messy html after splicing it back into the dom. anyway, glad to hear you got it figured out; i knew there was something i was missing :) -nathan
[PHP] SPL
I'm currently using RecursiveDirectoryIterator and RecursiveIteratorIterator. I'm using fwrite to write to a file while parsing throught the file structure, and was wondering if it is at all possible to sort alphabetical without going all array. That seems to me like doing the job twice over. Atleast part of it... -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SPL
On 10/27/07, Børge Holen [EMAIL PROTECTED] wrote: I'm currently using RecursiveDirectoryIterator and RecursiveIteratorIterator. I'm using fwrite to write to a file while parsing throught the file structure, and was wondering if it is at all possible to sort alphabetical without going all array. That seems to me like doing the job twice over. Atleast part of it... how are you doing the sorting part? can you show us some of your code ? -nathan
Re: [PHP] SPL
On Sunday 28 October 2007 01:32:15 you wrote: On 10/27/07, Børge Holen [EMAIL PROTECTED] wrote: I'm currently using RecursiveDirectoryIterator and RecursiveIteratorIterator. I'm using fwrite to write to a file while parsing throught the file structure, and was wondering if it is at all possible to sort alphabetical without going all array. That seems to me like doing the job twice over. Atleast part of it... how are you doing the sorting part? can you show us some of your code ? thats the problem, i don't know how to sort before read starts, that came out a bit wrong. I need to read the filesystem alphabeticly. I could use the system command 'find somepath' and then use '| sort' witch was part of my old stuff with a ton of waste code. or I could 'sort array' witch of course forces me to create an array to loop around and push at each folder and leaf. I found this code at php.net witch needs very little modifications and can do so much, but I can't figure out how to make it read alphabeticly as mentioned $it = new RecursiveDirectoryIterator($_GET['location']); foreach (new RecursiveIteratorIterator($it, 2) as $path){ if($path-isDir()){ // writing to some static file }elseif(some unfinished statement){ fwrite($dynfile, $path\n); }else{ // writing to some static file } } I just... nothings keeping me from sorting the the dynfile after writing, but also that seems to do the job twice instead of doing it correct the first time. -nathan -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SPL
Børge Holen wrote: On Sunday 28 October 2007 01:32:15 you wrote: On 10/27/07, Børge Holen [EMAIL PROTECTED] wrote: I'm currently using RecursiveDirectoryIterator and RecursiveIteratorIterator. I'm using fwrite to write to a file while parsing throught the file structure, and was wondering if it is at all possible to sort alphabetical without going all array. That seems to me like doing the job twice over. Atleast part of it... how are you doing the sorting part? can you show us some of your code ? thats the problem, i don't know how to sort before read starts, that came out a bit wrong. I need to read the filesystem alphabeticly. I could use the system command 'find somepath' and then use '| sort' witch was part of my old stuff with a ton of waste code. or I could 'sort array' witch of course forces me to create an array to loop around and push at each folder and leaf. I found this code at php.net witch needs very little modifications and can do so much, but I can't figure out how to make it read alphabeticly as mentioned $it = new RecursiveDirectoryIterator($_GET['location']); ^-- you modified this part right? foreach (new RecursiveIteratorIterator($it, 2) as $path){ if($path-isDir()){ // writing to some static file }elseif(some unfinished statement){ fwrite($dynfile, $path\n); }else{ // writing to some static file } } I just... nothings keeping me from sorting the the dynfile after writing, but also that seems to do the job twice instead of doing it correct the first time. you have a file stream open, I have no idea what a $path-__toString() results in but I'll assume it's the full path. whats to stop you seeking in the file and using string comparison to find the correct position (ie. line) to inject a path. so basically sort as you write into the file, how to do this efficiently is another question. :-) -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php