php-general Digest 20 Apr 2010 23:38:13 -0000 Issue 6703

Topics (messages 304244 through 304272):

Re: Mail Function Using PEAR Issues
        304244 by: Ken Guest
        304259 by: Alice Wei
        304268 by: Peter Lind
        304269 by: Ashley Sheridan

Excel Report Formatting
        304245 by: Php Developer
        304246 by: Tommy Pham
        304247 by: Jay Blanchard
        304250 by: Tommy Pham
        304251 by: Jay Blanchard
        304252 by: Dan Joseph
        304253 by: Php Developer
        304255 by: Ashley Sheridan
        304258 by: Tommy Pham
        304261 by: Jay Blanchard
        304265 by: Php Developer
        304266 by: Ashley Sheridan
        304270 by: Jay Blanchard
        304272 by: Tommy Pham

Date Math
        304248 by: Floyd Resler
        304249 by: Dan Joseph
        304264 by: tedd
        304267 by: Paul M Foster

Re: How to do i18n better?
        304254 by: Ashley Sheridan
        304260 by: Per Jessen
        304263 by: Ashley Sheridan

Re: Class constants
        304256 by: Nathan Rixham

Re: Directory permissions question
        304257 by: Nathan Rixham

Re: Get Power Saving Settings of the Server
        304262 by: kranthi

Hello everybody - php newbie from switzerland
        304271 by: Nick Balestra

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 ---
On Tue, Apr 20, 2010 at 2:10 AM, David McGlone <da...@dmcentral.net> wrote:
> On Mon, 2010-04-19 at 08:25 -0400, Alice Wei wrote:
>
>> I have not changed any of my SMTP settings since my new installation of
>> PHP with Pear. So, I am not sure what the settings are supposed to be.
>> Would I need to install anything else even when the Pear Mail package
>> has been installed?

You might, depending on if you need to use the Mail_Mime or Mail_Queue
packages also (for sending emails with attachments etc etc or for
sending mails in bulk).
 Also there's some rather nice new functionality in the more recent
versions of Mail and Net_SMTP that enable you to log the ESMTP Id of
mails you have submitted to a mail server (along with the SMTP
greeting sent by that server when you connect to it).

> Alice, I never use the PEAR install from my distro, I always download
> and install PEAR into my working folder. The benefit of doing it this
> way is so that when you move your project to a different server, nothing
> will break and you don't have to change anything.
>
> Sometimes when I create a new project, I'll just copy the PEAR folder
> from an older project to the new one. The only thing you may have to
> change in your PHP code is the path to the PEAR libs only if you don't
> put them in the same place every time.
>

When some bug is fixed or dependencies of some of those PEAR packages
change I think you'll find your attitude towards that will change -
there's a pear installer so you don't have to update and track the
dependencies by hand - you do regularly update your packages don't
you? It's smart to do so because at the very least you don't have to
implement work-arounds for bugs that have been fixed in later versions
of those packages - and in the worst-case scenario it means you're not
using versions that have PEAR Security Advisories issued against them.

I believe it's possible to have seperate pear config files per project
so you're not limited to having to use the same versions of packages
across all projects.

If you're using more than a handful of PEAR packages in your project
you might want to write your own meta-package for the project; that
way you don't have to install all those packages individually;
you just do something like "$pear install myProject.xml" and the pear
installer will download and install whichever pear packages you have
described in your xml file.

Details on doing this are at
http://pear.php.net/manual/en/guide.users.dependencytracking.php

For the record, this is the example script that I submitted to
http://www.web-development-blog.com/archives/php-mail-scripts-using-smtp-transport-a-guide-for-beginners/
for demonstrating how to use the PEAR packages for sending a mail with
a file attached.:

<?php
require_once "Mail.php";
require_once "Mail/mime.php";

$from = "Fred Flintstone <fli...@example.com>“;
$to = “Barney Rubble <barn...@example.net>“;
$subject = “Mail Subject”;
$message = “this is the text of the mail, sent using PEAR’s Mail packages.”;
$host = “smtp.example.com”;
$port = “25″;
$headers = array (‘From’ => $from, ‘To’ => $to, ‘Subject’ => $subject);
$smtp = Mail::factory(’smtp’, array (‘host’ => $host, ‘port’ => $port));
$mime = new Mail_mime();
$mime->setTxtBody($message);
$mime->addAttachment(“/home/ken/logo.png”, ‘image/png’);
$body = $mime->get();
$mail = $smtp->send($to, $mime->headers($headers), $body);

