Re: [PHP] Date Comparison

2009-09-03 Thread J DeBord
Telling someone RTFM is just rude and mean. Manipulating dates and times can
be confusing for beginners and experienced people alike. I would suggest
that when a question asked here causes you to respond with RTFM, don't
respond at all. Save yourself the time and trouble and save the person
asking the question the grief of being insulted. And Tedd your condescending
response caused me to lose respect for you. I'm sure the OP would have been
more than thankful to receive the same response without the RTFM. I'll read
any response to this, but I won't have anything more to say. This list has
been polluted enough lately with nonsense. Incredible.


On Sat, Aug 29, 2009 at 3:44 PM, tedd  wrote:

> At 1:01 PM -0400 8/28/09, David Stoltz wrote:
>
>> Hey Stuart -
>>
>> RTFM yourselfI did read it, and obviously misunderstood...
>>
>> I'm really sorry to bother you. I thought that was what a listserv like
>> this was for - to ask questions...
>>
>> I'll try not to ask questions I should know the answer to next time.
>>
>
> Whoa dude!
>
> You just received advice from a brilliant man and you are bitching about
> it?!?
>
> Look child, you are being told what you should do by a professional who is
> donating his time freely to help you. Just how did you not understand that?
>
> So, just do what he advised and say "Thank you sir, may I have another?"
>
> I've posted some dumb-ass questions before, but only after I took the time
> to research the question myself. And when someone took the time to
> straighten me out and help, I appreciated it.
>
> Hopefully next time you'll read the manual and take the time to understand
> what you read -- it would cut down on post that demonstrate just how
> ignorant and thankless you are at this.
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ashley Sheridan
On Wed, 2009-09-02 at 21:30 -0700, Ben Dunlap wrote:
> >Is there is a way to search only for the alphanumeric content of
> > field in a db?  I have an itemID field that contains item #'s that include
> > dashes, forward slashes, etc, and I want people to be able to search for an
> > item # even if they don't enter the punctuation exactly.
> 
> Not sure if there's anything specifically PHP-ish that will help you
> here, but I would be inclined to start by storing a stripped-down
> version of the item ID (alphanumeric characters only) in a separate
> column in the database table.
> 
> Then, when a user enters some search data, I would remove
> non-alphanumeric characters, if any, from the user's input, and then
> search the stripped column with this normalized version of the input.
> 
> If you want even fuzzier matching (inadvertent transpositions or an
> omitted character or two OK, for example), you might read about
> Levenshtein distance:
> 
> http://en.wikipedia.org/wiki/Levenshtein_distance
> 
> PHP has a levenshtein function but you'll have to figure out a way to
> use it efficiently with your data set. Or, if Levenshtein isn't quite
> right for your needs, the article above might at least point you in a
> useful direction.
> 
> Ben
> 

What's wrong with using the wildcards that are built into most SQL
variants?

SELECT * FROM table WHERE item_id LIKE '%#abcdef'

Will select all records where the item_id field ends in '#abcdef'

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




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



Re: [PHP] CodeWorks 09

2009-09-03 Thread Luke
2009/9/2 Ben Dunlap 

> > What I would do for UK PHP events :-(
>
> Something like this perhaps?
>
> http://conference.phpnw.org.uk/phpnw09/
>
> Ben
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Nice one, I might be able to get to that one :)

Thanks,

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


RE: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi

Which DB?
If it is MySQL, as example, you can simply use REGEXP syntax "^[a-zA-Z0-9]+$" 
via SELECT

Regards

> From: sono...@fannullone.us
> To: php-general@lists.php.net
> Date: Wed, 2 Sep 2009 20:47:15 -0700
> Subject: [PHP] Searching on AlphaNumeric Content Only
> 
>   Is there is a way to search only for the alphanumeric content of  
> field in a db?  I have an itemID field that contains item #'s that  
> include dashes, forward slashes, etc, and I want people to be able to  
> search for an item # even if they don't enter the punctuation exactly.
> 
>   Here's an example:  let's say there is an itemID of 4D-2448-7PS but  
> someone omits the dashes and searches on 4D24487PS.  Is it possible in  
> PHP to have the find be successful, even if the search criteria  
> doesn't exactly match what's stored in the field?
> 
>   If this is possible, I'd appreciate it if someone could just point me  
> in the right direction so I can read up on it.
> 
> Thanks,
> Frank
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

Re: [PHP] Date Comparison

2009-09-03 Thread Stuart
2009/9/3 J DeBord :
> Telling someone RTFM is just rude and mean. Manipulating dates and times can
> be confusing for beginners and experienced people alike. I would suggest
> that when a question asked here causes you to respond with RTFM, don't
> respond at all. Save yourself the time and trouble and save the person
> asking the question the grief of being insulted. And Tedd your condescending
> response caused me to lose respect for you. I'm sure the OP would have been
> more than thankful to receive the same response without the RTFM. I'll read
> any response to this, but I won't have anything more to say. This list has
> been polluted enough lately with nonsense. Incredible.

You're entitled to your opinion as much as I am, and my opinion is
that not making it clear to people that the answer to their question
is plainly obvious in the manual is just as rude if not more so than
suggesting they RTFM.

I make a point to never just say RTFM but to also answer the question
at the same time, but IMHO not telling people how fundamental their
question was does not help them in the long run. At the end of the day
it just encourages them to continue to rely on this list rather than
learning how to find the answer themselves and to only use this list
as a last resort.

I make no apology for my attitude towards this type of question, and
if you don't like it you can stick it where the sun don't shine.

-Stuart

-- 
http://stut.net/

> On Sat, Aug 29, 2009 at 3:44 PM, tedd  wrote:
>
>> At 1:01 PM -0400 8/28/09, David Stoltz wrote:
>>
>>> Hey Stuart -
>>>
>>> RTFM yourselfI did read it, and obviously misunderstood...
>>>
>>> I'm really sorry to bother you. I thought that was what a listserv like
>>> this was for - to ask questions...
>>>
>>> I'll try not to ask questions I should know the answer to next time.
>>>
>>
>> Whoa dude!
>>
>> You just received advice from a brilliant man and you are bitching about
>> it?!?
>>
>> Look child, you are being told what you should do by a professional who is
>> donating his time freely to help you. Just how did you not understand that?
>>
>> So, just do what he advised and say "Thank you sir, may I have another?"
>>
>> I've posted some dumb-ass questions before, but only after I took the time
>> to research the question myself. And when someone took the time to
>> straighten me out and help, I appreciated it.
>>
>> Hopefully next time you'll read the manual and take the time to understand
>> what you read -- it would cut down on post that demonstrate just how
>> ignorant and thankless you are at this.
>>
>> Cheers,
>>
>> tedd
>>
>> --
>> ---
>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php

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



RE: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi


> Indeed you could do it via a regexp, but that uses up quite some memory. 
> Every time you do a SELECT. You can simply add a table column with the 
> stripped value and let the table update itself (with an ON UPDATE ON 
> INSERT trigger, which takes the input value for the itemID and strips it 
> once).
> 
> When doing this on inputting the value into the database, you save 
> yourself the pain (and performance) of doing it on every SELECT-query.

Excuse me? Somebody suggested a PHP loop to solve a query problem and you are 
saying that REGEXP should not be used?
MySQL caches queries and 100 SELECT with a REGEXP will cost zero after the 
first one if nothing changed inside the table.

At the same time an internal REGEXP is faster than everything else has to move 
out and be parsed after via, probably, the same REGEXP engine. Try some bench.

This problem, imho, is a non-problem, at least not a PHP problem.

How MySQL optimizes internally REGEXPs is not PHP problem as well.

It's like to create a loop to read byte after byte because file_get_contents 
could be memory greedy (if you do that with 1 Gb of file you are you doing 
wrong in any case, logs need to be split as example) or avoid MATCH AGAINST in 
query if we have too many rows because of performances problem (table could be 
slipt as well to optimize performances) ... and these practices to avoid native 
solutions are a bit hilarious, imho.

