php-general Digest 26 Jan 2011 13:06:15 -0000 Issue 7153
Topics (messages 311032 through 311037):
Formatting
311032 by: Ethan Rosenberg
311033 by: Donovan Brooke
311034 by: joris ros
311035 by: Jim Lucas
Unit Tests for Cache Class
311036 by: Sebastian Detert
Cross-platform IDE
311037 by: Andy McKenzie
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Dear list -
I have a program with the following statement: $out = system('ls
-l', $retval); The output is a string. How do I format the output
to be in the Linux format, that is in columns. I cannot think of a
way to use explode to do it.
Advice and comments, please.
Thanks
Ethan
MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)]
--- End Message ---
--- Begin Message ---
Ethan Rosenberg wrote:
Dear list -
I have a program with the following statement: $out = system('ls -l',
$retval); The output is a string. How do I format the output to be in
the Linux format, that is in columns. I cannot think of a way to use
explode to do it.
Advice and comments, please.
Thanks
Ethan
MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)]
Something like?:
print "<pre>";
$out = system('ls -l', $retval);
print "</pre>";
Donovan
--
D Brooke
--- End Message ---
--- Begin Message ---
Hi You can try something like this:
<?php
ob_start();
system('ls', $retval);
$raw = ob_get_contents();
ob_end_clean();
$arr = explode(chr(10),$raw);
print_r($arr);
it gives you a array back whit the lines
2011/1/26 Donovan Brooke <li...@euca.us>
> Ethan Rosenberg wrote:
>
>> Dear list -
>>
>> I have a program with the following statement: $out = system('ls -l',
>> $retval); The output is a string. How do I format the output to be in
>> the Linux format, that is in columns. I cannot think of a way to use
>> explode to do it.
>>
>> Advice and comments, please.
>>
>> Thanks
>>
>> Ethan
>>
>> MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)]
>>
>
>
> Something like?:
>
> print "<pre>";
>
> $out = system('ls -l', $retval);
> print "</pre>";
>
>
> Donovan
>
>
> --
> D Brooke
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On 1/25/2011 9:05 PM, Ethan Rosenberg wrote:
Dear list -
I have a program with the following statement: $out = system('ls -l',
$retval); The output is a string. How do I format the output to be in
the Linux format, that is in columns. I cannot think of a way to use
explode to do it.
Advice and comments, please.
Thanks
Ethan
MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)]
Well, depends, are you running this in a browser or at the console?
If you are displaying this in a browser, you are probably seeing that
browsers do not like \n (newlines)
If in a browser, you could:
1) Wrap your output in a <pre><?php echo $out; ?></pre> HTML tag
2) Use PHP's nl2br() to replace all newlines with "<br />" tags
3) Use PHP's header() function to tell the browser to display the output
as plaintext. i.e. header('Content-Type: text/plain'); [1,2]
1 - Google "php header plain text"
2 - http://www.php.net/manual/en/function.header.php#92620
If in cli... well, you wouldn't be having this problem... :)
Jim Lucas
--- End Message ---
--- Begin Message ---
Hi all,
I'm just writing a small cache class to optimize my database connection.
I want to use three different stages to store and receive my data as
fast as possible.
1) fast
get data from class variable if existing
2) mid
get data from memcache if existing
-> save result as class variable
3) slowest:
sql query -> receive data from database
-> save result to memcache
-> save result as class variable
How would you write (unit) tests for such a class? What is the best way
to prove, that all data was stored correctly, even after data
manipulations like insert/update/delete?
I'm looking forward to your suggestions,
Sebastian
--- End Message ---
--- Begin Message ---
Hey folks,
Hopefully this is enough on-topic not to annoy anyone. Up until
now I've mostly written small one-off scripts -- a web page that needs
a few things dynamically generated, a shell script to do a small job,
things like that -- and vim has been more than adequate. I'm
currently working on something a lot more complex -- a web based
front-end for a medium sized custom database -- and I'm finding that
my code is getting more and more scattered because I don't have a good
tool for looking at it.
So: does anyone have a recommendation for an IDE that works in
Windows, Mac, and Linux? I spend roughly equal time in all three, and
I haven't found a tool I like yet that works in all of them.
Actually, I stopped looking three or four years ago, but at that point
there didn't seem to be anything. If anyone has any advice, I'd love
to hear it!
Thanks,
Alex
--- End Message ---