if (PEAR::isError($mail)) {
echo($mail->getMessage() . “!\n”);
} else {
echo(“Message successfully sent to $to!\n”);
echo “Queued As (ESMTP Id): “, $smtp->queued_as, “\n”;
echo “Greeting From Mailserver: “, $smtp->greeting, “\n”;
}

?>


> Blessings,
> David M.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
http://blogs.linux.ie/kenguest/

--- End Message ---
--- Begin Message ---

> From: peter.e.l...@gmail.com
> Date: Mon, 19 Apr 2010 10:15:08 +0200
> Subject: Re: [PHP] Mail Function Using PEAR Issues
> To: aj...@alumni.iu.edu
> CC: php-gene...@lists.php.net
> 
> Most, if not all, mail servers keep log files. You should look for the
> log files to see if the mail server has sent your mail properly or is
> experiencing problems (those may not feed back into PHP).
> 
> Regards
> Peter
> 
> -- 
> <hype>
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> </hype>

You know where I can find that? I use Evolution Mail, a mail server? I found it 
through Ubuntu yesterday. Here is the link: 
http://projects.gnome.org/evolution/ It asks me to put in the type of mail 
service I used, it grabbed Google, which is smtp.google.com. I still cannot 
send mail. I start to wonder what is going on. 

Alice
                                          
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

--- End Message ---
--- Begin Message ---
On 20 April 2010 20:17, Alice Wei <aj...@alumni.iu.edu> wrote:
>
>> From: peter.e.l...@gmail.com
>> Date: Mon, 19 Apr 2010 10:15:08 +0200
>> Subject: Re: [PHP] Mail Function Using PEAR Issues
>> To: aj...@alumni.iu.edu
>> CC: php-gene...@lists.php.net
>>
>> Most, if not all, mail servers keep log files. You should look for the
>> log files to see if the mail server has sent your mail properly or is
>> experiencing problems (those may not feed back into PHP).
>>
>> Regards
>> Peter
>>
>> --
>> <hype>
>> WWW: http://plphp.dk / http://plind.dk
>> LinkedIn: http://www.linkedin.com/in/plind
>> Flickr: http://www.flickr.com/photos/fake51
>> BeWelcome: Fake51
>> Couchsurfing: Fake51
>> </hype>
>
> You know where I can find that? I use Evolution Mail, a mail server? I found
> it through Ubuntu yesterday. Here is the link:
> http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> service I used, it grabbed Google, which is smtp.google.com. I still cannot
> send mail. I start to wonder what is going on.
>
> Alice
>

Evolution is a mail client, not a mail server. Apart from that, you're
using the 'mail' (PHPs mail function) as the backend mailer in your
PEAR script - try using smtp instead and pass the SMTP config data you
normally use. Have a look at
http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
part.

Regards
Peter

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
On Tue, 2010-04-20 at 22:17 +0200, Peter Lind wrote:

> On 20 April 2010 20:17, Alice Wei <aj...@alumni.iu.edu> wrote:
> >
> >> From: peter.e.l...@gmail.com
> >> Date: Mon, 19 Apr 2010 10:15:08 +0200
> >> Subject: Re: [PHP] Mail Function Using PEAR Issues
> >> To: aj...@alumni.iu.edu
> >> CC: php-gene...@lists.php.net
> >>
> >> Most, if not all, mail servers keep log files. You should look for the
> >> log files to see if the mail server has sent your mail properly or is
> >> experiencing problems (those may not feed back into PHP).
> >>
> >> Regards
> >> Peter
> >>
> >> --
> >> <hype>
> >> WWW: http://plphp.dk / http://plind.dk
> >> LinkedIn: http://www.linkedin.com/in/plind
> >> Flickr: http://www.flickr.com/photos/fake51
> >> BeWelcome: Fake51
> >> Couchsurfing: Fake51
> >> </hype>
> >
> > You know where I can find that? I use Evolution Mail, a mail server? I found
> > it through Ubuntu yesterday. Here is the link:
> > http://projects.gnome.org/evolution/ It asks me to put in the type of mail
> > service I used, it grabbed Google, which is smtp.google.com. I still cannot
> > send mail. I start to wonder what is going on.
> >
> > Alice
> >
> 
> Evolution is a mail client, not a mail server. Apart from that, you're
> using the 'mail' (PHPs mail function) as the backend mailer in your
> PEAR script - try using smtp instead and pass the SMTP config data you
> normally use. Have a look at
> http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp
> part.
> 
> Regards
> Peter
> 
> -- 
> <hype>
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> </hype>
> 