Regards

_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

Re: [PHP] a doubt with class DOM

2009-09-03 Thread Raymond Irving

It works ok for me and I think it's very reliable. You might want to run a few 
test on it though.

Another approach is to break up your xml into smaller documents and then use 
php string functions to merge them together.

__
Raymond Irving
Rich Ajax/PHP Development 
http://raxanpdi.com


--- On Wed, 9/2/09, Carlos Garcia  wrote:

From: Carlos Garcia 
Subject: [PHP] a doubt with class DOM
To: php-general@lists.php.net
Date: Wednesday, September 2, 2009, 1:02 AM



if my xml is something big, how reliable is saving changes to my xml this way:

 

$doc->save('file.xml');

 

or another shape of save changes of my xml?

 

Sorry my english is bad =P.-

 

Thanks.-

 

Best regards, Karl.-
 
Carlos A. Garcia Hernandez



José Clemente Orozco Mza. 7 Lt. 14 Pedro Ojeda Paullada Ecatepec, Edo. De 
México / T: +(52 55) 57809620 / E: carlos.gar...@imkarl.net / W: www.imkarl.net
 
Por favor considere sus responsabilidades ecológicas, no imprima este documento 
a menos que sea realmente necesario. / Please consider your ecological 
responsibilities. Don't print this e-mail unless you really need to.
 
AVISO DE CONFIDENCIALIDAD: Este mensaje de correo electrónico incluyendo en su 
caso los archivos adjuntos al mismo, pueden contener información de carácter 
confidencial y/o privilegiada, y se envían única y exclusivamente a la atención 
de la persona y/o entidad a quien va dirigido. La copia, revisión, uso, 
revelación y/o distribución de dicha información, sin autorización por escrito 
de Carlos A. García Hernández está prohibida. Si usted no es el destinatario a 
quien se dirige el presente correo, favor de contactar al remitente 
respondiendo al presente correo y eliminar el original incluyendo los archivos, 
así como cualesquiera copia del mismo. Mediante la recepción del presente 
correo usted reconoce y acepta que en caso de incumplimiento de su parte y/o de 
sus representantes a los términos antes descritos, Carlos A. García Hernández 
tendrá derecho a los daños y perjuicios que esto le ocasione.


CONFIDENTIALITY NOTICE: This e-mail message including attachments, may contain 
confidential and/or privileged material and only for the person or entity to 
which it is addressed. Any use, review, disclosure or distribution of such 
confidential information without the written authorization of Carlos A. García 
Hernández is prohibited. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message 
including attachments. By receiving this e-mail you acknowledge that a breach 
by you and/or your representatives of the above provisions may entitle Carlos 
A. García Hernández to seek for damages.


_
Feliz aniversario Messenger!
www.aniversariomessenger.com.mx

Re: [PHP] windows 5.2.10 PHP not working with phpinfo

2009-09-03 Thread hack988 hack988
HTTP 403.1 Forbidden: Execute Access Forbidden
Internet Information Services

IIS: properties->home directory->configuration->execute permissions
set it to script and execute  .


