[PHP] Re: A really wacky design decision

2009-10-03 Thread Ralph Deffke
u increment after! asigning, so far so good, but for math reasons the
interpreter has to keep in mind the 123 you want to assign before increment
to the same var.

this is absolutely correct what php does here.

$num = ++$num; would print 124
the same like
$num++;

on the other hand this is just bullshit I would release any programmer using
that type of code.

ralph_def...@yahoo.de

clanc...@cybec.com.au wrote in message
news:8fudc5tc6qvfj4n297kvjlqd3s7sjdk...@4ax.com...
 Daevid Vincent is surprised that:

 $num = 123;
 $num = $num++;
 print $num;  //this prints 123 and not 124 ?!!

 To me this is relatively logical. As I understand it, the post-increment
operator says do
 something with the variable, and then increment it. The trouble in this
case is that we
 are doing something irrational; we are copying the number back to itself,
and to me it is
 reasonably logical (or at least no less illogical than the alternative) to
assume that if
 we copy it to itself, then increment the original version, the copy will
not be
 incremented.

 However there is one feature of PHP which, to my mind, is really bad
design. How many of
 you can see anything wrong with the following procedure to search a list
of names for a
 particular name?

 $i = 0; $j = count ($names); while ($i  $j)
 { if ($names[$i] == $target) { break; }
 ++$i;
 }

 As long as the names are conventional names, this procedure is probably
safe to use.
 However if you allow the names to be general alphanumeric strings, it is
not reliable. One
 of my programs recently broke down in one particular case, and when I
eventually isolated
 the bug I discovered that it was matching '2260' to '226E1'. (The logic of
this is: 226E1
 = 226*10^1 = 2260).

 I agree that I was well aware of this trap, and that I should not have
used a simple
 comparison, but it seems to me to be a bizarre design decision to assume
that anything
 which can be converted to an integer, using any of the available
notations, is in fact an
 integer, rather than making the default to simply treat it as a string. It
is also a trap
 that it is very easy to fall into if you start off thinking about simple
names, and then
 extend (or borrow) the procedure to use more general strings.

 And can anyone tell me whether, in the above case, it is sufficient to
write simply:
 if ((string) $names[$i] == $target),

 or should I write:
 if ((string) $names[$i] == (string) $target)?

 (I decided to play safe and use strcmp ().)




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



Re: [PHP] Re: A really wacky design decision

2009-10-03 Thread Ralph Deffke
yes for using
$num = $num++;
yes !!

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1254577641.2385.7.ca...@localhost...
 On Sat, 2009-10-03 at 15:33 +0200, Ralph Deffke wrote:
  u increment after! asigning, so far so good, but for math reasons the
  interpreter has to keep in mind the 123 you want to assign before
increment
  to the same var.
 
  this is absolutely correct what php does here.
 
  $num = ++$num; would print 124
  the same like
  $num++;
 
  on the other hand this is just bullshit I would release any programmer
using
  that type of code.
 
  ralph_def...@yahoo.de
 
  clanc...@cybec.com.au wrote in message
  news:8fudc5tc6qvfj4n297kvjlqd3s7sjdk...@4ax.com...
   Daevid Vincent is surprised that:
  
   $num = 123;
   $num = $num++;
   print $num;  //this prints 123 and not 124 ?!!
  
   To me this is relatively logical. As I understand it, the
post-increment
  operator says do
   something with the variable, and then increment it. The trouble in
this
  case is that we
   are doing something irrational; we are copying the number back to
itself,
  and to me it is
   reasonably logical (or at least no less illogical than the
alternative) to
  assume that if
   we copy it to itself, then increment the original version, the copy
will
  not be
   incremented.
  
   However there is one feature of PHP which, to my mind, is really bad
  design. How many of
   you can see anything wrong with the following procedure to search a
list
  of names for a
   particular name?
  
   $i = 0; $j = count ($names); while ($i  $j)
   { if ($names[$i] == $target) { break; }
   ++$i;
   }
  
   As long as the names are conventional names, this procedure is
probably
  safe to use.
   However if you allow the names to be general alphanumeric strings, it
is
  not reliable. One
   of my programs recently broke down in one particular case, and when I
  eventually isolated
   the bug I discovered that it was matching '2260' to '226E1'. (The
logic of
  this is: 226E1
   = 226*10^1 = 2260).
  
   I agree that I was well aware of this trap, and that I should not have
  used a simple
   comparison, but it seems to me to be a bizarre design decision to
assume
  that anything
   which can be converted to an integer, using any of the available
  notations, is in fact an
   integer, rather than making the default to simply treat it as a
string. It
  is also a trap
   that it is very easy to fall into if you start off thinking about
simple
  names, and then
   extend (or borrow) the procedure to use more general strings.
  
   And can anyone tell me whether, in the above case, it is sufficient to
  write simply:
   if ((string) $names[$i] == $target),
  
   or should I write:
   if ((string) $names[$i] == (string) $target)?
  
   (I decided to play safe and use strcmp ().)
  
 
 
 
 You'd release a programmer for using the incremental operators for self
 assignation?

 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] Re: A really wacky design decision

2009-10-03 Thread Ralph Deffke
this is a clear sign that somebody is on a sin TRAIL, I would not even spend
the time on  what sin collections this guy got

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1254577986.2385.8.ca...@localhost...
 On Sat, 2009-10-03 at 15:46 +0200, Ralph Deffke wrote:

  yes for using
  $num = $num++;
  yes !!
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1254577641.2385.7.ca...@localhost...
   On Sat, 2009-10-03 at 15:33 +0200, Ralph Deffke wrote:
u increment after! asigning, so far so good, but for math reasons
the
interpreter has to keep in mind the 123 you want to assign before
  increment
to the same var.
   
this is absolutely correct what php does here.
   
$num = ++$num; would print 124
the same like
$num++;
   
on the other hand this is just bullshit I would release any
programmer
  using
that type of code.
   
ralph_def...@yahoo.de
   
clanc...@cybec.com.au wrote in message
news:8fudc5tc6qvfj4n297kvjlqd3s7sjdk...@4ax.com...
 Daevid Vincent is surprised that:

 $num = 123;
 $num = $num++;
 print $num;  //this prints 123 and not 124 ?!!

 To me this is relatively logical. As I understand it, the
  post-increment
operator says do
 something with the variable, and then increment it. The trouble in
  this
case is that we
 are doing something irrational; we are copying the number back to
  itself,
and to me it is
 reasonably logical (or at least no less illogical than the
  alternative) to
assume that if
 we copy it to itself, then increment the original version, the
copy
  will
not be
 incremented.

 However there is one feature of PHP which, to my mind, is really
bad
design. How many of
 you can see anything wrong with the following procedure to search
a
  list
of names for a
 particular name?

 $i = 0; $j = count ($names); while ($i  $j)
 { if ($names[$i] == $target) { break; }
 ++$i;
 }

 As long as the names are conventional names, this procedure is
  probably
safe to use.
 However if you allow the names to be general alphanumeric strings,
it
  is
not reliable. One
 of my programs recently broke down in one particular case, and
when I
eventually isolated
 the bug I discovered that it was matching '2260' to '226E1'. (The
  logic of
this is: 226E1
 = 226*10^1 = 2260).

 I agree that I was well aware of this trap, and that I should not
have
used a simple
 comparison, but it seems to me to be a bizarre design decision to
  assume
that anything
 which can be converted to an integer, using any of the available
notations, is in fact an
 integer, rather than making the default to simply treat it as a
  string. It
is also a trap
 that it is very easy to fall into if you start off thinking about
  simple
names, and then
 extend (or borrow) the procedure to use more general strings.

 And can anyone tell me whether, in the above case, it is
sufficient to
write simply:
 if ((string) $names[$i] == $target),

 or should I write:
 if ((string) $names[$i] == (string) $target)?

 (I decided to play safe and use strcmp ().)

   
   
   
   You'd release a programmer for using the incremental operators for
self
   assignation?
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
 
 
 

 To be honest, of all the programming sins, this is not one to fire
 someone for. Have a look at the daily wtf and you'll see what i mean!

 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] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-03 Thread Ralph Deffke
Ben,

might be intersting to consider that in ur c axample u r working with a pure
memory position, while php works with references. thry it with pointers it
I'm pretty shure u get the same result as in PHP.

I'm not shure, because I don't work in perl, but doesn't per work on
references as well ?

ralph_def...@yahoo.de

Ben Dunlap bdun...@agentintellect.com wrote in message
news:7997e80e0910021458h20ebd75dtfc51f9264f351...@mail.gmail.com...
 mind-blowing. What the heck /is/ supposed to happen when you do this:

 $a = 2;
 $a = $a++;
 echo $a;

 Seems like any way you slice it the output should be 3. I guess what's

... and, in fact, that /is/ how C behaves. The following code:

int a = 2;
a = a++;
printf(a = [%d]\n, a);

Will output a = [3]. At least on Ubuntu 9 using gcc 4.3.3.

So I retract my initial terse reply and apologize for misunderstanding
your question.

Ben



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



Re: [PHP] Where's my memory going?!

2009-09-30 Thread Ralph Deffke
Hi Philip,

before u start running arround and taking ur hand on major changes I would
like u to concider the following:

the way u use the memory_get_usage() is incomplete use the function like
memory_get_usage( true ) if this is set the REAL SIZE OF MEMORY ALLOCATED
FROM THE SYSTEM is shown.

some posters gave u little winks, like has the garbage collection been run?

freeing the results is important, it means the memory is available for other
data, but it does not necesarily mean it is reported just a step later as
free! u are running on concurrent os.

the only way u can test that is in real world. clean the whole application
with the free_result_set and see the effect.

I'm personaly not shure if the memory allocated for result sets for MySQL
are reported as used by PHP anyway. It might be that the amount of memory is
not shown as PHP used even if u set real_usage = true. it is something to
test.

I think the way u tested the effect of freeing the results is just wrong.

hope that helps

ralph_def...@yahoo.de



u came up with the problem that ur server is running out of memory.
Philip Thompson philthath...@gmail.com wrote in message
news:098d2158-9199-4983-aec4-6ffb06c1c...@gmail.com...
 On Sep 29, 2009, at 6:15 PM, Eddie Drapkin wrote:

  On Tue, Sep 29, 2009 at 6:51 PM, Jim Lucas li...@cmsws.com wrote:
  Philip Thompson wrote:
  On Sep 29, 2009, at 4:38 PM, Jim Lucas wrote:
 
  Philip Thompson wrote:
  On Sep 28, 2009, at 4:40 PM, jeff brown wrote:
 
  Yes, that's the best way to clean up after yourself.  And you
  really
  should use that on anything you have sitting around daemon like.
 
  Jeff
 
  Philip Thompson wrote:
  On Sep 28, 2009, at 4:27 PM, Ralph Deffke wrote:
  well this sound clearly to me like you are not freeing
  resultsets
  you are not going to use anymore. In long scripts you have to
  take
  care of this. on short scripts you can be a bit weak on that,
  because the resultsets are closed and freed on script ending.
 
  assumed u r using MySQL are u using mysql_free_result($result)
 
  goog luck
 
  ralph_def...@yahoo.de
 
 
  Philip Thompson philthath...@gmail.com wrote in message
  news:9c0b9c4c-5e64-4519-862b-8a3e1da4d...@gmail.com...
  Hi all.
 
  I have a script that opens a socket, creates a persistent
  mysql
  connection, and loops to receive data. When the amount of
  specified
  data has been received, it calls a class which processes the
  data
  and
  inserts it into the database. Each iteration, I unset/
  destruct that
  class I call. However, the script keeps going up in memory and
  eventually runs out, causing a fatal error. Any thoughts on
  where to
  start to see where I'm losing my memory?
 
  Thanks in advance,
  ~Philip
  I am not using mysql_free_result(). Is that highly recommended
  by all?
  Thanks,
  ~Philip
 
  I took your suggestions and made sure to clean up after myself.
  I'm
  running into something that *appears* to be a bug with
  mysql_free_result(). Here's a snippet of my db class.
 
  ?php
  class db {
 function fetch ($sql, $assoc=false)
 {
 echo \nMemory usage before query:  . number_format
  (memory_get_usage ()) . \n;
 $resultSet = $this-query($sql);
 echo Memory usage after  query:  . number_format
  (memory_get_usage ()) . \n;
 
 if (!$assoc) { $result = $this-fetch_row($resultSet); }
 else {
 $result = $this-fetch_array($resultSet);
 echo Memory usage after  fetch:  . number_format
  (memory_get_usage ()) . \n;
 }
 
 $this-freeResult($resultSet);
 echo Memory usage after   free:  . number_format
  (memory_get_usage ()) . \n;
 
 return $result;
 }
 
 function freeResult ($result)
 {
 if (is_resource ($result)) {
 if (!mysql_free_result ($result)) { echo Memory
  could not
  be freed\n; }
 }
 unset ($result); // For good measure
 }
 
 function fetch_row ($set) {
 return mysql_fetch_row ($set);
 }
 
 function fetch_array ($set) {
 return mysql_fetch_array ($set, MYSQL_ASSOC);
 }
  }
 
  // I seem to be losing memory when I call this
  $db-fetch($sql);
  ?
 
  The result I get with this is...
 
  Memory usage before query: 6,406,548
  Memory usage after  query: 6,406,548
  Memory usage after  fetch: 6,406,548
  Memory usage after   free: 6,406,572
 
  As you may notice, the memory actually goes UP after the
  *freeing* of
  memory. Why is this happening?! What have I done wrong? Is this
  a bug?
  Any thoughts would be appreciated.
 
 
  First off, my question would be, is your query actually working?
  Because I
  would imagine that if you were getting results back from the DB,
  that
  the amount
  of memory being used would increase between step 1  2.
 
  Check to make sure that you are getting results.
 
  I'm confident the queries are working (there's many of them and I
  know
  the data they're returning is correct), but they may not always

[PHP] Re: turning off a E_STRICT or fix for a bad coding habit

2009-09-27 Thread Ralph Deffke
Hi Viraj,

well from the viewpoint of the PHP developers, it depends if u allow to
extend a class before it is been declared. If it is allowed that way, then
yes you are right none of the sniped should create an error. If u study the
bug report, u will see that the class is extended before it is declared. If
u have to declare a calss before u can extend it and it is set as a rule,
then yes the interpreter should fire an error.

I think in your code must be something similar to this, extention before
declaration. I'm not shure but if PHP goes towards variable declaration
feature ( PHP 6 ? ), the result would be that extention of a class before
declaration will be prohibited.

Right now it seems to me that the interpreter is allowing extention before
declaration, however takes the first overwriting method as its declaration
and of course that would fire the error you have.

I personally have no such problems, as since ever I try to program in the
way strict languages like JAVA require and found it as best practice. That
means e.g. declaration strict before extention/use of functions and classes.
I also avoid even NOTICE messages.

One last thing, an entry in the PHP buglist doesn't mean it is a bug.

It would be helpfull to see the complete code firing this error, but I
assume its a bit large to sniip here.

ralph_def...@yahoo.de


viraj kali...@gmail.com wrote in message
news:74721f460909270203s723480d3u361ca9a18da43...@mail.gmail.com...
 just upgraded to php 5.2.10-2.2 on debian

 now i get this error

 [2048] Declaration of form::bindData() should be compatible with that
 of db::bindData()

 i use __autoload to load these classes.. found this bug report
 http://bugs.php.net/bug.php?id=46851, i thought it's this new E_STRICT
 bit and tried to turn it off, but didn't help.

 this code was working perfect before.. even with this error.. it
 works. any idea about a workaround? or some reading suggestions!

 many thanks

 ~viraj



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



Re: [PHP] Re: Does anyone here use TCPDF?

2009-09-24 Thread Ralph Deffke
Hi Dave,

if its the case u could do a good deal, why u don't climp urself into the
pdf format? It is nothing else then a presentation format, not magic,
complicated and huge yes, but at the end just a text file. I am not that pdf
specialist, but I know at least for the older pdf formats the enconding is
open and well documented. I have a book on my shelf called 'pdf bible' an it
explains the pdf byte code.

Another idea would be to contact all the companies creating these pdf
converters (html pdf, word-pdf, pdf-word) they should be able to tell u the
answer.

And even may be there is a programm u could use in a OS batch process to put
ur text in.
At least just contact Adobe and ask them how to do it, u might get an
answer.

sorry thats all I have coming up in my mind for now.

ralph_def...@yahoo.de

Dave M G mar...@autotelic.com wrote in message
news:4abb1e10.9070...@autotelic.com...
 Ralph, Paul,

 Thank you for responding.

  I don't use TCPDF; I use FPDF, but I imagine the drill is about the same
 
 I tried using FPDF, but it did not support UTF-8/Japanese. It claims
 some support in the documentation, but after much experimentation, I
 verified it does not. That is why I switched to TCPDF.

  What you're asking sounds like you want to *edit* an existing PDF via a
  PHP class,

 No, I just want to write on top of it. And that was possible with
 FPDI/FPDF, but I had to abandon those as they did not support Japanese.

 I attempted to use the same functions as FPDI/FPDF, but they did not
 work in TCPDF.

  have a look in the archive of this list. there is a topic writing
japanese
  test in an excisting pdf its of 31. of August, this should help
 

 That was a thread I started. Things have changed slightly since I now
 know that only TCPDF supports Japanese.

 So I still need to know if/how to write text into a PDF, like I did with
 FPDF, but with TCPDF instead.

 If this turns out to not be possible, I am going to be suffering a great
 deal.

 -- 
 Dave M G



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



Re: [PHP] Re: session.gc_maxlifetime

2009-09-24 Thread Ralph Deffke
php not but perhaps the client its not clear and commonly defined what
clients do with cookies on reconnect and stuff or long idle times.

I would expect as source the new browsers where more and more users use
subwindows to have concurrent sessions, does anybody know how they handle ip
changes? I'm not.

these things are new and that would fit that the problem is new as well.


bdunlap bdun...@agentintellect.com wrote in message
news:7997e80e0909240851t7f0a2189u4540a09546a85...@mail.gmail.com...
  it could be ip address changes. interesting thought.

 As far as I'm aware, PHP session-management doesn't care about source
 IP, out-of-the-box -- your app would have to be coded to care. Plus I
 suspect you would have started seeing the problem a long time ago, if
 changing source IPs were the cause.

 Ben



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



[PHP] Re: NULLS vs Empty result in PHP

2009-09-23 Thread Ralph Deffke
using empty() is ´the right way to check a var for NULL or 

however, it also depends what MySQL has got as setuo definition for empty
fields. on textfields u can define an epmty string as default.

ralph_def...@yahoo.de

Dan Shirah mrsqua...@gmail.com wrote in message
news:a16da1ff0909230458o30d66186m75fc4fd0d1972...@mail.gmail.com...
 Morning!

 Just a quick question.

 Say I have a column in my database that could contain NULLS, empty spaces,
 or an actual value.

 If I do:

 $my_query = SELECT my_column FROM my_database WHERE 1 = 1;
 $my_result = ifx_query($my_query, $connect_id);

 while($row = ifx_fetch_row($my_result)) {
   $my_column = trim($row['my_column']);

   if ($my_column != ) {
echo Test;
   }
 }

 The way PHP assigns the query results to the $my_column variable,
wouldn't;
 if ($my_column != )  not do anything for the rows that contained NULLS
or
 empty spaces?




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



Re: [PHP] Re: session.gc_maxlifetime

2009-09-23 Thread Ralph Deffke
finaly we went with a custom cooky handling, however the customers
requirements where two days.

if u are shure that the server is still the same hardware like it has been 6
years ago then it might be some client stuff, however if there are other
applications, pages running (virtual servers) then it would still be to
consider. mamory and resource management is deep os. again I wouldn't trust
for that amount of session livetime.

I dont think, putting it down to three hours would help much.

and of course, it could be client side also. Can't you figure out the
clients?
and keep in mind that a lot of people connect to UMTS rigzt now, these
systems deconnect on idle lines and reconect without the users even know it.
Also a lot of lines change IP address at midnihgt.

cheers
ralph_def...@yahoo.de

Tom Worster f...@thefsb.org wrote in message
news:c6e00521.12d98%...@thefsb.org...
 there's a need for long timeouts in this app but could perhaps be reduced
 from 6 to 3 hours.

 the sessions are cookie based using php's 'file' handler and
 session.cookie_lifetime=0. the server appears to have plenty of free
memory
 and appears not to have swapped in nearly a year of uptime. load averages
 indicate a pretty quiet server. there are currently 170 kbyte total in 90
 serialized session files which is typical and not a memory load. the
 distribution of modification times doesn't indicate heavy activity: ~20
 files in the last 15 minutes and 35 in the last hour.

 so i think the os can handle this. plus the app ran for 6 years before
 anyone reported being prematurely logged off. i'm looking for other
 possibilities: odd browser behavior, network trouble, ...


 are there any browsers that have configurable cookie handling policy such
 that they time out a cookie?

 one web site i use displays this curious message: For your protection,
 sessions are open for a limited period of time on our website. Please
 sign-on again. NOTE: Your browser may also limit secure connection time,
and
 automatically log you out independent of our timeout procedure.

 that could be referring to browsers timing out an ssl connection. or
perhaps
 the cookie?


 btw: when you said in your email you wouldn't trust a long gc_maxlifetime,
 and you would only use a cookie-based solution for long session. did you
 mean that you wouldn't trust php's cookie-based session handler? and you
 would use a custom handler instead?


 On 9/22/09 4:46 PM, Ralph Deffke ralph_def...@yahoo.de wrote:

  Hi Tom,
 
  in sometimes 2001 I did have incidences with those things, and as I
remember
  over the past years there where some trouble with operating systems and
  stuff. This part is very deep inside the os. I would expect that this is
  still to consider. I also would check, if this occurs on very busy/low
  memory server.
 
  If I would programm the garbage collection clean up part, and if the
server
  is about to run out of memory, I would kill sessions being longer time
idle
  even when they are not yet as old as it is set in the gc_maxlifetime.
This
  would be far better then shutting down the whole server just because
there a
  100 of idle sessions waiting to get used again.
 
  as u mention a maxlivetime of 6h I would bet, that this is the problem.
I
  would not trust such a long lifetime at all.
 
  If sessions have to be active such a long time, I would see only cooky