If you've got Pear on Ubuntu, can Pear not default to sendmail if no
SMTP connection is set up?

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hi,

Do you know if there is a way to generate a formated Excel report.
I want some rows to be of different colors than the others.

Thank you



      __________________________________________________________________
Get the name you've always wanted @ymail.com or @rocketmail.com! Go to 
http://ca.promos.yahoo.com/jacko/


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 8:30 AM
> To: php-gene...@lists.php.net
> Subject: [PHP] Excel Report Formatting
> 
> Hi,
> 
> Do you know if there is a way to generate a formated Excel report.
> I want some rows to be of different colors than the others.
> 
> Thank you
> 
> 
> 
> 
> __________________________________________________________________
> Get the name you've always wanted @ymail.com or @rocketmail.com! Go to
> http://ca.promos.yahoo.com/jacko/
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-1--P155.html


--- End Message ---
--- Begin Message ---
[snip]
Do you know if there is a way to generate a formated Excel report.
I want some rows to be of different colors than the others.
[/snip]

STFW or STFA much? This was posted yesterday....

Stupid browser tricks....

http://www.evolt.org/node/26896



--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Jay Blanchard [mailto:jblanch...@pocket.com]
> Sent: Tuesday, April 20, 2010 8:40 AM
> To: Php Developer; php-gene...@lists.php.net
> Subject: RE: [PHP] Excel Report Formatting
> 
> [snip]
> Do you know if there is a way to generate a formated Excel report.
> I want some rows to be of different colors than the others.
> [/snip]
> 
> STFW or STFA much? This was posted yesterday....
> 
> Stupid browser tricks....
> 
> http://www.evolt.org/node/26896
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


I believe the OP wants to format the excel for download.  And not display the 
data in excel like in the web browser.


--- End Message ---
--- Begin Message ---
[snip]I believe the OP wants to format the excel for download.  And not
display the data in excel like in the web browser.[/snip]

He didn't specify that, but you can change the code in the article to
save the file and make available for download. 


--- End Message ---
--- Begin Message ---
Its good to see we're all playing nice today!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry

--- End Message ---
--- Begin Message ---
Hi Tommy,

The code in the link is traightforward. The problem is you need to install 
ADOdb.

I'm wondering if there is a way to do it from scratch.

Thanks


----- Original Message ----
From: Tommy Pham <tommy...@gmail.com>
To: Php Developer <pdevelo...@rocketmail.com>; php-gene...@lists.php.net
Sent: Tue, April 20, 2010 11:37:21 AM
Subject: RE: [PHP] Excel Report Formatting

> -----Original Message-----
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 8:30 AM
> To: php-gene...@lists.php.net
> Subject: [PHP] Excel Report Formatting
> 
> Hi,
> 
> Do you know if there is a way to generate a formated Excel report.
> I want some rows to be of different colors than the others.
> 
> Thank you
> 
> 
> 
> 
> __________________________________________________________________
> Get the name you've always wanted @ymail.com or @rocketmail.com! Go to
> http://ca.promos.yahoo.com/jacko/
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-1--P155.html

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


--- End Message ---
--- Begin Message ---
On Tue, 2010-04-20 at 12:50 -0400, Dan Joseph wrote:

> Its good to see we're all playing nice today!
> 