2009/9/3 Fred Silsbee :
> THANKS!
>
> Here is my current situation (if you care to look at it (under the windows ) 
> list
>
> I tried 5.3 and found out it had no php_mssql.
> Then I retreated to 5.2.10.
>
> Trying to get back to where I had everything worked, I downloaded 5.2.6:
> (1) I uninstalled cgi 1.5
> (2) php.ini   has:
>
> extension_dir = "C:\PHP\ext"
> ; doc_root = "C:\inetpub\wwwroot"              commented out
> doc_root =
>
> ALL extensions are uncommented
>
> I only need:
> extension=php_mssql.dll
>
> ; **You CAN safely turn this off for IIS, in fact, you MUST.**
> cgi.force_redirect = 0
>
> ntwdblib and php.ini moved to
> C:\WINDOWS
> C:\WINDOWS\system
> C:\WINDOWS\system32
>
> IIS: properties->home directory->configuration   C:\PHP\php5isapi.dll
> with GET,HOST,POST,DEBUG
>
> I also tried:
> php5ts.dll
> phpnsapi.dll
> only php5isapi.dll seemed to work!
> added to XP Prof SP3 path: ;C:\PHP;C:\PHP\ext
>
> also created (just in case) PHPRC environment variable (alongside path)
> containing C:\PHP;C:\PHP\ext
>
> I gave IUSR_LANDON all powers
>
> results
> this works:http://207.254.225.224:8080/phpinfo.php
>
> http://207.254.225.224:8080/new_black_scholes.php
> initial display works until I select "DEMO"...then:
>
> The page cannot be displayed
> There is a problem with a program on the page you are trying to reach, and 
> the page cannot be displayed.
>
> Here is new_black_scholes.php
>  define( "ITMAX",100);
> define( "EPS",3.0e-7);
>    // If the submit button has been pressed
>    $StockPrice = $ExercisePrice = $RiskFreeRateInterest = 
> $InstantaneousVarianceRateStocksReturn = "";
>    $TimetoExpirationOption = $ValueCallOption = $ValuePutOption = $DeltaCalls 
>  = $DeltaPuts  = "";
>
>    if (isset($_POST['reset']))
>    {
>
>    $m_s = 100.;
>    $m_e = 100.;
>    $m_rf = .12;
>    $m_sigma = .1;
>    $m_time = 365.;
>    Black_Scholes_Main($m_s, $m_e, $m_rf, $m_sigma,$m_time, $m_c, $m_p, 
> $m_deltacalls, $m_deltaputs);
>    $StockPrice = $m_s;
>    $ExercisePrice = $m_e;
>    $RiskFreeRateInterest = $m_rf;
>    $InstantaneousVarianceRateStocksReturn = $m_sigma;
>    $TimetoExpirationOption = $m_time;
>    $ValueCallOption = $m_c;
>    $ValuePutOption = $m_p;
>    $DeltaCalls = $m_deltacalls;
>    $DeltaPuts = $m_deltaputs;
>    }
>    elseif (isset($_POST['submit']))
>    {
>    $m_s = $_POST['StockPrice'];
>    $m_e = $_POST['ExercisePrice'];
>    $m_rf = $_POST['RiskFreeRateInterest'];
>    $m_sigma = $_POST['InstantaneousVarianceRateStocksReturn'];
>    $m_time = $_POST['TimetoExpirationOption'];
>    Black_Scholes_Main($m_s, $m_e, $m_rf, $m_sigma,$m_time, $m_c, $m_p, 
> $m_deltacalls, $m_deltaputs);
>    $StockPrice = $m_s;
>    $ExercisePrice = $m_e;
>    $RiskFreeRateInterest = $m_rf;
>    $InstantaneousVarianceRateStocksReturn = $m_sigma;
>    $TimetoExpirationOption = $m_time;
>    $ValueCallOption = $m_c;
>    $ValuePutOption = $m_p;
>    $DeltaCalls = $m_deltacalls;
>    $DeltaPuts = $m_deltaputs;
>    }
> function Black_Scholes_Main($m_s, $m_e, $m_rf, $m_sigma, $m_time, &$m_c, 
> &$m_p, &$m_deltacalls, &$m_deltaputs) {
>        $m_c = black_scholes($m_s,  $m_e,  $m_rf,  $m_sigma,  $m_time/365., 
> $nd1, $nd2);
>        $m_p = $m_e / pow(1.+$m_rf, $m_time/365.) - $m_s + $m_c;
>        $m_deltacalls = $nd1;
>        $m_deltaputs = $nd1 - 1.;
> }
> function black_scholes( $s,  $e,  $rf,  $sigma,  $time, &$nd1, &$nd2) {
>        $num = log($s/$e)+$time*($rf+.5*$sigma*$sigma);
>        $d1 = $num/($sigma*sqrt($time));
>        $d2 = $d1 - $sigma*sqrt($time);
>        $c = $s*myerf($d1) - $e * myerf($d2) * exp(-$rf*$time);
>        $nd1 = myerf($d1);
>        $nd2 = myerf($d2);
>
>        return $c;
> }
> function gammln($xx)
> {
>        $cof=array(76.18009173,-86.50532033,24.01409822,
>                -1.231739516,0.120858003e-2,-0.536382e-5);
>
>        $x=$xx-1.0;
>        $tmp=$x+5.5;
>        $tmp -= ($x+0.5)*log($tmp);
>        $ser=1.0;
>        for ($j=0;$j<=5;$j++) {
>                $x += 1.0;
>                $ser += $cof[$j]/$x;
>        }
>        return -$tmp+log(2.50662827465*$ser);
> }
>
> function gser(  &$gamser,  $a,  $x, &$gln)
> {
>
>        $gln=gammln($a);
>        if ($x <= 0.0) {
>                if ($x < 0.0) echo "x less than 0 in routine GSER";
>                $gamser=0.0;
>                return;
>        } else {
>                $ap=$a;
>                $sum=1.0/$a;
>        $del=$sum;
>                for ($n=1;$n<=ITMAX;$n++) {
>                        $ap += 1.0;
>                        $del *= $x/$ap;
>                        $sum += $del;
>                        if (abs($del) < abs($sum)*EPS) {
>                                $gamser=$sum*exp(-$x+$a*log($x)-($gln));
>                                return;
>                 

Re: [PHP] Array references - how to unset() ?

2009-09-03 Thread hack988 hack988
Reference vars in php would not be unset if it reference by another
var,so you must keep original var had'nt being reference.
2009/9/3 Martin Zvarík :
> AHA !!!
>
> OMG... how come I did not see that!?
>
> Instead this:
> $array =& $array[$final];
> unset($array);
>
> This:
> unset($array[$final]);
>
>
> 3 AM in the morning... that must be the reason! .)
>
> Thanks.
>
>
>
>>
>> This is possible. You're just not giving enough consideration to your exit
>> strategy :)
>>
>> >
>> function unset_deep( &$array, $keys )
>> {
>>    $final = array_pop( $keys );
>>
>>    foreach( $keys as $key )
>>    {
>>        $array = &$array[$key];
>>    }
>>
>>    unset( $array[$final] );
>> }
>>
>> $value = array
>> (
>>    'a' => array
>>    (
>>        'b' => array
>>        (
>>            'c' => 'C',
>>            'd' => 'D',
>>            'e' => 'E'
>>        ),
>>    ),
>> );
>>
>> $keys = array('a', 'b', 'c');
>> unset_deep( $value, $keys );
>>
>> print_r( $value );
>>
>> ?>
>>
>> Cheers,
>> Rob.
>
>
> --
> 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] Array references - how to unset() ?

2009-09-03 Thread Robert Cummings

hack988 hack988 wrote:

Reference vars in php would not be unset if it reference by another
var,so you must keep original var had'nt being reference.


You can't reference a reference in PHP. If you take the reference of a 
variable that is itself a reference then you are taking a reference to 
the referenced value and not the reference variable itself. This is 
illustrated in the following example:




What I think you meant to say, is that a value is not unset as long as 
it has at least one variable referencing it. You most certainly unset 
the reference if you apply unset to it, it is the value referenced that 
may remain.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] Validating XML Issue

2009-09-03 Thread Mattias Thorslund
I'd say your XML document is not "well formed", but validity depends on 
whether it conforms to the rules expressed in a schema.


Mattias

Alice Wei wrote:
Hi, 

  This seems like a small problem that I have read from http://us.php.net/manual/en/xmlreader.isvalid.php. 
  I have the code snippet here as follows:


setParserProperty(XMLReader::VALIDATE, true);

if ($xml->isValid()) echo "true";
else echo "NOT";

?>

Here is the contents of hello.xml:

 Hello

Obviously, this is not a well formed XML file. 

However, whenever I run the PHP code, it returns true, how do I get it to validate it the way it is supposed to be? 

Thanks for your help. 


Alice




_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview
  




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



[PHP] Validating XML Issue

2009-09-03 Thread Alice Wei

Hi, 

  This seems like a small problem that I have read from 
http://us.php.net/manual/en/xmlreader.isvalid.php. 
  I have the code snippet here as follows:

setParserProperty(XMLReader::VALIDATE, true);

if ($xml->isValid()) echo "true";
else echo "NOT";

?>

Here is the contents of hello.xml:

 Hello

Obviously, this is not a well formed XML file. 

However, whenever I run the PHP code, it returns true, how do I get it to 
validate it the way it is supposed to be? 

Thanks for your help. 

Alice




_
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

[PHP] Some help with SimpleXML :`(

2009-09-03 Thread Matthew Croud

Hi foks,

Could someone lend me a little hand with simpleXML ?
I've been looking at examples in the PHP manual and W3C, i'm at the  
pinnacle of figuring it out but alas i need a hand from the mailing  
list dudes.


My aim is to add another "item" node, so i'll start with my XML file  
called "items.xml"


Item.xml_




  
Red Gloves
a pair of red gloves
adult
12.99
  

  
Snow Boots
some snow boots
child
23.99
  


__


And now the PHP i'm using to create a new "item" node:


$xml = simplexml_load_file('items.xml');

$item = $xml->clothes->addChild('item');
$item->addChild('name', 'blue gloves');
$item->addChild('desc', 'some blue gloves');
$item->addChild('size', 'adult');
$item->addChild('price', '4.99');

__

The error i'm getting is:  "Cannot add child. Parent is not a  
permanent member of the XML tree"



Help me Gamesmaster!
Matt

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



Re: [PHP] Date Comparison

2009-09-03 Thread Paul M Foster
On Thu, Sep 03, 2009 at 10:20:49AM +0100, Stuart wrote:

> 2009/9/3 J DeBord :
> > Telling someone RTFM is just rude and mean. Manipulating dates and times can
> > be confusing for beginners and experienced people alike. I would suggest
> > that when a question asked here causes you to respond with RTFM, don't
> > respond at all. Save yourself the time and trouble and save the person
> > asking the question the grief of being insulted. And Tedd your condescending
> > response caused me to lose respect for you. I'm sure the OP would have been
> > more than thankful to receive the same response without the RTFM. I'll read
> > any response to this, but I won't have anything more to say. This list has
> > been polluted enough lately with nonsense. Incredible.
> 
> You're entitled to your opinion as much as I am, and my opinion is
> that not making it clear to people that the answer to their question
> is plainly obvious in the manual is just as rude if not more so than
> suggesting they RTFM.
> 
> I make a point to never just say RTFM but to also answer the question
> at the same time, but IMHO not telling people how fundamental their
> question was does not help them in the long run. At the end of the day
> it just encourages them to continue to rely on this list rather than
> learning how to find the answer themselves and to only use this list
> as a last resort.
> 
> I make no apology for my attitude towards this type of question, and
> if you don't like it you can stick it where the sun don't shine.

+1

I can't argue with this approach. If you're going to point the poster to
the manual and *then* explain, that's the ideal way to do this. Now it
could be argued that you could say, "Please refer to
http://php.net/manual/en/whatever.php for more info." Or you could say,
"RTFM". The former is more polite, but the latter will suffice. Both
mean the same thing; one is simply more terse.

Also stipulated that one should research a question as much as possible
before posting to this list. We're not tutors; more like professional
side-checkers.

(Please don't take this the wrong way, newbies. You're welcome to ask
questions here. Just do whatever research you can first, and follow our
advice afterward, to RTFM.)

Paul

-- 
Paul M. Foster

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



Re: [PHP] Array references - how to unset() ?

2009-09-03 Thread hack988 hack988
Yes,thanks and I sorry for my poor english

2009/9/3 Robert Cummings :
> hack988 hack988 wrote:
>>
>> Reference vars in php would not be unset if it reference by another
>> var,so you must keep original var had'nt being reference.
>
> You can't reference a reference in PHP. If you take the reference of a
> variable that is itself a reference then you are taking a reference to the
> referenced value and not the reference variable itself. This is illustrated
> in the following example:
>
> 
> $foo = '123';
> $fee = '987';
>
> $blah = &$foo;
> $bleh = &$blah;
> $blah = &$fee;
>
> echo 'blah: '.$blah."\n";
> echo 'bleh: '.$bleh."\n";
>
> ?>
>
> What I think you meant to say, is that a value is not unset as long as it
> has at least one variable referencing it. You most certainly unset the
> reference if you apply unset to it, it is the value referenced that may
> remain.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>

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



RE: [PHP] Validating XML Issue

2009-09-03 Thread Alice Wei

Hi, 



   Thanks for trying to help me out. I don't have a schema for my XML, but here 
is something cool I found that worked for me: 
http://www.w3schools.com/PHP/func_xml_error_string.asp

Alice

> Date: Thu, 3 Sep 2009 07:42:00 -0700
> From: matt...@thorslund.us
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
> Subject: Re: [PHP] Validating XML Issue
> 
> I'd say your XML document is not "well formed", but validity depends on 
> whether it conforms to the rules expressed in a schema.
> 
> Mattias
> 
> Alice Wei wrote:
> > Hi, 
> >
> >   This seems like a small problem that I have read from 
> > http://us.php.net/manual/en/xmlreader.isvalid.php. 
> >   I have the code snippet here as follows:
> >
> >  > $xml = XMLReader::open('hello.xml');
> >
> > // You must to use it
> > $xml->setParserProperty(XMLReader::VALIDATE, true);
> >
> > if ($xml->isValid()) echo "true";
> > else echo "NOT";
> >
> > ?>
> >
> > Here is the contents of hello.xml:
> >
> >  Hello
> >
> > Obviously, this is not a well formed XML file. 
> >
> > However, whenever I run the PHP code, it returns true, how do I get it to 
> > validate it the way it is supposed to be? 
> >
> > Thanks for your help. 
> >
> > Alice
> >
> >
> >
> >
> > _
> > Search from any Web page with powerful protection. Get the FREE Windows 
> > Live Toolbar Today!
> > http://get.live.com/toolbar/overview
> >   
> 
> 

_
All-in-one security and maintenance for your PC.  Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

Re: [PHP] Just a tip from one of your peers

2009-09-03 Thread Ashley Sheridan
On Thu, 2009-09-03 at 09:27 -0700, Jim Lucas wrote:
> I want this to come across in the nicest way possible.  Please I mean no 
> harm by my following statements.  And if you decide to hate me and never 
> to respond to one of my posts again, well, that is your choice.
> 
> 
> 
> I, and others too I'd expect, would appreciate it if you didn't take a 
> response email from one thread and change the subject thinking you are 
> created a new thread.  Because you are not.
> 
> To those of us that use email clients or news readers that correctly 
> display threads, things get lost in the mix of threads that get many 
> levels deep.
> 
> The initial topic for the thread that I am referring to is as follows
> 
> AuthorThread
> RRT   [PHP] PHP pages won't open correctly on my server.
> David Stoltz  [PHP] How to output a NULL field?
> David Stoltz  [PHP] Date Comparison
> David Stoltz  [PHP] Date +30 comparison
> 
> Mind you that two of them were date related, but can anybody else see 
> how things could get lost very quickly?  I sure do.
> 
> After writing this, I guess it would be best to simply ask David to 
> create a new email to the list each time that he has a different question.
> 
> 
> 
> If you are in question now about how you should behave on this list, 
> please refer here:
>   http://us2.php.net/reST/php-src/README.MAILINGLIST_RULES
> 
> 
> Jim Lucas
> 
> 
+1 I know the feeling! I have my email client display messages by
thread, and it's darn annoying for threads to have several completely
different topics!

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




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



[PHP] Just a tip from one of your peers

2009-09-03 Thread Jim Lucas
I want this to come across in the nicest way possible.  Please I mean no 
harm by my following statements.  And if you decide to hate me and never 
to respond to one of my posts again, well, that is your choice.




I, and others too I'd expect, would appreciate it if you didn't take a 
response email from one thread and change the subject thinking you are 
created a new thread.  Because you are not.


To those of us that use email clients or news readers that correctly 
display threads, things get lost in the mix of threads that get many 
levels deep.


The initial topic for the thread that I am referring to is as follows

Author  Thread
RRT [PHP] PHP pages won't open correctly on my server.
David Stoltz[PHP] How to output a NULL field?
David Stoltz[PHP] Date Comparison
David Stoltz[PHP] Date +30 comparison

Mind you that two of them were date related, but can anybody else see 
how things could get lost very quickly?  I sure do.


After writing this, I guess it would be best to simply ask David to 
create a new email to the list each time that he has a different question.




If you are in question now about how you should behave on this list, 
please refer here:

http://us2.php.net/reST/php-src/README.MAILINGLIST_RULES


Jim Lucas


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



Re: [PHP] Some help with SimpleXML :`(

2009-09-03 Thread J DeBord
You almost had it...

Since clothes is the root element you can think of your initial $xml as
. So, you add a child to it. That error message is kinda cryptic
though.




 
   Red Gloves
   a pair of red gloves
   adult
   12.99
 

 
   Snow Boots
   some snow boots
   child
   23.99
 


EOD;

$sxml = simplexml_load_string($xml);

$item = $sxml->addChild('item');
$item->addChild('name', 'Blue Gloves');

echo $sxml->asXML();

exit;


On Thu, Sep 3, 2009 at 5:03 PM, Matthew Croud wrote:

> Hi foks,
>
> Could someone lend me a little hand with simpleXML ?
> I've been looking at examples in the PHP manual and W3C, i'm at the
> pinnacle of figuring it out but alas i need a hand from the mailing list
> dudes.
>
> My aim is to add another "item" node, so i'll start with my XML file called
> "items.xml"
>
> Item.xml_
>
> 
> 
>
>  
>Red Gloves
>a pair of red gloves
>adult
>12.99
>  
>
>  
>Snow Boots
>some snow boots
>child
>23.99
>  
>
> 
> __
>
>
> And now the PHP i'm using to create a new "item" node:
>
>
> $xml = simplexml_load_file('items.xml');
>
> $item = $xml->clothes->addChild('item');
> $item->addChild('name', 'blue gloves');
> $item->addChild('desc', 'some blue gloves');
> $item->addChild('size', 'adult');
> $item->addChild('price', '4.99');
>
> __
>
> The error i'm getting is:  "Cannot add child. Parent is not a permanent
> member of the XML tree"
>
>
> Help me Gamesmaster!
> Matt
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
> Excuse me? Somebody suggested a PHP loop to solve a query problem and you are 
> saying that REGEXP should not be used?
> MySQL caches queries and 100 SELECT with a REGEXP will cost zero after the 
> first one if nothing changed inside the table.

Even if the REGEXP has to change with every query?

Performance aside, I think REGEXP() could be used here, but not in the
way you've suggested. As the OP has described his table, your regex
("^[a-zA-Z0-9]+$") won't match any rows, because all of his product
IDs have non-alphanumeric characters in them.

Suppose this table:

pk  | prod_id
1   | 07-ABCD-98
2   | 98-ZCXQ-21

And now suppose the OP's scenario, where a user tries to search on
product id, but enters "07ABCD98".

If the aim is to use REGEXP() to return row 1, I suppose you could
intersperse the search string with ".?" sequences and end up with this
query:

SELECT * FROM table WHERE prod_id REGEXP '^0.?7.?A.?B.?C.?D.?9.?8$'

I think just stripping the alphanumeric characters would end up being
more flexible, though.

-Ben

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



Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
> What's wrong with using the wildcards that are built into most SQL
> variants?
>
> SELECT * FROM table WHERE item_id LIKE '%#abcdef'
>
> Will select all records where the item_id field ends in '#abcdef'

That works if you know the user is always going to enter the last 7
characters of the product id, but that's not how the OP characterized
the problem. The OP talked about search strings where multiple
characters had been omitted from different parts of the product id.

Ben

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



RE: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi


> Even if the REGEXP has to change with every query?

Ben, it does not matter, this is not a PHP problem but a DB 
structure/select/insert/update problem.
Whatever REGEXP you use, a REGEXP is what you need to solve this problem, 
certainly not a PHP loop over each row with operations for each rows.

These things are OK if you do not know REGEXP or REGEXP MySQL syntax, but in 
this case you should ask for the correct REGEXP rather than talk about 
performances, obviously slower outside MySQL and via a runtime interpreted 
language as PHP is, or other solutions which aim is to end up with something 
that just emulate a select with REGEXP.

Did you get my point? Finally, when I say "you" I mean generally speaking :)

Regards

_
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread sono-io
	Thanks to everyone who has responded.  After reading everyone's  
response, I think I have a very simple way to solve my "problem".


	Using my original example, if someone wants to find item #  
4D-2448-7PS, no matter what they type in, I'll take the input, strip  
out all non-alphanumeric characters to make it 4D24487PS, add the  
wildcard character between each of the remaining characters like so,  
4*D*2*4*4*8*7*P*S, and then do the search.


	Still being new at this, it seems to be the simplest approach, or is  
my thinking flawed?  This also keeps me from having to add another  
field in the db to search on.


	BTW, this solution needs to work with any db, even ASCII files, so it  
has to happen in PHP.


Thanks again,
Frank

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



Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ashley Sheridan
On Thu, 2009-09-03 at 12:12 -0700, sono...@fannullone.us wrote:
>   Thanks to everyone who has responded.  After reading everyone's  
> response, I think I have a very simple way to solve my "problem".
> 
>   Using my original example, if someone wants to find item #  
> 4D-2448-7PS, no matter what they type in, I'll take the input, strip  
> out all non-alphanumeric characters to make it 4D24487PS, add the  
> wildcard character between each of the remaining characters like so,  
> 4*D*2*4*4*8*7*P*S, and then do the search.
> 
>   Still being new at this, it seems to be the simplest approach, or is  
> my thinking flawed?  This also keeps me from having to add another  
> field in the db to search on.
> 
>   BTW, this solution needs to work with any db, even ASCII files, so it  
> has to happen in PHP.
> 
> Thanks again,
> Frank
> 
For speed you might want to consider an extra field in the DB in the
future. If the database gets larger, or your query needs to join several
tables together, then things will take a noticeable speed hit. I had a
similar issue myself where I had to search for names based on
mis-spellings of them. In the end I searched with metaphone tags on an
extra field in the DB set up for that purpose, but it was the only way
to do it that didn't affect the speed of the site.

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




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



Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Eddie Drapkin
On Thu, Sep 3, 2009 at 3:17 PM, Ashley Sheridan 
wrote:
> On Thu, 2009-09-03 at 12:12 -0700, sono...@fannullone.us wrote:
>>       Thanks to everyone who has responded.  After reading everyone's
>> response, I think I have a very simple way to solve my "problem".
>>
>>       Using my original example, if someone wants to find item #
>> 4D-2448-7PS, no matter what they type in, I'll take the input, strip
>> out all non-alphanumeric characters to make it 4D24487PS, add the
>> wildcard character between each of the remaining characters like so,
>> 4*D*2*4*4*8*7*P*S, and then do the search.
>>
>>       Still being new at this, it seems to be the simplest approach, or is
>> my thinking flawed?  This also keeps me from having to add another
>> field in the db to search on.
>>
>>       BTW, this solution needs to work with any db, even ASCII files, so it
>> has to happen in PHP.
>>
>> Thanks again,
>> Frank
>>
> For speed you might want to consider an extra field in the DB in the
> future. If the database gets larger, or your query needs to join several
> tables together, then things will take a noticeable speed hit. I had a
> similar issue myself where I had to search for names based on
> mis-spellings of them. In the end I searched with metaphone tags on an
> extra field in the DB set up for that purpose, but it was the only way
> to do it that didn't affect the speed of the site.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Has anyone considered deploying an actual search engine (Solr, Sphinx,
etc.), as they will take care of the stripping, stemming, spelling
corrections, etc?

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



