php-general Digest 4 Dec 2007 15:21:53 -0000 Issue 5163
Topics (messages 265441 through 265450):
Re: howto get .tar.gz content's filenames
265441 by: Casey
265442 by: Casey
265443 by: Casey
265444 by: Daniel Brown
265445 by: Daniel Brown
Re: Software Help
265446 by: Paul Scott
Re: Issue with STRFTIME and Daylight Savings
265447 by: Malcolm Green
Re: calculate a varchar
265448 by: Zoltán Németh
forget about this.
265449 by: julian
Re: Banned from #php
265450 by: tedd
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]
----------------------------------------------------------------------
--- Begin Message ---
<?php
shell_exec('gunzip -c foo.tar.gz | tar -tvf -');
?>
Tell me if it works ;)
On Dec 3, 2007, at 7:05 PM, Shelley Shyan
<[EMAIL PROTECTED]> wrote:
Hi all,
It may not be a php question, but I want to get the filename lists
that a .tar.gz file contains and give it to an array.
How can I manage that?
Thank you very much for your consideration.
Regards,
Shelley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Dec 3, 2007, at 7:05 PM, Shelley Shyan
<[EMAIL PROTECTED]> wrote:
Hi all,
It may not be a php question, but I want to get the filename lists
that a .tar.gz file contains and give it to an array.
How can I manage that?
Thank you very much for your consideration.
Regards,
Shelley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Sorry, should be:
<?php
$names = shell_exec('...');
$names = explode(PHP_EOL, $names);
?>
Note: typed on phone. That explains my empty message :)
On Dec 3, 2007, at 7:05 PM, Shelley Shyan
<[EMAIL PROTECTED]> wrote:
Hi all,
It may not be a php question, but I want to get the filename lists
that a .tar.gz file contains and give it to an array.
How can I manage that?
Thank you very much for your consideration.
Regards,
Shelley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Dec 3, 2007 10:05 PM, Shelley Shyan <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> It may not be a php question, but I want to get the filename lists that a
> .tar.gz file contains and give it to an array.
> How can I manage that?
>
> Thank you very much for your consideration.
>
> Regards,
> Shelley
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
If you're on Linux/BSD/Unix/MacOS or Cygwin on Windows, this should work:
<?php
$tar_gz_file = "filename.tar.gz"; // Replace this with the actual filename.
exec('tar -ztf '.$tar_gz_file,$ret);
print_r($ret);
?>
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
--- End Message ---
--- Begin Message ---
On Dec 3, 2007 11:09 PM, Shelley Shyan <[EMAIL PROTECTED]> wrote:
> Thank you very much, Dan. It works exactly what I want. :)
>
>
> Regards,
> Shelley
No problem.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
--- End Message ---
--- Begin Message ---
On Mon, 2007-12-03 at 14:55 -0500, Mike Roberts wrote:
> My name is Mike Roberts, and I am a recruiter with Corporate Staffing
> Services in Bala Cynwyd, Pennsylvania. I need help finding qualified
> candidates who have experience with PHP ( whole lamp environment). Out
> of respect, I am not including the job spec, but if anybody has a
> reccomendation, I would appreciate it. Also if you would like to see the
> specification, please let me know and I will happy to email it directly
> to you.
I seem to remember a thread about stinky job ads a while back, and I
would like to point out to all of the subscribed recruiters that this is
an example of a less stinky one.
Note:
1. No HTML to waste my precious bandwidth on
2. No lengthy job spec - just an invitation to one OFF LIST!
3. Courteous and to the point as well as respectful to those not
interested
4. Slightly flamboyant signature still (shouldn't be more than 4 lines
Mike), but that is forgiven
Thank you, and if I ever move to PA or the USA, I will look you up
because of this.
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--- End Message ---
--- Begin Message ---
Hi Rob:
Thanks for the feedback.
Just to throw one in from "left field", the script is written in AWK, not
PHP (told you I was a novice!)
Have confirmed that 'systime' refers to hardware clock, so I have a quick
and dirty work-around by adding '3600' (seconds) to STRFTIME, but will look
into a cleaner solution.
Thanks & Regards,
Malcolm.
Malcolm Green
Voice Consultant, Managed Network Services
CSC Australia Pty Limited
M: 0401-002-569
T: (02) 9034-3114
E: [EMAIL PROTECTED]
"Vision without action is a dream; action without vision is a nightmare." -
Chinese Proverb
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Robert Cummings
<[EMAIL PROTECTED]
.com> To
Malcolm Green <[EMAIL PROTECTED]>
03/12/2007 04:53 cc
PM [EMAIL PROTECTED]
Subject
Re: [PHP] Issue with STRFTIME and
Daylight Savings
On Mon, 2007-12-03 at 15:14 +1000, Malcolm Green wrote:
> Hi Support:
>
> I've moved into a new role and inherited a system which uses the
'STRFTIME'
> function to create a filename in the form 'strftime("%Y%m%d")'; the
> filename is supposed to be "today's date". (Note I've left out the file
> extension for clarity.)
>
> I've noticed that system creates the wrong filename when the process runs
> between midnight and 12:59am, during Daylight Savings time. That is, it
> creates a filename equal to "yesterday's date". When run at 1:00am or
> later, everything OK.
>
> I've checked the Date/Time and 'Locale' settings in Windows, and
everything
> is ok. My initial thought was that STRFTIME was looking a the system
clock
> rather than Windows (?).
>
> Can you help?
>
> (PS ... please be gentle, I'm a novice at PHP!)
Check your timezone settings in php.ini
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
2007. 12. 3, hétfő keltezéssel 15.00-kor Andrew Ballard ezt írta:
> On Dec 3, 2007 10:56 AM, John Taylor-Johnston
> <[EMAIL PROTECTED]> wrote:
> > Is there a calculation function?
> >
> > I'm using an e-commerce shopping cart. I want to tweak the code. The
> > author is using a varchar(100) field to store prices.
> >
> > Taking advantage of there being a varchar, instead of entering a price,
> > I would like to enter a calculation.
> >
> > (24*2.2)+(24*2.2*.1) 24 is my unit price in British pounds. 2.2 is the
> > exchange rate into Canadian dollars. etc.
> >
> > The exchange rate changes frequently. Instead of recalculating and
> > entering a new price every few days, it would be useful to enter a
> > calculation in any price field.
> >
> > I had a look at: http://ca3.php.net/manual-lookup.php?pattern=calc
> > http://ca3.php.net/manual-lookup.php?pattern=calculate
> > http://ca3.php.net/manual-lookup.php?pattern=calculation
> > but I see no function, although I'm sure there is one.
> >
> > So how could I do this?
> >
> > $price = (24*2.2)+(24*2.2*.1);
> >
> > if $price is not an integer, verify if it is a calculation. If so, give
> > me an integer and round it off to two decimal points:
> >
> > $price = 58.08;
> >
> > Do-able?
> >
> > John
> >
>
> John,
>
> Technically, yes you can do it. eval() will work, as Richard
> mentioned. However, your question involves two things that I prefer to
> avoid at all costs. The first is storing numeric data in a varchar
> field. I'm not sure why the author chose this approach. A varchar(100)
> is reserving storage space for 100 characters. I doubt you're selling
> any items that require that number of digits, so it's wasted space.
> (It also makes queries like this "SELECT * FROM `items` WHERE `price`
> > 100" problematic because the comparison is being done
> alphanumerically rather than just numerically.) Price is a number,
> regardless of the units -- even cats or canaries -- and is nearly
> always handled better as such.
AFAIK the varchar(100) fields do not reserve the space in advance. these
fields occupy space according to the length of the data stored in them.
hence their name 'var'
> The second item I like to avoid is anything like that evalutates a
> string of text as code like eval(), because you have to handle a wide
> range of potential errors in the string being evaluated as well as the
> potential security risk.
>
> If you're just wanting to convert prices from one currency to another,
> isn't the formula the same regardless of the currency? Could you not
> store all your prices numerically in a single currency and then
> convert the price to any other currency by passing the stored price
> and the exchange rate into a function?
>
> function exchangeCurrency($amount, $exchange_rate) {
> return $amount * $exchange_rate;
> }
>
>
however I agree 100% with you in your conclusions ;)
greets
Zoltán Németh
>
> Andrew
>
--- End Message ---
--- Begin Message ---
julian wrote:
however this will work...
p1.inc
1 <?php
2
3 class dbb{
4
5 var $var=10;
6
7 function fun2(){
8 return $this->var;;
9 }
10 }
11
12 class obj {
13 var $obj2=20;
14
15 function f1(){
16 global $db;
17
18 echo "\n".$db->fun2()*$this->obj2."\n";
19 }
20 }
21 ?>
1 #!/usr/bin/php -q
2
3 <?php
4
5 require_once('p1.inc');
6
7 $db= new dbb();
8
9
10 $obj = new obj();
11
12 $obj->f1();
13
14 ?>
--- End Message ---
--- Begin Message ---
At 1:09 PM -0800 12/3/07, Stephen Johnson wrote:
Part of this job is learning how to learn, and so many times people just
want you to write the code for them.
That works for me, but I seldom use their code.
I always like to see (have an example) of how it's done, but then I
rewrite everything to fit with my view of the world.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---