It's still not an excel file but an HTML table sent with an Excel
mime-type. This is just asking for trouble if the user does not use
Excel, as it's exploiting behaviour that looks very particular to Excel
and not ALL spreadsheet software.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 9:52 AM
> To: Tommy Pham; php-gene...@lists.php.net
> Subject: Re: [PHP] Excel Report Formatting
> 
> Hi Tommy,
> 
> The code in the link is traightforward. The problem is you need to
> install ADOdb.
> 
> I'm wondering if there is a way to do it from scratch.
> 
> Thanks
> 
> 
> ----- Original Message ----
> From: Tommy Pham <tommy...@gmail.com>
> To: Php Developer <pdevelo...@rocketmail.com>; php-
> gene...@lists.php.net
> Sent: Tue, April 20, 2010 11:37:21 AM
> Subject: RE: [PHP] Excel Report Formatting
> 
> > -----Original Message-----
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 8:30 AM
> > To: php-gene...@lists.php.net
> > Subject: [PHP] Excel Report Formatting
> >
> > Hi,
> >
> > Do you know if there is a way to generate a formated Excel report.
> > I want some rows to be of different colors than the others.
> >
> > Thank you
> >
> >
> >
> >
> > __________________________________________________________________
> > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> to
> > http://ca.promos.yahoo.com/jacko/
> >
> 
> http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> 1--P155.html
> 

I think the article/sample uses PEAR's Excel Writer.

http://pear.php.net/package/Spreadsheet_Excel_Writer/
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php



--- End Message ---
--- Begin Message ---
[snip]
It's still not an excel file but an HTML table sent with an Excel
mime-type. This is just asking for trouble if the user does not use
Excel, as it's exploiting behaviour that looks very particular to Excel
and not ALL spreadsheet software.
[/snip]

This is true, it is exploiting behavior that is particular to Excel. I
was able to do this with Open Office too, even though I didn't fully
bake the code for that.

The article is pretty old and there are other tools that would probably
work a lot better, but the OP asked about Excel and coloring.

--- End Message ---
--- Begin Message ---
Hi, somebody knows if it is possible to open excel content in a new window? 
what i want is basically initialize the headers and instead of echo $content i 
want it to open in a new window. is that possible?



----- Original Message ----
From: Tommy Pham <tommy...@gmail.com>
To: Php Developer <pdevelo...@rocketmail.com>; php-gene...@lists.php.net
Sent: Tue, April 20, 2010 1:47:40 PM
Subject: RE: [PHP] Excel Report Formatting

> -----Original Message-----
> From: Php Developer [mailto:pdevelo...@rocketmail.com]
> Sent: Tuesday, April 20, 2010 9:52 AM
> To: Tommy Pham; php-gene...@lists.php.net
> Subject: Re: [PHP] Excel Report Formatting
> 
> Hi Tommy,
> 
> The code in the link is traightforward. The problem is you need to
> install ADOdb.
> 
> I'm wondering if there is a way to do it from scratch.
> 
> Thanks
> 
> 
> ----- Original Message ----
> From: Tommy Pham <tommy...@gmail.com>
> To: Php Developer <pdevelo...@rocketmail.com>; php-
> gene...@lists.php.net
> Sent: Tue, April 20, 2010 11:37:21 AM
> Subject: RE: [PHP] Excel Report Formatting
> 
> > -----Original Message-----
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 8:30 AM
> > To: php-gene...@lists.php.net
> > Subject: [PHP] Excel Report Formatting
> >
> > Hi,
> >
> > Do you know if there is a way to generate a formated Excel report.
> > I want some rows to be of different colors than the others.
> >
> > Thank you
> >
> >
> >
> >
> > __________________________________________________________________
> > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> to
> > http://ca.promos.yahoo.com/jacko/
> >
> 
> http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> 1--P155.html
> 

I think the article/sample uses PEAR's Excel Writer.

http://pear.php.net/package/Spreadsheet_Excel_Writer/
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
On Tue, 2010-04-20 at 12:58 -0700, Php Developer wrote:

> Hi, somebody knows if it is possible to open excel content in a new window? 
> what i want is basically initialize the headers and instead of echo $content 
> i want it to open in a new window. is that possible?
> 
> 
> 
> ----- Original Message ----
> From: Tommy Pham <tommy...@gmail.com>
> To: Php Developer <pdevelo...@rocketmail.com>; php-gene...@lists.php.net
> Sent: Tue, April 20, 2010 1:47:40 PM
> Subject: RE: [PHP] Excel Report Formatting
> 
> > -----Original Message-----
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 9:52 AM
> > To: Tommy Pham; php-gene...@lists.php.net
> > Subject: Re: [PHP] Excel Report Formatting
> > 
> > Hi Tommy,
> > 
> > The code in the link is traightforward. The problem is you need to
> > install ADOdb.
> > 
> > I'm wondering if there is a way to do it from scratch.
> > 
> > Thanks
> > 
> > 
> > ----- Original Message ----
> > From: Tommy Pham <tommy...@gmail.com>
> > To: Php Developer <pdevelo...@rocketmail.com>; php-
> > gene...@lists.php.net
> > Sent: Tue, April 20, 2010 11:37:21 AM
> > Subject: RE: [PHP] Excel Report Formatting
> > 
> > > -----Original Message-----
> > > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > > Sent: Tuesday, April 20, 2010 8:30 AM
> > > To: php-gene...@lists.php.net
> > > Subject: [PHP] Excel Report Formatting
> > >
> > > Hi,
> > >
> > > Do you know if there is a way to generate a formated Excel report.
> > > I want some rows to be of different colors than the others.
> > >
> > > Thank you
> > >
> > >
> > >
> > >
> > > __________________________________________________________________
> > > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> > to
> > > http://ca.promos.yahoo.com/jacko/
> > >
> > 
> > http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> > 1--P155.html
> > 
> 
> I think the article/sample uses PEAR's Excel Writer.
> 
> http://pear.php.net/package/Spreadsheet_Excel_Writer/
> http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 


Erm, why?

Wouldn't it be easier to output the table as HTML in a new window?

Excel does have plugins for *some* browsers that allow the browser to
open Excel files within its own window (in that annoying way that PDF's
try to open up within the browser) but this can be turned off by the
user (and I can't imagine many people who wouldn't turn it off tbh) This
is also only available for some browsers on some operating systems, and
you could well be alienating users who don't use Microsoft software.

Are you looking to allow a way for users to edit spreadsheets within
your web app? It's worth considering that this is a huge task. There are
some Javascript-based plugins that you can use to embed spreadsheet-like
data into your web pages, but I think anything more than basic
formatting and data entry is a pipe dream at the moment. The only really
usable web-based spreadsheets I've seen come from the likes of very big
companies like Google and Microsoft.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
[snip]
Hi, somebody knows if it is possible to open excel content in a new
window? what i want is basically initialize the headers and instead of
echo $content i want it to open in a new window. is that possible?
[/snip]

Yes, it is possible. <a href="" target="_blank"> Is this too obvious?


















My apologies, I am in a funky mood today.