based
  solutions
 
  let me know, what u did investigate on this.
 
  ralph_def...@yahoo.de
 
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6deae55.12cae%...@thefsb.org...
  thank you, Ralph!
 
  i'm going to be bold and assume that tom at punkave dot com is right
  despite
  that the report was discarded.
 
  i got a complaint from a client about some users reporting being logged
  out
  with rather short periods of inactivity. but session.gc_maxlifetime is
set
  to 6 hours so i don't think that's the source of the problem.
 
 
  On 9/22/09 4:17 PM, Ralph Deffke ralph_def...@yahoo.de wrote:
 
  Hi Tom,
 
  i did find this in the bug reports, its pretty new and should be an
  answer.
 
  http://news.php.net/php.doc.bugs/2653
 
  ralph_def...@yahoo.de
 
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6de9eee.12c8d%...@thefsb.org...
  i'm not 100% sure what the manual means when it says...
 
  session.gc_maxlifetime integer
  session.gc_maxlifetime specifies the number of seconds after which
data
  will
  be seen as 'garbage' and cleaned up. Garbage collection occurs during
  session start.
 
  what event exactly does the after which here refer to?
 
  i'd like to think that it means that a session is eligible for gc no
  sooner
  than session.gc_maxlifetime seconds after the most recent access
(read
  or
  write) to that session. but it seems dangerously presumptuous to
assume
  that
  this is the case.
 
  what do you take it to mean?
 
 
 
 
 
 
 
 





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



[PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Ralph Deffke
Hi Tom,

i did find this in the bug reports, its pretty new and should be an answer.

http://news.php.net/php.doc.bugs/2653

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...

 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.

 what event exactly does the after which here refer to?

 i'd like to think that it means that a session is eligible for gc no
sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
that
 this is the case.

 what do you take it to mean?





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



[PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Ralph Deffke
I forgot to mention, that this doesn't mean, you can not read data after
this timeout or that a session does ALWAYS die after this timeout. I would
assume, that the server has to have a reason to run garbage clean up. If the
server is not running a clean up, I would expect the session would excist
longer for access.

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...

 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.

 what event exactly does the after which here refer to?

 i'd like to think that it means that a session is eligible for gc no
sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
that
 this is the case.

 what do you take it to mean?





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



Re: [PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Ralph Deffke
Hi Tom,

in sometimes 2001 I did have incidences with those things, and as I remember
over the past years there where some trouble with operating systems and
stuff. This part is very deep inside the os. I would expect that this is
still to consider. I also would check, if this occurs on very busy/low
memory server.

If I would programm the garbage collection clean up part, and if the server
is about to run out of memory, I would kill sessions being longer time idle
even when they are not yet as old as it is set in the gc_maxlifetime. This
would be far better then shutting down the whole server just because there a
100 of idle sessions waiting to get used again.

as u mention a maxlivetime of 6h I would bet, that this is the problem. I
would not trust such a long lifetime at all.

If sessions have to be active such a long time, I would see only cooky based
solutions

let me know, what u did investigate on this.

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6deae55.12cae%...@thefsb.org...
 thank you, Ralph!

 i'm going to be bold and assume that tom at punkave dot com is right
despite
 that the report was discarded.

 i got a complaint from a client about some users reporting being logged
out
 with rather short periods of inactivity. but session.gc_maxlifetime is set
 to 6 hours so i don't think that's the source of the problem.


 On 9/22/09 4:17 PM, Ralph Deffke ralph_def...@yahoo.de wrote:

  Hi Tom,
 
  i did find this in the bug reports, its pretty new and should be an
answer.
 
  http://news.php.net/php.doc.bugs/2653
 
  ralph_def...@yahoo.de
 
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6de9eee.12c8d%...@thefsb.org...
  i'm not 100% sure what the manual means when it says...
 
  session.gc_maxlifetime integer
  session.gc_maxlifetime specifies the number of seconds after which data
  will
  be seen as 'garbage' and cleaned up. Garbage collection occurs during
  session start.
 
  what event exactly does the after which here refer to?
 
  i'd like to think that it means that a session is eligible for gc no
  sooner
  than session.gc_maxlifetime seconds after the most recent access (read
or
  write) to that session. but it seems dangerously presumptuous to assume
  that
  this is the case.
 
  what do you take it to mean?
 
 
 
 





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



[PHP] Re: Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ralph Deffke
be aware if you do not have full control of your server setup, this type of
parameter handling is not possible on most shared hostings.

however url encoded it is never a problem. so be clear where yout page will
be hosted.

ralph_def...@yahoo.de

Gaurav Kumar kumargauravjuke...@gmail.com wrote in message
news:87292e170909210054k79858b96yf09eeca5111ec...@mail.gmail.com...
 Hi All,

 I am creating a social networking website. I want that every user should
 have there own profile page with a static URL like-

 http://www.abcnetwork/user/username

 Where username will be dynamic userid or something else.

 This is something very similar to www.youtube.com/user/kumargauravmail
(this
 is my profile page).

 So what should be the best practice to create such DYNAMIC URL's OR what
 kind of methodology youtube is following?

 Thanks in Advance.

 Gaurav Kumar
 OSWebstudio.com




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



[PHP] Re: Touch screen programming help

2009-09-21 Thread Ralph Deffke
well, I would say a touch screen usualy is just another 'pointing device'
like the mouse is. it depends on the operating system and the driver setup
for it. then u simply can use any browser and just adjust the pointing
receiving elements like buttons and links a bit bigger and with images
rather then with just text. However this is not realy a PHP related issue.
more like a designers issue.

I think its realy simple

ralph_def...@yahoo.de

Manish - dz - PHP man...@dotzoo.net wrote in message
news:013c01ca3ab7$a9524dd0$5e01a...@manish...
Hi
Is it possible to do touch screen programming  in PHP ? If it is then,
how ?
   Please specify th specs with code.

Thanks in advance,

Regards,
Manish




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



[PHP] Re: Creating file name with $variable

2009-09-20 Thread Ralph Deffke
Hi Haig,

it would be better if u tell us what purpose u want to solf with this
approuch. Its hard to understand for a prov why u want to create a filename
.php
.php files are scrips containing functions or classes, called/instantinated
with parameters.
why the hell u want to create a filename with these parameters? does this
file excist?
you can create 'dynamic code' in php, but u would never write it to a file!

understand that that question is wierd and appears that ur concept is wild
and realy sick.

ralph_def...@yahoo.de

Haig Davis level...@gmail.com wrote in message
news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
 Good Afternoon All,

 Thanks for the help with the checkbox issue the other day.

 Todays question: I want to create a filename.php from a variable more
 specifically the results if a mySQL query I.e. userID + orderNumber =
 filename. Is this possible? 'cause I've tried every option I can think
 of and am not winng.

 Thanks a ton

 Haig

 Sent from my iPhone



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



[PHP] Re: Does anyone here use TCPDF?

2009-09-19 Thread Ralph Deffke
have a look in the archive of this list. there is a topic writing japanese
test in an excisting pdf its of 31. of August, this should helph u

ralph_def...@yahoo.de


Dave M G mar...@autotelic.com wrote in message
news:4ab3ca5c.3050...@autotelic.com...
 PHP List,


 I posted this question on the TCPDF forum on SourceForge, but it's
 getting no response. I'm not even sure how active their list is.
 http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3400663

 So I'm hoping someone here might be able to help if they are using
 TCPDF. I just need to get the key details to get started, and then I can
 probably start to roll on my own.

 This is the question:


 Forgive me for what I would assume is a very obvious question, but I can
 not locate any clear instructions on what I want to do.

 Simply, I want to take an existing PDF and write text on top of it.

 The PDF is a single page, and it is a form that people fill out. What I
 need to do is fill out some of the fields in the form before sending it
 to the recipient.

 So I need to do two simple tasks. One is to load an existing PDF file.
 The second is to place short lines of text into specific locations on
 the page (A4 size).

 I know these two functions must be dead simple, and yet I am lost in the
 documentation.

 If someone could tell me the right function calls or point me to the
 right place so that I can RTFM on my own, I would be very grateful.

 Thank you for any advice.

 -- 
 Dave M G





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



[PHP] Re: PHP Header issue

2009-09-18 Thread Ralph Deffke
sorry man, but no blancs etc. means NOTHING should be send before the header

it should look like this:
?php 

header(Location: advertise2.php); 

?

here u can do ur html



not one! single char incl. space should be outputted before the header e.g. 
before the php open tag.



ralph_def...@yahoo.de



  Ernie Kemp ernie.k...@sympatico.ca wrote in message 
news:blu0-smtp35a2b5ec02eb211ecaa8b1f9...@phx.gbl...
   
  html 

  head 

  titleContact Us/title 

  /head 

  body 

  ?php header(Location: advertise2.php); ?

  /body 

  /html

  The above is just snippet of the code but even this simple example throws the 
Header Warning / Error.

   

  Warning: Cannot modify header information - headers already sent by (output 
started at /home/content/g/t/a /html/yourestate/advertise.php:6) 
in/home/content/g/t/a /html/yourestate/advertise.php on line 6

   

  The anwser may be simple but I have looked a blanks or spaces around the 
?php ? with no success.

  Ready need your help.

   

  Thanks,

  Ernie Kemp   

  Phone: 416 577 5565

  Email:   ek...@digitalbiz4u.com

   

  ...man will occasionally stumble over the truth, but usually manages to pick 
himself up, walk over or around it, and carry on.

  Winston S. Churchill 

   

   

   

   


Re: [PHP] ie6 memory could not be read help!

2009-09-17 Thread Ralph Deffke
Yes, there is A LOT.

to make u aware that this is the last version be able to run under windows
2000. windows 2000 however is the last professional version of windows made
by microsoft. I don't know any bigger company using other os. All banks,
stock traders (wall street etc.) are still using 2k. Microsoft wanted in
2005 to stopp maintaining 2k but still until today they improving the os.

preventing IE6 from viewing ur sites is cutting away all professional window
users.

ralph_def...@yahoo.de

HallMarc Websites m...@hallmarcwebsites.com wrote in message
news:!!aaayacoynf9yfjpghykdv3koofzcgaaaea6vnkzo3vbkpufhofaqoloba...@hallmarcwebsites.com...
 Wow. IMHO that is a really bad stance to take on IE 6. Most offices still
 have IE 6 for whatever reason. If you block them then you are blocking
 possible clients. There is still a large percentage that still use it.


 Thank you,
 Marc Hall
 HallMarc Websites
 610.446.3346

  -Original Message-
  From: Philip Thompson [mailto:philthath...@gmail.com]
  Sent: Thursday, September 17, 2009 1:56 PM
  To: PHP General list
  Subject: Re: [PHP] ie6 memory could not be read help!
 
  On Sep 17, 2009, at 4:04 AM, Ashley Sheridan wrote:
 
   On Thu, 2009-09-17 at 16:41 +0800, Shelley wrote:
   Hi all,
  
   With IE6,
  
   After the pages i developed was loaded, there seems to be no
  problem,
   but when you then click a link, refresh the page, etc. it shows
   memory
   could not be 'read' error message.
  
   However, when you load other sites, google.com, for example, there
   is no
   such problem.
  
   Anybody knows how to fix this problem?
  
   Any help is appreciated  thanks in advance.
  
  
   http://support.microsoft.com/kb/899811
  
   first result from a Google search
  
   Thanks,
   Ash
 
  Since this post is not PHP-related, I'll continue the trend. Are
  people still using IE6? In sites I design, I prevent the user from
  viewing it. If they're still on IE6, I don't want them to use my sites.
 
  Cheers,
  ~Philip
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  __ Information from ESET Smart Security, version of virus
  signature database 4434 (20090917) __
 
  The message was checked by ESET Smart Security.
 
  http://www.eset.com
 



 __ Information from ESET Smart Security, version of virus
signature
 database 4434 (20090917) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





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



[PHP] Re: file_put_contents problem

2009-09-14 Thread Ralph Deffke
it would be interesting on what os u are working as well. did u try to open
the file?
on windows often a file is reported as 0 bytes as of failing the refresh in
explorer.

ralph_def...@yahoo.de


Andres Gonzalez and...@packetstorm.com wrote in message
news:4aae510e.8030...@packetstorm.com...
 I have read in the contents of a file using file_get_contents. I can
verify
 that the data has actually been read in by echoing its contents.

 But then if I do this:

 $ret = file_put_contents(/tmp/bla, $bk);

 The return value gives the correct size of string $bk, and the file
/tmp/bla
 is created in /tmp, but the length is 0.

 Why are not the contents written to the file?

 -Andres



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



Re: [PHP] get an object property

2009-09-12 Thread Ralph Deffke
 echo a()['q'];  // isn't?

because this is simply not valid syntax for the INTERPRETER PHP

while this
 echo o()-q;
can be interpreted because of the design of the interpreter.

I can live with that.

ralph_def...@yahoo.de

Tom Worster f...@thefsb.org wrote in message
news:c6d13522.12422%...@thefsb.org...
 On 9/12/09 9:50 AM, Tom Worster f...@thefsb.org wrote:

  On 9/12/09 1:32 AM, Lars Torben Wilson tor...@php.net wrote:
 
  Tom Worster wrote:
  if i have an expression that evaluates to an object, the return value
from a
  function, say, and i only want the value of one of the objects
properties,
  is there a tidy way to get it without setting another variable?
 
  to illustrate, here's something that doesn't work, but it would be
  convenient if it did:
 
  $o = array( (object) array('a'=1), (object) array('a'=2) );
 
  if ( end($o)-a  1 ) {  // can't use - like this!
  ...
  }
 
  What version of PHP are you using? Your example should work.
 
  Torben
 
  5.2.9.
 
  what version does it work in?

 i shamefully beg your pardon, lars. i was sure i tested the example but
it's
 clear to me now i either didn't or i made a mistake. end($o)-a IS php
 syntax! so - may follow a function (or method, i guess) call.

 but let me give you a more different example:

 $a and $b are normally both objects, each with various members including a
 prop q, but sometimes $a is false. i want the q of $a if $a isn't false,
 otherwise that of $b.

 ($a ? $a : $b)-q   // is not php, afaik

 before you suggest one, i know there are simple workarounds.

 but mine is a theoretical question about syntax, not a practical one. i'm
 exploring php's syntactic constraints on the - operator in contrast to,
 say, the + or . operators. and in contrast to other languages.

 for example, the . in js seems more generally allowed than - (or, for
that
 matter, []) in php. programmers (especially using jquery) are familiar
with
 using . after an expression that evaluates to an object, e.g.

 body
 p id=thepara class=top x23 indentMy x class number is
 span id=num/span/p
 div id=mandatory style=border: solid red 1px/div
 script type=text/javascript
 document.getElementById('num').innerText =
   ( ( document.getElementById('optional')
   || document.getElementById('mandatory')
 ).appendChild(document.getElementById('thepara'))
 .className.match(/x(\d+)/) || [0,'absent']
   )[1]
 /script
 /body

 which shows . after objects, method calls and expressions (as well as the
[]
 operator applied to an expression).

 do we just live without in phpville or am i missing something?


 and while i'm at it, and using my original error, how come...

 function o() { return (object) array('q'=7); }
 echo o()-q;  // is ok syntax, but

 function a() { return array('q'=5); }
 echo a()['q'];  // isn't?






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



Re: [PHP] Creating alphanumeric id for a table

2009-09-11 Thread Ralph Deffke
I agree that this question could be just how to create an unique ID with
leading letters like 'AAA'.

At that point I want to mention that a timestamp does garanty a unique
number at almost 100% formated with the given samples in the other posts
will do the job.

tedd tedd.sperl...@gmail.com wrote in message
news:p06240805c6cff752b...@[192.168.1.102]...
 At 3:17 PM -0700 9/10/09, aveev wrote:
 I want to create user generated id like this :
 AAA0001
 AAA0002
 ...
 AAA0009
 AAA0010
 
 where the id consists of 3 alphanumeric characters and 4 numerical digits
in
 the beginning (for numerical digit, it can grow like this AAA10001). I
try
 to use php script to generate id like this, where I use the following
 script.
 
 ?
  function generate_id($num) {
  $start_dig = 4;
  $num_dig = strlen($num);
 
  $id = $num;
  if($num_dig = $start_dig) {
  $num_zero = $start_dig - $num_dig;
 
  for($i=0;$i $num_zero; $i++) {
  $id = '0' . $id;
  }
  }
  $id = 'AAA' . $id;
  return $id;
  }
 
  $app_id = generate_id(1);
 
 ?
 
 I assume that I can get increment value/sequence from db  (I used
harcoded
 increment value  in the code above (generate_id(1))),
 but I don't know how I can get this incremental value from db.I use mysql
 5.0.
 Or has anyone had another solution to create this alphanumeric id  ?
 
 Any help would be much appreciated
 Thanks

 aveev:

 Why get an incremental value from the database? What information does
 that give you? Why do you want it? And what are you going to do with
 it?

 When those questions are answered, then we can help with more informed
advice.

 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] XML. Prevent from turning into lt;

2009-09-09 Thread Ralph Deffke
give it a try with PDATA instead of CDATA and see what happns


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252512252.2961.40.ca...@localhost...
 On Wed, 2009-09-09 at 16:51 +0100, Matthew Croud wrote:
  On 9 Sep 2009, at 16:37, Ashley Sheridan wrote:
 
   On Wed, 2009-09-09 at 15:14 +0100, Matthew Croud wrote:
   On 9 Sep 2009, at 15:09, Ashley Sheridan wrote:
  
   On Wed, 2009-09-09 at 14:46 +0100, Matthew Croud wrote:
   On 9 Sep 2009, at 14:36, Bob McConnell wrote:
  
   From: Bastien Koert
   On Wed, Sep 9, 2009 at 5:27 AM, Matthew
   Croudm...@obviousdigital.com wrote:
  
   Hiya,
   I'm writing an app that let's my client upload images, the image
   html code
   is added to an XML file.
   Take a look at the image element below:
  
   item Code=e1022
codee1022/code
image![CDATA[img src=uploads/image2.jpg alt=Homepage
   Image
   width=124 height=70 /]]/image
nameBlue Ski Trousers/name
price8.99/price
   /item
  
   Now, whenever PHP writes this to the XML files, it turns the 
   and
   into
   lt; and gt; . which means it does not display on the webpage.
   How can I
   prevent this from happening ?
  
  
   str_replace?
  
  
   Does the xml string get passed to htmlentities() or a similar
   function before it is sent to the browser? That would explain the
   substitutions. I saw an xmlentities() variation mentioned
   somewhere.
  
   Bob McConnell
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
   Hi Bob,
  
   Nope the string doesn't get passed into any function.
   Here is the XML:
   _
  
   ?xml version=1.0 encoding=UTF-8?
   clothes
  
item Code=e1021
  codee1021/code
  image![CDATA[img src=uploads/image1.jpg alt=Homepage
   Image width=124 height=70 border=1
   onclick=MM_openBrWindow('uploads/
   image1.jpg','Preview','width=680,height=520') /]]/image
  nameRed Jacket/name
  descAn adult sized red jacket/desc
  sizeadult/size
  price12.99/price
/item
  
item Code=e1022
  codee1022/code
  image![CDATA[img src=uploads/image2.jpg alt=Homepage
   Image width=124 height=70 border=1
   onclick=MM_openBrWindow('uploads/
   image2.jpg','Preview','width=680,height=520') /]]/image
  nameBlue Ski Trousers/name
  descA pair of Blue Ski Trousers/desc
  sizechild/size
  price8.99/price
/item
  
   /clothes
  
   
  
   Now the image tags I have written here I have done manually, but
   when
   I use PHP using DOM they come out like this (note the image
   element):
  
   item Code=e1024
   codee1024/code
   imagelt;![CDATA[lt;img src=uploads/image4.jpg alt=Homepage
   Image width=124 height=70 border=1
   onclick=MM_openBrWindow('uploads/
   image4.jpg','Preview','width=680,height=520') /gt;]]gt;/image
   nameorange top/name
   descan orange jacket/desc
   sizelarge/size
   price14.50/price
   /item
  
  
  
  
   Matthew Croud
   Studio
  
   Obvious Print Solutions Limited
   Unit 3 Abbeygate Court
   Stockett Lane
   Maidstone
   Kent
   ME15 0PP
  
   T | 0845 094 9704
   F | 0845 094 9705
   www.obviousprint.com
  
  
  
  
  
   I've not experienced this with using any DOM functions, but if we
   can
   see your code it might help us.
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
  
   -- 
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
  
  
   Well i'll pop the PHP down here, i'll trim it as much as i can:
  

  
   $code = $_POST['code'];
   $name = $_POST['name'];
   $desc = $_POST['desc'];
   $size = $_POST['size'];
   $price = $_POST['price'];
  
  
   #load an XML document into the DOM
  
   $dom = new DomDocument();
   $dom - load(items.xml);
  
   #create elements
  
   $Xitem =  $dom - createElement(item);
   $Xcode =  $dom - createElement(code);
   $Ximage =  $dom - createElement(image);
   $Xname =  $dom - createElement(name);
   $Xdesc = $dom - createElement(desc);
   $Xsize = $dom - createElement(size);
   $Xprice = $dom - createElement(price);
  
   #create text nodes
  
   $Xcodetext =  $dom - createTextNode($code);
   $Ximagetext =  $dom - createTextNode( ![CDATA[img src=\uploads/
   $UploadName\ alt=\Homepage Image\ width=\124\ height=\70\
   border=\1\ onclick=\MM_openBrWindow('uploads/
   $UploadName','Preview','width=680,height=520')\ /]] );
   $Xnametext =  $dom - createTextNode($name);
   $Xdesctext = $dom - createTextNode($desc);
   $Xsizetext =$dom - createTextNode($size);
   $Xpricetext =$dom - createTextNode($price);
  
   #append the text nodes to the inner nested elements
  
   $Xcode  - appendChild($Xcodetext);
   $Ximage  - appendChild($Ximagetext);
   $Xname  - appendChild($Xnametext);
   $Xdesc - 

[PHP] how to strip empty lines out of a txt using preg_replace()

2009-09-04 Thread Ralph Deffke
Hi all, I'm a bit under stress, maybe somebody knows the regex on a snap.
using PHP_EOL would be great.

thanks
ralph_def...@yahoo.de



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



Re: [PHP] how to strip empty lines out of a txt using preg_replace()

2009-09-04 Thread Ralph Deffke
ok
 preg_replace( /^\s*$/m, , $somestring)
does not take empty lines out

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252069539.24700.150.ca...@localhost...
 On Fri, 2009-09-04 at 14:58 +0200, Ralph Deffke wrote:
  Hi all, I'm a bit under stress, maybe somebody knows the regex on a
snap.
  using PHP_EOL would be great.
 
  thanks
  ralph_def...@yahoo.de
 
 
 
 The regex that would match a line containing only whitespace would look
 like this:

 ^\s*$

 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] how to strip empty lines out of a txt using preg_replace()

2009-09-04 Thread Ralph Deffke
the problem is some have got \t\n
some are just \n\n\n

using PHP_EOL is a must

I thing must be something with the /../sm attributes to the regex, spend
like half an hour, but didn't get it, I'm running against a dead line,
doesn't seem to be that easy if regex is not the everydays need u have


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252071327.24700.152.ca...@localhost...
 On Fri, 2009-09-04 at 15:28 +0200, Ralph Deffke wrote:
  ok
   preg_replace( /^\s*$/m, , $somestring)
  does not take empty lines out
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1252069539.24700.150.ca...@localhost...
   On Fri, 2009-09-04 at 14:58 +0200, Ralph Deffke wrote:
Hi all, I'm a bit under stress, maybe somebody knows the regex on a
  snap.
using PHP_EOL would be great.
   
thanks
ralph_def...@yahoo.de
   
   
   
   The regex that would match a line containing only whitespace would
look
   like this:
  
   ^\s*$
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
 
 
 
 Are the lines actually whitespace, or are they actually br/ tags that
 are inserting lines to format the page for HTML display?

 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] how to strip empty lines out of a txt using preg_replace()

2009-09-04 Thread Ralph Deffke
I'm working on DTD's

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252071932.24700.153.ca...@localhost...
 On Fri, 2009-09-04 at 15:37 +0200, Ralph Deffke wrote:
  the problem is some have got \t\n
  some are just \n\n\n
 
  using PHP_EOL is a must
 
  I thing must be something with the /../sm attributes to the regex, spend
  like half an hour, but didn't get it, I'm running against a dead line,
  doesn't seem to be that easy if regex is not the everydays need u have
 
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1252071327.24700.152.ca...@localhost...
   On Fri, 2009-09-04 at 15:28 +0200, Ralph Deffke wrote:
ok
 preg_replace( /^\s*$/m, , $somestring)
does not take empty lines out
   
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252069539.24700.150.ca...@localhost...
 On Fri, 2009-09-04 at 14:58 +0200, Ralph Deffke wrote:
  Hi all, I'm a bit under stress, maybe somebody knows the regex
on a
snap.
  using PHP_EOL would be great.
 
  thanks
  ralph_def...@yahoo.de
 
 
 
 The regex that would match a line containing only whitespace would
  look
 like this:

 ^\s*$

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



   
   
   
   Are the lines actually whitespace, or are they actually br/ tags
that
   are inserting lines to format the page for HTML display?
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
 
 
 
 If it is just made up of \t and \n then \s in the regex should match it,
 as it's meant to match just whitespace characters. Where are you getting
 the content from anyway?

 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] how to strip empty lines out of a txt using preg_replace()

2009-09-04 Thread Ralph Deffke
this works
$dtd = preg_replace( /\n+/, \n, $dtd);

Martin Scotta martinsco...@gmail.com wrote in message
news:6445d94e0909040653i44716f79m972f11055599...@mail.gmail.com...
 On Fri, Sep 4, 2009 at 10:37 AM, Ralph Deffke ralph_def...@yahoo.de
wrote:

  the problem is some have got \t\n
  some are just \n\n\n
 
  using PHP_EOL is a must
 
  I thing must be something with the /../sm attributes to the regex, spend
  like half an hour, but didn't get it, I'm running against a dead line,
  doesn't seem to be that easy if regex is not the everydays need u have
 
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1252071327.24700.152.ca...@localhost...
   On Fri, 2009-09-04 at 15:28 +0200, Ralph Deffke wrote:
ok
 preg_replace( /^\s*$/m, , $somestring)
does not take empty lines out
   
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252069539.24700.150.ca...@localhost...
 On Fri, 2009-09-04 at 14:58 +0200, Ralph Deffke wrote:
  Hi all, I'm a bit under stress, maybe somebody knows the regex
on a
snap.
  using PHP_EOL would be great.
 
  thanks
  ralph_def...@yahoo.de
 
 
 
 The regex that would match a line containing only whitespace would
  look
 like this:

 ^\s*$

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



   
   
   
   Are the lines actually whitespace, or are they actually br/ tags
that
   are inserting lines to format the page for HTML display?
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 The PHP_EOL is system dependent. If you want a solution that works on
every
 type of file you have to code it yourself. Here you have a function made
 some time ago.
 Maybe you can improve it.

 If you want the result as a text format you can implode( PHP_EOL,
$buffer )
 Hope this helps you.

 function explode($code)
 {
 $lines = array();
 $buffer = '';

 for($i=0, $len = strlen($code); $i$len; ++$i)
 switch( $code{$i} )
 {
 case \r:
 case \n:
 if( $i+1 == $len )
 break 2;

 if( \r == ($next = $code{ $i+1 }) || \n == $next )
 {
 ++$i;
 }

 $lines[] = $buffer;
 $buffer = '';
 break;
 default:
 $buffer .= $code{$i};
 }

 if( '' !== $buffer );
 $lines[] = $buffer;

 return $lines;
 }


 -- 
 Martin Scotta




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



Re: [PHP] how to strip empty lines out of a txt using preg_replace()

2009-09-04 Thread Ralph Deffke
and this is the PHP_EOL solution:
$dtd = preg_replace( /[. PHP_EOL . ]+/, . PHP_EOL . , $dtd);

dont ask me why two empty strings are needed to surround the PHP_EOL but its
does it.

Why this works? we have got an INTERPRETER here any \n is transtlated into
0x0D an \r into 0x0A so the pattern does not reach prce as '\n' hehe


Martin Scotta martinsco...@gmail.com wrote in message
news:6445d94e0909040653i44716f79m972f11055599...@mail.gmail.com...
 On Fri, Sep 4, 2009 at 10:37 AM, Ralph Deffke ralph_def...@yahoo.de
wrote:

  the problem is some have got \t\n
  some are just \n\n\n
 
  using PHP_EOL is a must
 
  I thing must be something with the /../sm attributes to the regex, spend
  like half an hour, but didn't get it, I'm running against a dead line,
  doesn't seem to be that easy if regex is not the everydays need u have
 
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1252071327.24700.152.ca...@localhost...
   On Fri, 2009-09-04 at 15:28 +0200, Ralph Deffke wrote:
ok
 preg_replace( /^\s*$/m, , $somestring)
does not take empty lines out
   
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252069539.24700.150.ca...@localhost...
 On Fri, 2009-09-04 at 14:58 +0200, Ralph Deffke wrote:
  Hi all, I'm a bit under stress, maybe somebody knows the regex
on a
snap.
  using PHP_EOL would be great.
 
  thanks
  ralph_def...@yahoo.de
 
 
 
 The regex that would match a line containing only whitespace would
  look
 like this:

 ^\s*$

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



   
   
   
   Are the lines actually whitespace, or are they actually br/ tags
that
   are inserting lines to format the page for HTML display?
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 The PHP_EOL is system dependent. If you want a solution that works on
every
 type of file you have to code it yourself. Here you have a function made
 some time ago.
 Maybe you can improve it.

 If you want the result as a text format you can implode( PHP_EOL,
$buffer )
 Hope this helps you.

 function explode($code)
 {
 $lines = array();
 $buffer = '';

 for($i=0, $len = strlen($code); $i$len; ++$i)
 switch( $code{$i} )
 {
 case \r:
 case \n:
 if( $i+1 == $len )
 break 2;

 if( \r == ($next = $code{ $i+1 }) || \n == $next )
 {
 ++$i;
 }

 $lines[] = $buffer;
 $buffer = '';
 break;
 default:
 $buffer .= $code{$i};
 }

 if( '' !== $buffer );
 $lines[] = $buffer;

 return $lines;
 }


 -- 
 Martin Scotta




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



Re: [PHP] Reading remote files

2009-09-01 Thread Ralph Deffke
I think, this also depends on the oprating system. I would say that any
development team would avoid loading file type data into fast memory. These
problems are all over applications. From the PHP point of view, it could
mean that file data have to be read into memory, but it could not mean that
the data have to be necceserily in a memory chip. as smart as oprerating
systems, apache and PHP are designed, I would expect some disk cashing
mechanism for large data block fom the developers.

so if u did not have any problem yet, do define a test with the average of
traffic u are expecting and see what happens. I see a pretty good chance
that there will be not so much a problem.

ralph_def...@yahoo.de

Grace Shibley shibl...@gmail.com wrote in message
news:a4d1d5260909011055o55689189n4e42af2e319f...@mail.gmail.com...
 Are you actually having a problem with memory, or simply that you have
 to transfer it over a network first? Depending on the protocol used, you
 may be able to read it in chunks, but those chunks will still have to be
 copied to the computer that is reading it before it can be processed.

 The other option is to run a process in the computer where the file
 resides and only send the results over the network.

 Bob McConnell


 We haven't actually had a problem yet, but we don't want to run a risk of
a
 server crash.  We want to be able to call this PHP function from a
 standalone application that will get that particular chunk of data
specified
 and save it to the local drive.
 But, so far, we have been told that any function we use (fopen/fread,
 file_get_contents) will first load the entire file into memory.

 As far as I know then, HTTP doesn't support entering files at points
 specified by a remote user. A request is made for a file, and the server
 determines how to break it up in order to send.

 Apparently, with file_get_contents, you can specify an offset and a
 datasize, but it still loads the whole file first.  Is this true?


 On Tue, Sep 1, 2009 at 10:46 AM, Ashley Sheridan
 a...@ashleysheridan.co.ukwrote:

  On Tue, 2009-09-01 at 10:43 -0700, Grace Shibley wrote:
   HTTP
  
   On Tue, Sep 1, 2009 at 10:36 AM, Ashley Sheridan
   a...@ashleysheridan.co.ukwrote:
  
On Tue, 2009-09-01 at 10:34 -0700, Grace Shibley wrote:
 Is there a way to read large (possibly 500 MB) remote files
without
loading
 the whole file into memory?
 We are trying to write a function that will return chunks of
binary
  data
 from a file on our server given a file location, specified offset
and
data
 size.

 But, we have not been able to get around loading the whole file
into
memory
 first.  Is there a way to do this??
   
What sort of remote file is it, i.e. how are you remotely connecting
to
it? FTP, HTTP, SSH?
   
Thanks,
Ash
http://www.ashleysheridan.co.uk
   
   
   
   
  As far as I know then, HTTP doesn't support entering files at points
  specified by a remote user. A request is made for a file, and the server
  determines how to break it up in order to send.
 
  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] Re: windows 5.2.10 PHP not working with phpinfo

2009-08-30 Thread Ralph Deffke
use wamp 2 !!
http://www.wampserver.com/

no easier way under windows

ralph_def...@yahoo.de

Fred Silsbee fredsils...@yahoo.com wrote in message
news:43633.64942...@web59909.mail.ac4.yahoo.com...
I got 5.3 working but found out there was no php_mssql.dll for it.
Somebody (who didn;t know) said I had to return to 5.2.8 but I found no
5.2.8 so I am trying 5.2.10
_problem:
under IE8:
http://72.47.28.128:8080/phpinfo.php
with:
 ?php
   phpinfo();
 ?

I get :
The website cannot display the page
HTTP 500
   Most likely causes:
.The website is under maintenance.
.The website has a programming error.
___

I installed :
php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext
AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32

I installed FastCGI 1.5 !

In php.ini I put :


cgi.force_redirect = 0  // for CGI

extension_dir =  C:\PHP\ext

commented out
;doc_root = C:\inetpub\wwwroot // for IIS/PWS
leaving
doc_root =
_
IIS 5.1 properties-configuration I added .php  C:\PHP\php5ts.dll
GET,HEAD,POST,DEBUG

Maybe php-win.exe
_

I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\

I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext


I never found any statement of the necessity of requiring CGI

The instructions ramble around







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



Re: [PHP] File Open Prompt?

2009-08-29 Thread Ralph Deffke
are u shure, u dont send anything out before u send the headers? even one
space would be too much.

ralph_def...@yahoo.de

Dan Shirah mrsqua...@gmail.com wrote in message
news:a16da1ff0908281328k641ea332v25d887c4de5b3...@mail.gmail.com...
 
  You will need to add some headers to the page to popup the prompt, at
least
  with
  these.
 
  $filename = 'somefile.tif';
  $filesize = filesize($filename);
 
  header('Content-Type: application/force-download');
  header('Content-disposition: attachement; filename=' . $filename);
  header('Content-length: ' . $filesize);
 
  Eric
 
 

 I don't know what I'm doing wrong.  I've tried:

 header('Content-Description: File Transfer');
 header('Content-Type: application/force-download');
 header('Content-Length: ' . filesize($filename));
 header('Content-Disposition: attachment; filename=' . basename($file));
 readfile($file);
 AND

 if (file_exists($new_file)) {
 header('Content-Description: File Transfer');
 header('Content-Type: application/octet-stream');
 header('Content-Disposition: attachment; filename='.basename($new_file
 ));
 header('Content-Transfer-Encoding: binary');
 header('Expires: 0');
 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
 header('Pragma: public');
 header('Content-Length: ' . filesize($new_file));
 ob_clean();
 flush();
 readfile($new_file);
 exit;
 }

 But everything I do just sends heiroglyphics to the screen instead of
giving
 the download box.




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



Re: [PHP] File Open Prompt?

2009-08-29 Thread Ralph Deffke
even the .tif is valid or not, the file should be downloaded


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1251530173.27899.135.ca...@localhost...
 On Sat, 2009-08-29 at 09:03 +0200, Ralph Deffke wrote:
  are u shure, u dont send anything out before u send the headers? even
one
  space would be too much.
 
  ralph_def...@yahoo.de
 
  Dan Shirah mrsqua...@gmail.com wrote in message
  news:a16da1ff0908281328k641ea332v25d887c4de5b3...@mail.gmail.com...
   
You will need to add some headers to the page to popup the prompt,
at
  least
with
these.
   
$filename = 'somefile.tif';
$filesize = filesize($filename);
   
header('Content-Type: application/force-download');
header('Content-disposition: attachement; filename=' . $filename);
header('Content-length: ' . $filesize);
   
Eric
   
   
  
   I don't know what I'm doing wrong.  I've tried:
  
   header('Content-Description: File Transfer');
   header('Content-Type: application/force-download');
   header('Content-Length: ' . filesize($filename));
   header('Content-Disposition: attachment; filename=' .
basename($file));
   readfile($file);
   AND
  
   if (file_exists($new_file)) {
   header('Content-Description: File Transfer');
   header('Content-Type: application/octet-stream');
   header('Content-Disposition: attachment;
filename='.basename($new_file
   ));
   header('Content-Transfer-Encoding: binary');
   header('Expires: 0');
   header('Cache-Control: must-revalidate, post-check=0,
pre-check=0');
   header('Pragma: public');
   header('Content-Length: ' . filesize($new_file));
   ob_clean();
   flush();
   readfile($new_file);
   exit;
   }
  
   But everything I do just sends heiroglyphics to the screen instead of
  giving
   the download box.
  
 
 
 
 Try putting all of that inside of a headers_sent(){} block. If nothing
 is displayed, it means that you've already sent something to the
 browser, so the headers have already been sent and the extra ones you
 are sending do nothing. This sort of thing is shown in your error log
 also.

 If you still get the tif displayed as text, then are you sure that the
 tif is valid?

 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] Re: PHP Crash in file_get_contents

2009-08-29 Thread Ralph Deffke
on a regulary base I read the docs even on functions I know, I just read
about the funstion u use and the doc says this:
Note: If you're opening a URI with special characters, such as spaces, you
need to encode the URI with urlencode().

did u try to avoid the problem by using urlencode ?

just a thought

ralph_def...@yahoo.de


Seth Hill set...@gmail.com wrote in message
news:a90c87ed0908271150x18202147n1717d24daf141...@mail.gmail.com...
 Hello all,
 I'm experiencing a curious error that I'm hoping someone can help with.

 I am using file_get_contents() with Google Maps Geocoding to retrieve
 information about an address. The URL that I'm requesting looks like:
 http://maps.google.com/maps/geo?q=[Search Subject]key=[google maps
 key]sensor=falseoutput=jsonoe=utf8

 If I pass a space (0x20) in the search subject, I get a 400 error back (as
 it should be). However, the next request to the site crashes PHP.

 I can reproduce it as part of my whole site (which runs a custom
framework),
 but I've been unable to come up with a single PHP file that will duplicate
 the problem.

 I am running PHP under IIS6 on a Windows 2003 Web Edition server. I have
 seen this with PHP 5.1.1 and PHP 5.2.5 using the ISAPI dll. Thinking that
it
 was a known bug, I upgraded, but I still see it on PHP 5.2.10 with
 FastCGI. With ISAPI I get a PHP Access Violation message until I recycle
 the app pool, with FastCGI I get an equivalent message (except with
FastCGI
 I don't have to manually restart anything).

 This is the stack trace:

  Function Arg 1 Arg 2 Arg 3   Source
 php5!_zend_mm_realloc_int+357 00223ea0 0274ab98 0008
 php5!_erealloc+2e 0274ab98 0008 
 php5!php_stream_wrapper_log_error+49 1044b458 0004
10333244
php5!php_stream_url_wrap_http_ex+1f17 1044b458 027a2bb8
 102a3780php5!php_stream_url_wrap_http+27 1044b458 027a2bb8
 102a3780php5!_php_stream_open_wrapper_ex+aa 027a2bb8 102a3780
 php5!zif_file_get_contents+e2 0001 0274a9e8
 php5!zend_do_fcall_common_helper_SPEC+6d7 00c0a45c
 00c0a2e8 000cphp5!ZEND_DO_FCALL_SPEC_CONST_HANDLER+df
 00c0a45c 027492a4 0274912cphp5!execute+12e 02749af8
 00c0a518 0028php5!zend_do_fcall_common_helper_SPEC+796
 00c0aa64 10018e9e 00c0aa64
 php5!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+10 00c0aa64 027a2cbc
 0274a9bcphp5!execute+12e 0178e668 00c0ab40 0030
 php5!ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER+332 0178e668 0178e3b4
 0178e53cphp5!execute+12e 0178b368 00c0cba8 
 php5!ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER+2d1 0178b368 00c0cbac
 php5!execute+12e 0178b100  00c0fee0
 php5!zend_execute_scripts+c8 0008  0003
 php5!php_execute_script+1c0 00c0fee0  
 php_cgi!main+b2f 0001 00223c90 00222928
 php_cgi!mainCRTStartup+e3   7ffd8000
 kernel32!BaseProcessStart+23 00405cd6  

 I guess I'm asking for some pointers on how to narrow this down a bit, or
if
 anyone has seen this problem before. I didn't find anything on the PHP
bugs
 list.



 Regards,

 Seth Hill




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



[PHP] Re: parse_ini_file problem

2009-08-27 Thread Ralph Deffke
Is it that some code, creating this error u talking about, is reading the
init file?

I would guess so, to me it looks like if u open the file dirctly the scrupt
is suppost to die. that seems like a little funny protection not no show the
init parameters.

if thats the case u got to send the code producing the error.

ralph_de...@yahoo.de

Richard H Lee rich...@webdezign.co.uk wrote in message
news:bf.55.21292.3c865...@pb1.pair.com...
 Hi all,

 I think I'm having a problem with parse_ini_file in php. I am using wamp
 on two machines. I'm installing a Digishop e-commerce package.

 The blah.ini.php file starts with

 
 ?php die ?


 [SOMETITLE]
 some_setting=Ok, I Have Completed This Step
 another_setting=Next
 ..
 ..
 ..
 

 On one machine which uses php 5.2.5 it parses the file fine and installs
 properly

 But on another machine which use 5.3.0 i get the error

 Warning: parse error in blah.ini.php on line 1 in myparser.php on line 81

 On the 5.3.0 if I remove the ?php die ? it works fine. But it still
 does not install the sofware properly.

 I get the feeling php on the 5.3.0 marchine is parsing the file
 differently to the 5.2.5. I doubt anything has changed between the
 versions. I also compared the phpinfos between the two setups but could
 not see anything outstanding.

 Have any of you guys seen this behaviour before?

 Cheers,

 Richard




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



Re: [PHP] wierd behavior on parsing css with no php included

2009-08-25 Thread Ralph Deffke
tx Lucas,

all your recomended solutions made sence for the different pupose.

for my purpose the apache solution worked just great

Files ~ \.css$
php_value default_mimetype text/css
/Files

and
AddType application/x-httpd-php .css

ralph_def...@yahoo.de



Jim Lucas li...@cmsws.com wrote in message
news:4a923946.3020...@cmsws.com...
 Ralph Deffke wrote:
  Hi folks, i did post this also on the Wamp page but maybe someone out
there
  had to solve that problem as well.
 
  systems involved
 
  Firefox 3.0.13
  Firefox 3.5.2
  IE 6
 
  Wamp:
  apache 2.2.11
  PHP 5.2.9  php 5.3
 
  I do parse css files through php
 

 If you state that they have not PHP to parse, then why parse them?  It is
a waist!

  Problem: css files are loaded into the browsers but not interpreted or
used
  on RAW HTML files no php included. The html files are produced with
  phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display
the
  page, Firefox NOT AT ALL.
 
  I think it might be possible that wamp throughs some wierd characters
into
  the css files or is the header type a problem? It looks like parsing the
css
  through the php engine changes the header of the css to text/html. this
  would explain why IE6 can use them. on the other hand firebug shows the
  loaded css, indicates however that no css is available.
 
  as an reverse check I did load the html files direktly from the disk
with
  file:/// ... and the css are interpreted perfectly. so the source of the
  problem is wamp.
 
  it seems that the @importcsss does the biggest problem.it creates a 404
  error file not found
 
  it seems creating dynamic css files got some secrets involved with the
wamp.
  I'm using this concept since ages on linux with no problem.
 
  on the @includecss it seems that the search for files are changing to
the
  php include path or something.
 
  any idear what to check?
 
  is important for my work to create css dynamicly
 

 My suggestion would be to have php run a script using the
auto_prepend_file ini option

 ; Automatically add files before or after any PHP document.
 auto_prepend_file = fix_headers.php
 auto_append_file =

 Then, in a script called fix_headers.php, somewhere in your path I hope,
you have this.

 ?php

 # The following regex is completely untested.  It is meant to
 $ext = strtolower(preg_replace('|^.*\.([^.]+)$|',
$_SERVER['SCRIPT_NAME']));

 if ( 'css' === $ext ) {
 header('Content-Type: text/css');
 }

 ?

 Another way to get around it is to have apache instruct PHP to change, and
output, the correct
 content type.

 http://httpd.apache.org/docs/1.3/mod/core.html#files
 http://us2.php.net/manual/en/ini.core.php#ini.sect.data-handling
 http://us2.php.net/manual/en/ini.core.php#ini.default-mimetype

 Files ~ \.css$
 php_value default_mimetype text/css
 /Files

 Hope this helps

 Jim Lucas

  ralph_def...@yahoo.de
 
 
 


 -- 
 Jim Lucas

 Some men are born to greatness, some achieve greatness,
 and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
  by William Shakespeare



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



[PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
yes it does on my machine

and it makes sence since it is not a function its a language construct.

cheers
ralph_def...@yahoo.de

Shawn McKenzie nos...@mckenzies.net wrote in message
news:4a935c42.2010...@mckenzies.net...
 Ralph Deffke wrote:
  causes an error
  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$''
in
  C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6b87877.11463%...@thefsb.org...
  is it the case that unset() does not trigger an error or throw an
  exception
  if it's argument was never set?
 
 
 
 

 What!?!?


 No, It does not cause an error, not even a notice.

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com



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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
of course its a syntax error, because unset() IS NOT A FUNCTION its a
language construct

ralph

Stuart stut...@gmail.com wrote in message
news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  causes an error
  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$''
in
  C:\wamp\www\TinyCreator\testCrapp6.php on line 42

 This is a syntax error, not a runtime error. You've clearly done
 something wrong.

  Tom Worster f...@thefsb.org wrote in message
  news:c6b87877.11463%...@thefsb.org...
  is it the case that unset() does not trigger an error or throw an
  exception
  if it's argument was never set?

 Absolutely.

 -Stuart

 -- 
 http://stut.net/



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



Re: [PHP] anchor inside form

2009-08-25 Thread Ralph Deffke
may be u can use this

a href=urpage.php?var1=somethingvar2=something 

cheers
ralph_def...@yahoo.de

leledumbo leledumbo_c...@yahoo.co.id wrote in message
news:25131146.p...@talk.nabble.com...

  Why not just use another submit button?

 Because it's actually an entry in a tree-like menu. I need to send
 parameters via get method, and code above is one way I can think of.
 -- 
 View this message in context:
http://www.nabble.com/anchor-inside-form-tp25129981p25131146.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] Re: Directory Listing

2009-08-25 Thread Ralph Deffke
I would say
foreach( $dirTree as $key = $value ){
echo $key .br;
foreach( $value as $v){
echo $v .br;
}
}

something like that

ralph_def...@yahoo.de
Tom Chubb tomch...@gmail.com wrote in message
news:4577934f0908250241i195dc691x3f8c552e72791...@mail.gmail.com...
Hi gang,
I'm trying to create a script to read the files in a folder (approx
2000) and get the filename, path and last modified date in a tabulated
format to copy into excel. (We have been issued a CD and need to get
all files documented and assigned to an owner.)

I've tried loads of different scripts but can't get them working with
all the features.
I think the best one to work with is this (although I'm having
problems getting the date but don't worry about that at the moment)

?
error_reporting(E_ALL);
ini_set('display_errors', true);
function getDirectory($path = '.', $ignore = '') {
$dirTree = array ();
$dirTreeTemp = array ();
$ignore[] = '.';
$ignore[] = '..';

$dh = @opendir($path);

while (false !== ($file = readdir($dh))) {

if (!in_array($file, $ignore)) {
if (!is_dir($path/$file)) {

$dirTree[$path][] = $file;

} else {

$dirTreeTemp = getDirectory($path/$file, $ignore);
if (is_array($dirTreeTemp))$dirTree =
array_merge($dirTree, $dirTreeTemp);
}
}
}
closedir($dh);

return $dirTree;
}

$ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini',
'.ftpquota');

$dirTree = getDirectory('./Tender', $ignore);
?
pre
?
print_r($dirTree);
?
/pre

?php
getdirectory('./Tender');
//or
//get_dir_iterative(/*etc.*/);
?






Here is an example of what I'm getting out from the $dirTree array:

Array
(
[./Tender] = Array
(
[0] = 9216_100_REV_V1.0_bound.dwg
)


[./Tender/Tender Docs] = Array
(
[0] = BAA Works Terms v1.1 (22.05.08).pdf
[1] = Contents of Volumes 1 and 2.pdf
[2] = Cover Letter and Instructions.doc

[3] = Form of Tender.doc
)

[./Tender/Tender Docs/Health and Safety Questionnaire] = Array
(
[0] = NT Baggage Tender Questionaire rev2.xls
)


[./Tender/Tender Docs/NTB BH Lighting] = Array
(
[0] = 3J-B-1 PIR.xls
[1] = 3J-B-2B PIR.xls
[2] = 3J-B-2R PIR.xls
[3] = 3J-B-3R PIR.xls

[4] = 3J-D PIR.xls
[5] = 4G-G PIR.xls
[6] = 4J-B-1B PIR.xls
[7] = 4J-B-1R PIR.xls
[8] = 4J-B-2B PIR.xls
[9] = 4J-B-2R PIR.xls

[10] = 4J-B-4 PIR.xls
[11] = 5G-G PIR.xls
)

I'm having problems getting my head round how to get access the array
data so that I can format it how I want, eg:

Folder   Filename
Tender   9216_100_REV_V1.0_bound.dwg
Tender/Tender Docs   BAA Works Terms v1.1 (22.05.08).pdf
Tender/Tender Docs   Contents of Volumes 1 and 2.pdf

etc.

I'm trying to do this at work (php is a hobby and this is the first
time I've tried to use it in my electrical engineering job) in notepad
without any code highlighting, etc. and tearing my hair out to try and
avoid going through the CD manually!

Could anybody please help or let me know which function I need to read
up on? I've tried countless searches on array formatting, etc and not
getting anywhere.

Thanks in advance,

Tom



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



Re: [PHP] Re: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
?php

$a = bhsdhjk;

unset();
?

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
C:\wamp\www\TinyCreator\testCrapp8.php on line 5


the function! doen't exist its a language construct

http://us.php.net/manual/en/function.unset.php


Stuart stut...@gmail.com wrote in message
news:a5f019de0908250344y17c96d5eqc5cedd944e1f7...@mail.gmail.com...
 2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  of course its a syntax error, because unset() IS NOT A FUNCTION its a
  language construct

 FFS, stop talking out of your rear end and post line 42 of
 testCrapp6.php. Or not, your choice.

 -Stuart

 -- 
 http://stut.net/

  Stuart stut...@gmail.com wrote in message
  news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
  2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
   causes an error
   Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`'$''
  in
   C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  This is a syntax error, not a runtime error. You've clearly done
  something wrong.
 
   Tom Worster f...@thefsb.org wrote in message
   news:c6b87877.11463%...@thefsb.org...
   is it the case that unset() does not trigger an error or throw an
   exception
   if it's argument was never set?
 
  Absolutely.
 
  -Stuart
 
  --
  http://stut.net/
 
 
 
  --
  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: unset() something that doesn't exist

2009-08-25 Thread Ralph Deffke
sorry I mixed 'set' with 'given' and if my mistake did prevent all the
smarter guys to give u an answer I'm sorry too.

I hope not to be too limited to give u an answer

well, think about how PHP 5 works.
$a e.g. is a REFENCE to some memory where the variable resides.

so the interpreter running into this unset() statement searches the
reference table to find the pointer named $a to delete its name from the
reference table. it doesn't find it, but it's ment to unset it anyway, why
should be complained about it. in the next line the $a is not set, as u want
it.

mmmh nice as well that nobody told me direcly that I mixed set with given

ralph_def...@yahoo.de

ps.: great behavior, I think for less then 10% of the world population is
english the native language, such a behavior prevents very good and smart
programmers arround the world to share their knowledge.

Tom Worster f...@thefsb.org wrote in message
news:c6b93df9.114fa%...@thefsb.org...
 On 8/25/09 5:00 AM, Ralph Deffke ralph_def...@yahoo.de wrote:

  of course its a syntax error, because unset() IS NOT A FUNCTION its a
  language construct

 that's hard to believe. i can't imagine how the compiler could reliably
 predict if the argument will be set or not when the unset line is
executed.


  Stuart stut...@gmail.com wrote in message
  news:a5f019de0908250201g14e4b61cn73c6cd67da6f...@mail.gmail.com...
  2009/8/25 Ralph Deffke ralph_def...@yahoo.de:
  causes an error
  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`'$''
  in
  C:\wamp\www\TinyCreator\testCrapp6.php on line 42
 
  This is a syntax error, not a runtime error. You've clearly done
  something wrong.
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6b87877.11463%...@thefsb.org...
  is it the case that unset() does not trigger an error or throw an
  exception
  if it's argument was never set?
 
  Absolutely.
 
  -Stuart
 
  -- 
  http://stut.net/
 
 





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



[PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
but it should? shouldn't it how can I destroy a class instance invocing
__detruct() of the class ?!?!?






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



Re: [PHP] wierd behavior on parsing css with no php included

2009-08-24 Thread Ralph Deffke
perfect, thats what I was looking for, great thanks

ralph

Jim Lucas li...@cmsws.com wrote in message
news:4a923946.3020...@cmsws.com...
 Ralph Deffke wrote:
  Hi folks, i did post this also on the Wamp page but maybe someone out
there
  had to solve that problem as well.
 
  systems involved
 
  Firefox 3.0.13
  Firefox 3.5.2
  IE 6
 
  Wamp:
  apache 2.2.11
  PHP 5.2.9  php 5.3
 
  I do parse css files through php
 

 If you state that they have not PHP to parse, then why parse them?  It is
a waist!

  Problem: css files are loaded into the browsers but not interpreted or
used
  on RAW HTML files no php included. The html files are produced with
  phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display
the
  page, Firefox NOT AT ALL.
 
  I think it might be possible that wamp throughs some wierd characters
into
  the css files or is the header type a problem? It looks like parsing the
css
  through the php engine changes the header of the css to text/html. this
  would explain why IE6 can use them. on the other hand firebug shows the
  loaded css, indicates however that no css is available.
 
  as an reverse check I did load the html files direktly from the disk
with
  file:/// ... and the css are interpreted perfectly. so the source of the
  problem is wamp.
 
  it seems that the @importcsss does the biggest problem.it creates a 404
  error file not found
 
  it seems creating dynamic css files got some secrets involved with the
wamp.
  I'm using this concept since ages on linux with no problem.
 
  on the @includecss it seems that the search for files are changing to
the
  php include path or something.
 
  any idear what to check?
 
  is important for my work to create css dynamicly
 

 My suggestion would be to have php run a script using the
auto_prepend_file ini option

 ; Automatically add files before or after any PHP document.
 auto_prepend_file = fix_headers.php
 auto_append_file =

 Then, in a script called fix_headers.php, somewhere in your path I hope,
you have this.

 ?php

 # The following regex is completely untested.  It is meant to
 $ext = strtolower(preg_replace('|^.*\.([^.]+)$|',
$_SERVER['SCRIPT_NAME']));

 if ( 'css' === $ext ) {
 header('Content-Type: text/css');
 }

 ?

 Another way to get around it is to have apache instruct PHP to change, and
output, the correct
 content type.

 http://httpd.apache.org/docs/1.3/mod/core.html#files
 http://us2.php.net/manual/en/ini.core.php#ini.sect.data-handling
 http://us2.php.net/manual/en/ini.core.php#ini.default-mimetype

 Files ~ \.css$
 php_value default_mimetype text/css
 /Files

 Hope this helps

 Jim Lucas

  ralph_def...@yahoo.de
 
 
 


 -- 
 Jim Lucas

 Some men are born to greatness, some achieve greatness,
 and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
  by William Shakespeare



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



Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
that is correct and that is the problem, and even that is not all !!!

try this
?php


abstract class a {
  public function __construct(){
echo constructingbr;
  }
  public function __detruct(){
echo destructingbr;
  }
}

class b extends a{

}
$c = new b();
unset( $c );
?

the constructor is inherited, the destructor not !!

PHP 5.2.9-1 and
PHP 5.3.0 behave the same

las trampas de la vida



ralph_def...@yahoo.de



Stuart stut...@gmail.com wrote in message
news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com...
 2009/8/24 kranthi kranthi...@gmail.com:
  unset($obj) always calls the __destruct() function of the class.
 
  in your case clearly you are missing something else. Probably
  unset($anobject) is not being called at all ?

 That's not entirely correct. PHP uses reference counting, so if
 unsetting a variable did not cause the object to be destructed then
 it's highly likely that there is another variable somewhere that is
 holding a reference to that object.

 -Stuart

 -- 
 http://stut.net/



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



Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
typing error sorry

forget my last post

is there a was to destroy an object if there is hold a reference somewhere?

Stuart stut...@gmail.com wrote in message
news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com...
 2009/8/24 kranthi kranthi...@gmail.com:
  unset($obj) always calls the __destruct() function of the class.
 
  in your case clearly you are missing something else. Probably
  unset($anobject) is not being called at all ?

 That's not entirely correct. PHP uses reference counting, so if
 unsetting a variable did not cause the object to be destructed then
 it's highly likely that there is another variable somewhere that is
 holding a reference to that object.

 -Stuart

 -- 
 http://stut.net/



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



Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
this is also not the full truth try this and it works
what are the circumstances that is causing this problem then, yes I do have
distributed references over my script and there are clearly references still
set, however after running the snipped script I can not see what I do
special in my script causing the problem. I even tried with public and
private static in other objects. it works. however the manual indicates the
refernce counter has to be 0.

?php


abstract class a {
  public function __construct(){
echo constructingbr;
  }
  public function __destruct(){
echo destructingbr;
  }
}

class b extends a{

}

$c = new b();

$d = $c ;   // works
$f[] = $c ; // works

class e {
  private $m;

  public function setM( $m ){
$this-m = $m;
  }
}

$o = new e();
$o-setM( $c ); // works


unset( $c );


?
Lupus Michaelis mickael+...@lupusmic.org wrote in message
news:41.f9.03363.01192...@pb1.pair.com...
 kranthi wrote:
  unset($obj) always calls the __destruct() function of the class.

Never calls the dtor. The dtor will be called only when the reference
 count reaches 0.

 class c { function __destruct() { echo 'dying !' ; } }
 $v1 = new c ;
 $v2 = $v1 ;

 unset($v1) ; // don't call the dtor
 unset($v2) ; // call the dtor

 -- 
 Mickaël Wolff aka Lupus Michaelis
 http://lupusmic.org



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



Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
I dont agree, and as u see in my snipped code it works fine.

in an abstract class u can define an implementation to define some basic
things a overwriting function in an extending class has to take care of as
well.

this includes specialy magic functions.

thats what they are made for. may be you talk about interfaces ?

hack988 hack988 hack...@dev.htwap.com wrote in message
news:4d03254c0908241122r5b6d1c3csc06ec475a0797...@mail.gmail.com...
 see http://cn.php.net/manual/en/language.oop5.abstract.php
 PHP 5 introduces abstract classes and methods. It is not allowed to
 create an instance of a class that has been defined as abstract. Any
 class that contains at least one abstract method must also be
 abstract. Methods defined as abstract simply declare the method's
 signature they cannot define the implementation.

 You make misconception understand for abstract class,:(, correct code is:
 abstract class a {
abstract public function __construct(){

   }
   abstract public function __destruct(){

   }
  }

  class b extends a{
public function __construct(){
 echo constructingbr;
   }
   public function __destruct(){
 echo destructingbr;
   }
  }

  $c = new b();
 unset($c);

 if you want to make it work correctly that you want,plase change code to
follow
 class c {
public function __construct(){
 echo constructingbr/;
   }
   public function __destruct(){
 echo destructingbr/;
   }
 }

  class d extends c{

  }
   $e = new d();
   unset($e);



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



Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
Stuart, u are right, the refcount in php 5 doesn't matter, where something
left behind in my memory from earlier days, However i do have the effect
that unsetting an object does NOT call __dectruct() ! but when the script
ends it is called. this can be easily tested by putting a echo in destruct.

my objects affected are pretty much the sheme I send. however I'm doing some
reflection stuff in my classes. may be thats the reason. I will do some
further investigation about that.


Stuart stut...@gmail.com wrote in message
news:a5f019de0908240749l8fa749s825cfa0e475f7...@mail.gmail.com...
2009/8/24 Ralph Deffke ralph_def...@yahoo.de:
 this is also not the full truth try this and it works
 what are the circumstances that is causing this problem then, yes I do
have
 distributed references over my script and there are clearly references
still
 set, however after running the snipped script I can not see what I do
 special in my script causing the problem. I even tried with public and
 private static in other objects. it works. however the manual indicates
the
 refernce counter has to be 0.

Assuming you're using PHP 5...

 ?php


 abstract class a {
 public function __construct(){
 echo constructingbr;
 }
 public function __destruct(){
 echo destructingbr;
 }
 }

 class b extends a{

 }

 $c = new b();

refcount = 1

 $d = $c ; // works

refcount = 2

 $f[] = $c ; // works

refcount = 3

 class e {
 private $m;

 public function setM( $m ){
 $this-m = $m;
 }
 }

 $o = new e();
 $o-setM( $c ); // works

refcount = 4 (due to assignment in setM)

 unset( $c );

refcount = 3

In PHP 5 all objects are passed by reference unless explicitly cloned.
This means that assigning an object variable to another variable does
nothing more than assign a reference and increment the referece count.

What exactly in the manual leads you to believe that after the unset
the refcount should be 0?

-Stuart

-- 
http://stut.net/

 Lupus Michaelis mickael+...@lupusmic.org wrote in message
 news:41.f9.03363.01192...@pb1.pair.com...
 kranthi wrote:
  unset($obj) always calls the __destruct() function of the class.

 Never calls the dtor. The dtor will be called only when the reference
 count reaches 0.

 class c { function __destruct() { echo 'dying !' ; } }
 $v1 = new c ;
 $v2 = $v1 ;

 unset($v1) ; // don't call the dtor
 unset($v2) ; // call the dtor

 --
 Mickaël Wolff aka Lupus Michaelis
 http://lupusmic.org



 --
 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] php move_uploaded_file() filesize problem

2009-08-24 Thread Ralph Deffke
I would also be shure that u run into the srcipt time out time. of course
there is one limit u can be a little bit under or a little bit above.

measure the time with microtime() and compare it with the script time out
settings and u will have the answer

ralph_def...@yahoo.de

Thomas Gabrielsen tho...@arton.no wrote in message
news:df.aa.03363.30213...@pb1.pair.com...

 Ryan Cavicchioni ryan...@confabulator.net wrote in message
 news:20090824205810.gc32...@mail.confabulator.net...
  On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote:
  Hi
 
  I have a problem with uploading files that are bigger than the Master
  Value allow me to, which is 32 MB. I've set the max_upload_filesize and
  max_post_size in a .htaccess file and the phpinfo() reports the new
local
  value (128 MB) according to the .htaccess, but the script fails
silently
  with no errors every time I try to upload a file greater than 32 MB.
Have
  any of you had the same problem?
 
  I stumbled across this blog post:
  http://www.gen-x-design.com/archives/uploading-large-files-with-php/
 
  He suggests also looking at the script timeout and the
  'max_input_time' ini setting.
 
  Regards,
   --Ryan Cavicchioni

 Hi Ryan, and thanks for your reply:

 I've allready set that, but I forgot to mention it in the first post. This
 is what my .htaccess looks like:
 php_value upload_max_filesize 64M
 php_value max_execution_time 800
 php_value post_max_size 64M
 php_value max_input_time 100
 php_value memory_limit 120M

 I'm very sure that it has something to do with the upload_max_filesize
 because I generated two files, one just a little greater than 32MB, and
one
 just a little bit smaller. The latter file is uploaded fine, but the
bigger
 one is not.

 Thanks!
 Thomas Gabrielsen




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



[PHP] Re: unset() something that doesn't exist

2009-08-24 Thread Ralph Deffke
causes an error
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in
C:\wamp\www\TinyCreator\testCrapp6.php on line 42

Tom Worster f...@thefsb.org wrote in message
news:c6b87877.11463%...@thefsb.org...
 is it the case that unset() does not trigger an error or throw an
exception
 if it's argument was never set?





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



[PHP] __destruct() not called ! we shot us in the foot try the script

2009-08-24 Thread Ralph Deffke

well I would call this an error in the first view , and some of u where
right! and the stuff with the refernce counter seems to be right as well.

however I can't see a reason for it as 5.x works through refernces. so
unsetting a REFERENCE to the object does not destroy it.

How to destroy the object then?

?php


abstract class a {
  public function __construct(){
echo constructingbr;
  }
  public function __destruct(){
echo destructingbr;
  }
}

class b extends a{

  public function doSomething(){
echo I'm doing ...but the reference c to the object is unset()br;
  }

}

$c = new b();

$d = $c ;   // works
$f[] = $c ; // works

class e {
  public static $m;

  public static function setM( $m ){
self::$m = $m;
  }
}

$o = new e();
e::setM( $c ); // works

echo unsetting ...br;
unset( $c );

$d-doSomething();

echo script ending now ...br;

?




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



[PHP] Re: unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
I did start a new topic
have a look there;

Ralph Deffke ralph_def...@yahoo.de wrote in message
news:79.73.03363.43752...@pb1.pair.com...
 but it should? shouldn't it how can I destroy a class instance invocing
 __detruct() of the class ?!?!?








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



[PHP] wierd behavior on parsing css with no php included

2009-08-23 Thread Ralph Deffke
Hi folks, i did post this also on the Wamp page but maybe someone out there
had to solve that problem as well.

systems involved

Firefox 3.0.13
Firefox 3.5.2
IE 6

Wamp:
apache 2.2.11
PHP 5.2.9  php 5.3

I do parse css files through php

Problem: css files are loaded into the browsers but not interpreted or used
on RAW HTML files no php included. The html files are produced with
phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the
page, Firefox NOT AT ALL.

I think it might be possible that wamp throughs some wierd characters into
the css files or is the header type a problem? It looks like parsing the css
through the php engine changes the header of the css to text/html. this
would explain why IE6 can use them. on the other hand firebug shows the
loaded css, indicates however that no css is available.

as an reverse check I did load the html files direktly from the disk with
file:/// ... and the css are interpreted perfectly. so the source of the
problem is wamp.

it seems that the @importcsss does the biggest problem.it creates a 404
error file not found

it seems creating dynamic css files got some secrets involved with the wamp.
I'm using this concept since ages on linux with no problem.

on the @includecss it seems that the search for files are changing to the
php include path or something.

any idear what to check?

is important for my work to create css dynamicly

ralph_def...@yahoo.de



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



[PHP] wierd behavior on parsing css with no php included

2009-08-23 Thread Ralph Deffke
Hi folks, i did post this also on the Wamp page but maybe someone out there
had to solve that problem as well.

systems involved

Firefox 3.0.13
Firefox 3.5.2
IE 6

Wamp:
apache 2.2.11
PHP 5.2.9  php 5.3

I do parse css files through php

Problem: css files are loaded into the browsers but not interpreted or used
on RAW HTML files no php included. The html files are produced with
phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the
page, Firefox NOT AT ALL.

I think it might be possible that wamp throughs some wierd characters into
the css files or is the header type a problem? It looks like parsing the css
through the php engine changes the header of the css to text/html. this
would explain why IE6 can use them. on the other hand firebug shows the
loaded css, indicates however that no css is available.

as an reverse check I did load the html files direktly from the disk with
file:/// ... and the css are interpreted perfectly. so the source of the
problem is wamp.

it seems that the @importcsss does the biggest problem.it creates a 404
error file not found

it seems creating dynamic css files got some secrets involved with the wamp.
I'm using this concept since ages on linux with no problem.

on the @includecss it seems that the search for files are changing to the
php include path or something.

any idear what to check?

is important for my work to create css dynamicly

ralph_def...@yahoo.de




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



[PHP] Re: wierd behavior on parsing css with no php included

2009-08-23 Thread Ralph Deffke
Yes, pasring .css is the problem, is there a way to tell php to send
different headers based on the file extention of the file parsed ? should
be, it worked on linux.

ralph_def...@yahoo.de


Ralph Deffke ralph_def...@yahoo.de wrote in message
news:67.4f.03363.a1e21...@pb1.pair.com...
 Hi folks, i did post this also on the Wamp page but maybe someone out
there
 had to solve that problem as well.

 systems involved

 Firefox 3.0.13
 Firefox 3.5.2
 IE 6

 Wamp:
 apache 2.2.11
 PHP 5.2.9  php 5.3

 I do parse css files through php

 Problem: css files are loaded into the browsers but not interpreted or
used
 on RAW HTML files no php included. The html files are produced with
 phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the
 page, Firefox NOT AT ALL.

 I think it might be possible that wamp throughs some wierd characters into
 the css files or is the header type a problem? It looks like parsing the
css
 through the php engine changes the header of the css to text/html. this
 would explain why IE6 can use them. on the other hand firebug shows the
 loaded css, indicates however that no css is available.

 as an reverse check I did load the html files direktly from the disk with
 file:/// ... and the css are interpreted perfectly. so the source of the
 problem is wamp.

 it seems that the @importcsss does the biggest problem.it creates a 404
 error file not found

 it seems creating dynamic css files got some secrets involved with the
wamp.
 I'm using this concept since ages on linux with no problem.

 on the @includecss it seems that the search for files are changing to the
 php include path or something.

 any idear what to check?

 is important for my work to create css dynamicly

 ralph_def...@yahoo.de





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



[PHP] Re: wierd behavior on parsing css with no php included

2009-08-23 Thread Ralph Deffke
before you come up with how to send a header in php

I'm TALKING ABOUT .CSS FILES NOT INCLUDING ANY PHP

if you put this in httpconf
AddType application/x-httpd-php .css
the problem is caused


Ralph Deffke ralph_def...@yahoo.de wrote in message
news:67.4f.03363.a1e21...@pb1.pair.com...
 Hi folks, i did post this also on the Wamp page but maybe someone out
there
 had to solve that problem as well.

 systems involved

 Firefox 3.0.13
 Firefox 3.5.2
 IE 6

 Wamp:
 apache 2.2.11
 PHP 5.2.9  php 5.3

 I do parse css files through php

 Problem: css files are loaded into the browsers but not interpreted or
used
 on RAW HTML files no php included. The html files are produced with
 phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the
 page, Firefox NOT AT ALL.

 I think it might be possible that wamp throughs some wierd characters into
 the css files or is the header type a problem? It looks like parsing the
css
 through the php engine changes the header of the css to text/html. this
 would explain why IE6 can use them. on the other hand firebug shows the
 loaded css, indicates however that no css is available.

 as an reverse check I did load the html files direktly from the disk with
 file:/// ... and the css are interpreted perfectly. so the source of the
 problem is wamp.

 it seems that the @importcsss does the biggest problem.it creates a 404
 error file not found

 it seems creating dynamic css files got some secrets involved with the
wamp.
 I'm using this concept since ages on linux with no problem.

 on the @includecss it seems that the search for files are changing to the
 php include path or something.

 any idear what to check?

 is important for my work to create css dynamicly

 ralph_def...@yahoo.de





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



Re: [PHP] array() returns something weird

2009-08-22 Thread Ralph Deffke
well, when I saw ur post I got immediately the thought I would bed it has to
do with some stuff of $this or self.

I did play arround a bit with class creation the last days and yes, with
using self parent and $this I did put the HTTPPD in unstable and sometimes
it died without beeing able to send any error.

well this doesn't help very mutch.

I have two point:

(1)ur code is ( sorry ) lazy written, invest the brackets !! ur code writing
is predestinated for that type of error. shooting variable types arround by
pulling out of foreach loops,  if's,  is typical.

(2) using static variables are known for type missmatch errors just anything
has acces to them even if the containing class is not instantinated. many
dirty things can happen unless of corse they are not private.

further sugestions: check if you work on ur arrays with functions returning
array on success but false on fail or something like that. also a typical
source for that type of error

are u using magic __set ? I ran into a type change as well with it

good luck

ralph_def...@yahoo.de


Szczepan Holyszewski webmas...@strefarytmu.pl wrote in message
news:200908222152.55846.webmas...@strefarytmu.pl...
  What it looks like to me is that something is causing $foo to be a
  string before the '$foo[] = bar;' line is encountered. What do you
  get if you put a gettype($foo); just before that line?
 
  $foo=null;
  $foo[]=bar;  // -- $foo simply becomes an array

 NULL. That is the problem. I _did_ put a gettype($foo) before the actual
line.

 OK, here are exact four lines of my code:

 $ret=array();
 foreach(self::$_allowed as $r = $a)
 if ($a)
 $ret[]=$r;

 As you can see, there is not a shred of a chance for $ret to become
something
 other than empty array between initialization and the last line in the
above
 snippet which causes the fatal errror. There's no __staticGet in 5.2.9, so
 self::$_allowed cannot have side effects.

 Secondly, the above code starts failing after it has executed successfully
 dozens of times (and yes, the last line _does_ get executed; in fact
self::
 $_allowed contains configuration information that doesn't change at
runtime).

 Thirdly...

   The problem is not limited to one place in code, and indeed before the
   fatal caused by append-assignment I get several warnings like
   array_diff_key(): Argument #1 is not an array, where the offending
   argument receives a result of array().
 
  This would appear to support my suspicion, but try inserting the
  gettype($foo) (or better, var_export($foo);) just before one of the
  lines which triggers the error, and post the results.

 No, I don't think it supports your suspicion. Conversely, it indicates
that
 once array() returns a strangelet, it starts returning strangelets all
over
 the place. Initially it only triggers warnings but eventually one of the
 returned strangelets is used in a way that triggers a fatal error.

 As per your request:

 //at the beginning of the script:

 $GLOBALS['offending_line_execution_count']=0;

 // /srv/home/[munged]/public_html/scripts/common.php line 161 and on
 // instrumented as per your request:

 public static function GetAllowed() {

 if (debug_mode()) echo
++$GLOBALS['offending_line_execution_count'].br/;
 $ret=array();
 if (debug_mode()) echo var_export($ret).br/;
 foreach(self::$_allowed as $r = $a)
 if ($a)
 $ret[]=$r;

 if (self::$_allowEmpty) $ret[]=;
 return $ret;
 }

 Output tail:
 ---
 28
 array ( )
 29
 array ( )
 30
 array ( )
 31
 array ( )
 32
 array ( )

 Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an
array
 in /srv/home/u80959ue/public_html/v3/scripts/SimpliciText.php on line 350

 Warning: Invalid argument supplied for foreach() in
 /srv/home/u80959ue/public_html/v3/scripts/SimpliciText.php on line 351

 Warning: array_merge() [function.array-merge]: Argument #2 is not an array
in
 /srv/home/u80959ue/public_html/v3/scripts/SimpliciText.php on line 357

 Warning: Invalid argument supplied for foreach() in
 /srv/home/u80959ue/public_html/scripts/common.php on line 28

 Warning: Invalid argument supplied for foreach() in
 /srv/home/u80959ue/public_html/scripts/common.php on line 28

 Warning: Invalid argument supplied for foreach() in
 /srv/home/u80959ue/public_html/scripts/common.php on line 28
 33
 NULL

 Fatal error: [] operator not supported for strings in
 /srv/home/u80959ue/public_html/scripts/common.php on line 168
 --

 The warnings come from other uses of array().

 But wait! There is this invocation of debug_mode() between initialization
of
 $ret var_export. Let's factor it out to be safe:

 $debugmode=debug_mode();
 if ($debugmode) echo ++$GLOBALS['offending_line_execution_count'].br/;
 $ret=array();
 if ($debugmode) echo var_export($ret).br/;

 And now the output ends with:

 
 Warning: Invalid argument supplied for foreach() in
 

[PHP] Re: Form Spam

2009-08-20 Thread Ralph Deffke
may be a better afvice could be given if we would know more about the
application. However u mentioend that these little amonut is HUMAN driven.
then its very much dependent on the application itself and can not be done
with putting some retrictions which would be against the internationality of
the web.

However a common practice is thst u give a human only readable image that
shows hard readable character stuff to put in a input field for verification
on the server.

however human driven spam is almost not avoidable, bots yes.

The problem is that people in the third world work for 2 bugs a day. I would
wonder if u don't talk about the nigeria conection by the way.

hope it helps
ralph_def...@yahoo.de

Gary gwp...@ptd.net wrote in message
news:e8.c5.10097.1ab4d...@pb1.pair.com...
 I have a client with a form on his site and he is getting spammed.  It
 appears not to be from bots but human generated.  While they are coming
from
 India, they do not all have the same IP address, but they all have gmail
 addresses, New York  addresses are used in the input field and they all
 offer SEO services.  It is not overwhleming, but about 5 a month.

 What is the best way to stop this.

 Thanks

 Gary



 __ Information from ESET Smart Security, version of virus
signature database 4351 (20090820) __

 The message was checked by ESET Smart Security.

 http://www.eset.com







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



[PHP] Re: DB Question | A hotel reservation scenario

2009-08-18 Thread Ralph Deffke
to answer this is in fact not possible on the base of information u give.

I dont think there is a general db outlay for hotels. it depends how the
booking tables are designed.

does the application excist or u are doing a new one?

if it excist, have a look how the availability of a room is calculated and
then go from there. it would be the same calculation, just with backwards
dates.

hope that helps

ralph_def...@yahoo.de



Behzad behzad.esl...@gmail.com wrote in message
news:470fa6660908180745i6bb6a442xd53d2c02fac7b...@mail.gmail.com...
 Dear list,
 e-Greetings!

 I'm faced with an interesting and challenging problem.

 Consider a database, designed for a hotel.
 At any given time, each room has a different status: It's Busy or
Reserved,
 or Free.

 It's easy to retrieve number of Free rooms at the current time.
 But how can I count the number of rooms that were busy during the last
week
 ?

 I would appreciate if you take a brief moment of your time and share your
 opinion.

 Thank you in advance,
 -b




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



Re: [PHP] Undefined Offset Error with Pagination and Sessions

2009-08-18 Thread Ralph Deffke
by having a quick look on it, u have to work on a session base? otherwise it
could be done by the post data only. I'm trying to avoid to work on the
session, because it makes live a bit easier. if u can try.

I'm telling this, because as u metioned to unset the session stuff is wierd
and I wouldn't trust the session vars any more anyway.

ralph_def...@yahoo.de


Miller, Terion tmil...@springfi.gannett.com wrote in message
news:c6b04cb6.49e1%kmille...@springfi.gannett.com...
Formatted as PHP
http://pastebin.ca/1534058


and a note before I get chewed about the weird setting and unsetting at the
top with the sessions...because believe I see it...but if you take the
unset() out..nothing works, I can't figure that out and maybe that is a
blatent thing I'm missing (prob) but I know that checking if a sesion is set
then immediately unsetting it is not logical, and I tried putting it like if
isset else unset but same results, nothing work all variables error'd  out
as undefined.



On 8/18/09 11:49 AM, Miller, Terion tmil...@springfi.gannett.com wrote:

Hi Folks, after days of trying lots of different things, I'm must grovel to
the list and post my problem...which is I am unable to get my pagination to
work, it seems to not carry the session to the next page and I get the
undefined offset error

The page code is posted here since my email client seems to mess up the code
formatting: http://pastebin.ca/1534024

Thanks to any and all who have a look.
Terion


--
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: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke

try

$link-nodeValue()

or

$link-getContent()

im not shure which one works on an image link which is indeed a child of a
so u could also check if the node has a child, if so its an image with, in
good practice. an alt attribute to use

haven't tried but should work. let me know pls

ralph_def...@yahoo.de


chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
 I have the following code to extract the URLs from the anchor tags of an
 HTML page:

 $html = new DOMDocument();
 $htmlpage-loadHtmlFile($location);
 $xpath = new DOMXPath($htmlpage);
 $links = $xpath-query( '//a' );
 foreach ($links as $link)
 { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }

 If I have a link a href=http://X.com;/a, how do I extract the
 corresponding  which is displayed to the user as the text of the link
 (if it's an image tag, I would like a DOMElement for that).
 Thanks




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



Re: [PHP] Re: Issue with the huge import script

2009-08-16 Thread Ralph Deffke
because I assume always that a requester got some intelligence, so in that
case there must be a reasonsble reason why he wants to do it in PHP

im not like u assuming everybody is a thumb

ralph

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1250413427.2344.51.ca...@localhost...
 On Sun, 2009-08-16 at 04:06 +0200, Ralph Deffke wrote:
  Hi,
 
  this sounds huge, and cries for a sql version of the import.
  Are both databases the same? MySQL?
 
  I give u a draft for MySQL
  u export the data u have, then u got a textfile with 10+ sql
statments
 
  in the php script u open the file and iterate over it by line (carefull
it
  could be also ; in case its a Unix created file on a windows platform)
 
  line == one SQL insert in table bla bla...
 
  in the loop then just mysq_query with this line
 
  if the the someid is an unique index the insert will fail, so only those
  records are inserted beeing not already in the database.
 
  but I think as of the amount off records it doesn't sound like a every
10
  minutes job, if it is a rara job, just do it with phpMyAdmin
 
  sorry not pulling out the code, but was a long day behind the keyboard,
need
  some sleep
 
  ralph_def...@yahoo.de
 
 
 
 
  Devendra Jadhav devendra...@gmail.com wrote in message
  news:be4b00cf0908151815r1c7430d2j8a6cb0da1f10a...@mail.gmail.com...
   Hi,
  
   I have to import data from one database to another, I have to import
  around
   10(1Lac) records.
   First I need to check if the record is already imported or not and
import
   only those records which are not imported.
  
   Here is my logic
  
   $already_imported = get_already_imported_records();
   format of the $already_imported is $already_imported[someid] =
'imported';
  
   Now i take all records from another db and iterating through it.
  
   if (!key_exists($already_imported[$new_id])){
   import_function($new_id)
   }else{
   echo 'allready imported'.$already_imported[$new_id];
   }
  
   Now my script is importing same records for more than one time. I am
not
   able to get through this issue
  
   Is it because of the size of the records or something else...?
  
   Please suggest me some solution which is faster, safe and easy to code
:D
  
   Thanks in advance
  
   -- 
   Devendra Jadhav
  
 
 
 
 You cry for a MySQL version and then revert back to PHP?! Why not just
 keep the whole thing in MySQL? You can use SQL statements to check
 whether a record exists before attempting to shove it in the database
 using a WHERE clause in the INSERT statement or by making one field
 unique and hiding notices about inserts that are attempting to overwrite
 that.

 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] Re: Issue with the huge import script

2009-08-16 Thread Ralph Deffke
so then tell me tell me what my first sentence means

this sounds huge, and cries for a sql version of the import.

it looks like u have no experience in working as consultant  hotlines Ash
first the folk is asking for a sulotion of HIS php implying a general
solution in PHP with a hint to the prof solution

I think thats what I did


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1250414284.2344.55.ca...@localhost...
 On Sun, 2009-08-16 at 11:05 +0200, Ralph Deffke wrote:
  because I assume always that a requester got some intelligence, so in
that
  case there must be a reasonsble reason why he wants to do it in PHP
 
  im not like u assuming everybody is a thumb
 
  ralph
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1250413427.2344.51.ca...@localhost...
   On Sun, 2009-08-16 at 04:06 +0200, Ralph Deffke wrote:
Hi,
   
this sounds huge, and cries for a sql version of the import.
Are both databases the same? MySQL?
   
I give u a draft for MySQL
u export the data u have, then u got a textfile with 10+ sql
  statments
   
in the php script u open the file and iterate over it by line
(carefull
  it
could be also ; in case its a Unix created file on a windows
platform)
   
line == one SQL insert in table bla bla...
   
in the loop then just mysq_query with this line
   
if the the someid is an unique index the insert will fail, so only
those
records are inserted beeing not already in the database.
   
but I think as of the amount off records it doesn't sound like a
every
  10
minutes job, if it is a rara job, just do it with phpMyAdmin
   
sorry not pulling out the code, but was a long day behind the
keyboard,
  need
some sleep
   
ralph_def...@yahoo.de
   
   
   
   
Devendra Jadhav devendra...@gmail.com wrote in message
news:be4b00cf0908151815r1c7430d2j8a6cb0da1f10a...@mail.gmail.com...
 Hi,

 I have to import data from one database to another, I have to
import
around
 10(1Lac) records.
 First I need to check if the record is already imported or not and
  import
 only those records which are not imported.

 Here is my logic

 $already_imported = get_already_imported_records();
 format of the $already_imported is $already_imported[someid] =
  'imported';

 Now i take all records from another db and iterating through it.

 if (!key_exists($already_imported[$new_id])){
 import_function($new_id)
 }else{
 echo 'allready imported'.$already_imported[$new_id];
 }

 Now my script is importing same records for more than one time. I
am
  not
 able to get through this issue

 Is it because of the size of the records or something else...?

 Please suggest me some solution which is faster, safe and easy to
code
  :D

 Thanks in advance

 -- 
 Devendra Jadhav

   
   
   
   You cry for a MySQL version and then revert back to PHP?! Why not just
   keep the whole thing in MySQL? You can use SQL statements to check
   whether a record exists before attempting to shove it in the database
   using a WHERE clause in the INSERT statement or by making one field
   unique and hiding notices about inserts that are attempting to
overwrite
   that.
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
 
 
 
 There are rare occasions on this list where the best answer is not PHP,
 and I believe this is one of them.

 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] Re: Issue with the huge import script

2009-08-16 Thread Ralph Deffke
better consider if u r insulting I've seen a view posts of u falling into
that category i w'ld recomment respect posters first approaches even if they
r stupid and incorporate the respect in the way u answer

the comment you r crying ... is an insult.

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1250417781.2344.58.ca...@localhost...
 On Sun, 2009-08-16 at 11:25 +0200, Ralph Deffke wrote:
  so then tell me tell me what my first sentence means
 
  this sounds huge, and cries for a sql version of the import.
 
  it looks like u have no experience in working as consultant  hotlines
Ash
  first the folk is asking for a sulotion of HIS php implying a general
  solution in PHP with a hint to the prof solution
 
  I think thats what I did
 
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1250414284.2344.55.ca...@localhost...
   On Sun, 2009-08-16 at 11:05 +0200, Ralph Deffke wrote:
because I assume always that a requester got some intelligence, so
in
  that
case there must be a reasonsble reason why he wants to do it in PHP
   
im not like u assuming everybody is a thumb
   
ralph
   
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1250413427.2344.51.ca...@localhost...
 On Sun, 2009-08-16 at 04:06 +0200, Ralph Deffke wrote:
  Hi,
 
  this sounds huge, and cries for a sql version of the import.
  Are both databases the same? MySQL?
 
  I give u a draft for MySQL
  u export the data u have, then u got a textfile with 10+ sql
statments
 
  in the php script u open the file and iterate over it by line
  (carefull
it
  could be also ; in case its a Unix created file on a windows
  platform)
 
  line == one SQL insert in table bla bla...
 
  in the loop then just mysq_query with this line
 
  if the the someid is an unique index the insert will fail, so
only
  those
  records are inserted beeing not already in the database.
 
  but I think as of the amount off records it doesn't sound like a
  every
10
  minutes job, if it is a rara job, just do it with phpMyAdmin
 
  sorry not pulling out the code, but was a long day behind the
  keyboard,
need
  some sleep
 
  ralph_def...@yahoo.de
 
 
 
 
  Devendra Jadhav devendra...@gmail.com wrote in message
 
news:be4b00cf0908151815r1c7430d2j8a6cb0da1f10a...@mail.gmail.com...
   Hi,
  
   I have to import data from one database to another, I have to
  import
  around
   10(1Lac) records.
   First I need to check if the record is already imported or not
and
import
   only those records which are not imported.
  
   Here is my logic
  
   $already_imported = get_already_imported_records();
   format of the $already_imported is $already_imported[someid] =
'imported';
  
   Now i take all records from another db and iterating through
it.
  
   if (!key_exists($already_imported[$new_id])){
   import_function($new_id)
   }else{
   echo 'allready imported'.$already_imported[$new_id];
   }
  
   Now my script is importing same records for more than one
time. I
  am
not
   able to get through this issue
  
   Is it because of the size of the records or something else...?
  
   Please suggest me some solution which is faster, safe and easy
to
  code
:D
  
   Thanks in advance
  
   -- 
   Devendra Jadhav
  
 
 
 
 You cry for a MySQL version and then revert back to PHP?! Why not
just
 keep the whole thing in MySQL? You can use SQL statements to check
 whether a record exists before attempting to shove it in the
database
 using a WHERE clause in the INSERT statement or by making one
field
 unique and hiding notices about inserts that are attempting to
  overwrite
 that.

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

   
   
   
   There are rare occasions on this list where the best answer is not
PHP,
   and I believe this is one of them.
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
 
 
 
 You did say this cries for a pure SQL solution, which you then went on
 to say involved PHP. Call me a pedant, but PHP is not SQL. And please,
 try to leave insults out of the list in future, it makes you look
 unprofessional.

 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] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke
did u try it something like this

foreach ($links as $link) {
$int_url_list[$i][href] = $link-getAttribute( 'href' );
$int_url_list[$i++][linkText] = $link-getContent(  ); // nodeValue();
}
that should work

send ur code then please
ralph_def...@yahoo,de


chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
 I have the following code to extract the URLs from the anchor tags of an
 HTML page:

 $html = new DOMDocument();
 $htmlpage-loadHtmlFile($location);
 $xpath = new DOMXPath($htmlpage);
 $links = $xpath-query( '//a' );
 foreach ($links as $link)
 { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }

 If I have a link a href=http://X.com;/a, how do I extract the
 corresponding  which is displayed to the user as the text of the link
 (if it's an image tag, I would like a DOMElement for that).
 Thanks




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



Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke
well the immage goes inside the a.. img... /a

on ur html the node a has no value however u should not get a error

this is pergect jtml link
a href=thema.htmimg src=button4.jpg width=160 height=34
border=0 alt=THEMA/a

ralph

chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160943t2254137fve43771c7e4f8c...@mail.gmail.com...
 WHile waiting for suggestions for extracting the link text from the DOM, I
 tried a brute force approach using the URLs I had found with
getAttribute(),
 but found myself baffled by my results. I boiled down my issue with this
 approach to the following snippet.

 $htmldata =EOB

http://www.protools.com/users/user_story.cfm?story_id=1162amp;lang=1;quot;Creating

 Surround Mixes with Tim Weidner/aquot; img height=11
 src=new.gif width=28
 - iMagnification/i engineer talks about mixing the album
at
 the
 iProTools/i site, by Jim Batchco
 http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html;quot;Don't
 Goquot; Video/aa href=

http://fi.soneraplaza.net/kaista/musiq/kaistatv/0,8883,201392,00.html;/a
 img height=11 src=new.gif width=28 - Presented by
Beyond
 Music
 (a
href=http://www.apple.com/quicktime/download/;QuickTime/a

 Required)
 EOB;
 $url = 'http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html';
 $posn = strpos($url, $htmldata);
 echo URL |$url| position is |$posn|;

 Running this gives me:

 URL |http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html| position is
||

 I've tried lots of functions, and even regular expressions, but I cannot
get
 the code to find the URL in the HTML. While I still hope for a DOM
solution
 to getting this link text, WHY can't the code find the URL in the HTML
 snippet?

 On Sun, Aug 16, 2009 at 9:29 AM, chrysanhy
phpli...@hyphusonline.comwrote:

  I pasted the code exactly as you have it, and I got the following:
 
  *Fatal error*: Call to undefined method DOMElement::getContent()
 
  I got the same thing with nodeValue().
 
 
  On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke
ralph_def...@yahoo.dewrote:
 
  did u try it something like this
 
  foreach ($links as $link) {
 $int_url_list[$i][href] = $link-getAttribute( 'href' );
 $int_url_list[$i++][linkText] = $link-getContent(  ); //
  nodeValue();
  }
  that should work
 
  send ur code then please
  ralph_def...@yahoo,de
 
 
  chrysanhy phpli...@hyphusonline.com wrote in message
  news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
   I have the following code to extract the URLs from the anchor tags of
an
   HTML page:
  
   $html = new DOMDocument();
   $htmlpage-loadHtmlFile($location);
   $xpath = new DOMXPath($htmlpage);
   $links = $xpath-query( '//a' );
   foreach ($links as $link)
   { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
  
   If I have a link a href=http://X.com;/a, how do I extract
the
   corresponding  which is displayed to the user as the text of the
  link
   (if it's an image tag, I would like a DOMElement for that).
   Thanks
  
 
 
 
  --
  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: How do I extract link text from anchor tag as well as the URL from the href attribute

2009-08-16 Thread Ralph Deffke
this worked here:
?php

$html = new DOMDocument();
$html-loadHtmlFile(testHtml.html);
$links = $html-getElementsByTagName('a');
echo pre;

foreach ($links as $item) {
  echo $item-getAttribute( 'href' ). \n;
  echo --- . $item-nodeValue . \n;
}

echo /pre;

?

Im sending u the 2 files directly in a minute. it came out, as I thought
earlier that u have to check if the a tags has got children to extract
image links.

ralph_def...@yahoo.de


chrysanhy phpli...@hyphusonline.com wrote in message
news:88827b190908160943t2254137fve43771c7e4f8c...@mail.gmail.com...
 WHile waiting for suggestions for extracting the link text from the DOM, I
 tried a brute force approach using the URLs I had found with
getAttribute(),
 but found myself baffled by my results. I boiled down my issue with this
 approach to the following snippet.

 $htmldata =EOB

http://www.protools.com/users/user_story.cfm?story_id=1162amp;lang=1;quot;Creating

 Surround Mixes with Tim Weidner/aquot; img height=11
 src=new.gif width=28
 - iMagnification/i engineer talks about mixing the album
at
 the
 iProTools/i site, by Jim Batchco
 http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html;quot;Don't
 Goquot; Video/aa href=

http://fi.soneraplaza.net/kaista/musiq/kaistatv/0,8883,201392,00.html;/a
 img height=11 src=new.gif width=28 - Presented by
Beyond
 Music
 (a
href=http://www.apple.com/quicktime/download/;QuickTime/a

 Required)
 EOB;
 $url = 'http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html';
 $posn = strpos($url, $htmldata);
 echo URL |$url| position is |$posn|;

 Running this gives me:

 URL |http://www.beyondmusic.com/MediaPlayer/Yes/DontGo.html| position is
||

 I've tried lots of functions, and even regular expressions, but I cannot
get
 the code to find the URL in the HTML. While I still hope for a DOM
solution
 to getting this link text, WHY can't the code find the URL in the HTML
 snippet?

 On Sun, Aug 16, 2009 at 9:29 AM, chrysanhy
phpli...@hyphusonline.comwrote:

  I pasted the code exactly as you have it, and I got the following:
 
  *Fatal error*: Call to undefined method DOMElement::getContent()
 
  I got the same thing with nodeValue().
 
 
  On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke
ralph_def...@yahoo.dewrote:
 
  did u try it something like this
 
  foreach ($links as $link) {
 $int_url_list[$i][href] = $link-getAttribute( 'href' );
 $int_url_list[$i++][linkText] = $link-getContent(  ); //
  nodeValue();
  }
  that should work
 
  send ur code then please
  ralph_def...@yahoo,de
 
 
  chrysanhy phpli...@hyphusonline.com wrote in message
  news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com...
   I have the following code to extract the URLs from the anchor tags of
an
   HTML page:
  
   $html = new DOMDocument();
   $htmlpage-loadHtmlFile($location);
   $xpath = new DOMXPath($htmlpage);
   $links = $xpath-query( '//a' );
   foreach ($links as $link)
   { $int_url_list[$i++] = $link-getAttribute( 'href' ) . \n; }
  
   If I have a link a href=http://X.com;/a, how do I extract
the
   corresponding  which is displayed to the user as the text of the
  link
   (if it's an image tag, I would like a DOMElement for that).
   Thanks
  
 
 
 
  --
  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] brainstorm/samples on _autoload() needed

2009-08-16 Thread Ralph Deffke
anybody out there with a ultimate solution, speed optimzed?

im going now for an ultimate solution, this repeating problem sucks

ralph_def...@yahoo.de



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



Re: [PHP] Another date exercise

2009-08-16 Thread Ralph Deffke
i agree on date pickers and js is  well

use individual fields for day month and year, make month and year as drop
down and u have no problem at all

make live easier

ralph

Paul M Foster pa...@quillandmouse.com wrote in message
news:20090816202217.gs2...@quillandmouse.com...
 On Sun, Aug 16, 2009 at 08:36:17AM +0100, Lester Caine wrote:

  tedd wrote:
  Hi gang:
 
  Here's another exercise to consider.
 
  This is a date entry problem where the user can enter a date in various
  forms, but the return will be in a consistent format.
 
  For example, a user might enter a date in the form of:
 
  August 5, 2009
  Aug 05 2009
  Aug 5, 9
  08/05/09
  8-5-9
  8 05 2009
  8,5,9
 
  Or any combination thereof.
 
  However, the resultant date will be standardized to: Aug 5, 2009.
 
  Extra points for solving this for Euro as well as US date formats
(i.e.,
  5 Aug, 2009 vs Aug 5, 2009).  And, extra extra points for accommodating
  month brevity, such as A for August and Mar for March and so on.
 
  But the real problem here is 05/08/09 is still August 5 2009 .
  So teaching customers to use 2009.08.05 removes the hassle of needing to
  know
  where your target site is based!
 
  But as has been said, the real solution is a date picker.

 I *hate* date pickers. They slow down input. I can type 082309Enter
 faster than I can ever do it with a date picker. The date class knows
 I'm in America and since it's a six-digit date, it must be mmddyy. (Yes,
 for those of you *not* in America, I agree our dates are goofy. I think
 we all ought to be on the metic system, too, but America and the UK seem
 intent on sticking to Imperial measure.)

 Paul


 -- 
 Paul M. Foster



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



[PHP] Re: File or directory?

2009-08-15 Thread Ralph Deffke
can u upload ur own files ?
can u create a directory ?
are u using a ftp client ?

try

ralph_def...@yahoo.de

Clancy clanc...@cybec.com.au wrote in message
news:kjhc85hpub7drihgappifphcboolt9u...@4ax.com...
 I have just got access to a new server, and am playing with
upload/download procedures. I
 looked in the root directory, and see several objects which I assume to be
directories.
 However I was surprised to find there does not appear to be any command to
determine if an
 object is a file or directory, either in PHP FTP or plain FTP.  I could
try to change to
 them, or download them, but this seems overkill.  Am I overlooking
something obvious?



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



[PHP] Re: Issue with the huge import script

2009-08-15 Thread Ralph Deffke
Hi,

this sounds huge, and cries for a sql version of the import.
Are both databases the same? MySQL?

I give u a draft for MySQL
u export the data u have, then u got a textfile with 10+ sql statments

in the php script u open the file and iterate over it by line (carefull it
could be also ; in case its a Unix created file on a windows platform)

line == one SQL insert in table bla bla...

in the loop then just mysq_query with this line

if the the someid is an unique index the insert will fail, so only those
records are inserted beeing not already in the database.

but I think as of the amount off records it doesn't sound like a every 10
minutes job, if it is a rara job, just do it with phpMyAdmin

sorry not pulling out the code, but was a long day behind the keyboard, need
some sleep

ralph_def...@yahoo.de




Devendra Jadhav devendra...@gmail.com wrote in message
news:be4b00cf0908151815r1c7430d2j8a6cb0da1f10a...@mail.gmail.com...
 Hi,

 I have to import data from one database to another, I have to import
around
 10(1Lac) records.
 First I need to check if the record is already imported or not and import
 only those records which are not imported.

 Here is my logic

 $already_imported = get_already_imported_records();
 format of the $already_imported is $already_imported[someid] = 'imported';

 Now i take all records from another db and iterating through it.

 if (!key_exists($already_imported[$new_id])){
 import_function($new_id)
 }else{
 echo 'allready imported'.$already_imported[$new_id];
 }

 Now my script is importing same records for more than one time. I am not
 able to get through this issue

 Is it because of the size of the records or something else...?

 Please suggest me some solution which is faster, safe and easy to code :D

 Thanks in advance

 -- 
 Devendra Jadhav




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



Re: [PHP] session variables - help

2009-08-14 Thread Ralph Deffke
I'm realy sorry for u, but the reason for no answers is ur concept.

may be some rules will help u and I recommend u to think to spend the time
to rewrite the whole code. Im shure u will solve the problem then:
first  dont use the global arrays directly. pick the values u need and put
them in reasonable types of variables.
build the business logic on these variables and if u feel like put the
results in well readable new ones
then populate the presentation in the required htmls
this will give u an more structured code, easier to debug and more fun for
the group to help u

I still dont understand why u use the $_SESSION variable. user often leave
forms open for hours and then submit them. u can not expect a user to end a
job in the livecycle of the session. thats what hidden form fields are made
for.

the $_session is for member like things and applications with security
issues where u can expect the user to finish things in a certain time or u
restart the whole.

Allen McCabe allenmcc...@gmail.com wrote in message
news:657acef20908132257x630719e1g4ecddcdff9492...@mail.gmail.com...
 Ben,

 First of all, I thank you for your time and help.

 My ai with using unset($var) in update_order.php is to set the SESSION
 variable for an item to ' ' (empty) so that it would not show up on the
 order summary (because my writeResultRow() function will only write a row
if
 that variable is greater than 0).

 I just can't figure out what I'm missing here. Before I received your
 response, I made a few changes to my code, which helped streamline the
 calculating parts (grabbing values from SESSION instead of POST, and now
 when I update order_summary, the values will remain because it pulls them
 from the SESSION).

 I want to edit the values in the SESSION, so that when update_order.php
 redirects to order_process.php, the values are changed, and if applicable,
 an item is removed from the html table (if the quantity is less than 1).

 Here is some more complete code:

 [code = order_process.php]

 ?php
 session_start();
 // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION
 foreach($_POST as $k=$v) {
  $_SESSION[$k]=$v;
 }

 $thisPage=AFY;  //NAVIGATION PURPOSES
 include(afyshows.php); //CONTAINS ARRAYS FOR SHOW ENTITIES; POPULATES
 ORDER FORM
 ?

 . . .

 /pform name=update action=update_order.php method=post 
  !-- HIDDEN FORM VALUES FOR SESSION PURPOSES --
  input type=hidden name=School  id=School value=?php
 $_SESSION['School']; ? /
  input type=hidden name=Grade id=Grade value=?php
 $_SESSION['Grade']; ? /
  input type=hidden name=Address id=Address value=?php
 $_SESSION['Address']; ? /
  input type=hidden name=City id=City value=?php
$_SESSION['City'];
 ? /
  input type=hidden name=State id=State value=?php
 $_SESSION['State']; ? /
  input type=hidden name=Zip id=Zip size=9 value=?php
 $_SESSION['Zip']; ? /
  input type=hidden name=Contact id=Contact value=?php
 $_SESSION['Contact']; ? /
  input type=hidden name=Phone id=Phone value=?php
 $_SESSION['Phone']; ? /
  input type=hidden name=Fax id=Fax value=?php $_SESSION['Fax'];
?
 /
  input type=hidden name=Email id=Email value=?php
 $_SESSION['Email']; ? /
 . . .

 ?php

 function findTotalCost($b, $c) {
  $total = $b * $c;
  return $total;
 }

 function writeResultRow($a, $b, $c, $d, $e, $f) {
  if($a != '') {
   echo \ntr\n\t;
   echo td'.$b./tdtd.$c./tdtd.$d./td;
   echo td.$e./tdtdnbsp;/tdtdinput type='text'
value='.$a.'
 name='.$a.' id='.$a.' size='2' //tdtd=/tdtd\$.$f./td;
   echo /tr;
  }
 }

 //SETS $Total_show_01 to PRICE * QUANTITY
 //FORMATS TOTAL
 //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES
 $Total_show_01 = findTotalCost($shows['show_01']['price'],
 $_SESSION['show_01_qty']);
 $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', '');
 writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'],
 $shows['show_01']['date'], $shows['show_01']['time'],
 $shows['show_01']['price'],$Total_show_01_fmtd);

 //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38)

 ?
 . . .

 input  name=updates id=updates  type=submit value=Update/

 [/code]

 Now, here is the update_order.php code in entirety:

 [code]

 ?php
 session_start();
 foreach ($_SESSION as $var = $val) {
  if ($val == 0) {
   unset($_SESSION[$var]);
  } elseif ($val == '') {
   unset($_SESSION[$var]);
  } else {
   $val = $_SESSION[$var];

  }
 }
 header(Location: order_process.php);

 //NOTICE I FIXED THE LOCATION OF THE header() FUNCTION
 //BUT IT STILL DOES NOT UPDATE

 ?

 [/code]

 If you're still with me, I thank you. I removed all the styling elements
 from the html to make it easier for you (and me) to see what it says. I
have
 invested many hours into this, and have generated many many lines of code,
 but I hope what I gave you is sufficient, while not being overwhelming at
 this hour.

 Thank you very much for your help thus far, anything else would be greatly
 appreciated.


 On Thu, Aug 13, 2009 at 5:56 PM, Ben Dunlap

Re: [PHP] session variables - help

2009-08-14 Thread Ralph Deffke
well thanks good they are far away then, but the problem is ur client, i
didnt find anybody giving me the permission to beat his customers

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1250236989.2344.10.ca...@localhost...
 On Fri, 2009-08-14 at 09:55 +0200, Ralph Deffke wrote:
  user often leave
  forms open for hours and then submit them

 These users should be taken out and beaten over the head with their
 keyboards!

 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] Re: Using fopen on a site with popups

2009-08-14 Thread Ralph Deffke
have u tried?

I did not, but as far as I understand u getting the stream including the
html causing the browser to open an popup.

so what is ur real problem then?

James Colannino ja...@colannino.org wrote in message
news:4a851d14.2010...@colannino.org...
 Hey everyone!  I have a question.  I know that you can use fopen to open
 not just local files, but also files via HTTP.  My question is, assuming
 you're attempting to open a page that has popups, is there anyway to get
 at the actual content underneath the popup?

 Thanks!

 James



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



Re: [PHP] Re: Using fopen on a site with popups

2009-08-14 Thread Ralph Deffke
well included in a html script tag isn't it!

James Colannino ja...@colannino.org wrote in message
news:4a8522f6.60...@colannino.org...
 Ralph Deffke wrote:
  have u tried?
 
  I did not, but as far as I understand u getting the stream including the
  html causing the browser to open an popup.
 
  so what is ur real problem then?

 Yeah, ummm...

 Sorry for the traffic.  That was a really stupid question...  It looks
 like the format of a page I was reading data from changed, which messed
 something else up.  It just recently started implementing popup ads as
 well, so I blamed that, but as another poster pointed out, popups are
 caused by javascript execution in the browser, so that shouldn't have
 any effect on the content I read.

 Me needs to get some sleep :)

 James



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



[PHP] PHP Byte Code Compiler

2009-08-14 Thread Ralph Deffke
quite a while I'm thinking for what could that be used. also in the
documentation there are no posts, has anybody ever played arround with if?



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



[PHP] Re: Re: Re: Design Patterns

2009-08-13 Thread Ralph Deffke
Thanks Jaime,

very nice, but I'm a programmer since 1982 and into OOP since 1988 with the
outcome if IBM's C++ compiler on the OS2 platform.

Don't u think it could be reasonable to ask if such an overhead IN PHP is
necessary?

does anybody agree that PHP might be the wrong language to accomplish such a
designpattern. Specialy if I find classes about interpreting things.

Don't u think to blow up a servers memonry just to have a nice little
framework could be ask?

Don't u think it makes sence to remember that PHP is just to output a simple
text file?

Has inbedween all the OOP ability everybody forgotten that this is the
simple purpose?

Are there anybody who understands that PHP is an INTERPRETING language and
has anybody an idear what is the amount of code running to do a simple

$something = new object();

versus echo $something

Design pattern are very good, standarizing even better. but would u agree
that, out of Martins presented work, u can not see the how AND how fast the
code is created to output the header the head and body and all other tags.

What I can see, the result will be a lot of code, lots of includes for a
view bytes.

For me, wrong language with unneccesary overhead.

as i can see there must be some more folks out there thinking  a bit
similar, or why is the feetback so relatively poor.

and at least u create design pattern for a PURPOSE.

so again for what pupose are this overhead in PHP
As long as nobody tells me for what benefit this work is done I would say
the design pattern should be done in other packages ready made for that with
an PHP output.

this would not affect any server resources.

now after more then 25 years behind the keyboard I got possibly a bit thumb.
lets open the discussion.

ralph_def...@yahoo.de


Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message
news:62f65ec80908130320t70078242y65308d2ef0288...@mail.gmail.com...
 Hi Ralph.

 If u want to understand the Martin's job u need to read about
 design patterns. A good place to start? Wikipedia (
 http://en.wikipedia.org/wiki/Design_Patterns).

 The use of Design patterns is an advanced programming method.
 It helps us to improve our object oriented programation.

 I hope this helps you,

  Jaime




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



[PHP] Re: literal strings vs variable strings

2009-08-13 Thread Ralph Deffke
I dont think so, because PHP is an interpreter, the string 'something' has
to be extracted and then be put in memory after that the code will compare
the two memory locations. doesnt give me any benefit.

however, comparing strings with the '==' does involve case sensitivity and
also leading or trailing spaces will guide to not equal. thats why I prefere
the comparison functions anyway

Martin Scotta martinsco...@gmail.com wrote in message
news:6445d94e0908130702v4c2e5b77xe4b891546cc85...@mail.gmail.com...
 Hi all.

 Is this going to save me anything?

 ?php # literal
 foreach($items as $item)
if( 'something' == $item-something() )
  return true;

 ?php # variable
 $something = 'something';
 foreach($items as $item)
if( $something == $item-something() )
  return true;

 -- 
 Martin Scotta




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



Re: [PHP] Re: Re: Re: Design Patterns

2009-08-13 Thread Ralph Deffke
funny then that I see here serious people discussing the benefit of
shortening code and cutting out commends.

maby thats a general problem of our society that everybody think higher
cheaper faster. this will have a limit guys !!! u can not go smaler then an
atom.

funny as well that I make my main money in optimizing code to speed and low
server resources. Im one of the old guys who can do both hardware and
software and I'm telling u this is suspect to me. I still can build a
computer from board and powersupply upward.

looks like that u joung guys got a little dream implementet by ur profs. Did
u know that the industry is complaining that the engeneers coming from the
universities are useless for business? a big complain! the real world is
different. Hosting companies will always try to keep a server machine as
long as they can, because a paid server DOES MAKE MONEY. so where is then
the cheap and fast server. how many servers out there still running on PHP4?
have u thouhgt about?

again, design pattern make sence, but on a companies policy base or on a
medium upwards sized project. but there will be more languages be involved
in one company it would be much better to use a language independent tool.

again this is chasing mice with an elephant

ralph_def...@yahoo.de


Nathan Nobbe quickshif...@gmail.com wrote in message
news:7dd2dc0b0908130809p456de5e7g35641de69af14...@mail.gmail.com...
 On Thu, Aug 13, 2009 at 8:09 AM, Ralph Deffke ralph_def...@yahoo.de
wrote:

  Thanks Jaime,
 
  very nice, but I'm a programmer since 1982 and into OOP since 1988 with
the
  outcome if IBM's C++ compiler on the OS2 platform.
 
  Don't u think it could be reasonable to ask if such an overhead IN PHP
is
  necessary?
 
  does anybody agree that PHP might be the wrong language to accomplish
such
  a
  designpattern. Specialy if I find classes about interpreting things.
 
  Don't u think to blow up a servers memonry just to have a nice little
  framework could be ask?
 
  Don't u think it makes sence to remember that PHP is just to output a
  simple
  text file?
 
  Has inbedween all the OOP ability everybody forgotten that this is the
  simple purpose?
 
  Are there anybody who understands that PHP is an INTERPRETING language
and
  has anybody an idear what is the amount of code running to do a simple
 
  $something = new object();
 
  versus echo $something
 
  Design pattern are very good, standarizing even better. but would u
agree
  that, out of Martins presented work, u can not see the how AND how fast
the
  code is created to output the header the head and body and all other
tags.
 
  What I can see, the result will be a lot of code, lots of includes for a
  view bytes.
 
  For me, wrong language with unneccesary overhead.
 
  as i can see there must be some more folks out there thinking  a bit
  similar, or why is the feetback so relatively poor.
 
  and at least u create design pattern for a PURPOSE.
 
  so again for what pupose are this overhead in PHP
  As long as nobody tells me for what benefit this work is done I would
say
  the design pattern should be done in other packages ready made for that
  with
  an PHP output.
 
  this would not affect any server resources.
 
  now after more then 25 years behind the keyboard I got possibly a bit
  thumb.
  lets open the discussion.


 since the 1980's, another advent has come about, called cheap memory, and
 fast
 cpu's.  so the answer is no, nobody cares about how many cycles it
 takes to instantiate a new class in php.  for those who do, they can
 go off and code apps based on sets of global functions or straight
 proceedural code, as php supports them all.

 if you're writing an app in todays world of fast cheap hardware, where
 you're concerned about the number of cycles it takes to instantiate an
 object being too high; i suppose you should be considering something
 like C++ for said app.

 also, it stands to reason that since nobody cares about the object
creation
 overhead, that the very next thing the community will do after getting
 classes in their language is reach out to design patterns.  just as GoF
and
 you did back in the day, w/ the advent of objc/C++ coming out after having
 lived through years of C.

 -nathan




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



Re: [PHP] Re: Re: Re: Design Patterns

2009-08-13 Thread Ralph Deffke
NO NO NO

OOP is the best ever inventet !

see my comments on this list, I will also come up with an pure oop
opensource OMS very soon.

I just think a dam big pattern catalog like this one is like an elephant
chacing mice. I mean I can think of customers asking for a documentation of
course of the page u created for them calling the next day asking wher the
hell are the code for the page are documented in the 1000 pages of
documentation u had to give them.

I can think of two of my largest customers with their intranet application
with 23000 members and more then 5 hits during working hours where I
startet sweating while figting for every 1ms.

I'm thinking of people with even more hits a day, they even dont start using
PHP
so I dont know if thats the right way to blow up with includes  and
thousands of classes.

Im complaining on the deepnes and breakdown of the single pattern I miss the
orientation on the real problem - outputting marup text

cheers
ralph_def...@yahoo.de



Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message
news:62f65ec80908130817x3edc8ffav4153b7c1a44a2...@mail.gmail.com...
Hi Ralph,

Sorry, I haven't understand your question.

Do you  think OOP isn't usefull for PHP? The PHP
task is just to output a text file but the process might involve
a lot of work: database access, communication with web services, etc.

Do you think duplicate code is better than use more memory?
What is your proposal?

I'm very interested in more opinions.



2009/8/13 Ralph Deffke ralph_def...@yahoo.de

 Thanks Jaime,

 very nice, but I'm a programmer since 1982 and into OOP since 1988 with
the
 outcome if IBM's C++ compiler on the OS2 platform.

 Don't u think it could be reasonable to ask if such an overhead IN PHP is
 necessary?

 does anybody agree that PHP might be the wrong language to accomplish such
 a
 designpattern. Specialy if I find classes about interpreting things.

 Don't u think to blow up a servers memonry just to have a nice little
 framework could be ask?

 Don't u think it makes sence to remember that PHP is just to output a
 simple
 text file?

 Has inbedween all the OOP ability everybody forgotten that this is the
 simple purpose?

 Are there anybody who understands that PHP is an INTERPRETING language and
 has anybody an idear what is the amount of code running to do a simple

 $something = new object();

 versus echo $something

 Design pattern are very good, standarizing even better. but would u agree
 that, out of Martins presented work, u can not see the how AND how fast
the
 code is created to output the header the head and body and all other tags.

 What I can see, the result will be a lot of code, lots of includes for a
 view bytes.

 For me, wrong language with unneccesary overhead.

 as i can see there must be some more folks out there thinking  a bit
 similar, or why is the feetback so relatively poor.

 and at least u create design pattern for a PURPOSE.

 so again for what pupose are this overhead in PHP
 As long as nobody tells me for what benefit this work is done I would say
 the design pattern should be done in other packages ready made for that
 with
 an PHP output.

 this would not affect any server resources.

 now after more then 25 years behind the keyboard I got possibly a bit
 thumb.
 lets open the discussion.

 ralph_def...@yahoo.de


 Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message
 news:62f65ec80908130320t70078242y65308d2ef0288...@mail.gmail.com...
  Hi Ralph.
 
  If u want to understand the Martin's job u need to read about
  design patterns. A good place to start? Wikipedia (
  http://en.wikipedia.org/wiki/Design_Patterns).
 
  The use of Design patterns is an advanced programming method.
  It helps us to improve our object oriented programation.
 
  I hope this helps you,
 
   Jaime
 



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




-- 
Jaime J. Perera Merino
Aplicaciones Informáticas. Desarrollo y Formación
jaimejper...@gmail.com - 655460979



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



Re: [PHP] Re: Re: Re: Design Patterns

2009-08-13 Thread Ralph Deffke
but what Im asking is that the reality?

go and talk to accountant and tell them after spending soansomuch for the
new site hes has to buy a new server ! what will acountant say, what u
think.

another more important point is in reality u take a project on on a specific
hardware base. lets say it a pretty new server fast a mercedes 500 but not a
ferrari V1.
because of ur great reusable code u do an extra ordinary competitive price
bacause u are ready made that fast, u put it on the server and ? womm
because of thausand of includes and stuff the customer is not happy with the
speed.
what u think who is going to pay the new hardware? or better who is going to
cut down the code.

well its me, because as senior consultant i'm taking over the projects from
young programmers who went out of business because the postulations of the
closed contract put them bankrupt.

THATS THE REALITY so guys tell me on a design pattern frame work what
requirements the server should fullfill that I can astimate if the customers
situation will not put me out of business?


Robert Cummings rob...@interjinn.com wrote in message
news:4a84400a.9090...@interjinn.com...


 Ralph Deffke wrote:
  funny then that I see here serious people discussing the benefit of
  shortening code and cutting out commends.
 
  maby thats a general problem of our society that everybody think higher
  cheaper faster. this will have a limit guys !!! u can not go smaler then
an
  atom.
 
  funny as well that I make my main money in optimizing code to speed and
low
  server resources. Im one of the old guys who can do both hardware and
  software and I'm telling u this is suspect to me. I still can build a
  computer from board and powersupply upward.
 
  looks like that u joung guys got a little dream implementet by ur profs.
Did
  u know that the industry is complaining that the engeneers coming from
the
  universities are useless for business? a big complain! the real world is
  different. Hosting companies will always try to keep a server machine as
  long as they can, because a paid server DOES MAKE MONEY. so where is
then
  the cheap and fast server. how many servers out there still running on
PHP4?
  have u thouhgt about?
 
  again, design pattern make sence, but on a companies policy base or on a
  medium upwards sized project. but there will be more languages be
involved
  in one company it would be much better to use a language independent
tool.
 
  again this is chasing mice with an elephant

 Except for incompetent algorithms, it is almost always cheaper to throw
 money at a new server than to have a coder micro optimize his/her code.
 Similarly, it is usually cheaper to throw more hardware at a well
 programmed solution that uses modern programming concepts than to have a
 programmer use the most rudimentary of programming techniques to save on
 cycles.

 With respect to why you see shortening of code and cutting out
 comments, perhaps you are referring to the recent Calendar thread,
 where a bunch of us were just having some good old optimization fun. I
 for one enjoy the occasional diversion of optimizing some code just for
 the sake of optimizing it. Sometimes even, the optimization is even the
 cleanest/most readable solution.

 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] Re: Re: Re: Design Patterns

2009-08-13 Thread Ralph Deffke
Greg I completly aggree, but dont miss the point that I'M adigted to OOP

WHY NOT A FRAMEWORK CLOSER TO THE REAL POINT  CALLED DOM
design pattern for HTML XHTML XML SVG Database conection and retrieving.

WHY CLASSES FOR CALLERS AND RECEIVERS AND INTERPRETERS.

a div is it a caller? a receiver?

why there a only dom classes? why not forgetting about the tag shit and a
bunch of classes for it?

well wait I will come up with it if I find ever the time and stop learning
from this list.

I also believe that u can force a good design patter by supplying a some
good very well design base classes. I mean talk to an JAVA freak, I dont
think they will come up with that type of framework.

as we just talking about that when can we expect PHP to extend unlimited
classes in one class.

for the newbies following the bullheaded experts fight:
something like this

class wow extents database, users, accessright implements HTML {
}

WHEN

Greg Beaver g...@chiaraquartet.net wrote in message
news:4a84460d.3080...@chiaraquartet.net...
 Robert Cummings wrote:
 
 
  Martin Zvarík wrote:
  Ralph Deffke napsal(a):
  NO NO NO
 
  OOP is the best ever inventet !
 
  see my comments on this list, I will also come up with an pure oop
  opensource OMS very soon.
 
  I just think a dam big pattern catalog like this one is like an
elephant
  chacing mice. I mean I can think of customers asking for a
  documentation of
  course of the page u created for them calling the next day asking
  wher the
  hell are the code for the page are documented in the 1000 pages of
  documentation u had to give them.
 
  I can think of two of my largest customers with their intranet
  application
  with 23000 members and more then 5 hits during working hours where
I
  startet sweating while figting for every 1ms.
 
  I'm thinking of people with even more hits a day, they even dont
  start using
  PHP
  so I dont know if thats the right way to blow up with includes  and
  thousands of classes.
 
  I deeply and completely agree.
 
  Yes, certainly optimize on an as-needed basis. But well written PHP code
  should certainly scale quite well horizontally. Extremely traffic laden
  websites are quite likely to see a bottleneck at the database before a
  bottleneck in the code.

 Hi,

 You all should understand that on high traffic sites, C or C++ is far
 more frequently used and called PHP because they use a whole lot of
 custom extensions to speed things up.  In addition, memcached speeds up
 database access so much that the speed of PHP starts to matter.  This is
 why PHP 5.3.0 is somewhere around 30% faster than any previous PHP
 version when running common applications, because the core developers
 realized that the base efficiency begins to matter and spent
 considerable effort improving basic language performance.

 There are a lot of ways to improve PHP's efficiency, and arguing over
 whether to use design patterns is not a particularly effective one.
 Profiling early and often to understand the slowest portions of your
 code is an effective method.  There are many, many talks/videos/etc.
 that can be found via google.com which discuss these principles, but
 suffice to say that xdebug, APC, and most importantly siege and apache
 benchmark are your friends in this endeavor.

 For Ralph: it might help you to know that facebook.com improved their
 performance by splitting up things into lots and lots of classes, and
 using autoload.  I don't have specific details because I don't work
 there, but the programmer who coded this solution was telling me the
 generalities at php|tek 2 years ago.  The pages that saw improvement
 were ones with a large number of possible execution branches in
 different requests.  autoload simply reduced the number of needed files
 to the bare minimum from a wide variety of choices.

 This surprised me, because the prevailing opinion at the time was that
 autoload always reduces performance.  The point to take from this story
 is that what you think to be true doesn't matter, the only thing is
 really understanding where your bottlenecks are by profiling
 aggressively, and even more important, why its slow, so you can fix it.

 Greg



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



AW: [PHP] Re: Re: Re: Design Patterns

2009-08-13 Thread Ralph Deffke
for those of u not being a physician

semiconductors are of pretty big atoms, but this is not the main problem, 
the problem is that u have to cut out structures off these semiconductors
in order to build faster computers this matters.

many physicians believe that we are pretty close to a ultimate limit 
if we dont procees with the *biological* chips we facing a limit soon.

the other point is the cost, faster chips wount be any cheaper in the future
due to very expencive production processes.

So we should start thinking in optimization realy. at least some bewareness
it will not be endless

ralph_def...@yahoo.de





Von: Jay Blanchard jblanch...@pocket.com
An: Ralph Deffke ralph_def...@yahoo.de; php-general@lists.php.net
Gesendet: Donnerstag, den 13. August 2009, 20:15:31 Uhr
Betreff: RE: [PHP] Re: Re: Re: Design Patterns

[snip]
u can not go smaler then an atom.
[/snip]

Neutrons, electrons, gluons, protons  particles all smaller than an
atom. There are others if you want to get into a discussion of quantum
physics and mechanics, but we should probably take that discussion
offline.

Many folks here are building enterprise capable applications with PHP,
its OOP capabilities and the afore mentioned design patterns.. This level
of application, especially when combined with other technologies (like
the bits that make up AJAX), are much better served by using design
patterns so that consistency, readability and code-ability are enhanced.


You're correct in that the end result is just a text file...but look at
the format of that file output! When those files are handled by the
proper container, such as a web browser or relational database system
they become powerful tools and information.


  

[PHP] design pattern

2009-08-13 Thread Ralph Deffke
so guys

why u don't discuss Martins outcome?
is there no advice, idears?
isn't there a need for it?
nobody want to use it?

I WANT TO LEARN

ralph_def...@yahoo.de



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



Re: [PHP] design pattern

2009-08-13 Thread Ralph Deffke
well u got to know me personal, however may be u mix it with sarcasm?
may be I can't express that as good as I want in english.

if u follow the posts didn't some put me in the stupid corner?
I think its legal to ask why the question of Martin are not discussed.

and I still think, my question what he want to accomplish still is legal and
reasonable.

Many posts said, code done with design pattern framework are easy to
maintain and understand.

I ask u; is Martins work easy to understand? he put a lot of effort, but
with even design pattern it comes to the point of a good presentation. not
all people are the top smartest.

as u may have realised, he changed the presentation already and is coming up
with a more overview like documentation.

he is realy working hard, and I can't wait to see what benefit I could have
from his work what size of project it is worth for.

he deserves that design pattern experts comment his work.

ralph_def...@yahoo.de


Robert Cummings rob...@interjinn.com wrote in message
news:4a846ea7.5010...@interjinn.com...
 Ralph Deffke wrote:
  so guys
 
  why u don't discuss Martins outcome?
  is there no advice, idears?
  isn't there a need for it?
  nobody want to use it?
 
  I WANT TO LEARN

 Maybe it's your grasp of the English language, maybe not. But I detect
 an air of aggression to your posts.

 ARE YOU JUST TROLLING?

 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] design pattern

2009-08-13 Thread Ralph Deffke
Hi Martin,

thanks for ur efforts, this is a lot of good work.

for my opinion the start is a bit too much theoretical and valid for all
type of application. In simple words, u are too close to the book.

I would love to have something closer to the purpose of PHP
and its applications.

if u have a look at the SMARTY documentation u have good explanation (and a
bad example by the way concerned oop) what are the real world problem.

When it comes to the final u find the most spagetti code in putting the page
grafic designer toghether with the business logic.

It would be great if this could be put in good oop patterns. As I can not
see that with the little amount of time I have got, p l e a s e tell me what
will come up on this edge?

ralph_def...@yahoo.de


Martin Scotta martinsco...@gmail.com wrote in message
news:6445d94e0908131322w722a37bbi24983ae143c5d...@mail.gmail.com...
 On Thu, Aug 13, 2009 at 4:04 PM, Ralph Deffke ralph_def...@yahoo.de
wrote:

  so guys
 
  why u don't discuss Martins outcome?
  is there no advice, idears?
  isn't there a need for it?
  nobody want to use it?
 
  I WANT TO LEARN
 
  ralph_def...@yahoo.de
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 I was following the entirely conversation, I must admit I wasn't expecting
 such thread.

 It is not common to see design patterns applied to PHP applications and,
is
 more common to don't see PHP applications. They are just scripts. Many
 scripts in a simple folder puts together to do the dirty work.

 Of course there are many kicking-ass PHP Applications, but they are a
 minimum portion compared to old-fashioned scripts.

 So, how do we start writing good quality PHP Applications? That's a very
 good question, and I don't know the answer, but I think by talking about
 design patterns we are in a good way.

 It's true that using design patterns the code will run slower, but it'll
be
 flexible, maintable, and the most important: simple.
 After all that's what we are looking for, something really simple that
make
 our life as developers happier every day. How do you explain the crescent
 number of php frameworks for rapid development?

 PHP core team has taken OOP seriously.
 Do you note the new SPL objects? The core team creates those objects using
 many designs patterns.
 By example the RecursiveDirectoryIterator and it's family use the
decorator
 pattern.
 Also features such as late static binding were added because a design
 pattern.

 I think there will be some separation in the community, those who will
 stay using scripts and those who will use heavily OOP. I do not know who
the
 dark side will be, xD


 -- 
 Martin Scotta




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



Re: [PHP] Is select_db necessary?

2009-08-12 Thread Ralph Deffke
here a basic background to this question.

all databases are build from various module bases. one module is the
database itself prosessing eg. the sql's another module is the database
connectivity. e.g. mySQL has a ability to connect thru ADO, .NET and an
server via IP.

MySQL supports unlimited databases comtaining tables. so from the point of
the database u have always to selct the database and then to the table.

however, if u study the various Database extensions u will find functions
(eg. mysql_db_query() ) where u point the database in the function call
while others don't (eg. mysql_query() ) on those u have to do a db select
first because the function itself doesn't do it, while mysql_db_connect()
does.

so if we know that now, we are coming to the question, why are database
extensions do have those two types of processing a sql statement?

the answer is: speed ! while those commands with a pointing out the database
do internally a select of the database they do it every time on each call.

if u have a application which does a lot of stuff at the same time other
then just select statement, this comes into consideration. it saves time to
do one select_db first and then 50 just raw sql's to that database.

now after dumping that much stuff on u, it depends on ur design if u need a
select_db first or not.

hope that helps
Ralph
ralph_def...@yahoo.de

Allen McCabe allenmcc...@gmail.com wrote in message
news:657acef20908112023y222de6f4q63e64cd1e2785...@mail.gmail.com...
 I have seen different scripts for working with SQL, and most follow the
same
 method with on difference.

 Variables are defined (host, password, etc.)
 mysql_connect command

 //then, the difference

 mysql_select_db command

 //back to common

 $sql = SELECT ... 
 $result = mysql_query($ql)

 Is the database selection necessary, or is that implied with a SELECT or
 other SQL command?




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



[PHP] Re: Is select_db necessary?

2009-08-12 Thread Ralph Deffke
I agree totally, are we not dicussing speed issues all the time? and then we
recommend a code doing an unessesary job on every call?

an ANSI selct db in the sql forces any database to run the internal select
db because there would be no check if the databse is the current one.
because, databasedevelopers can espext some smartness of us, the
programmers. its a lot off stuff to do for the database to select a
database. for shure, the database leafs that IN OUR hand to avoid to force
time consuming server resources.

ralph
ralph_def...@yahoo.de

Colin Guthrie gm...@colin.guthr.ie wrote in message
news:h5ug1h$tj...@ger.gmane.org...
 'Twas brillig, and Jay Blanchard at 12/08/09 13:53 did gyre and gimble:
  Jay Blanchard wrote:
  SELECT a.foo, a.bar
  FROM myDatabase.myTable a
  WHERE you set other conditions here
 
  All that is required is that you establish a connection to a server.
 
  If I recall correctly, this will cause issues with replication in
  MySQL... insofar as you perform amodifying query.
  [/snip]
 
  You're correct with regards to queries that modify on replicated
  systems. If all you're doing is gathering data then this will work just
  fine, is somewhat self-documenting (especially in lengthier code
  containers), and very flexible. It also leaves the selection in the
  database's hands, and as we almost always say, let the database do the
  work when it can.

 I'm interested to know why you consider this to be very flexible and how
 this leaves the selection in the database's hands?

 If I were to implement this and they try some destructive testing/demo
 on a sacrificial database, I'd have to use a whole other server instance
 (as all the queries would hardcode in the db name).

 Is it not more flexible if you omit the table name in every single query
 and specify it once in your bootstrap/connection code? Thus doing tests
 on other dbs etc. is a pretty simple switch of the connection code.

 Also telling the db engine what database you want to use in every query
 is not, IMO, leaving the selection in the the database's hands.

 Just curious as to the rationale here :)

 Col




 -- 

 Colin Guthrie
 gmane(at)colin.guthr.ie
 http://colin.guthr.ie/

 Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
 Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]




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



Re: [PHP] Re: Is select_db necessary?

2009-08-12 Thread Ralph Deffke
as i said earlier: on db level there is always al select db done, doing this
on higer level layers (the database extension) consumes time. or why do
extension have the two ways of functions? to make our live more difficult?

on a ANSI sql the sql interpreter time is increased! unnessarylie

ralph_def...@yahoo.de


Martin Scotta martinsco...@gmail.com wrote in message
news:6445d94e0908120718g6c5bf368tacf8bbad127b5...@mail.gmail.com...
 Wed, Aug 12, 2009 at 10:37 AM, Ralph Deffke ralph_def...@yahoo.de wrote:

  I agree totally, are we not dicussing speed issues all the time? and
then
  we
  recommend a code doing an unessesary job on every call?
 
  an ANSI selct db in the sql forces any database to run the internal
select
  db because there would be no check if the databse is the current one.
  because, databasedevelopers can espext some smartness of us, the
  programmers. its a lot off stuff to do for the database to select a
  database. for shure, the database leafs that IN OUR hand to avoid to
force
  time consuming server resources.
 
  ralph
  ralph_def...@yahoo.de
 
  Colin Guthrie gm...@colin.guthr.ie wrote in message
  news:h5ug1h$tj...@ger.gmane.org...
   'Twas brillig, and Jay Blanchard at 12/08/09 13:53 did gyre and
gimble:
Jay Blanchard wrote:
SELECT a.foo, a.bar
FROM myDatabase.myTable a
WHERE you set other conditions here
   
All that is required is that you establish a connection to a
server.
   
If I recall correctly, this will cause issues with replication in
MySQL... insofar as you perform amodifying query.
[/snip]
   
You're correct with regards to queries that modify on replicated
systems. If all you're doing is gathering data then this will work
just
fine, is somewhat self-documenting (especially in lengthier code
containers), and very flexible. It also leaves the selection in the
database's hands, and as we almost always say, let the database do
the
work when it can.
  
   I'm interested to know why you consider this to be very flexible and
how
   this leaves the selection in the database's hands?
  
   If I were to implement this and they try some destructive testing/demo
   on a sacrificial database, I'd have to use a whole other server
instance
   (as all the queries would hardcode in the db name).
  
   Is it not more flexible if you omit the table name in every single
query
   and specify it once in your bootstrap/connection code? Thus doing
tests
   on other dbs etc. is a pretty simple switch of the connection code.
  
   Also telling the db engine what database you want to use in every
query
   is not, IMO, leaving the selection in the the database's hands.
  
   Just curious as to the rationale here :)
  
   Col
  
  
  
  
   --
  
   Colin Guthrie
   gmane(at)colin.guthr.ie
   http://colin.guthr.ie/
  
   Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
   Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 ?php

 $link = mysql_connect( /* settings */);
 mysql_select_db( 'database', $link);
 $result = mysql_query( 'SELECT * FROM table', $link );

 What SQL was sent to the database?

 Looking at bin logs I've found this.

 1. use database = mysql_select_db
 2. use database: SELECT * FROM table = mysql_query

 The DB is usually a common bottle-neck for most applications.
 You can have several webservers, but can't do that with the DB... of
course,
 you can have multiples slaves but just 1 master.

 is this the best way to send queries?
 What's the better and faster way?

 -- 
 Martin Scotta




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



AW: [PHP] Re: Is select_db necessary?

2009-08-12 Thread Ralph Deffke
what are telling the logs on that code?

?php

$link = mysql_connect( /* settings */);
mysql_select_db( 'database', $link);
$result = mysql_query( 'SELECT * FROM table', $link );
$result = mysql_query( 'SELECT * FROM anothertable', $link );
$result = mysql_query( 'SELECT * FROM anothertable', $link );
$result = mysql_query( 'SELECT * FROM anothertable', $link );
$result = mysql_query( 'SELECT * FROM anothertable', $link );
$result = mysql_query( 'SELECT * FROM table', $link );

would be interesting to see.

I personaly woudn't spend the time on logs, a computer is logical, I try to be 
logical, and I would
try to create code which is logical speedy. I expect the database kernel 
programmer the same.

I think then we are on the secure side.

ralph_def...@yahoo.de






Von: Martin Scotta martinsco...@gmail.com
An: Ralph Deffke ralph_def...@yahoo.de
CC: php-general@lists.php.net
Gesendet: Mittwoch, den 12. August 2009, 16:18:01 Uhr
Betreff: Re: [PHP] Re: Is select_db necessary?


Wed, Aug 12, 2009 at 10:37 AM, Ralph Deffke ralph_def...@yahoo.de wrote:

I agree totally, are we not dicussing speed issues all the time? and then we
recommend a code doing an unessesary job on every call?

an ANSI selct db in the sql forces any database to run the internal select
db because there would be no check if the databse is the current one.
because, databasedevelopers can espext some smartness of us, the
programmers. its a lot off stuff to do for the database to select a
database. for shure, the database leafs that IN OUR hand to avoid to force
time consuming server resources.

ralph
ralph_def...@yahoo.de

Colin Guthrie gm...@colin.guthr.ie wrote in message
news:h5ug1h$tj...@ger.gmane.org...

 'Twas brillig, and Jay Blanchard at 12/08/09 13:53 did gyre and gimble:
  Jay Blanchard wrote:
  SELECT a.foo, a.bar
  FROM myDatabase.myTable a
  WHERE you set other conditions here
 
  All that is required is that you establish a connection to a server.
 
  If I recall correctly, this will cause issues with replication in
  MySQL... insofar as you perform amodifying query.
  [/snip]
 
  You're correct with regards to queries that modify on replicated
  systems. If all you're doing is gathering data then this will work just
  fine, is somewhat self-documenting (especially in lengthier code
  containers), and very flexible. It also leaves the selection in the
  database's hands, and as we almost always say, let the database do the
  work when it can.

 I'm interested to know why you consider this to be very flexible and how
 this leaves the selection in the database's hands?

 If I were to implement this and they try some destructive testing/demo
 on a sacrificial database, I'd have to use a whole other server instance
 (as all the queries would hardcode in the db name).

 Is it not more flexible if you omit the table name in every single query
 and specify it once in your bootstrap/connection code? Thus doing tests
 on other dbs etc. is a pretty simple switch of the connection code.

 Also telling the db engine what database you want to use in every query
 is not, IMO, leaving the selection in the the database's hands.

 Just curious as to the rationale here :)

 Col




 --

 Colin Guthrie
 gmane(at)colin.guthr.ie
 http://colin.guthr.ie/

 Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
 Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]




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



?php

$link = mysql_connect( /* settings */);
mysql_select_db( 'database', $link);
$result = mysql_query( 'SELECT * FROM table', $link );

What SQL was sent to the database?

Looking at bin logs I've found this.

1. use database = mysql_select_db
2. use database: SELECT * FROM table  = mysql_query

The DB is usually a common bottle-neck for most applications. 
You can have several webservers, but can't do that with the DB... of course, 
you can have multiples slaves but just 1 master.

is this the best way to send queries?
What's the better and faster way?

-- 
Martin Scotta



  

Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-12 Thread Ralph Deffke
thats why I decided years ago to write myself a little bunch of classes for
the html tags which gives me the ability to have PHP only code, very nice,
no errors and my outputs dont even need Tidy pure XHTML

i find these idear of mixing html and php as spagetty, using divs for tables
as something what facirs do,

no problems with unexpected header outputs, no small fat grafic designer can
make my live difficult, I can change evrything on the fly.

pure OOP

one final echo $page-toHtml();

put a candle for the invention of OOP ...
better as sex
makes the nights fun

consider this guys

ralph_def...@yahoo.de


tedd tedd.sperl...@gmail.com wrote in message
news:p06240800c6a892b12...@[192.168.1.100]...
 At 8:33 AM -0700 8/12/09, Jim Lucas wrote:
 Daevid Vincent wrote:


 -snip-

 I side with Jim on this. I never use short tags and write similar crap.

 Jim said:

 I have found, in a number of cases, that using only the TR  tag
 doesn't work all the time.

 It should work ALL the time, but sometimes inheritance overrides what
 you think is happening. In such cases, try adding !important to the
 rule and I think you'll see what you expect.

 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] Include Paths

2009-08-12 Thread Ralph Deffke
a rap song hihi haha
best comment I've ever read on a mailing list. reminds me that live is fun

thanks for making my day
thanks sheridan for ur shakespear like abbilities
thanks bastien for ur humor

GREAT



Bastien Koert phps...@gmail.com wrote in message
news:d7b6cab70908120909u593cbd6v692f34ae6ddea...@mail.gmail.com...
 On Wed, Aug 12, 2009 at 12:06 PM, Ashley
 Sheridana...@ashleysheridan.co.uk wrote:
  On Wed, 2009-08-12 at 12:03 -0400, Rick Duval wrote:
  SORRY BUT
  I CAN'T GET OFF THIS LIST, I CAN'T GET OFF THIS LIST, I CAN'T GET OFF
THIS LIST
  I'VE TRIED. NO RESPONSE. IS THERE AN ADMIN OUT THERE? PLEASE GET ME
  OFF THIS LIST!
 
  
  This message has been scanned for
  viruses and dangerous content by
  Accurate Anti-Spam Technologies.
  www.AccurateAntiSpam.com
 
 
 
  On Wed, Aug 12, 2009 at 11:08 AM, Adam Shannona...@ashannon.us wrote:
   On Wed, Aug 12, 2009 at 10:02 AM, Julian Muscat Doublesin 
   opensourc...@gmail.com wrote:
  
   I had a problem with the include and require paths when using AJAX.
This I
   have solved by using the document root. However since doing so I am
   experiencing performance issues. Loading 20 records has suddenly
turned
   into
   something of a matter of a minute rather then seconds.
  
   Has anyone ever experienced such an issue?
  
   Can anyone please advise?
  
   Thanks
  
  
   I wonder if loading the script/page with an absolute path would fix
the
   problem.
  
  
  
   --
   - Adam Shannon ( http://ashannon.us )
  
   -
   This message has been scanned for
   viruses and dangerous content by
   Accurate Anti-Spam Technologies.
   www.AccurateAntiSpam.com
  
  
 
  Wow!
 
  First off, have you followed the unsubscription details on the website?
 
  Failing that, have you tried emailing the unsubscribe email address?
  It's found in all the email headers that are part of the mailing list.
 
  And don't shout!
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 Thought it was a rap song to the tune of You Can't Touch This

 -- 

 Bastien

 Cat, the other other white meat



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



[PHP] Re: Form Validation

2009-08-12 Thread Ralph Deffke
this is a PHP mailing list, may be u ask this on a js mailinglist

ralph_def...@yahoo.de


Micheleh Davis m...@micheleh.com wrote in message
news:002901ca1b68$fc6b0020$f54100...@com...
 Please help.  My form validation worked fine until I added the terms check
 at the bottom.  Any ideas?



 //form validation step one

 function validateStep1(myForm){

 // list of required fields

 with (myForm) {

 var requiredFields = new Array (

 firstName,

 lastName,

 phone,

 email,

 terms)

 }

 // check for missing required fields

 for (var i = 0; i  requiredFields.length; i++){

 if (requiredFields[i].value == ){

 alert (You left a
required
 field blank. Please enter the required information.);

 requiredFields[i].focus();

 return false;

 }

 }

 // check for valid email address format

 var eaddress= myForm.email.value;

 var validaddress=
 /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;

 //var validaddress= /^((\w+).?(\w+))+...@\w+/i;

 var result= eaddress.match(validaddress);

 if (result == null) {

 alert (Please enter your complete email
 address.);

 myForm.email.focus();

 return false;

 }

 // check for valid phone format

 var check= myForm.phone.value;

 check= check.replace(/[^0-9]/g,);

 if (check.length  10) {

alert (please enter your complete phone number.);

return false;

 }//end if



 return true;



 //begin terms and conditions check

 var termsCheck= myForm.terms.value;

 if (bcForm1.checked == false)

 {

 alert ('Please read and select I Agree to
 the Terms and Conditions of Service.');

 return false;

 }

 else

 {

 return true;

 }

//end terms check







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



Re: [PHP] Re: Form Validation

2009-08-12 Thread Ralph Deffke
may I ask what JS list u are using?

Micheleh Davis m...@micheleh.com wrote in message
news:003901ca1b6b$dd103d00$9730b7...@com...
 Yep, I'm sorry, sent to the wrong one.  Thanks all!


 -Original Message-
 From: Ralph Deffke [mailto:ralph_def...@yahoo.de]
 Sent: Wednesday, August 12, 2009 12:29 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: Form Validation

 this is a PHP mailing list, may be u ask this on a js mailinglist

 ralph_def...@yahoo.de


 Micheleh Davis m...@micheleh.com wrote in message
 news:002901ca1b68$fc6b0020$f54100...@com...
  Please help.  My form validation worked fine until I added the terms
check
  at the bottom.  Any ideas?
 
 
 
  //form validation step one
 
  function validateStep1(myForm){
 
  // list of required fields
 
  with (myForm) {
 
  var requiredFields = new Array (
 
  firstName,
 
  lastName,
 
  phone,
 
  email,
 
  terms)
 
  }
 
  // check for missing required fields
 
  for (var i = 0; i  requiredFields.length; i++){
 
  if (requiredFields[i].value == ){
 
  alert (You left a
 required
  field blank. Please enter the required information.);
 
 
requiredFields[i].focus();
 
  return false;
 
  }
 
  }
 
  // check for valid email address format
 
  var eaddress= myForm.email.value;
 
  var validaddress=
  /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;
 
  //var validaddress= /^((\w+).?(\w+))+...@\w+/i;
 
  var result= eaddress.match(validaddress);
 
  if (result == null) {
 
  alert (Please enter your complete email
  address.);
 
  myForm.email.focus();
 
  return false;
 
  }
 
  // check for valid phone format
 
  var check= myForm.phone.value;
 
  check= check.replace(/[^0-9]/g,);
 
  if (check.length  10) {
 
 alert (please enter your complete phone number.);
 
 return false;
 
  }//end if
 
 
 
  return true;
 
 
 
  //begin terms and conditions check
 
  var termsCheck= myForm.terms.value;
 
  if (bcForm1.checked == false)
 
  {
 
  alert ('Please read and select I Agree
to
  the Terms and Conditions of Service.');
 
  return false;
 
  }
 
  else
 
  {
 
  return true;
 
  }
 
 //end terms check
 
 
 
 



 -- 
 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: Design Patterns

2009-08-12 Thread Ralph Deffke
it would help if u would tell us what u want to accomplish with this ativity

cheers
ralph_def...@yahoo.de

Martin Scotta martinsco...@gmail.com wrote in message
news:6445d94e0908121323x721254c4ja389978d67bc0...@mail.gmail.com...
 Hi all!

 I've written a little Design Patterns Catalog in PHP.
 The patterns where taken from GoF: *Design Patterns: Elements of Reusable
 Object-Oriented Software* (ISBN

0-201-63361-2http://en.wikipedia.org/wiki/Special:BookSources/0201633612)


 This catalog includes (for each pattern):

1. general description
2. class responsibilities
3. UML
4. structural source
5. documentation
6. implementation example


 Also I've upload the documentation into my site for online purposes.
 http://martinscotta.com.ar/DesignPatterns/


 I don't know if I can send files attached through this list... so, if you
 want a copy just reply to this message.

 Any bug, comment, or anything you like to say is welcome!

 -- 
 Martin Scotta




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



Re: [PHP] Re: Design Patterns

2009-08-12 Thread Ralph Deffke
I wrote this message after spending 1/2 hour at your documentation. I'm
sorry, may be I don't have the ability to understand your goal. thats thats
why I ask you what is this for.

I'm an application programmer with an industrial process control
background. A peace of code ment to do something for me.

may I ask again what do u want to accomplish?

ralph_def...@yahoo.de

Martin Scotta martinsco...@gmail.com wrote in message
news:6445d94e0908121526r7280c680v22742e8418e6b...@mail.gmail.com...
 On Wed, Aug 12, 2009 at 6:27 PM, Ralph Deffke ralph_def...@yahoo.de
wrote:

  it would help if u would tell us what u want to accomplish with this
  ativity
 
  cheers
  ralph_def...@yahoo.de
 
  Martin Scotta martinsco...@gmail.com wrote in message
  news:6445d94e0908121323x721254c4ja389978d67bc0...@mail.gmail.com...
   Hi all!
  
   I've written a little Design Patterns Catalog in PHP.
   The patterns where taken from GoF: *Design Patterns: Elements of
Reusable
   Object-Oriented Software* (ISBN
  
 
0-201-63361-2http://en.wikipedia.org/wiki/Special:BookSources/0201633612
  )
  
  
   This catalog includes (for each pattern):
  
  1. general description
  2. class responsibilities
  3. UML
  4. structural source
  5. documentation
  6. implementation example
  
  
   Also I've upload the documentation into my site for online purposes.
   http://martinscotta.com.ar/DesignPatterns/
  
  
   I don't know if I can send files attached through this list... so, if
you
   want a copy just reply to this message.
  
   Any bug, comment, or anything you like to say is welcome!
  
   --
   Martin Scotta
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 I have uploaded the files into mi site.
 http://martinscotta.com.ar/DesignPatterns/

 -- 
 Martin Scotta




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



[PHP] Re: Synchronizing autonumber fields

2009-08-11 Thread Ralph Deffke
hi there,

this is typical app for db repliction mechanism. it depnds of the size off
your project.

have a look here:
http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html

if this is oversized for u do a dump of each table without the
auto_increment fields. if u read in these tables the main database then does
use its own record id.
to identifie these records use a subsidairy finegerprint field.

another way would be not to use a ai field for identifying the record, use a
timestamp field to have an unique index on the tables. it is very unlikeley
that two records are written at the same time in the various subsidaries. a
timestamp field is a breakdown to the milisecond. however there is still a
chance of 1 to some billion, that two records have the same key.

just some possibilities

cheers
ralph
ralph_def...@yahoo.de


Leidago !Noabeb leid...@googlemail.com wrote in message
news:5bcf496e0908110004w94d29c2j4b01806822ca0...@mail.gmail.com...
 Hi

 I have the following tables setup in MYSQL:

 Region 1 Region 2
 HQ
 Tbl1 with autonumbered (PK) Tbl1 with autonumbered (PK)
 Tbl1 autonumbered-PK

 To explain the above. Basically there are two regions that collect
 information and then at the end of each month they have to send the
 information to HQ. This is fine, but the problem comes when the
 information (the data in the tables) is submitted to HQ. All three
 tables have the same names and the same structure. We want to
 synchronize the information sent by the regions into one table at HQ.
 How can we do this without having the duplicate number problem?

 Thanks



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



Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-11 Thread Ralph Deffke
seems they changing idears on the fly? could it be that the designer is a
smal ugly person while u a a good looking ladykiller ?

on that background I would design a function where u can change ti what ever
u want on the fly something like this

var $a;
function alternate(  $a, $_b=array( red, red ,green ,... ) {
if( count( $_b )  $a ) {
return $_b[ $a++ ] ;
}
$a=0;
return $_b[ $a++ ] ;
}

so now u can do what ever anybody wants on just putting the right values
into the array

cheers

ralph
ralph_def...@yahoo.de

David Otton phpm...@jawbone.freeserve.co.uk wrote in message
news:193d27170908110328p43b4722fkc46b0bcda97fc...@mail.gmail.com...
2009/8/11 Daevid Vincent dae...@daevid.com:

 NO! For the love of God and all that is holy, don't do that accumulator /
 mod hack.
 That's so 1980's. And why make the CPU do all that math for every
row...

 Just do this. It's quick and simple:

 CSS:
 .dataRow1 { background-color: #DFDFDF; }
 .dataRow2 { background-color: #FF; }

 foreach ($foo_array as $foo) {
 ?tr class=?= ($dr = !$dr) ? dataRow1 : dataRow2 ?td?= $foo
 ?/td/tr?php
 }

A change request just came in - the interaction designer wants every
third line to have a grey background, instead of every second line.

 No need to initialize $dr as by default PHP will make it a boolean
false,
 then each itteration, it will toggle true/false and substitute the CSS
class

Um. No. Just no.



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



Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Ralph Deffke
this is not intelligence its just pure math. the '' says if BOTH
expressions are true then the whole expression is true.

so if the first one is false, the whole is false, why checking the next one
in the underlaying C it would be something like this
{
if ( expression == false ) return false;
if ( expression == false) return false;
return true;
}

ralph
ralph_def...@yahoo.de

John Butler govinda.webdnat...@gmail.com wrote in message
news:9ada6df4-649c-4790-b51b-cc9cc0505...@gmail.com...
 
  If you switch it around you'll get a notice because the IF evaluates
  from left to right.  So you just want to make sure you check isset()
  first.
 
  This would throw a notice:
 
  if($_POST['UserWishesDateRange']  == 'T' 
  isset($_POST['UserWishesDateRange'])) {

 Aha!  That must be what I tried and was still getting the notice!
 Interesting that it works (without notice) if we check against the
 isset () one first.   It makes if() look more intelligent that I would
 think... as if it saying, good now that we've established that the
 var isset, now is it also equal to '___'., as opposed to just, is var
 set, and is var equal to ___'.



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



  1   2   3   4   >