[PHP] Magento shows blank page.

2009-09-03 Thread Ricky Tompu Breaky
Dear my friends,

Anybody has ever the same experience as I am having now with PHP5CGI
and Magento?

I'm using Apache, MySQL and Mandriva 2009.1.

What I've done is:
1. Downloaded the Magento from:
http://www.magentocommerce.com/getmagento/1.3.2.3/magento-1.3.2.3.zip
and some other from is from:
http://www.magentocommerce.com/download/get-started ;
2. Decompressed and put it into: '/var/www/html/magento';
3. Defined in the '/etc/httpd/conf/httpd.conf' :
"

allow from all

";
4. I've create very2x simple php script in the directory of magento to
tes the php module:
"

". And the result is looks OK. I can see "tes php" in my webbrowser.

But the problem is once I visit the :
'http://127.0.0.1/magento/index.php' and the
'http://127.0.0.1/magento/install.php'; the result is totally
empty/blank.

Please share your knowledge and experience to me please.

I'm stuck now.

Thank you very much in advance.

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



Re: [PHP] Magento shows blank page.

2009-09-03 Thread Ashley Sheridan
On Fri, 2009-09-04 at 02:34 +0700, Ricky Tompu Breaky wrote:
> Dear my friends,
> 
> Anybody has ever the same experience as I am having now with PHP5CGI
> and Magento?
> 
> I'm using Apache, MySQL and Mandriva 2009.1.
> 
> What I've done is:
> 1. Downloaded the Magento from:
> http://www.magentocommerce.com/getmagento/1.3.2.3/magento-1.3.2.3.zip
> and some other from is from:
> http://www.magentocommerce.com/download/get-started ;
> 2. Decompressed and put it into: '/var/www/html/magento';
> 3. Defined in the '/etc/httpd/conf/httpd.conf' :
> "
> 
>   allow from all
> 
> ";
> 4. I've create very2x simple php script in the directory of magento to
> tes the php module:
> "
>  echo "tes php";
> ?>
> ". And the result is looks OK. I can see "tes php" in my webbrowser.
> 
> But the problem is once I visit the :
> 'http://127.0.0.1/magento/index.php' and the
> 'http://127.0.0.1/magento/install.php'; the result is totally
> empty/blank.
> 
> Please share your knowledge and experience to me please.
> 
> I'm stuck now.
> 
> Thank you very much in advance.
> 
A blank page with any PHP script is usually a good indication of a fatal
error where error messages are turned off. If this is a development
machine, turn errors on through the php.ini or .htaccess (you can't turn
them on via PHP as a syntax error there will prevent PHP from turning
error messages on). If it is a live server, then look to your error
logs.

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




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