--- End Message ---
--- Begin Message ---
On Tue, Apr 20, 2010 at 1:00 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
>
> On Tue, 2010-04-20 at 12:58 -0700, Php Developer wrote:
>
> Hi, somebody knows if it is possible to open excel content in a new window? 
> what i want is basically initialize the headers and instead of echo $content 
> i want it to open in a new window. is that possible?
>
>
>
> ----- Original Message ----
> From: Tommy Pham <tommy...@gmail.com>
> To: Php Developer <pdevelo...@rocketmail.com>; php-gene...@lists.php.net
> Sent: Tue, April 20, 2010 1:47:40 PM
> Subject: RE: [PHP] Excel Report Formatting
>
> > -----Original Message-----
> > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > Sent: Tuesday, April 20, 2010 9:52 AM
> > To: Tommy Pham; php-gene...@lists.php.net
> > Subject: Re: [PHP] Excel Report Formatting
> >
> > Hi Tommy,
> >
> > The code in the link is traightforward. The problem is you need to
> > install ADOdb.
> >
> > I'm wondering if there is a way to do it from scratch.
> >
> > Thanks
> >
> >
> > ----- Original Message ----
> > From: Tommy Pham <tommy...@gmail.com>
> > To: Php Developer <pdevelo...@rocketmail.com>; php-
> > gene...@lists.php.net
> > Sent: Tue, April 20, 2010 11:37:21 AM
> > Subject: RE: [PHP] Excel Report Formatting
> >
> > > -----Original Message-----
> > > From: Php Developer [mailto:pdevelo...@rocketmail.com]
> > > Sent: Tuesday, April 20, 2010 8:30 AM
> > > To: php-gene...@lists.php.net
> > > Subject: [PHP] Excel Report Formatting
> > >
> > > Hi,
> > >
> > > Do you know if there is a way to generate a formated Excel report.
> > > I want some rows to be of different colors than the others.
> > >
> > > Thank you
> > >
> > >
> > >
> > >
> > > __________________________________________________________________
> > > Get the name you've always wanted @ymail.com or @rocketmail.com! Go
> > to
> > > http://ca.promos.yahoo.com/jacko/
> > >
> >
> > http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-
> > 1--P155.html
> >
>
> I think the article/sample uses PEAR's Excel Writer.
>
> http://pear.php.net/package/Spreadsheet_Excel_Writer/
> http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> Erm, why?
>
> Wouldn't it be easier to output the table as HTML in a new window?
>
> Excel does have plugins for *some* browsers that allow the browser to open 
> Excel files within its own window (in that annoying way that PDF's try to 
> open up within the browser) but this can be turned off by the user (and I 
> can't imagine many people who wouldn't turn it off tbh) This is also only 
> available for some browsers on some operating systems, and you could well be 
> alienating users who don't use Microsoft software.
>
> Are you looking to allow a way for users to edit spreadsheets within your web 
> app? It's worth considering that this is a huge task. There are some 
> Javascript-based plugins that you can use to embed spreadsheet-like data into 
> your web pages, but I think anything more than basic formatting and data 
> entry is a pipe dream at the moment. The only really usable web-based 
> spreadsheets I've seen come from the likes of very big companies like Google 
> and Microsoft.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

If you're looking for something like Google's spreadsheet document
capability, you got a LOT of work of you ;)

--- End Message ---
--- Begin Message ---
I need to get the difference in months between two dates.  The dates could be 
as much as 60 months apart.  Is there any easy way to do this either through 
PHP or MySQL?  I know how I can do it through code but thought there might be a 
simple one or two line option.

Thanks!
Floyd


--- End Message ---
--- Begin Message ---
On Tue, Apr 20, 2010 at 11:40 AM, Floyd Resler <fres...@adex-intl.com>wrote:

> I need to get the difference in months between two dates.  The dates could
> be as much as 60 months apart.  Is there any easy way to do this either
> through PHP or MySQL?  I know how I can do it through code but thought there
> might be a simple one or two line option.
>
>
check out:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry

--- End Message ---
--- Begin Message ---
At 11:40 AM -0400 4/20/10, Floyd Resler wrote:
I need to get the difference in months between two dates. The dates could be as much as 60 months apart. Is there any easy way to do this either through PHP or MySQL? I know how I can do it through code but thought there might be a simple one or two line option.

Thanks!
Floyd



<?php

$date1 = '2009-02-27';
$date2 = '2004-12-03';

$udate1 = strtotime($date1);
$udate2 = strtotime($date2);

$difference = $udate1 - $udate2;

$months_difference = floor($difference / 2678400);

echo("The difference is $months_difference months");

?>

I this will work, but the question of what constitutes a month might come into play.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Tue, Apr 20, 2010 at 03:32:58PM -0400, tedd wrote:

> At 11:40 AM -0400 4/20/10, Floyd Resler wrote:
>> I need to get the difference in months between two dates.  The dates
>> could be as much as 60 months apart.  Is there any easy way to do
>> this either through PHP or MySQL?  I know how I can do it through
>> code but thought there might be a simple one or two line option.
>>
>> Thanks!
>> Floyd
>>
>
>
> <?php
>
> $date1 = '2009-02-27';
> $date2 = '2004-12-03';
>
> $udate1 = strtotime($date1);
> $udate2 = strtotime($date2);

$from = getdate($udate1);
$from_year = $from['year'];
$from_month = $from['month'];

$to = getdate($udate2);
$to_year = $to['year'];
$to_month = $to['month'];

