[PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Scott Baker
$sql = SELECT First, Last, Age, 'Foobar' AS Last;;

This is a simplified example of a SQL query where we're returning two
fields with the same name (Last). When I do a fetch_assoc with this
query I only get three fields, as the second Last field over writes
the first one.

I was hoping there was some method with PDO that would detect that and
throw a warning. Maybe some sort of strict mode that would tell me I'm
doing something stupid. Is there a way to catch this before it bites me?

It already bit me, but moving forward it'd be nice if PHP saw that
before I spent an hour debugging it again.

- Scott

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



Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Scott Baker
On 07/02/2012 03:34 PM, Matijn Woudt wrote:
 Why the  would you want to return 2 columns with the same name?
 To be short, there's no such function, so you have to:
 1) Rename one of the columns
 2) or, use fetch_row with numerical indexes instead of fetch_assoc.

My real world scenario was this

SELECT a.CustID, b.*
FROM Customer a
LEFT JOIN Sales B USING (CustID)
WHERE a.CustID = 1234;

In that case, there was a record in Customer, but not in Sales. Sales
returned CustID as NULL, which overwrote the one from Customer.

It was my mistake, and the SQL was easily fixed. But it woulda been nice
to have PHP realize there was a dupe when it was building that array to
return to me.


-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253



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



Re: [PHP] Critical Error

2012-03-28 Thread Paul Scott
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 28/03/2012 17:59, Karl James wrote:
 
 MYSQL: Duplicate entry for '0' for key 1.
 
 MYSQL: Insert Error - Duplicate entry '0' for key 1,.

Simply means that you are trying to insert a database entry into your
database table that already exists, for the primary key field (look at
ID or something like that)

This is a MySQL problem more than a PHP one, but there you go (I have
been largely absent from this list for a long time, so starting off
slowly again) ...

- -- 
- -- Paul http://www.paulscott.za.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPcznzAAoJEP24vLf5r1PRD9oH/jdPx1JmLk60MgwrojgPMc61
gdt416IyZVVe+d0z2YQ3Hep+T1otd8ibqnEb0nrl3URZoa2Bc+8OsCi9qTlcl/ts
qa+MgUd6if5/FBbev02f/39xBHrYtNm/3EPDuF/sFP1bZrXAYmOyze0pI50LU9Ki
5F/UyTjaa0l7mRA0MhcIOr0Q1+ouRDKPrTrPV/NKqhMSxkinzmcOEuIcpfxd78yD
ELiPS2GUuieusrFkrlHFq6DGoS2Kk8mtZa7Pu9FqYjCUdOUJCeuPlJlCRi5FRWxG
DFesqV3Xj2FxMLE2h0sTek4NNX6PvM7tlCEzgEy7QnjbqH8RPLGI+6B9M1WIWqg=
=0ACX
-END PGP SIGNATURE-

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



Re: [PHP] Need PHP Web Developer in So Cal

2012-03-28 Thread Paul Scott
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 28/03/2012 18:04, Michael Frankel wrote:
 Hi -
 
 I am looking for a reliable, experienced PHP / Web developer or
 development company to assist me with one of my long-time clients.
 I need someone who has experience with all the following
 technologies working in a hosted environment:

[snip]

 - Can be responsive to client emergencies - NOTE: this is the MOST
 important quality

Translates to we will be phoning you at 2am and you are expected to
be there with a smile on your face for the client

Am I right? Yeah, I know I am... ;)

- -- 
- -- Paul http://www.paulscott.za.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPczphAAoJEP24vLf5r1PRd6IH/3tLKoRDrL5R/fcjYop8RyLE
Bux+xJ/N6qkMr3aYOGq/k7C6StFZGK2WqxftqJW38qakWqnpX35ZseezsQyQ70Ek
ZZossCFAQ/n3DqXNeB3RDRGfVODEKEIlAGvYnwFK04VW/bsUU69o+ac7pffN7yYu
i/622+4ssSRPafMv6t1kX/w/DlfhzGyrAKGLbibM5uX4l1cNmM/YEkPzyiu/ySFd
8L9dI+N5j0vStJUh1jRpi08EoZJXGTjMtBfOGvYgjD1bnAl+K8nGYx9irGXfpBej
GaKRGAcP7ZxFmUl61bGyrK2ijUATbjAckfi/2z6DHmuJNr0TdnqEF545t77MrcQ=
=sEhx
-END PGP SIGNATURE-

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



Re: [PHP] Intentionally generate an Internal Server Error

2011-08-07 Thread Paul Scott
On Sun, 2011-08-07 at 07:30 +0100, Ashley Sheridan wrote:

 Quickest way I know of is to mess up an .htaccess file!

Another good way to do it on shared hosts is to give a file incorrect
permissions and try and access it

-- 
-- Paul

http://www.paulscott.za.net
http://twitter.com/paulscott56
http://www.chisimba.com


signature.asc
Description: This is a digitally signed message part


[PHP] Benchmark two functions against each other?

2011-06-27 Thread Scott Baker
I have functions that I'd like to benchmark and compare. What are the
best PHP libraries or websites to do that? Something like jsperf.com but
for PHP would be ideal.

- Scott

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



Re: [PHP] Benchmark two functions against each other?

2011-06-27 Thread Scott Baker
On 06/27/2011 10:33 AM, Stuart Dallas wrote:
 
 You're not going to find a service that will let you do that - allowing
 arbitrary PHP to be entered into a website to be executed is far too
 dangerous.

I would have thought so too but I found these:

http://codepad.viper-7.com/
http://codepad.org/
http://ideone.com/

 Just knocked this up, should do what you
 want:Â https://gist.github.com/1049335

Thanks I'll check it out!

-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253

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



[PHP] Get all the keys from a hierarchical hash

2011-06-23 Thread Scott Baker
I have a multi-tier hash (see below) and I'd like to be search the
hash for a given $id, and return that section, regardless of how many
layers deep it is. Sort of like how xpath works?

Once I have that I'd like get ALL the children of a given node. So I
could ask for 86, and get 36, 38, 56, etc and all THEIR children.
Basically I want *all* the ID #s that are children.

Array
(
[88] = Array
(
[109] =
)

[86] = Array
(
[36] = Array
(
[8] =
[121] =
[127] =
[135] =
[144] =
[161] =
[165] =
)

[38] = Array
(
[18] =
[39] =
[156] =
[158] =
[182] =
)

[56] =
[97] =
[107] = Array
(
[240] =
)

[115] =
[123] =
[146] =
[149] =
[223] =
)

[157] = Array
(
[3] = Array
(
[5] = Array
(
[11] =
)

[13] = Array
(
[6] =
[7] =
[98] = Array
(
[81] =
)

)

[111] = Array
(
[10] =
[17] =
[110] =
)

)

[148] = Array
(
[9] =
[87] =
[102] =
[104] =
[114] =
[130] =
[133] =
[160] =
[201] =
[237] =
[238] =
)

)

)

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



[PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
I have a bunch of records in a DB that look like

id | parent_id
--
1  | 4
2  | 4
3  | 2
4  | 0
5  | 2
6  | 1
7  | 3
8  | 7
9  | 7

I want to build a big has that looks like:

4 - 1 - 6
  - 2 - 3 - 7 - 9
   - 5  - 8

I'm like 90% of the way there, but I can't get my recursive assignment
to work. Has anyone done this before that could offer some pointers?
Here is my sample code thus far:

http://www.perturb.org/tmp/tree.txt

I can get one level of depth, but nothing more than that :(

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



Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
On 06/22/2011 03:06 PM, Simon J Welsh wrote:
 On further inspection, that's not the problem at all. The problem's around 
 assign_children($pid,$list,$new);
 
 The previous line you defined $new with $new = $leaf[$pid], *copying* that 
 node into $new. Thus the assign_children() call updates $new, but not 
 $lead[$pid].
 
 You can fix this by either assigning $new by reference ($new = $leaf[$pid]) 
 or by passing a reference to $lead[$pid] to assign_children instead of $new.

I updated the code:

http://www.perturb.org/tmp/tree.txt

I still get the same output though. Only one level of depth :(

-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253

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



Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
On 06/22/2011 03:17 PM, Simon J Welsh wrote:
 You still need to pass the value by reference to assign_children(), so:
 $new = $leaf[$pid];
 assign_children($pid,$list,$new);

Aha... that was it! Thanks!

-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253

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



Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
On 06/22/2011 03:17 PM, Simon J Welsh wrote:
 You still need to pass the value by reference to assign_children(), so:
 $new = $leaf[$pid];
 assign_children($pid,$list,$new);

One last thing I fixed was that PHP was complaining that run-time pass
by reference was deprecated. I changed assign_children to be

function assign_children($id,$list,$leaf)

Which solved that also!

-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253

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



[PHP] PHP intreprets trailing slashes incorrectly?

2011-05-19 Thread Scott Baker
I have a script:

http://www.perturb.org/index.php

I accidentally put a trailing / on the url and it STILL loaded:

http://www.perturb.org/index.php/

Is that a bug in URL interpretation? I've tried it on three servers and
all seem to have the same behavior. All three were Apache on Linux, but
different versions as far back as PHP 5.2.x.

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



Re: [PHP] Overriding session length in existing session?

2011-03-08 Thread Scott Baker
On 03/08/2011 09:46 AM, Marc Guay wrote:
 Hi Scott,
 
 I'm glad you resolved your problem.  I'm curious about your method
 though, as it seems to be an entirely different approach to my own.
 How do you refer to your session data throughout the rest of the site?
  Do you always reference the $_COOKIE variables or do you utilise
 $_SESSION's at some point?

I'll summarize... Everytime I hit a page I open a session with a session
time of 7 days. If the user logs in correctly it stores the user
information in $_SESSION, and then the site sees their login info and
lets them past the login screen. If, at the login screen, they select
public terminal it sets the session cookie length to 0 and regenerates
the cookie to expire on browser close.

Everything after that is pulled from the $_SESSION variable.

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



Re: [PHP] Overriding session length in existing session?

2011-03-07 Thread Scott Baker
On 03/04/2011 11:48 AM, Marc Guay wrote:
 I think that my suggestion is still a valid solution, someone correct
 me if I'm wrong.  Let's say your code went like this:
 
 session_start();

I did a ton of digging and came up with session_regenerate_id()

In my header.php I start the session as normal, and IF the user selects
public terminal I use the call set the session cookie length as 0 and
then regenerate the session cookie.

if ($public_term) {
   session_set_cookie_params(0);
   session_regenerate_id();
}

This way it defaults to a cookie of X days, but if it's a public
terminal it resets the cookie to expire at browser close.

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



Re: [PHP] Overriding session length in existing session?

2011-03-07 Thread Scott Baker
On 03/04/2011 11:48 AM, Marc Guay wrote:
 I think that my suggestion is still a valid solution, someone correct
 me if I'm wrong.  Let's say your code went like this:
 
 session_start();

I did a ton of digging and came up with session_regenerate_id()

In my header.php I start the session as normal, and IF the user selects
public terminal I use the call set the session cookie length as 0 and
then regenerate the session cookie.

if ($public_term) {
   session_set_cookie_params(0);
   session_regenerate_id();
}

This way it defaults to a cookie of X days, but if it's a public
terminal it resets the cookie to expire at browser close.

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



[PHP] Overriding session length in existing session?

2011-03-03 Thread Scott Baker
I have a global header.php file that sets up a bunch of stuff: DB,
global variables, and does session_start(). My header.php looks like this:

#header.php
$cookie_life = (86400 * 7); // Cookies last for seven days
session_set_cookie_params($cookie_life,/,.domain.com,true);
session_start();

This is called globally in *all* my scripts. In another script I'd
really like to set the session to expire after the browser closes if a
uses clicks public terminal or something.

I thought I could just set the session cookie to expire after the
browser closes. Can I override the already started session by doing
something like this in my index.php:

#index.php
include('header.php');
setcookie(session_name(), '', 0 ,/,.domain.com);

When I do this the session expires IMMEDIATELY. I must be missing something?

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



Re: [PHP] Overriding session length in existing session?

2011-03-03 Thread Scott Baker
On 03/03/2011 04:31 PM, tedd wrote:
 At 2:58 PM -0800 3/3/11, Scott Baker wrote:
 I have a global header.php file that sets up a bunch of stuff: DB,
 global variables, and does session_start(). My header.php looks like
 this:

 #header.php
 $cookie_life = (86400 * 7); // Cookies last for seven days
 session_set_cookie_params($cookie_life,/,.domain.com,true);
 session_start();

 This is called globally in *all* my scripts. In another script I'd
 really like to set the session to expire after the browser closes if a
 uses clicks public terminal or something.

 I thought I could just set the session cookie to expire after the
 browser closes. Can I override the already started session by doing
 something like this in my index.php:

 #index.php
 include('header.php');
 setcookie(session_name(), '', 0 ,/,.domain.com);

 When I do this the session expires IMMEDIATELY. I must be missing
 something?
 
 Simple answer -- put session_start() at the start of your code -- first
 line.

Of index.php or header.php? You lost me.

-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253

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



Re: [PHP] PDO working via Apache but not at the command line?

2010-10-18 Thread Scott Baker

On 10/18/2010 02:17 PM, a...@ashleysheridan.co.uk wrote:

It's most likely because both cli and web modules are using different
php.ini config files. See what the output of a phpinfo() call in both
browser and command line.


I didn't even think about it parsing different php.ini files. Checking 
the output of phpinfo() I see it's calling the same php.ini 
(/usr/local/lib/php.ini) though. :(


--
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253

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



[PHP] Re: [PDO] Re: [PHP] PDO working via Apache but not at the command line?

2010-10-18 Thread Scott Baker
On 10/18/2010 06:27 PM, Wez Furlong wrote:
 Things to check:
 
 - Environment: what env vars are set or not set in your Apache vs. CLI
 - Owner: are you running as the same user as your web server?
 - Do you or the web server have some kind of rc file that might impact
 how things run?

Wez you're a genius. When I ran it as the same user as apache it works
fine. That got me thinking that it makes a log in /tmp. Checking the log
it was only writable by the apache user. A little chmod later and now my
script runs perfectly under apache and cli.

Thanks for helping me think outside the box. I spent all day puzzled by
this, you just made my night.

- Scott

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



[PHP] Re: Converting HTML to PDF via PHP

2010-08-05 Thread Scott Teresi
 I am trying to export generated HTML (an invoice for a customer) to a saveable
 PDF that is downloaded.  Any ideas?

I've found a very easy unix command for generating PDF's:

   code.google.com/p/wkhtmltopdf

[The PHP list wouldn't let me send this with http://; in front of the URL.]

It will turn any web page into a PDF and was easy to install and use and has
documentation. (I call it from a PHP script.) It renders the web page using
a WebKit library that's included in the source, and there are lots of
options for how to tweak the rendering engine.

Scott



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



[PHP] How to upload via SFTP with allow_url_open disabled?

2010-07-29 Thread Scott Teresi
I'm attempting to send a file over SFTP in PHP, but all the examples I find
online do something like this:

   $stream = @fopen(ssh2.sftp://xx;, 'w');
   @fwrite($stream, $data_to_send)

This requires allow_url_fopen to be enabled on the server, to get a stream
for the remote file.

I maintain the server but would like to keep allow_url_fopen disabled. If
I do that, how can I send a file over SFTP?

Thanks for any help people can provide!!

Scott Teresi



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



Re: [PHP] Happy New Year All!

2009-12-31 Thread Paul Scott

Bipper Goes! wrote:
 return ThankYou;
 
 
 Oh god I think I blowed it up.

I prefer:

?php
while(date('Y')  2010) ;
exit (' Happy New Year');


-- 
-- Paul

http://www.paulscott.za.net
http://twitter.com/paulscott56
http://avoir.uwc.ac.za
All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal


Re: [PHP] Happy New Year All!

2009-12-31 Thread Paul Scott
--=neXtPaRt_1262280971
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit


Robert Cummings wrote:
 
 Oh dear... that's terribly inefficient... Here's a better stab:

True, but my design criteria included that it needed to fit into a 140
char tweet too...

-- 
-- Paul

http://www.paulscott.za.net
http://twitter.com/paulscott56
http://avoir.uwc.ac.za

--=neXtPaRt_1262280971
Content-Type: text/plain;

All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal


Re: [PHP] Re: Dan Brown

2009-08-03 Thread Paul Scott
Daniel Brown wrote:
 (behind schedule) and distribute refunds to clients.  Having a baby is
 difficult enough; having a baby and a career is more difficult; having
 a baby and working as a freelancer or owner/operator of a company is
 the epitome of masochism --- I'm learning that quite thoroughly
 through experience.
 

Congratulations! Welcome to the club :) We just had a very similar (we
don't have a basement) experience with baby #2, so I feel you!

It gets better, sleep is for sissies anyway :)

-- 
-- Paul

http://www.paulscott.za.net/
http://twitter.com/paulscott56
http://avoir.uwc.ac.za

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



Re: [PHP] PHPBB Speed Issues

2009-07-31 Thread Paul Scott
Ashley Sheridan wrote:
 I've optimised the images in the template, enabled the GZ compression,
 and it's only improved the speed by a mere fraction. I have noticed that
 the page itself doesn't display until after this delay, so I was
 guessing that I could maybe force the buffer to flush at key intervals
 to give the impression the pages are loading faster. Does anybody have
 any insights into this?

To bring things more on topic, why not rather have a discussion about
general scalability?

1. Cache as much as you can (everything)
2. Minimise HTTP requests
3. Use an opcode cache like APC
4. Use a RAM based cache system like memcacheD and give your db a breather
5. FINALLY, throw more hardware at it.

-- 
-- Paul

http://www.paulscott.za.net/
http://twitter.com/paulscott56
http://avoir.uwc.ac.za

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



Re: [PHP] Re: Epiphany - a salute to APC

2009-07-05 Thread Paul Scott
Eddie Drapkin wrote:
 if you want a pure opcode cache, APC is a great choice.
 
 you think this is similar to http://www.danga.com/memcached/ or you think
 this method would be faster ? Which do you say would be the greatest
 benfit ?

A simple rule of thumb that I use is:

If you have one machine and medium to large traffic loads, go APC
If you have more machines for caching servers (dedicated) and large to
holy mofo loads, then go MemcacheD

This ALL assumes that you have followed a logical scalability plan and
have separate DB servers, app servers and possibly even using a CDN or
something beforehand.

-- Paul

http://www.paulscott.za.net/
http://twitter.com/paulscott56
http://avoir.uwc.ac.za

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



Re: [PHP] Writing to a file

2009-07-03 Thread Paul Scott
Jason Carson wrote:
 How would I go about writing stuff to a file but in between the ?php ?
 tags?
 

http://www.php.net/file_put_contents

-- Paul

http://www.paulscott.za.net/
http://twitter.com/paulscott56
http://avoir.uwc.ac.za

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



Re: [PHP] PHP MySQL 500 Internal Error

2009-06-19 Thread Paul Scott
On Thu, 2009-06-18 at 22:10 -0400, Shawn Simmons wrote:
 Wrote a small script to connect to the MySql database.  Tried to run the 
 script (http://localhost/dbscript.php) and I get a 500 Internal Server 
 error.  I have been up and down the web for two days looking for a solution 
 and I am completely frustrated.  I HAVE to be missing something.  PLEASE 
 PLEASE PLEASE help.  Thanks.
 

Check permissions and ownership on the file. That often happens when the
permissions are set to 0777 as opposed to 755 (in *nix speak), so check
that the webserver user has read and execute access on the file and that
it ownds the directory etc


-- Paul
http://www.paulscott.za.net
http://twitter.com/paulscott56
http://avoir.uwc.ac.za
-- 


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



Re: [PHP] User Authentication across multiple server

2009-03-06 Thread Paul Scott
On Fri, 2009-03-06 at 10:09 +0100, Edmund Hertle wrote:

 The only method which possibly could work and came to my mind was using
 somehow $_GET parameter for username and password (encrypted).

Set a cookie and crypt that (RC4 works well) and then check for the
cookie on both sites. Kind of like a Remember me type deal

-- Paul


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



Re: [PHP] Strange charecters

2009-03-03 Thread Paul Scott
On Wed, 2009-03-04 at 10:09 +0530, Chetan Rane wrote:
 I am using ob_start() in my application. However I am getting this error
 about headers already sent.
 

_Any_ output will set that error off. Check for Notices, Warnings,
echo's, prints and var_dumps in your code.

-- Paul


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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Paul Scott

On Tue, 2009-02-17 at 10:30 +, Richard Heyes wrote:
  The *other* white meat?
 
 Sorry, no idea what that means.
 

Cats are the other white meat. Sorry have flu, may be delirious

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Paul Scott

On Tue, 2009-02-17 at 10:19 +, Richard Heyes wrote:
 There's no reason not to use it - it works for a good many people. And
 a few cats too.

The *other* white meat?

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

RE: [PHP] Visibility of class constant

2009-02-03 Thread Chris Scott
 -Original Message-
 From: leledumbo [mailto:leledumbo_c...@yahoo.co.id] 
 Sent: 03 February 2009 05:03
 To: php-general@lists.php.net
 Subject: [PHP] Visibility of class constant


 I got a weird behaviour of class constant. Suppose I have
Index_Controller
 and Another_Controller classes, both extending Controller class. I
define
 some constants (let's assume I only have one, call it MY_CONST) in
 Controller class to be used by its descendants. In Index_Controller, I
can
 freely use MY_CONST without parent:: needed. However, this isn't the
case
 with Another_Controller. Without parent:: I got notice Use of
undefined
 constant MY_CONST - assumed 'MY_CONST'. How could this happen and
what's the
 correct behaviour? It's actually nicer to have it without parent::,
assuming
 that constants have protected visibility specifier (which isn't
possible
 AFAIK :-( ).

You cannot access a class constant just by the constant name. See
http://docs.php.net/manual/en/language.oop5.paamayim-nekudotayim.php.

you need to use self::MY_CONST, I guess; your code might make it
clearer.

e.g.

class Controller
{
const CONSTANT = 'foobr /';
}

class Index_Controller extends Controller
{
public function __construct()
{
echo CONSTANT; echo 'br/';  // gives warning
echo self::CONSTANT;  // foo
echo parent::CONSTANT;// foo
}
}

class Another_Controller extends Controller
{
const CONSTANT = 'barbr /';

public function __construct()
{
echo self::CONSTANT;  // bar
echo parent::CONSTANT;// foo
}
}



new Index_Controller would give you the warning you described for
CONSTANT and return 'foo' for self::CONSTANT and parent::CONSTANT as
CONSTANT was inherited. In Another_Controller CONSTANT is overridden so
self::CONSTANT would be 'bar' and parent::CONSTANT would be 'foo'.

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



RE: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Chris Scott

 Hi Folks,
 
 Newbie question
 
 I have a mysql table with 100 fields, currently all do not allow nulls.
 Rather than hand typing in phpMyAdmin, I would like a way to loop through
 all fields and update them to allow nulls
 
 My Beginning attempt needs help...
 
 
 $i = 1;
 while ($i = 100):
 
 // how do I word this to just change whatever field we are on to allow
 nulls?
 
 $sql = 'ALTER TABLE `mytable` ?*update*? `'.$???WhatEverField??[$i].'`
 ?ALLOWNULL?;';
 
 //mysql_query($sql);
 
 $result = mysql_query($sql) or die(br /br / Could not renumber dB $sql
 br /br / . mysql_error());
 
 
 $i++;
 endwhile;
 
 
 Thanks in advance

Hi,

The MySQL syntax to alter a column is:

ALTER TABLE `table` MODIFY `column` BIGINT NOT NULL;

[ http://dev.mysql.com/doc/refman/5.1/en/alter-table.html ]

The sql statement

SHOW COLUMNSFROM `table`;

[ http://dev.mysql.com/doc/refman/5.1/en/show-columns.html ]

will give you a list of all the fields with there type, default values, null 
etc...
You can then use this in the loop to find all the fields where null=NO.

Warning from the manual:

When you change a data type using CHANGE or MODIFY, MySQL tries to 
convert existing column values to the new type as well as possible. 

Warning
This conversion may result in alteration of data. For example, if you 
 shorten a 
string column, values may be truncated. To prevent the operation from 
succeeding if conversions to the new data type would result in loss of 
 data, enable 
strict SQL mode before using ALTER TABLE (see Section 5.1.6, “SQL Modes”). 

I don't think this will affect you but bare it in mind.

Regards

Ian
-- 


You can also retrieve the field types with:

SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 
'whatever';

Which might help the programmatic approach.


[PHP] ANN: Chisimba-2.1.0 release!

2009-01-16 Thread Paul Scott

The next release of the Chisimba PHP5 framework is now available
(Chisimba-2.1.0).

Major enhancements included in this release are:

 - Numerous enhancements to the database abstraction layer for increased
performance
 - Numerous core bugfixes and enhancements
 - Patch descriptions added in module catalogue
 - Layout and skin enhancements
 - Increased security and RC4 encryption of session data
 - Complete authentication system overhaul
 - Remember me functionality added
 - URL rewriting
 - Remote popularity contest module
 - Additional filters for rich content
 - Some installer fixes
 
and, of course, new modules to add onto your installation!

Please take a look, download it and give it a test drive! 
 
Chisimba, for those that don't know it already, is a PHP5 framework made
in Africa, for Africa. It is a collaboration between around 16 African
Universities, as well as around 35 active developers from around the
continent.
 
It can be downloaded from AVOIR at:
 
http://avoir.uwc.ac.za/

and the documentation can be found at:
 
http://avoir.uwc.ac.za/index.php?module=newsaction=viewcategoryid=gen14Srv6Nme27_7167_1219410313

There are server setup instructions, as well as installation
walkthroughs available linking from the main AVOIR site:
 
http://avoir.uwc.ac.za/index.php?module=newsaction=viewcategoryid=gen14Srv6Nme27_2077_1219410069
 
For those interested in developing a module, or just getting some
additional info please take a look at:
 
http://avoir.uwc.ac.za/index.php?module=newsaction=viewcategoryid=gen14Srv6Nme27_6705_1226737050

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] First steps towards unix and php

2009-01-09 Thread Paul Scott

On Fri, 2009-01-09 at 07:50 -0500, Daniel Brown wrote:
 I'd take SMART or urpmi over yum as well, for the record.

First choice is ./configure  make  make install, second choice is
apt

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] First steps towards unix and php

2009-01-09 Thread Paul Scott

On Fri, 2009-01-09 at 14:53 +0200, Paul Scott wrote:
 First choice is ./configure  make  make install, second choice is
 apt
 

Even better, of course, is the:

Yo sysadmin intern! Install package for me please and don't screw it
up

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] on Mapserver and php5_MapScript

2009-01-09 Thread Paul Scott

On Fri, 2009-01-09 at 14:15 -0500, Eduardo Arévalo wrote:
 As I write this line is highlighted in black php5_MapScript
 

You should probably ask this on the UMN Mapserver lists at
mapserver-us...@lists.osgeo.org but...
 ;
  $jStyle-outlinecolor-setRGB(200, 200, 200);

You are setting an outline colour, but the style you are using does not
allow it to be displayed. Basically all you are getting is the outline
and not the fill.

I suggest you read the excellent mapfile docs or ask on another list.

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Re: hello

2009-01-09 Thread Paul Scott

On Fri, 2009-01-09 at 18:15 -0500, Phpster wrote:
 -12C in Toronto
 

Meh! 30C - 35C in Cape Town, South Africa almost every day for the last
month. It has been a scorcher this year!

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Holocoste against palestinians

2009-01-07 Thread Paul Scott

On Wed, 2009-01-07 at 22:51 -0800, It flance wrote:
 The message is to webhosting companies,
 

This is not a web hosting company.

 Israel is killing palestinian children. Some sites are are showing the fotos 
 of israel's holocoste against palestinians. 
 Now here is a link that shows to israelis how to fight that too:
 http://www.jpost.com/servlet/Satellite?cid=1231167272840pagename=JPost%2FJPArticle%2FShowFull
 
 Please be aware of that.

What exactly does this inane crap have to do with PHP? I see that there
is an asshole like you on almost every list that I subscribe to (many)
and I am tired of politics creeping into FREE software. I think that
part of MY FREEDOM that you are infringing on is my FREEDOM from
politics. If I was interested in this crap, I would subscribe to an
APPROPRIATE list.

Thank YOU and good luck. 

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] permission failure with fopen

2008-11-07 Thread Paul Scott

On Fri, 2008-11-07 at 14:27 +0200, Thodoris wrote:
 
  I'm testing on Windows XP SP2 with PHP 5.2.0
 

As far as I remember, you need to pass the b parameter to Windows as
well on fopen(), so you would do an fopen(/path/to/file,wb);

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

RE: [PHP] web shot script

2008-10-23 Thread Paul Scott

On Thu, 2008-10-23 at 22:20 -0400, Joey wrote:

 Really I want to do this, not pay someone to do it via those services you
 linked to.
 So nobody has seen open source code for this?

I run a free (freedom and beer) webservice to do this via the Chisimba
framework (http://avoir.uwc.ac.za) The docs and files are all in svn so
if you would like em, get em! The screenshot code is in python though.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] PHP Dev Facts

2008-10-17 Thread Paul Scott

On Fri, 2008-10-17 at 00:14 +0100, Nathan Rixham wrote:
 Evening All,
 
 I'd be /really/ interested to know who uses what!
 
 *Procedural or OOP?*
 

OOP

 *Dev OS*
 

Ubuntu 8.04

 *Dev PHP Version*
 

PHP-5.2.3

 *Live Server OS*
 

Debian

 *Live Server PHP Version*
 

PHP-5.2.3

 *Which HTTP Server Software (+version)?*
 

Apache 2

 *IDE / Dev Environment*
 

Zend Studio / Vim / nano

 *Preferred Framework(s)?*
 

Chisimba

 *Do you Unit Test?*
 

Yes - PHPUnit3

 *Most Used Internal PHP Class*
 

SPL classes

 *Preferred OS CMS*
 

Chisimba CMS

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

[PHP] ANN: Chisimba-2.0.3 Released!

2008-09-04 Thread Paul Scott

The next release of the Chisimba PHP5 framework is now available.

Major enhancements included in this release are:

 - PDO and MDB2 support
 - Improved database performance
 - Bug fixes
 - Better code documentation
 - API integration for many more modules
 - Remote downloads of modules (apt like module installations)

and, of course, new modules to add onto your installation!

Please take a look, download it and give it a test drive! 
 
Chisimba, for those that don't know it already, is a PHP5 framework made
in Africa, for Africa. It is a collaboration between around 16 African
Universities, as well as around 35 active developers from around the
continent.
 
It can be downloaded from AVOIR at:
 
http://trac.uwc.ac.za/trac/chisimba/downloader/download/release/5

and the docs can be found at:
 
http://avoir.uwc.ac.za/

There are server setup instructions, as well as installation
walkthroughs available linking from the main AVOIR site:
 
For those interested in developing a module, or just getting some
additional info please join our mailing list and ask some questions:
 
http://mailman.uwc.ac.za/mailman/listinfo/nextgen-online

--Paul

-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

FW: [PHP] getting info from video formats

2008-07-28 Thread Chris Scott
I agree.

I use MPlayer to process videos. One script gets the video length like this.

//use mplayer to pull some info from the video
$info = exec(\$mplayer\ $videoPath/$videoName -identify -nosound -frames 0  
$tmpInfoFile);
//and open the file it stores the data in
$infoFile = fopen($tmpInfoFile, rb);
//then parse for the video length
while(! feof($infoFile) )
{
$lineBuffer = fgets($infoFile);
if(preg_match(/ID_LENGTH=/, $lineBuffer))
{
$videoLength = (int) preg_replace(/ID_LENGTH=/, , 
$lineBuffer);
}
}

 -Original Message-
 From: mike [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 28, 2008 1:12 PM
 To: Rene Veerman
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] getting info from video formats
 
 On 7/28/08, Rene Veerman [EMAIL PROTECTED] wrote:
 
  ImageMagick's identify command supposedly reads AVI and MPEG, but i can't
  get it to work on my avi's:
 
 i wouldn't rely on it; i'd rely on it for Images :)
 
  C:\Users\rene\Documents\Downloadsidentify
  Stargate.Atlantis.S05E02.HDTV.XviD-0TV.avi
  identify: Not enough pixel data
  `Stargate.Atlantis.S05E02.HDTV.XviD-0TV.avi'.
 
 you naughty pirater :P
 
  So if ImageMagick isn't the tool to use for video files, i wonder if there
  is any other tool that i can use to determine the size of video files.
 
  I'd like to be able to read as many of the major video formats (AVI, XVID,
  DIVX, QT, etc) as possible.
 
 ffmpeg is probably the best bet. i believe it has an option to get
 video info and not try to process it.
 
 also look at the mencoder/mplayer suite of tools.
 
 maybe even transcode.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



FW: FW: [PHP] getting info from video formats

2008-07-28 Thread Chris Scott


 -Original Message-
 From: mike [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 28, 2008 2:17 PM
 To: Chris Scott
 Cc: php-general@lists.php.net
 Subject: Re: FW: [PHP] getting info from video formats
 
 On 7/28/08, Chris Scott [EMAIL PROTECTED] wrote:
  I agree.
 
  I use MPlayer to process videos. One script gets the video length like this.
 
  //use mplayer to pull some info from the video
  $info = exec(\$mplayer\ $videoPath/$videoName -identify -nosound -frames   0
  $tmpInfoFile);
  //and open the file it stores the data in
  $infoFile = fopen($tmpInfoFile, rb);
  //then parse for the video length
  while(! feof($infoFile) )
  {
 $lineBuffer = fgets($infoFile);
 if(preg_match(/ID_LENGTH=/, $lineBuffer))
 {
 $videoLength = (int) preg_replace(/ID_LENGTH=/, , 
  $lineBuffer);
 }
  }
 
 you could probably skip piping it to a tempfile - and just use popen()
 to open the process...


Yeah thanks.

I didn't like the way I was doing it!


Re: [PHP] Re: very very small CMS

2008-07-19 Thread Paul Scott
On Sat, 2008-07-19 at 10:18 -0400, tedd wrote:
 At 12:48 PM +0200 7/19/08, Frank Arensmeier wrote:
 19 jul 2008 kl. 05.05 skrev Robert Cummings:
 Here's a CMS I've been working on.
 
 http://www.webbytedd.com/a/easy-page-db
 
 The idea is to allow the user edit pages in situ.
 

Tedd,

Looks pretty good, but why not use in place editing with a little bit of
AJAX rather than making the user click twice?

I would rather turn editing on, then click to edit in place.

--Paul


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



[PHP] FW: [SPAM] [PHP] No Database Connection possible (mySQL)

2008-07-04 Thread Chris Scott
 -Original Message-
 From: Aviation Coding [mailto:[EMAIL PROTECTED]
 Sent: Friday, July 04, 2008 10:15 AM
 To: php-general@lists.php.net
 Subject: [SPAM] [PHP] No Database Connection possible (mySQL)
 Importance: Low
 
 Hi all,
 
 I am having problems with a connection to a mysql database.
 
 I am using
 
 
 function con()
 {
 mysql_connect(localhost,user,pass) or die(mysql_error());
 mysql_select_db(tava) or die(mysql_error());
 }
 
 
 Now, when I call the _function_ (!)
 
 con() or die(no con);
 
 I get the no con output.
 
 When I call the mysql_connect and mysql_select directly before
executing a
 query, I get some DB output. But that won't work when I am using the
 function...
 
 Any ideas would be greatly appreciated.
 
 Cheers!
 
 Chris

It's a bit of a long shot but are you using variables in the function
which might be out of scope?

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



[PHP] FW: [SPAM] Re: [PHP] how to create a slide show using PHP5

2008-07-03 Thread Chris Scott


 -Original Message-
 From: philip [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 02, 2008 10:03 PM
 To: Bastien Koert
 Cc: php-general@lists.php.net
 Subject: [SPAM] Re: [PHP] how to create a slide show using PHP5
 Importance: Low
 
 Bastien Koert wrote:
 
 
  On Wed, Jul 2, 2008 at 4:37 PM, philip [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Hi everyone,
 
  I want to create a slide show of photos for my web site. How is
  this done using php5? I am using Opensuse 10.3, Apache, PHP5.
 
  TIA for any assistance,
 
  Philip
 
  --
  Philip Ramsey
  learning PHP and MySQL for building a better world
  philipramsey.is-a-geek.net http://philipramsey.is-a-geek.net
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  2 parts to this
 
  1. pull a series on [random] images from the system to show the user
  2. client side javascript code to load the images in a slide show
fashion
 
  You may want to get an existing one and pull it apart to see how
  they've done it
 
  --
 
  Bastien
 
  Cat, the other other white meat
 Hi Bastien,
 
 Thank you for your quick response. Where may I find sample? I tried
 searching the web but only found samples and tutorials that required
 flash for the actual slide show. Since I run Linux and
Adobe/Macromedia
 do not make a flash editor for Linux, flash is not an option.
 
 TIA,
 
 Philip
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Flash is still an option if you use Ming:
http://uk.php.net/manual/en/book.ming.php



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



[PHP] FW: [SPAM] [PHP] FIFO files on PHP?

2008-07-02 Thread Chris Scott
 -Original Message-
 From: Waynn Lue [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 01, 2008 11:06 PM
 To: php-general@lists.php.net
 Subject: [SPAM] [PHP] FIFO files on PHP?
 Importance: Low
 
 I'm trying to build a queue out using FIFO files (someone on the MySQL
 list suggested checking them out instead of using the database), but
 I'm running into a problem because of the synchronous fwrite call.
 Here's the code:
 
   $fifoFile = '/tmp/fifo';
   if (!file_exists($fifoFile)) {
 posix_mkfifo($fifoFile, 0600);
   }
   $fp = fopen($fifoFile, w);
   fwrite($fp, content);
   fclose($fp);
 
 But this will block until something actually reads the pipe.  Is there
 any way to write to the pipe, then go away as opposed to waiting until
 something consumes it?  Otherwise, I may just go back to a database
 table.
 
 Thanks,
 Waynn
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Fifo nodes are equivalent to a pipe (|) and have no size on the file
system and therefore the write won't finish until some process reads
from the node. See the man page http://linux.die.net/man/7/fifo .


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



[PHP] FW: [SPAM] Re: [PHP] Inspiration for a Tombstone.

2008-06-27 Thread Chris Scott
410

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



FW: [PHP] fwrite() Append Files

2008-06-27 Thread Chris Scott
Please post the code, I'm not clear on the problem.

-Original Message-
From: Wei, Alice J. [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 27, 2008 12:02 PM
To: php-general@lists.php.net
Subject: [PHP] fwrite() Append Files

Hi,

  I wonder if anyone on the list could tell me how to append the files
as I am writing in them. I have a file that has no more than five
characters per line, and I would like to keep its spacing between the
lines. Right now I have the set up so that it could write in the first
line, but the problem is that all the lines after it never get written
in to the desired file.

  Is there some sort of command that I could use to append files as I am
writing them? I would provide the code if this is not clear enough.

Thanks in advance.

 Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]




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



[PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files

2008-06-27 Thread Chris Scott
I don't think you can open files for writing over http, you get an error:

failed to open stream: HTTP wrapper does not support writeable connections.

-Original Message-
From: Per Jessen [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 27, 2008 2:39 PM
To: php-general@lists.php.net
Subject: [SPAM] RE: [PHP] fwrite() Append Files
Importance: Low

Wei, Alice J. wrote:

 
 Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')?
 

I think fopen($ourFileName, 'a') will do what you want.  


/Per Jessen, Zürich


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



[PHP] FW: [SPAM] RE: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files

2008-06-27 Thread Chris Scott

 -Original Message-
 From: Chris Scott [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 27, 2008 8:48 AM
 To: php-general@lists.php.net
 Subject: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files
 Importance: Low
 
 I don't think you can open files for writing over http, you get an
 error:
 
 failed to open stream: HTTP wrapper does not support writeable
 connections.
 
 -Original Message-
 From: Per Jessen [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 27, 2008 2:39 PM
 To: php-general@lists.php.net
 Subject: [SPAM] RE: [PHP] fwrite() Append Files
 Importance: Low
 
 Wei, Alice J. wrote:
 
 
  Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')?
 
 
 I think fopen($ourFileName, 'a') will do what you want.

From Alice's code:

  $ourFileName = hello.txt;

   $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file);

So... she is not, in fact, trying to write a file over HTTP. She is reading a 
file via HTTP and writing something pertaining to it on the local file system.

Also, please refrain from top-posting. It makes the posts get very confusing. 
:(


Todd Boyd
Web Programmer


Sorry about the top posting, just habit. I'll stop doing it.

From Alice's code:

   $newFileName=http://www.yoursite.com/hello.txt;;
   echo $newFileName;
   $result=rename($ourFileName, $newFileName);
   $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file);

// Loop through our array, show HTML source as HTML source; and line numbers 
too.

  foreach ($lines as $line_num = $line) {

  echo pLine #b{$line_num}/b :  . htmlspecialchars($line) . /p;
  $ourFileHandle = fopen($newFileName, 'wb') or die(can't open file);
  $content=fwrite($ourFileHandle, htmlspecialchars($line));
..


The fwrite is $ourFileHandle which on the previous line is set to $newFileName 
which is http://www.yoursite.com/hello.txt.

I might have missed the point (I regularly do) but it looks like http to me.



RE: [PHP] escape character in query string

2008-06-23 Thread Chris Scott
%20

-Original Message-
From: joaquinbordado [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 23, 2008 3:35 AM
To: php-general@lists.php.net
Subject: [SPAM] [PHP] escape character in query string
Importance: Low


would someone happen to know the escape character for query string?

here is my querysting my.php?message=Hello%PHP%0AHow%was%your%day?


the output should be 

Hello PHP
  How was your day?

-- 
View this message in context:
http://www.nabble.com/escape-character-in-query-string-tp18061596p180615
96.html
Sent from the PHP - General mailing list archive at Nabble.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



[PHP] RE: [SPAM] [PHP] format mobile number

2008-06-20 Thread Chris Scott
Something like:

$mobileNumber = 078;
$lastTen = substr($mobileNumber, strlen($mobileNumber) - 10);
$formatedNumber = 0 . $lastTen;

-Original Message-
From: joaquinbordado [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 20, 2008 12:15 PM
To: php-general@lists.php.net
Subject: [SPAM] [PHP] format mobile number
Importance: Low


my input  mobile is 9051231223what i want to do is get the last 10
digit
of mobile number and append 0 at the beginning. can someone help me with
that..
-- 
View this message in context:
http://www.nabble.com/format-mobile-number-tp18027538p18027538.html
Sent from the PHP - General mailing list archive at Nabble.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] RE: [SPAM] [PHP] format mobile number

2008-06-20 Thread Chris Scott
Sorry that should have been a quoted string:

$mobileNumber = 078;

For the strlen and substr.


-Original Message-
From: Chris Scott [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 20, 2008 1:15 PM
To: php-general@lists.php.net
Subject: [PHP] RE: [SPAM] [PHP] format mobile number
Importance: Low

Something like:

$mobileNumber = 078;
$lastTen = substr($mobileNumber, strlen($mobileNumber) - 10);
$formatedNumber = 0 . $lastTen;

-Original Message-
From: joaquinbordado [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 20, 2008 12:15 PM
To: php-general@lists.php.net
Subject: [SPAM] [PHP] format mobile number
Importance: Low


my input  mobile is 9051231223what i want to do is get the last 10
digit
of mobile number and append 0 at the beginning. can someone help me with
that..
-- 
View this message in context:
http://www.nabble.com/format-mobile-number-tp18027538p18027538.html
Sent from the PHP - General mailing list archive at Nabble.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


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



Re: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-19 Thread Chris Scott
You could just use an apache (or other web server) alias:

 

www.test.com/article - www.test.com/article.php

 

where article.php uses:

 

?php

$uri_vars = explode('/', $_SERVER['PATH_INFO']); foreach ($uri_vars as
$var)

if ($var != )

echo $var . br;

?



[PHP] Re: SPAM SPAM Re: [PHP] Capture homepage screenshot

2008-06-13 Thread Paul Scott


On Fri, 2008-06-13 at 14:45 -0400, Daniel Brown wrote:
 There are several commercial options available, but I may put
 together a script this afternoon capable of generating thumbnails from
 websites.  If I do, I'll keep you informed.
 

In my project, we do this through a small Python application. The cool
thing for you, is that the functionality is exposed through an XML-RPC
service as well...

You are free to use it, as long as you don't abuse it of course (we have
limited bandwidth in Africa).

The other option is to read the docs as to how its done and copy it
(it's all GPL anyway).

To see it in action, take a look at:
http://avoir.uwc.ac.za/index.php?module=cmsaction=showfulltextsectionid=init_1id=gen14Srv2Nme49_8062_1213073978

In my framework, we simply call it through a filter, so to get a
screnshot of the PHP site, I would simply add in:

[SCREENSHOT]http://www.php.net/[/SCREENSHOT] in any place that I can add
content (blog, wiki, cms etc).

Lastly, but not least at all, you could also just use our framework...
Download from http://avoir.uwc.ac.za/

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

[PHP] Re: SPAM SPAM [PHP] Build and Deployment Process

2008-06-10 Thread Paul Scott

On Tue, 2008-06-10 at 14:56 -0700, VamVan wrote:
 What is the best method to build and deploy php scripts along the different
 environments? You can talk about rpm's and stuff

In my project(s) I use Phing. http://phing.info It is even written in
PHP, so keeping this thread on topic.

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

RE: [PHP] Re: APC + PHP Problem (apc_fcntl_lock failed: Bad file descriptor)

2008-06-04 Thread Scott McNaught [Synergy 8]
Thanks for your reply.  I will try upgrading it. 

If anyone else has experienced this problem, please let me know.

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Colin Guthrie
Sent: Monday, June 02, 2008 10:50 PM
To: php-general@lists.php.net
Subject: [PHP] Re: APC + PHP Problem (apc_fcntl_lock failed: Bad file 
descriptor)

Scott McNaught [Synergy 8] wrote:
 Hello,
 
 I am running a production server with APC and php. We recently had a crash
 where APC bombed out. When it does this, the server serves empty, white
 pages.
 
 Here is what the error_log says.

 I have not yet found a resolution for this.  There are no calls made to
 apc_store() on the server. It is solely script caching.  

 I am running PHP 5.2.5, and APC 3.0.15. This is the PHP info for APC.

I've recently deployed a similar setup, again only for script caching. 
It's working great for me with PHP 5.2.6 and APC 3.0.19. I'd suggest 
upgrading and seeing if that fixes it (esp the APC bit for obvious 
reasons - should also be pretty painless to upgrade only that part)

I only have a fairly low cache enabled and it does fill up and expunge 
data after a time out, so if I was affected by this I'd have expected to 
have seen it rear it's ugly head by now.

Col


-- 
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] Avoid object twice

2008-06-02 Thread Scott McNaught [Synergy 8]
Try removing from a.php the lines:

$obj=new my(Hello);
$obj-buff();

I think this will achieve what you want.

-Original Message-
From: Yui Hiroaki [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 02, 2008 11:01 PM
To: php-general@lists.php.net
Subject: [PHP] Avoid object twice

Please take a look at code.

a.php

$obj=new my(Hello);
$obj-buff();


Class my{

private $word;
function __construct($getword){
   $this-word=$getword;
}
public function buff(){
 echo $this-word.br /;
}
--


-b.php---

function __autoload($class_name) {
include_once $class_name . '.php';
}


$objref=new my(Good);
$objref-buff();




I get an Echo;

Good
Hello
Hello

I do not need to get Hello twice.

When I b.php , $obj=new my(Hello) is loaded.


Do you have any adia to avoid load $obj in a.php twice?

Regards,
Yui

-- 
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



[PHP] APC + PHP Problem (apc_fcntl_lock failed: Bad file descriptor)

2008-06-01 Thread Scott McNaught [Synergy 8]
Hello,

I am running a production server with APC and php. We recently had a crash
where APC bombed out. When it does this, the server serves empty, white
pages.

Here is what the error_log says.

[Mon Jun  2 11:20:36 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun 02 11:20:37 2008] [notice] child pid 6104 exit signal Segmentation
fault (11)
[Mon Jun  2 11:20:40 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:40 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:41 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:41 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:41 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:42 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:43 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:45 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:45 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
...
And so it goes on until apache was restarted.



I have not yet found a resolution for this.  There are no calls made to
apc_store() on the server. It is solely script caching.  

I have seen bug reports on this:
http://pecl.php.net/bugs/bug.php?id=4769 
http://pecl.php.net/bugs/bug.php?id=9745 

After looking at these, I think what is happening is the cache is filling
up, and when it expunge()s it gets in a loop, php kills the process after
the 30sec timeout, and the lock is left. Then no more subsequent requests
can be served.

Has anyone else experienced this, and does anyone know of a fix for this?


I am running PHP 5.2.5, and APC 3.0.15. This is the PHP info for APC.

APC Support  enabled  
Version  3.0.15  
MMAP Support  Enabled  
MMAP File Mask  no value  
Locking type  File Locks  
Revision  $Revision: 3.151 $  
Build Date  Oct 29 2007 19:02:05  

Directive Local Value Master Value 
apc.cache_by_default On On 
apc.enable_cli Off Off 
apc.enabled On On 
apc.file_update_protection 2 2 
apc.filters no value no value 
apc.gc_ttl 3600 3600 
apc.include_once_override Off Off 
apc.localcache Off Off 
apc.localcache.size 512 512 
apc.max_file_size 1M 1M 
apc.mmap_file_mask no value no value 
apc.num_files_hint 1000 1000 
apc.report_autofilter Off Off 
apc.rfc1867 Off Off 
apc.rfc1867_freq 0 0 
apc.rfc1867_name APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS 
apc.rfc1867_prefix upload_ upload_ 
apc.shm_segments 1 1 
apc.shm_size 30 30 
apc.slam_defense 0 0 
apc.stat On On 
apc.stat_ctime Off Off 
apc.ttl 0 0 
apc.user_entries_hint 4096 4096 
apc.user_ttl 0 0 
apc.write_lock On On


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



Re: [PHP] the Y2K38 BUG

2008-05-07 Thread Paul Scott

On Wed, 2008-05-07 at 00:54 -0600, Nathan Nobbe wrote:

 looks like mine only goes to dec. 31,  =/
 

*Gasp!* best you get cracking on finding an alternative solution!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] AI file and mapping with PHP

2008-05-07 Thread Paul Scott

On Wed, 2008-05-07 at 12:17 +0200, Angelo Zanetti wrote:
 We have a project where by we have a map in ai format (vector format). What
 we want to do is to programmatically come up with a solution that say on the
 map there is a restaurant at a certain location, that we can zoom into the
 map on that specific area.
 

Angelo,

You will need a specialised solution for this, like UMN Mapserver with
PHP/Mapscript. If you need some real, local, help, mail me off list, and
I will see about you guys paying me to do this for you (at SA prices) ;)

Seriously though, you won't get what you want with GD...

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

[PHP] $_SESSION v. Cookies

2008-05-07 Thread Scott Campbell
Dear PHP List,

PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing  deving with
FireFox and Konqueror (Linux).

I am building a site with multiple tools and want to pass variables
throughout them all.  Before, I was passing variables using hidden HTML
Form tags, but the site has grown too large for this tactic, so I went to
using $_SESSION.  However, when I started using $_SESSION, my site loads 3-5
times slower then before.  A page that queried MySQL and built itself in 3-5
seconds was now taking 15-20.  While more has changed then just $_SESSION,
it is really the only significant difference.

Is $_SESSION slowing down my site?  Is there a faster alternative to
global variables then using $_SESSION?  Are using regular cookies faster?

Any help is appreciated.

Thanks,
  Scott

-- 
Scott Campbell
If you do what you've always done, you'll get what you've always gotten.

Courage is resistance to fear .. not absence of fear.


Re: [PHP] strange behavior, when converting float to int

2008-05-06 Thread Paul Scott

On Tue, 2008-05-06 at 09:34 -0500, Philip Thompson wrote:

 I got the same results. I'm not exactly sure what's happening, but
 I'd  
 be curious to see if there's anyone else who can shed some light.
 
 PHP Version 5.2.4.

Is this not coming from the underlying C libs that directly use the FP
on the CPU? 

I would say that the compile flags, CPU settings etc would probably have
an impact on accuracy.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

[PHP] Incorrect version shown in phpinfo() and phpversion() in 5.2.6

2008-05-06 Thread Scott Lerman
Has anyone else seen incorrect information on a phpinfo() page on the
Windows build of 5.2.6? The Apache log shows Apache/2.0.63 (Win32)
PHP/5.2.6 configured -- resuming normal operations, but phpinfo() and
phpversion() still show 5.2.5. The CLI executable does show the
correct version, though.

-- 
Scott Lerman

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



Re: [PHP] Incorrect version shown in phpinfo() and phpversion() in 5.2.6

2008-05-06 Thread Scott Lerman
Yup, I restarted Apache several times. The httpd.conf line I have is
LoadModule php5_module C:/Program
Files/PHP/php-5.2.6-Win32/php5apache2.dll. If nobody else has seen
this problem, I'll just assume it's some oddity on my system. I just
figured I'd mention it in case others were having the same problem.

On Tue, May 6, 2008 at 12:49 PM, Daniel Brown [EMAIL PROTECTED] wrote:

 On Tue, May 6, 2008 at 11:57 AM, Scott Lerman [EMAIL PROTECTED] wrote:
   Has anyone else seen incorrect information on a phpinfo() page on the
Windows build of 5.2.6? The Apache log shows Apache/2.0.63 (Win32)
PHP/5.2.6 configured -- resuming normal operations, but phpinfo() and
phpversion() still show 5.2.5. The CLI executable does show the
correct version, though.

 Did you remember to restart Apache?  I know the message you
  printed above from the log would indicate such, but it never hurts to
  double-check.

 Also, are you certain that it's using the correct DLL by
  configuration in both httpd.conf and any .htaccess files?

  --
  /Daniel P. Brown
  Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
  $59.99/mo. with no contract!
  Dedicated servers, VPS, and hosting from $2.50/mo.




-- 
Scott Lerman

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



Re: [PHP] the Y2K38 BUG

2008-05-06 Thread Paul Scott

On Wed, 2008-05-07 at 10:03 +0530, Chetan Rane wrote:
 Have guys heard of the the Y2K38 Bug more details are on this link
 

Nope, but I can guess what its about.

 Can there be a possible solution. As the system which I am developing
 for my client uses Unix timestamp.
 

There are probably multiple solutions. AFAIK time is a 32 bit signed
int, making it unsigned would add like 100 years onto your app.

 This might effect my application in the future
 

If your app survives that long! Why not just maintain it and when times
change, your app changes? :)

Seriously, this is really not a big deal!
  
 
 Thank you, in Advance.

It's a pleasure my paranoid son...

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] the Y2K38 BUG

2008-05-06 Thread Paul Scott

On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
 true-that ;)
 anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
 value.  so if you use it you should be good to go.
 
 php  echo date_create('2040-10-24')-format('M-d-Y');
 Oct-24-2040
 

a 64bit unsigned int is best, but that would only work properly on 64bit
arch. For 32bit users, making it unsigned is the best option for now,
and I suppose that by 2038 there will be another option. 

As far as I am concerned, this discussion is a discussion for the sake
of discussion. If I am still using the same apps that I use today in
2038, I will officially rethink my usefulness as a human being :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

RE: [PHP] Phpstop.com project - wanna be a writer?

2008-05-05 Thread Paul Scott

On Mon, 2008-05-05 at 15:12 +0200, Chris Haensel wrote:
 Maybe I can have you as a writer? ;o) And maybe 2 or 3 more of this list
 The big names, ya know *g*

Oh well, my name is only 4 letters so I guess I am out? ;)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Web page excerpt editor

2008-05-04 Thread Paul Scott

On Sun, 2008-05-04 at 10:12 -0500, Mike Potter wrote:

 Does anyone have any experience with something else? Alternately, has
 anyone written something they'd be willing to share under GPL?

FCKEditor, TinyMCE and a host of others. All JS based, so not really
relevant on a PHP list though

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] php framework vs just php?

2008-04-22 Thread Paul Scott

On Tue, 2008-04-22 at 13:34 +0100, Richard Heyes wrote:
 Absolutely. Personally I use a lot of disparate libraries, a lot of them 
 from PEAR. Doing this I've never found the need or the inclination to 
 use a framework.
 

But that is kind of a framework!

You get two kinds of framework in PHP IMHO - the Glue frameworks (like
Chisimba, CakePHP etc) and the component frameworks (like PEAR, Zend
Framework etc).

What you are describing is simply a component framework. Just because
you choose not to call it a framework, does not mean that it is not a
framework.

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

[PHP] mime_content_type and FileInfo

2008-04-21 Thread Paul Scott

I am in a bit of a pickle, or is that PECL?

I need to use either mime_content_type or FileInfo to get the mime type
of a file that is dumped into the system via email.

Now that is the easy part, where the hard part comes in is that a
commercial host that I use will do neither reason being that
mime_content_type is deprecated, and that FileInfo is unstable in PECL
only :/

Anyone got a workaround on this? I *really* don't feel like writing a
zillion lines of code to get arbitrary mimetypes out that will only be
used a little while and to replace 1 and 2  lines of code respectively.

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] April Fools Easter Egg

2008-04-01 Thread Paul Scott

On Tue, 2008-04-01 at 10:28 -0400, tedd wrote:
 You got me.
 

Wobbly PHP logo on mine (PHP-5.2.5 debian)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] new lines in textareas?

2008-03-30 Thread Paul Scott

On Sun, 2008-03-30 at 12:29 -0400, tedd wrote:
 At 9:26 PM -0700 3/29/08, Mary Anderson wrote:
 Hi all,
 I have a php script which produces text which is to be displayed 
 in a textarea.  I have the wrap for the text area set to 'hard'.  I 
 need to have newlines inserted in the text.
  \n and br don't work.  They just get quoted literally in 
 the text.  I suspect I need to use htmlspecialchars , but don't know 
 what special character to feed it.
 

Only getting to this now, but doesn't nl2br() do what you want?

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] How to install PHP 5.x on Windows Server 2000 with IIS 5 and MySQL 5.x

2008-03-27 Thread Paul Scott

On Thu, 2008-03-27 at 10:32 -0400, Wolf wrote:
 I'd suggest going with a real operating system (linux) which keeps patches 
 updated quicker...
 

As much of a Free Software advocate as I am, that is not the answer to
the question. That being said, however, I would replace the IIS with
Apache2 at least...

I seem to remember someone posting a really good guide to setting this
all up at some stage, so a quick search through the archives should
reveal all.


--Paul

-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] optimilize web page loading

2008-03-26 Thread Paul Scott

On Wed, 2008-03-26 at 09:25 +0100, Alain Roger wrote:
 i would like to know if there is a way to know how long does a web page need
 to be loaded into browser ?
 this is interesting fact for me, as i will optimilize my PHP code in order
 to reduce this time to minimum.

Try using microtime() http://www.php.net/microtime/ on either side of
your output statement(s).

--Paul
 
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] GPS Locator

2008-03-04 Thread Paul Scott

On Tue, 2008-03-04 at 11:42 -0600, Richard Lynch wrote:
 Almost for sure, browser security will not let you do this in a web
 browser.
 
 You'll probably have to write a custom desktop C application, or get
 the user to install some kind of glue widget...
 
 PEAR|PECL *might* have some USB stuff in a library you could use to
 write the PHP desktop widget and keep this on-topic, but I dunno...

DIO should let you do it, but that extension is pretty buggy last I used
it (OK like 5 years back with PHP4).

What I did was got high end barcode scanners to scan directly into a db
through a long running PHP script with it, so that should work just
fine.

That being said, though, something like a Winders COM object will
probably be a better bet (I have never used COM objects before as I
don't use Windows at all, ever) so correct me if I am wrong please!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] What design patterns do you usually use?

2008-02-27 Thread Paul Scott

On Wed, 2008-02-27 at 19:50 +0800, skylark wrote:
 What design patterns do you usually use?

I am not sure that you are understanding what a design pattern is. It is
not a piece of software or a thing to use, but it is a set of repeatable
components that you use in whatever app you are writing. 

Take for instance an observer pattern. When would you use that? Why
would you use that? Have you used it somewhere before and what were the
circumstances? Is it repeatable? Is your previous code re-usable?

Answer some of those questions, look up design patterns (even on
wikipedia to get an overview) and buy some books to see solid examples. 

If you suspect that you need to use a specific pattern, or are
interested in how to implement a specific pattern, write some throwaway
code to do it and ask opinions.

Look at the simple things that you would probably have used already -
factory, singleton and MVC and expand on those a little to get them to
be actual design patterns that you can use/reuse.

Don't use design patterns because you heard it on TV - same as
Web2.0 _think_ about what it means to you and your enterprise before
asking for a buzzword generator to do your job for you! :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] What design patterns do you usually use?

2008-02-27 Thread Paul Scott

On Wed, 2008-02-27 at 14:48 +0100, Jochem Maas wrote:
 Paul Scott schreef:
 there seems to be some misunderstanding ... a design pattern is not
 a component (or anything else of substance) but merely a conceptual
 strategy used to tackle a problem ... ever find yourself writing code
 that's conceptually identical to previously written code (in a different
 site/project/context), if so you've got yourself a pattern and as such it's
 probably been documented as an 'official' design pattern with suitable fancy
 name (something like 'Observer', 'Delegator', 'Factory')
 
 chances are then that you're already using design patterns - it's just
 that you don't know them by name :-)
 

Ja, that's what I was trying to say in a long, convoluted,
burning-the-candle-at-both-ends type of way :)

Thanks Jochem for clearing that up!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] How do you send stylized email?

2008-02-27 Thread Paul Scott

On Wed, 2008-02-27 at 13:18 -0500, Andrew Ballard wrote:

 Seriously? All e-mail? Sorry - couldn't resist. That is one serious
 disclaimer. I especially like the last line.
 

Holy crap! I had never actually looked at that stupid disclaimer before!
It gets added on the way out of our network, so like 80% of the mail
that I send doesn't even have that _HTML_ link in it.

Yech! Oh well, I suppose the suits have decided that its necessary

--Paul


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] How do you send stylized email?

2008-02-26 Thread Paul Scott

On Tue, 2008-02-26 at 11:44 -0500, Daniel Brown wrote:
 I wonder if I can just apt-get the wedding and have it all
 automated for me.  ;-P

If only! I remember the stress, and a good friend of mine is gettin'
hitched on Sat - while I am in Uganda - go figure! 

Anyway, congrats, and enjoy the day... (Jokes aside of course)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] How do you send stylized email?

2008-02-26 Thread Paul Scott

On Tue, 2008-02-26 at 11:27 -0500, Daniel Brown wrote:
 On Tue, Feb 26, 2008 at 10:57 AM, Robert Cummings [EMAIL PROTECTED] wrote:
   Marriage?? That's for backwards people stuck in ancient pointless
   traditions :) And moreso in today's culture... it's just a commercial
   suckfest when your money could better go to student loans and raising a
   family.
 
 http://debianddan.com/
 
 CC: Debs
 

LOL! Now you are going to get a gazillion requests coming from people
looking for debian packages (possibly a new debian based distro for
people that stutter?) 

:))

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] How do you send stylized email?

2008-02-26 Thread Paul Scott

On Tue, 2008-02-26 at 22:52 -0300, Manuel Lemos wrote:
 messages. I use this popular MIME message composing class. Try the
 test_simple_html_mail_message example script for instance.
 
 http://www.phpclasses.org/mimemessage
 
 

Hehe, I was holding my breath for Manuel to come on to this thread!

if($subject === 'something to do with mail')
{
$this-punt('mimemessage', 'phpclasses.org');
}
else {
sleep(86400);
}


;)


--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] PHP 24 hour processes?

2008-02-24 Thread Paul Scott

On Mon, 2008-02-25 at 07:39 +0100, Zoran Bogdanov wrote:
 How can you perform a timed event in PHP; for example:
 
 Count 24 hours and then delete all rows in a database...
 

I thought that this question was answered in some detail before...

Anyway, on *NIX based systems use cron.daily or on 'doze, use AT or
command scheduler I think it's called.

Either that or use a long running PHP process with ignore_user_abort()
and a time of 86400 seconds :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] temporary error

2008-02-21 Thread Paul Scott

On Thu, 2008-02-21 at 14:54 +0100, Mirco Soderi wrote:
 Consider the following code:
 
 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc etc 

How long does it take you to write a single line of code with variable
names like that?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Exception vs exception

2008-02-21 Thread Paul Scott

On Thu, 2008-02-21 at 21:01 -0800, Prabath Kumarasinghe wrote:
 In second approach for every query I have to write
 throw new MySQLException(My Message). It's very time
 consuming isn't it?

In order to *be* lazy, you have to *think* lazy...

Don't go and define every single query with an exception, thats just not
the lazy way, rather define a few functions that do generic stuff (or
even a single function that runs a query) and then send all of your
queries through that:

public function queryWithException($filter)
{
$results = $dblayer-query($filter);
if($results === FALSE)
{
 throw new MyException(Query failed!);
}
else {
return $results;
}
}

then in your code:

try {
$this-queryWithException(SELECT * FROM users WHERE clue  0);
}
catch (MyException $e)
{
   // clean up
}

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Deleting all rows in a database every 24 hours?

2008-02-21 Thread Paul Scott

On Fri, 2008-02-22 at 07:28 +0100, Zoran Bogdanov wrote:
 The title says it all, how do I perform an action every 24 hours?
 

$sql = TRUNCATE TABLE 'sometable';
$this-query($sql);

on a cron.daily

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Sending SMS via PHP

2008-02-20 Thread Paul Scott

On Wed, 2008-02-20 at 21:01 -0800, Nick Stinemates wrote:
  Do you need to receive SMS? If you need to receive SMS, you will need to
  host your own GSM device or modem so that people can send you SMS.
 
  If not, you can just use internet SMS gateways like clickatell to do the
  work, and post to them by HTTP, XML or email. The cost is about 6-8 cents
  per SMS. There are cheaper services, but not always reliable. If you need to
  host your own GSM device, you can use software like http://www.kannel.org
  (GPL Open Source) or http://www.visualgsm.com.
 

The thing with SMS is volume. Most commercial (bulk SMS) service
providers do provide a return path at a price, but this can get really
expensive especially at low volumes.

What you need to do is ask yourself whether you are going to do high
volume SMS or not, and look at when do the commercial providers become
more economical? What a lot of people do, is sign up for an account and
end up sending only 50 or so SMS a month, which is silly, when for the
same price as a month or two's subscription, you could buy your own GSM
modem and a prepaid SIM card and do it for half the price yourself.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] fail on preg_match_all

2008-02-20 Thread Paul Scott

On Wed, 2008-02-20 at 23:34 -0600, Hamilton Turner wrote:
 if i know the file handle is valid (i grabbed it using 'or die'), and 
   ^

This is probably your problem, you are trying to match on a resource
handle, not a string or something.

Check out http://www.php.net/preg_match_all

 the regex is valid

Won't really matter if the data is in the wrong format!

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

RE: [PHP] What community software package gets your vote? PHPfox etc...

2008-02-19 Thread Paul Scott


On Tue, 2008-02-19 at 23:21 -0500, TS wrote:
 On Feb 19, 2008 8:41 PM, TS [EMAIL PROTECTED] wrote:
  Hello everyone. I'm not sure what the budget is but, obviously inexpensive
  would be nice. Someone turned me on to PHPfox. Yet I don't have any others
  to compare it to. If you all would be so kind as to put a shout out and
 vote
  on your favorite, I'd be very grateful.

How about Chisimba? http://avoir.uwc.ac.za It is free (GPL) and has all
the features of PHPFox and more.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Template system in PHP

2008-02-14 Thread Paul Scott

On Thu, 2008-02-14 at 09:29 +0100, Zoltán Németh wrote:

 and by the way, symfony has YAML configuration files and a plugin for
 REST services.
 

and Chisimba does YAML configs in the blog module, REST, SOAP and
XML-RPC services as well as a whole whack of XML-ish things.

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Better DB Class MySQL

2008-02-14 Thread Paul Scott

On Thu, 2008-02-14 at 16:17 -0600, Richard Lynch wrote:
 And some have figured out that PDO does not quite live up to its
 promise (yet) and needs some more work...
 

I am finding this out the hard way, but just with MySQL and PostgreSQL
support (including MySQLi).

Portable, kinda, stable, not so much.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Session and Multi Server Architecture

2008-02-11 Thread Paul Scott

On Mon, 2008-02-11 at 23:03 +0530, chetan rane wrote:
  Can any one tell me what will be the best way to maintain session
 information on a Multi Server Architecture i.e a Web Cluster.

Memcached session handler. Provides failover as well as speeding things
up significantly.

Either that or in a db, but if you are already in clustering, you
probably have a memcached instance already right?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Session and Multi Server Architecture

2008-02-11 Thread Paul Scott

On Mon, 2008-02-11 at 12:48 -0500, Nathan Nobbe wrote:

 http://us.php.net/manual/en/ref.memcache.php
 

and http://www.danga.com/memcached/

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Name of variable to string

2008-02-08 Thread Paul Scott

On Fri, 2008-02-08 at 14:37 -0500, Daniel Brown wrote:
 On Feb 8, 2008 2:18 PM, Eric Butera [EMAIL PROTECTED] wrote:
 And look who chimes in with some helpful advice!  ;-P
 

lol

(now isn't that even more useless?)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Order directory output

2008-02-08 Thread Paul Scott

On Fri, 2008-02-08 at 21:19 -0500, Nathan Nobbe wrote:
 i hooked up an spl example; and the files are sorted by name.
 also, did you want that p inside or outside the span w/
 class=NormalText, because the opening and closing tags are
 mixed up..
 

Here is another, generic extension filter with SPL. Untested, and I have
just woken up, so if it doesn't work... :-P

class ExtensionFilter extends FilterIterator {

  private $ext; 
  private $it;

  public function __construct(DirectoryIterator $it, $ext) {
  parent::__construct($it);
  $this-it = $it;
  $this-ext = $ext;
  }
  public function accept() {
  if ( ! $this-it-isDir() ) {
$ext = array_pop(explode('.', $this-current()));
return $ext != $this-ext;
  }
  return true;
  }
}

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

  1   2   3   4   5   6   7   8   9   10   >