Re: [PHP] Date Comparison

2009-09-03 Thread tedd

At 10:01 AM +0200 9/3/09, J DeBord wrote:

Telling someone RTFM is just rude and mean.


And not taking the time to research your question before posting is 
what, thoughtful and kind?


The phrase RTFM is something I don't like to tell people, and from 
what I remember, I have never said that to anyone. However I can 
understand where one could read a person's question and deduce that 
they did NO research for themselves. Instead, they posted their 
question for others to do their research for them because they were 
too lazy to do it themselves. No matter how you cut that, that's 
lame. So, I certainly don't blame anyone for telling such a person to 
RTFM.



 I would suggest
that when a question asked here causes you to respond with RTFM, don't
respond at all. Save yourself the time and trouble and save the person
asking the question the grief of being insulted.


Well that's your prerogative to do as you want. But it's a bit 
arrogant of you to tell others how to conduct themselves on this 
list, don't you think? Who made you list monitor?




And Tedd your condescending
response caused me to lose respect for you.


No offense, but let me make this perfectly clear -- I don't give a 
rat's ass what you think about me. From my perspective, you could win 
the lottery or die tomorrow, it makes no difference to me either way.


I'm not here to win/lose your respect. I'm here to help those who ask 
honest questions. I, like many others, simply donate our time freely 
without any benefit whatsoever. If you have problems with that, then 
you probably have bigger problems elsewhere.