// Assumes $to_date is later than $from_date

if ($from_year == $to_year)
        $months = $to_month - $from_month;
elseif ($to_month >= $from_month) {
        $num_years = $to_year - $from_year;
        $add_months = $num_years * 12;
        $base_months = $to_month - $from_month;
        $months = $base_months + $add_months;
}
else { // $to_month < $from_month
        $num_years = $to_year - $from_year;
        $base_months = $num_years * 12;
        $sub_months = $from_month - $to_month;
        $months = $base_months - $sub_months;
}

This will give the months between two dates, ignoring the actual day of
the month for each date (may not be exactly what you want, and code is
untested).

>
> $difference = $udate1 - $udate2;
>
> $months_difference = floor($difference / 2678400);
>
> echo("The difference is $months_difference months");
>
> ?>
>
> I this will work, but the question of what constitutes a month might
> come into play.

My code above is submitted because I don't like doing calculations with
seconds. Tedd's right, the OP's questions can't be answered precisely
because months vary in number of days.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
On Tue, 2010-04-20 at 13:34 +0300, Andre Polykanine wrote:
> Hi Ash,
> 
> Yepp, it's understood. But how exactly did you store the
> language-specific strings: in an array or using another way?
> 
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> ----- Original message -----
> From: Ashley Sheridan <a...@ashleysheridan.co.uk>
> To: Jason Pruim <li...@pruimphotography.com>
> Date: Tuesday, April 20, 2010, 2:17:47 AM
> Subject: [PHP] How to do i18n better?
> 
> On Mon, 2010-04-19 at 19:17 -0400, Jason Pruim wrote:
> 
> > On Apr 18, 2010, at 6:55 PM, Andre Polykanine wrote:
> > 
> > > Hi everyone,
> > >
> > > I posted this in the PHP-i18n list, however got no answer so trying
> > > here).
> > > We are making a blog platform (http://oire.org/) which is provided in
> > > several languages (currently they are Russian, Ukrainian, and
> > > English).
> > > Now the i18n process is made as follows: we set a cookie on the site
> > > and depending on it we select the language to display the site in. We
> > > have three (currently) interface files: rus.lng, ukr.lng, and enu.lng
> > > (for English US). the format is the following:
> > > define ("MSG379", "Welcome!");
> > > etc. I know that PHP does support somehow exporting the strings into a
> > > .pod file. Maybe it would be better to do that? If so, how can I do
> > > it?
> > > Could you suggest me maybe a better solution than we currently have?
> > > Thanks a lot!
> > 
> > I've never actually had to do this... But one idea that I came up with  
> > is using the browser language in taking a best guess at what language  
> > to display... In other words, if the user's browser language is set to  
> > Chinese, you can be fairly certain they read Chinese :)
> > 
> > And now that I typed that out, I realize that may not be what you are  
> > really looking for...  And that's when we get into the part where I  
> > can't help alot because I've never had to do it :)
> > 
> > So good luck! :)
> > 
> > 
> > 
> > 
> 
> 
> That's the check I did on the last site i worked on (vicestyle.com) The
> user agent string is checked for a language and the site uses that. If
> none is found (bearing in mind that there's no hard and fast rule about
> what can go into a UA string) then it defaults to English.
> 
> Links within the site itself allow the user to change their language
> afterwards, and you could store that in a cookie to it remembers their
> choice.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 

The differences were stored in an array with a file per language like
so:

$lang['Welcome'] = 'Welcome';
$lang['Contact'] = 'Contact';

and in a a different file for German maybe:

$lang['Welcome'] = 'Willkommen';
$lang['Contact'] = 'Kontakt';

Thanks,
Ash
http://www.ashleysheridan.co.uk




--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:

> That's the check I did on the last site i worked on (vicestyle.com)
> The user agent string is checked for a language and the site uses
> that. If none is found (bearing in mind that there's no hard and fast
> rule about what can go into a UA string) then it defaults to English.

The language preference is not set in the UA string, it is set in the
Accept-Language header along with the priority. 

> Links within the site itself allow the user to change their language
> afterwards, and you could store that in a cookie to it remembers their
> choice.

The standard in Apache is 'prefer-language'.



-- 
Per Jessen, Zürich (12.4°C)


--- End Message ---
--- Begin Message ---
On Tue, 2010-04-20 at 20:27 +0200, Per Jessen wrote:

> Ashley Sheridan wrote:
> 
> > That's the check I did on the last site i worked on (vicestyle.com)
> > The user agent string is checked for a language and the site uses
> > that. If none is found (bearing in mind that there's no hard and fast
> > rule about what can go into a UA string) then it defaults to English.
> 
> The language preference is not set in the UA string, it is set in the
> Accept-Language header along with the priority. 
> 
> > Links within the site itself allow the user to change their language
> > afterwards, and you could store that in a cookie to it remembers their
> > choice.
> 
> The standard in Apache is 'prefer-language'.
> 
> 
> 
> -- 
> Per Jessen, Zürich (12.4°C)
> 
> 


I wasn't aware of that one, but I know most browsers send a language
with part of the UA string

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Gary . wrote:
> On Mon, Apr 19, 2010 at 3:12 PM, Ashley Sheridan wrote:
>> On 19 April 2010 14:24, Gary wrote:
> 
>>> Okay. Why not?
> ...
>> Class constants must be defined with static values, not variables. They are 
>> constants after all! If they relied on the value of a variable, surely that 
>> would mean that their own value might change, so they would just become 
>> regular variables not constants.

a constant is something constant (doesn't change), something static is
something static (persistently there, but may change)

> Right. But in fact the only referenced values are *also* constant
> (unless I'm completely misunderstanding the use of 'const'), so I
> think it's a valid thing to want to do. I accept it doesn't seem to be
> possible, I'm now curious as to the thinking behind it.
> 
>> Is there a specific reason that you need to try and achieve this?
> 
> Okay, well here's a more meaningful situation, perhaps:
> class SomeTable
> {
>   const TABLE_NAME = 'mytable';
>   const SELECT = 'SELECT * FROM ' . MyTable::TABLE_NAME;
>   const INSERT = 'INSERT INTO ' .  MyTable::TABLE_NAME ...
> 

try

public static $INSERT = 'INSERT INTO ' .  MyTable::$TABLE_NAME ...

self::$INSERT

> If the table name should change for some reason, it is preferable to
> make the change in one place in the code (i.e. the value of
> TABLE_NAME), surely, than changing the name in the alternative, which
> is something like:
> class SomeTable
> {
> //  const TABLE_NAME = 'mytable';
>   const SELECT = 'SELECT * FROM mytable';
>   const INSERT = 'INSERT INTO mytable...


--- End Message ---
--- Begin Message ---
Al wrote:
> I'm working on a hosted website that was hacked and found something I
> don't fully understand. Thought someone here may know the answer.
> 
> The site has 4 php malicious files in directories owned by "system" [php
> created dirs on the site are named "nobody"] and permissions 755.
> 
> Is there any way the files could have been written other than by ftp
> access or at the host root level? Clearly a php script couldn't.
> 
> Thanks, Al..........

it doesn't matter what the language of the script that did this is, it's
all about the permissions of the process that's running the script

it's the difference between you running a script as www-data and running
it via the shell as root.

SUExec might be at play, some other process, some user with ssh access,
some back door, consider the permissions and owner of the directory
containing the files, if it's nobody then anybody could have written to it.

All in, ask the ISP to check logs and history, ensure all your
permissions on directories are tight, and that you don't have any
scripts on there that can be abused and that they are "safe" - then
you're clear :)

Best,

Nathan

--- End Message ---
--- Begin Message ---
>> Your server management software may provide a way to get this information 
>> either through the command line or through a network interface

Using exec('gconftool-2 -g
/apps/gnome-power-manager/timeout/sleep_display_ac') helped. Thanks

--- End Message ---
--- Begin Message ---
Hello everybody,

I am NIck, from Locarno (southern switzerland) i am getting into php 
development for my own start-up company, maybe there are other people near me 
that would be nice to know for networking and alike. I will post here all my 
questions if i don't find any answer already on this list.


Cheers from Switzerland

Nick

--- End Message ---

Reply via email to