I'm sure the OP would have been
more than thankful to receive the same response without the RTFM. I'll read
any response to this, but I won't have anything more to say. This list has
been polluted enough lately with nonsense. Incredible.


What's Incredible is how people can post to this list thinking that 
they have some right to post whatever they want and expect others to 
comment as they want. And, if they don't get what they want, then 
they whine about the list being rude and mean. That's Incredible.


My advice, if you have problems with this list, get over it! There's 
much more in this world to get upset about rather than what happens 
on this list.


tedd

---




On Sat, Aug 29, 2009 at 3:44 PM, tedd  wrote:


 At 1:01 PM -0400 8/28/09, David Stoltz wrote:


 Hey Stuart -

 RTFM yourselfI did read it, and obviously misunderstood...

 I'm really sorry to bother you. I thought that was what a listserv like
 this was for - to ask questions...

 I'll try not to ask questions I should know the answer to next time.



 Whoa dude!

 You just received advice from a brilliant man and you are bitching about
 it?!?

 Look child, you are being told what you should do by a professional who is
 donating his time freely to help you. Just how did you not understand that?

 So, just do what he advised and say "Thank you sir, may I have another?"

 I've posted some dumb-ass questions before, but only after I took the time
 to research the question myself. And when someone took the time to
 straighten me out and help, I appreciated it.

 Hopefully next time you'll read the manual and take the time to understand
 what you read -- it would cut down on post that demonstrate just how
 ignorant and thankless you are at this.

 Cheers,

 tedd

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

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





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

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



Re: [PHP] Just a tip from one of your peers

2009-09-03 Thread tedd

At 9:27 AM -0700 9/3/09, Jim Lucas wrote:
I want this to come across in the nicest way possible.  Please I 
mean no harm by my following statements.  And if you decide to hate 
me and never to respond to one of my posts again, well, that is your 
choice.




-snip-

After writing this, I guess it would be best to simply ask David to 
create a new email to the list each time that he has a different 
question.




If you are in question now about how you should behave on this list, 
please refer here:

http://us2.php.net/reST/php-src/README.MAILINGLIST_RULES

Jim Lucas


Jim:

Of course you are right.

But sometimes people don't realize that their email application keeps 
the old thread going when they hit reply (I speak from experience).


They need to understand that they must create a new email and use the 
php list address rather than just hitting reply and changing the 
subject line.


Cheers,

tedd

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

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



RE: [PHP] a doubt with class DOM

2009-09-03 Thread Carlos Garcia


Thanks for your answer, I change to class simplexml, the class DOM save all 
tree on RAM, and simplexml used a little RAM, right?

He size file XMl is small no more 500 kb, i do not think having problem.


Best regards.-

_Karl_

Sorry for my english.-

 
Carlos A. Garcia Hernandez



José Clemente Orozco Mza. 7 Lt. 14 Pedro Ojeda Paullada Ecatepec, Edo. De 
México / T: +(52 55) 57809620 / E: carlos.gar...@imkarl.net / W: www.imkarl.net
 
Por favor considere sus responsabilidades ecológicas, no imprima este documento 
a menos que sea realmente necesario. / Please consider your ecological 
responsibilities. Don't print this e-mail unless you really need to.
 
AVISO DE CONFIDENCIALIDAD: Este mensaje de correo electrónico incluyendo en su 
caso los archivos adjuntos al mismo, pueden contener información de carácter 
confidencial y/o privilegiada, y se envían única y exclusivamente a la atención 
de la persona y/o entidad a quien va dirigido. La copia, revisión, uso, 
revelación y/o distribución de dicha información, sin autorización por escrito 
de Carlos A. García Hernández está prohibida. Si usted no es el destinatario a 
quien se dirige el presente correo, favor de contactar al remitente 
respondiendo al presente correo y eliminar el original incluyendo los archivos, 
así como cualesquiera copia del mismo. Mediante la recepción del presente 
correo usted reconoce y acepta que en caso de incumplimiento de su parte y/o de 
sus representantes a los términos antes descritos, Carlos A. García Hernández 
tendrá derecho a los daños y perjuicios que esto le ocasione.


CONFIDENTIALITY NOTICE: This e-mail message including attachments, may contain 
confidential and/or privileged material and only for the person or entity to 
which it is addressed. Any use, review, disclosure or distribution of such 
confidential information without the written authorization of Carlos A. García 
Hernández is prohibited. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message 
including attachments. By receiving this e-mail you acknowledge that a breach 
by you and/or your representatives of the above provisions may entitle Carlos 
A. García Hernández to seek for damages.


 

> Date: Thu, 3 Sep 2009 05:41:29 -0700
> From: xwis...@yahoo.com
> To: son_gohan_k...@hotmail.com
> CC: php-general@lists.php.net
> Subject: Re: [PHP] a doubt with class DOM
> 
> 
> It works ok for me and I think it's very reliable. You might want to run a 
> few test on it though.
> 
> Another approach is to break up your xml into smaller documents and then use 
> php string functions to merge them together.
> 
> __
> Raymond Irving
> Rich Ajax/PHP Development 
> http://raxanpdi.com
> 
> 
> --- On Wed, 9/2/09, Carlos Garcia  wrote:
> 
> From: Carlos Garcia 
> Subject: [PHP] a doubt with class DOM
> To: php-general@lists.php.net
> Date: Wednesday, September 2, 2009, 1:02 AM
> 
> 
> 
> if my xml is something big, how reliable is saving changes to my xml this way:
> 
> 
> 
> $doc->save('file.xml');
> 
> 
> 
> or another shape of save changes of my xml?
> 
> 
> 
> Sorry my english is bad =P.-
> 
> 
> 
> Thanks.-
> 
> 
> 
> Best regards, Karl.-
> 
> Carlos A. Garcia Hernandez
> 
> 
> 
> José Clemente Orozco Mza. 7 Lt. 14 Pedro Ojeda Paullada Ecatepec, Edo. De 
> México / T: +(52 55) 57809620 / E: carlos.gar...@imkarl.net / W: 
> www.imkarl.net
> 
> Por favor considere sus responsabilidades ecológicas, no imprima este 
> documento a menos que sea realmente necesario. / Please consider your 
> ecological responsibilities. Don't print this e-mail unless you really need 
> to.
> 
> AVISO DE CONFIDENCIALIDAD: Este mensaje de correo electrónico incluyendo en 
> su caso los archivos adjuntos al mismo, pueden contener información de 
> carácter confidencial y/o privilegiada, y se envían única y exclusivamente a 
> la atención de la persona y/o entidad a quien va dirigido. La copia, 
> revisión, uso, revelación y/o distribución de dicha información, sin 
> autorización por escrito de Carlos A. García Hernández está prohibida. Si 
> usted no es el destinatario a quien se dirige el presente correo, favor de 
> contactar al remitente respondiendo al presente correo y eliminar el original 
> incluyendo los archivos, así como cualesquiera copia del mismo. Mediante la 
> recepción del presente correo usted reconoce y acepta que en caso de 
> incumplimiento de su parte y/o de sus representantes a los términos antes 
> descritos, Carlos A. García Hernández tendrá derecho a los daños y perjuicios 
> que esto le ocasione.
> 
> 
> CONFIDENTIALITY NOTICE: This e-mail message including attachments, may 
> contain confidential and/or privileged material and only for the person or 
> entity to which it is addressed. Any use, review, disclosure or distribution 
> of such confidential information without the written authorization of Carlos 
> A. García Hernández is prohibited. If you are not the intended recipient, 

Re: [PHP] Magento shows blank page.

2009-09-03 Thread Ricky Tompu Breaky
Dear Ashley.

Firstly, thank you very much for your respond.

I uncommented this part of '/etc/php.ini':
"
display_errors
   Default Value: On
   Development Value: On
   Production Value: Off
".

The result is my magento shows this in my webbrowser:
"
.:
Fatal error: Method Varien_Object::__tostring() cannot take arguments
in /var/www/html/magento/lib/Varien/Object.php on line 488
"

So I had a look into the '/var/www/html/magento/lib/Varien/Object.php
on line 488':
from line of 484-510:
"
...
public function __toString(array $arrAttributes = array(),
$valueSeparator=',') {
$arrData = $this->toArray($arrAttributes);
return implode($valueSeparator, $arrData);
}

/**
 * Public wrapper for __toString
 *
 * Will use $format as an template and substitute {{key}} for
attributes *
 * @param string $format
 * @return string
 */
public function toString($format='')
{
if (empty($format)) {
$str = implode(', ', $this->getData());
} else {
preg_match_all('/\{\{([a-z0-9_]+)\}\}/is', $format,
$matches); foreach ($matches[1] as $var) {
$format = str_replace('{{'.$var.'}}',
$this->getData($var), $format); }
$str = $format;
}
return $str;
}
...
".

Sigh. I still don't understand where the problem located.

Please tell me what problem is it actualy?

On Thu, 03 Sep 2009 20:35:31 +0100
Ashley Sheridan  wrote:

> On Fri, 2009-09-04 at 02:34 +0700, Ricky Tompu Breaky wrote:
> > Dear my friends,
> > 
> > Anybody has ever the same experience as I am having now with PHP5CGI
> > and Magento?
> > 
> > I'm using Apache, MySQL and Mandriva 2009.1.
> > 
> > What I've done is:
> > 1. Downloaded the Magento from:
> > http://www.magentocommerce.com/getmagento/1.3.2.3/magento-1.3.2.3.zip
> > and some other from is from:
> > http://www.magentocommerce.com/download/get-started ;
> > 2. Decompressed and put it into: '/var/www/html/magento';
> > 3. Defined in the '/etc/httpd/conf/httpd.conf' :
> > "
> > 
> > allow from all
> > 
> > ";
> > 4. I've create very2x simple php script in the directory of magento
> > to tes the php module:
> > "
> >  > echo "tes php";
> > ?>
> > ". And the result is looks OK. I can see "tes php" in my webbrowser.
> > 
> > But the problem is once I visit the :
> > 'http://127.0.0.1/magento/index.php' and the
> > 'http://127.0.0.1/magento/install.php'; the result is totally
> > empty/blank.
> > 
> > Please share your knowledge and experience to me please.
> > 
> > I'm stuck now.
> > 
> > Thank you very much in advance.
> > 
> A blank page with any PHP script is usually a good indication of a
> fatal error where error messages are turned off. If this is a
> development machine, turn errors on through the php.ini or .htaccess
> (you can't turn them on via PHP as a syntax error there will prevent
> PHP from turning error messages on). If it is a live server, then
> look to your error logs.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 


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



Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Tommy Pham
- Original Message 
> From: "sono...@fannullone.us" 
> To: PHP General List 
> Sent: Thursday, September 3, 2009 12:12:40 PM
> Subject: Re: [PHP] Searching on AlphaNumeric Content Only
> 
> Thanks to everyone who has responded.  After reading everyone's response, 
> I 
> think I have a very simple way to solve my "problem".
> 
> Using my original example, if someone wants to find item # 4D-2448-7PS, 
> no 
> matter what they type in, I'll take the input, strip out all non-alphanumeric 
> characters to make it 4D24487PS, add the wildcard character between each of 
> the 
> remaining characters like so, 4*D*2*4*4*8*7*P*S, and then do the search.

The correct wildcard syntax to work in any DB (Oracle, MySQL, MSSQL, etc), is % 
and not * if I remember correctly.  Searching like this is ok but won't be 
efficient when you have a lot of rows.  As for external file processing txt, 
csv, etc... I recommend you create a separate mechanism for it since each 
storage medium is meant for different purposes.  txt (both delimited and fix 
formatted) and csv are usually meant for importing/exporting between various 
RDBMS types and different companies.  They're not mean for fast searching of 
data.  I suggest you think about the amount of the data you have to deal with 
1st and how often will the search be done on that data.  It's probably easier 
and faster just to import the ascii into db and do you search on db if you have 
to work with any ascii.

As for adding another field to the db, perhaps your project just started?  If 
so, wouldn't it be better to do it with the future in mind so later you won't 
have to go back and redesign the db and modify the codes because now you have 
over 100k rows to search and the search occurs just about every other hits?  
That time you now have could be used for code optimizing for better 
performance, add more features/functionalities to the site, etc... :)  Trust 
me, searching the db table with over 200k rows and return the results with 
multi-table joins based 1 criteria isn't fun.  Keep in mind that you shouldn't 
keep the users waiting more than 5 seconds.  Only exception to that rule is 
data mining where you'll have millions of rows to work with ;)  Then it's no 
longer your problem.  It's the DBA :D

Regards,
Tommy

> 
> Still being new at this, it seems to be the simplest approach, or is my 
> thinking flawed?  This also keeps me from having to add another field in the 
> db 
> to search on.
> 
> BTW, this solution needs to work with any db, even ASCII files, so it has 
> to 
> happen in PHP.
> 
> Thanks again,
> Frank
> 
> --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] reply to all

2009-09-03 Thread Tommy Pham
Hi all,

As you've probably noticed, I'm new the list.  My apologies if you're getting 
duplicates+ from my responses.  I just realized now that PHP lists doesn't 
strip out other e-mail addresses other than the list's.  The other lists I 
subscribe to does this automatically and I've taken it for granted.  I'll keep 
my eyes open wider for future e-mails to php lists :)

Thanks,
Tommy


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



Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Paul M Foster
On Thu, Sep 03, 2009 at 12:12:40PM -0700, sono...@fannullone.us wrote:

>   Thanks to everyone who has responded.  After reading everyone's
> response, I think I have a very simple way to solve my "problem".
>
>   Using my original example, if someone wants to find item #
> 4D-2448-7PS, no matter what they type in, I'll take the input, strip
> out all non-alphanumeric characters to make it 4D24487PS, add the
> wildcard character between each of the remaining characters like so,
> 4*D*2*4*4*8*7*P*S, and then do the search.

Your expression, if used to directly search in your SQL table, won't
work. The '*' character isn't a valid wildcard for SQL. In PostgreSQL,
the wildcard for any number of characters is '%', and for a single
character is '_'. I don't know that MySQL understands this same
convention. And who knows about Oracle.

As others have mentioned, it would be ideal (though not very
"normalized") to create a new table column which contains the
alphanumerics without the punctuation characters ('-'). In nearly any
SQL dialect, you could do a simple SELECT using LIKE to find your item,
if you're searching on this extra field.

If you want do the searching in PHP, then it becomes more complicated.
You'll have to strip out the dashes from the user input, and then query
all the keys from your table, and test them using a regular expression.
As mentioned before, this is time-consuming for a large table.

Here's something else to consider: Could there ever be two items which
only differ by the placement of their dashes? Like 4D-2448-7PS versus
4D2-44-87PS? If not, then you should store the item number without
punctuation, and use that as the primary key on your table. Have an
"extra" field which shows the item number with dashes. You can use this
extra field in printing inventory labels or whatever (I don't recall the
context of your original post).

Paul

-- 
Paul M. Foster

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



Re: [PHP] Magento shows blank page.

2009-09-03 Thread Tommy Pham
- Original Message 
> From: Ricky Tompu Breaky 
> To: php-general@lists.php.net
> Sent: Thursday, September 3, 2009 12:34:06 PM
> Subject: [PHP] Magento shows blank page.
> 
> Dear my friends,
> 
> Anybody has ever the same experience as I am having now with PHP5CGI
> and Magento?

I haven't had any experience with Magento but I've had nothing but bad 
experiences with PHP's CGI/FCGI.  For security reasons, it's strongly 
recommended
that you'll have to use doc_root in the ini.  This however will break some of
my apps running in virtual directory mappings of the physical directory outside 
doc_root
in both IIS and Apache.  So I went back to ISAPI and Apache Filter.  I don't 
know if this applies to you but something to think about,

Regards,
Tommy

> 
> I'm using Apache, MySQL and Mandriva 2009.1.
> 
> What I've done is:
> 1. Downloaded the Magento from:
> http://www.magentocommerce.com/getmagento/1.3.2.3/magento-1.3.2.3.zip
> and some other from is from:
> http://www.magentocommerce.com/download/get-started ;
> 2. Decompressed and put it into: '/var/www/html/magento';
> 3. Defined in the '/etc/httpd/conf/httpd.conf' :
> "
> 
> allow from all
> 
> ";
> 4. I've create very2x simple php script in the directory of magento to
> tes the php module:
> "
> > echo "tes php";
> ?>
> ". And the result is looks OK. I can see "tes php" in my webbrowser.
> 
> But the problem is once I visit the :
> 'http://127.0.0.1/magento/index.php' and the
> 'http://127.0.0.1/magento/install.php'; the result is totally
> empty/blank.
> 
> Please share your knowledge and experience to me please.
> 
> I'm stuck now.
> 
> Thank you very much in advance.
> 
> -- 
> 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] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi

stripping, stemming, spelling corrections ?
 ... uhm, that's probably why they invented regular expressions, isn't it?

As I said, at the end of the day, this will be a manual slow, potentially wrong 
implementation of what we already have and use on daily basis.

But obviously, everybody is free to create his own problems, no doubts about 
that.

Regards

> Has anyone considered deploying an actual search engine (Solr, Sphinx,
> etc.), as they will take care of the stripping, stemming, spelling
> corrections, etc?


_
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx

Re: [PHP] Magento shows blank page.

2009-09-03 Thread Ricky Tompu Breaky
After googling.

I followed this thread:
"
http://spikomoko.wordpress.com/2009/08/19/magento-not-working-on-php-5-3/
".

But then, I'm bounched on this error in my webbrowser for visitting my
magento on my production server desktop:
"
.:
Fatal error: Call to a member function createDirIfNotExists() on a
non-object in /var/www/html/magento/app/Mage.php on line 644
".

Please keep telling me, where is the mistake.

Thank you very much.
===
On Fri, 4 Sep 2009 03:01:08 +0700
Ricky Tompu Breaky  wrote:

> Dear Ashley.
> 
> Firstly, thank you very much for your respond.
> 
> I uncommented this part of '/etc/php.ini':
> "
> display_errors
>Default Value: On
>Development Value: On
>Production Value: Off
> ".
> 
> The result is my magento shows this in my webbrowser:
> "
> .:
> Fatal error: Method Varien_Object::__tostring() cannot take arguments
> in /var/www/html/magento/lib/Varien/Object.php on line 488
> "
> 
> So I had a look into the '/var/www/html/magento/lib/Varien/Object.php
> on line 488':
> from line of 484-510:
> "
> ...
> public function __toString(array $arrAttributes = array(),
> $valueSeparator=',') {
> $arrData = $this->toArray($arrAttributes);
> return implode($valueSeparator, $arrData);
> }
> 
> /**
>  * Public wrapper for __toString
>  *
>  * Will use $format as an template and substitute {{key}} for
> attributes *
>  * @param string $format
>  * @return string
>  */
> public function toString($format='')
> {
> if (empty($format)) {
> $str = implode(', ', $this->getData());
> } else {
> preg_match_all('/\{\{([a-z0-9_]+)\}\}/is', $format,
> $matches); foreach ($matches[1] as $var) {
> $format = str_replace('{{'.$var.'}}',
> $this->getData($var), $format); }
> $str = $format;
> }
> return $str;
> }
> ...
> ".
> 
> Sigh. I still don't understand where the problem located.
> 
> Please tell me what problem is it actualy?
> 
> On Thu, 03 Sep 2009 20:35:31 +0100
> Ashley Sheridan  wrote:
> 
> > On Fri, 2009-09-04 at 02:34 +0700, Ricky Tompu Breaky wrote:
> > > Dear my friends,
> > > 
> > > Anybody has ever the same experience as I am having now with
> > > PHP5CGI and Magento?
> > > 
> > > I'm using Apache, MySQL and Mandriva 2009.1.
> > > 
> > > What I've done is:
> > > 1. Downloaded the Magento from:
> > > http://www.magentocommerce.com/getmagento/1.3.2.3/magento-1.3.2.3.zip
> > > and some other from is from:
> > > http://www.magentocommerce.com/download/get-started ;
> > > 2. Decompressed and put it into: '/var/www/html/magento';
> > > 3. Defined in the '/etc/httpd/conf/httpd.conf' :
> > > "
> > > 
> > >   allow from all
> > > 
> > > ";
> > > 4. I've create very2x simple php script in the directory of
> > > magento to tes the php module:
> > > "
> > >  > > echo "tes php";
> > > ?>
> > > ". And the result is looks OK. I can see "tes php" in my
> > > webbrowser.
> > > 
> > > But the problem is once I visit the :
> > > 'http://127.0.0.1/magento/index.php' and the
> > > 'http://127.0.0.1/magento/install.php'; the result is totally
> > > empty/blank.
> > > 
> > > Please share your knowledge and experience to me please.
> > > 
> > > I'm stuck now.
> > > 
> > > Thank you very much in advance.
> > > 
> > A blank page with any PHP script is usually a good indication of a
> > fatal error where error messages are turned off. If this is a
> > development machine, turn errors on through the php.ini or .htaccess
> > (you can't turn them on via PHP as a syntax error there will prevent
> > PHP from turning error messages on). If it is a live server, then
> > look to your error logs.
> > 
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> > 
> > 
> > 
> 
> 


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



Re: [PHP] Magento shows blank page.

2009-09-03 Thread Ben Dunlap
> I followed this thread:
> "
> http://spikomoko.wordpress.com/2009/08/19/magento-not-working-on-php-5-3/
> ".
>
> But then, I'm bounched on this error in my webbrowser for visitting my
> magento on my production server desktop:
> "
> .:
> Fatal error: Call to a member function createDirIfNotExists() on a
> non-object in /var/www/html/magento/app/Mage.php on line 644

Sounds like your version of Magento isn't compatible with PHP 5.3 (and
perhaps less-recent releases also?).

Is there a newer version of Magento available?

Ben

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



Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
>
> stripping, stemming, spelling corrections ?
>  ... uhm, that's probably why they invented regular expressions, isn't it?
>
> As I said, at the end of the day, this will be a manual slow, potentially 
> wrong implementation of what we already have and use on daily basis.

If you've got a regular-expression-based method in mind that simply
nails the OP's problem, please share. I'm still not seeing how
"regular expressions" is a sufficient answer to the OP's problem,
which is basically fuzzy search.

My sense is that regular expressions are for situations where you
basically know just what you're searching for, but don't really know
where it falls in your search space.

The OP, on the other hand, is building a system where he won't know
just what he's searching for -- all he'll know is that his search key
is "sort of like" the thing he actually needs to find.

You might be able to squeeze this problem, or at least some part of
it, into a regex-based solution, but I don't think it's a natural fit.

Ben

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