Re: [PHP] PHP Dependency Injector

2013-09-15 Thread ma...@behnke.biz
Hey Juan,

before sharing your work, you should spend some time on class and method
documentation and putting stuff into the readme ;)
This can be very helpful for others.

Regards,
Marco

 Juan Sebastian Scatularo sebastianscatul...@gmail.com hat am 5. September
 2013 um 22:30 geschrieben:


 Sorry guys if disturbed.


 2013/9/5 Bastien Koert phps...@gmail.com

  Jee, that should have been a friday comment...how does your dic standout
 
 
  On Thu, Sep 5, 2013 at 4:06 PM, Sorin Badea sorin.bade...@gmail.comwrote:
 
  There are few tutorials about home made dic. How does your dic stand out
  from the crowd ?
 
  Regards.
 
  On Thu, Sep 5, 2013 at 10:56 PM, Juan Sebastian Scatularo 
  sebastianscatul...@gmail.com wrote:
 
   Hello people, I want to share with you a simple and small Dependency
   Injector made for me.
  
   https://github.com/abloos/Sofia
  
   Regards
  
   --
   Facebook: www.facebook.com/JuanSebastianScatularo
   Twitter: www.twitter.com/js_scatularo
   Web: www.sebastianscatularo.com.ar
  
 
 
 
  --
  Sorin Badea - Software Engineer
 
 
 
 
  --
 
  Bastien
 
  Cat, the other other white meat
 



 --
 Facebook: www.facebook.com/JuanSebastianScatularo
 Twitter: www.twitter.com/js_scatularo
 Web: www.sebastianscatularo.com.ar

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] exec and system do not work

2013-08-26 Thread ma...@behnke.biz


 Tamara Temple tamouse.li...@gmail.com hat am 26. August 2013 um 08:33
 geschrieben:



 On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
 erosenb...@hygeiabiomedical.com wrote:

  Dear List -
 
  I'm lost on this one -
 
  This works -
 
  $out = system(ls -l ,$retvals);
  printf(%s, $out);
 
  This does -
 
  echo exec(ls -l);

Please show the output of the directory listing.
Please us ls -la

 
  This does not -
 
  if( !file_exists(/var/www/orders.txt));
  {
    $out = system(touch /var/www/orders.txt, $ret);

Maybe you don't have write permissions on the folder?

    $out2 = system(chmod 766 /var/www/orders.txt, $ret);
    echo 'file2br /';
    echo file_exists(/var/www/orders.txt);
  }
 
  and this does not -
 
  if( !file_exists(/var/www/orders.txt));
  {
    exec(touch /var/www/orders.txt);
    exec(chmod 766 /var/www/orders.txt);
    echo 'file2br /';
    echo file_exists(/var/www/orders.txt);
  }
 
  Ethan
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 When you say does not work, can you show what is actually not working? I
 believe the exec and system functions are likely working just fine, but that
 the commands you've passed to them may not be.



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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] exec and system do not work

2013-08-26 Thread ma...@behnke.biz


 Ethan Rosenberg erosenb...@hygeiabiomedical.com hat am 26. August 2013 um
 20:41 geschrieben:


   Please show the output of the directory listing.
   Please us ls -la

 echo exec('ls -la orders.txt');

 -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt

Please supply the complete output. Especially the rights for . and ..

 Maybe you don't have write permissions on the folder?

 If I perform the touch and chmod from the command line, everything works.

cli and ww are different users.

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



Re: [PHP] How to send post-variables in a Location header

2013-08-26 Thread ma...@behnke.biz


 Ajay Garg ajaygargn...@gmail.com hat am 26. August 2013 um 21:48
 geschrieben:


 Hi all.

 I have a scenario, wherein I need to do something like this ::

 ###
         $original_url = /autologin.php;
         $username = ajay;
         $password = garg;

         header('Location: ' . $original_url);
 ###

 As can be seen, I wish to redirect to the URL autologin.php.

 Additionally, I wish to pass two POST key-value pairs :: user=ajay and
 password=garg (I understand that passing GET key-value pairs is trivial).

 Is it  even possible?
 If yes, I will be grateful if someone could let me know how to redirect to
 a URL, passing the POST key-value pairs as necessary.

Iirc it is not possible to pass post body content via location redirect.
What you can do: Set auth headers

http://forums.phpfreaks.com/topic/84480-solved-how-to-send-authorization-basic-header/



 Looking forward to a reply :)


 --
 Regards,
 Ajay

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] filesize question

2013-05-07 Thread ma...@behnke.biz


 Curtis Maurand cur...@maurand.com hat am 7. Mai 2013 um 15:16 geschrieben:


 Hello,
 I'm feeding a filename to a php script on the command line (command line
 program).  I run the following against it:

 $inputline = fread($inputfile, filesize($argv[1]));

mayve

$inputline = fread($inputfile, filesize($inputfile));


 I'm getting an error complaining that the second parameter can't be '0'

 any ideas?

 thanks,
 Curtis





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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



RE: [PHP] Need a tool to minimize HTML before storing in memecache

2013-05-03 Thread ma...@behnke.biz
But why are you caching uncompiled php code?

 Daevid Vincent dae...@daevid.com hat am 2. Mai 2013 um 23:21 geschrieben:


 While that may be true for most users, I see no reason that it should limit or
 force me to a certain use case given that dynamic pages make up the vast
 majority of web pages served.

 Secondly, there are 8 billion options in Tidy to configure it, I would be
 astonished if they were so short-sighted to not have one to disable converting
  and  to lt; and gt; as they do for all sorts of other things like quotes,
 ampersands, etc. I just don't know which flag this falls under or what
 combination of flags I'm setting that is causing this to happen.

 Barring that little snag, it works like a champ.

  -Original Message-
  From: ma...@behnke.biz [mailto:ma...@behnke.biz]
  Sent: Thursday, May 02, 2013 4:55 AM
  To: Daevid Vincent; 'php-general General'
  Subject: RE: [PHP] Need a tool to minimize HTML before storing in memecache
 
  This is because tidy is for optimizing HTML, not for optimizing PHP.
 
   Daevid Vincent dae...@daevid.com hat am 2. Mai 2013 um 02:20
  geschrieben:
  
  
   So I took the time to install Tidy extension and wedge it into my code.
  Now
   there is one thing that is killing me and breaking all my pages.
  
   This is what I WANT the result to be:
  
   link rel=stylesheet type=text/css
  href=/templates/?=
   $layout_id ?/css/styles.css /
   link rel=stylesheet type=text/css
  href=/templates/?=
   $layout_id ?/css/retina.css media=only screen and
   (-webkit-min-device-pixel-ratio: 2) /
  
   Which then 'renders' out to this normally without Tidy:
  
   link rel=stylesheet type=text/css
   href=/templates/2/css/styles.css /
   link rel=stylesheet type=text/css
   href=/templates/2/css/retina.css media=only screen and
   (-webkit-min-device-pixel-ratio: 2) /
  
   This is what Tidy does:
  
   link rel=stylesheet type=text/css
   href=/templates/%3C?=%20$layout_id%20?%3E/css/styles.css
   link rel=stylesheet type=text/css
   href=/templates/%3C?=%20$layout_id%20?%3E/css/retina.css media=only
   screen and (-webkit-min-device-pixel-ratio: 2)
  
   I found ['fix-uri' = false] which gets closer:
  
   link rel=stylesheet type=text/css
   href=/templates/lt;?= $layout_id ?gt;/css/styles.css
   link rel=stylesheet type=text/css
   href=/templates/lt;?= $layout_id ?gt;/css/retina.css media=only
  screen
   and (-webkit-min-device-pixel-ratio: 2)
  
   I've tried about every option I can think of. What is the solution to make
   it stop trying to be smarter than me and converting my  and  tags??
  
   //See all parameters available here:
   http://tidy.sourceforge.net/docs/quickref.html
   $tconfig = array(
  //'clean' = true,
  'hide-comments' = true,
  'hide-endtags' = true,
  'drop-proprietary-attributes' = true,
  //'join-classes' = true,
  //'join-styles' = true,
  //'quote-marks' = true,
  'fix-uri' = false,
  'numeric-entities' = true,
  'preserve-entities' = true,
  'doctype' = 'omit',
  'tab-size' = 1,
  'wrap' = 0,
  'wrap-php' = false,
  'char-encoding' = 'raw',
  'input-encoding' = 'raw',
  'output-encoding' = 'raw',
  'newline' = 'LF',
  'tidy-mark' = false,
  'quiet' = true,
  'show-errors' = ($this-_debug ? 6 : 0),
  'show-warnings' = $this-_debug,
   );
  
  
   From: Joseph Moniz [mailto:joseph.mo...@gmail.com]
   Sent: Wednesday, April 17, 2013 2:55 PM
   To: Daevid Vincent
   Cc: php-general General
   Subject: Re: [PHP] Need a tool to minimize HTML before storing in
  memecache
  
   http://php.net/manual/en/book.tidy.php
  
  
   - Joseph Moniz
   (510) 509-0775 | @josephmoniz https://twitter.com/josephmoniz  |
   https://github.com/JosephMoniz GitHub |
   http://www.linkedin.com/pub/joseph-moniz/13/949/b54/ LinkedIn | Blog
   http://josephmoniz.github.io/  | CoderWall
   https://coderwall.com/josephmoniz
  
   Wake up early, Stay up late, Change the world
  
   On Wed, Apr 17, 2013 at 2:52 PM, Daevid Vincent dae...@daevid.com wrote:
   We do a lot with caching and storing in memecached as well as local copies
   so as to not hit the cache pool over the network and we have found some
   great tools to minimize our javascript and our css, and now we'd like to
   compress our HTML in these cache slabs.
  
  
  
   Anyone know of a good tool or even regex magic that I can call from PHP to
   compress/minimize the giant string web page before I store it in the
  cache?
  
  
  
   It's not quite as simple as stripping white space b/c obviously there are
   spaces between attributes in tags that need to be preserved, but also in
  the
   words/text on the page. I could strip out newlines I suppose, but then do
  I
   run into any issues

RE: [PHP] Need a tool to minimize HTML before storing in memecache

2013-05-02 Thread ma...@behnke.biz
This is because tidy is for optimizing HTML, not for optimizing PHP.

 Daevid Vincent dae...@daevid.com hat am 2. Mai 2013 um 02:20 geschrieben:


 So I took the time to install Tidy extension and wedge it into my code. Now
 there is one thing that is killing me and breaking all my pages.
 
 This is what I WANT the result to be:
 
 link rel=stylesheet type=text/css href=/templates/?=
 $layout_id ?/css/styles.css /
 link rel=stylesheet type=text/css href=/templates/?=
 $layout_id ?/css/retina.css media=only screen and
 (-webkit-min-device-pixel-ratio: 2) /
 
 Which then 'renders' out to this normally without Tidy:
 
 link rel=stylesheet type=text/css
 href=/templates/2/css/styles.css /
 link rel=stylesheet type=text/css
 href=/templates/2/css/retina.css media=only screen and
 (-webkit-min-device-pixel-ratio: 2) /
 
 This is what Tidy does:
 
 link rel=stylesheet type=text/css
 href=/templates/%3C?=%20$layout_id%20?%3E/css/styles.css
 link rel=stylesheet type=text/css
 href=/templates/%3C?=%20$layout_id%20?%3E/css/retina.css media=only
 screen and (-webkit-min-device-pixel-ratio: 2)
 
 I found ['fix-uri' = false] which gets closer:
 
 link rel=stylesheet type=text/css
 href=/templates/lt;?= $layout_id ?gt;/css/styles.css
 link rel=stylesheet type=text/css
 href=/templates/lt;?= $layout_id ?gt;/css/retina.css media=only screen
 and (-webkit-min-device-pixel-ratio: 2)
 
 I've tried about every option I can think of. What is the solution to make
 it stop trying to be smarter than me and converting my  and  tags??

 //See all parameters available here:
 http://tidy.sourceforge.net/docs/quickref.html
 $tconfig = array(
//'clean' = true,
'hide-comments' = true,
'hide-endtags' = true,
'drop-proprietary-attributes' = true,
//'join-classes' = true,
//'join-styles' = true,
//'quote-marks' = true,
'fix-uri' = false,
'numeric-entities' = true,
'preserve-entities' = true,
'doctype' = 'omit',
'tab-size' = 1,
'wrap' = 0,
'wrap-php' = false,
'char-encoding' = 'raw',
'input-encoding' = 'raw',
'output-encoding' = 'raw',
'newline' = 'LF',
'tidy-mark' = false,
'quiet' = true,
'show-errors' = ($this-_debug ? 6 : 0),
'show-warnings' = $this-_debug,
 );
 
 
 From: Joseph Moniz [mailto:joseph.mo...@gmail.com]
 Sent: Wednesday, April 17, 2013 2:55 PM
 To: Daevid Vincent
 Cc: php-general General
 Subject: Re: [PHP] Need a tool to minimize HTML before storing in memecache
 
 http://php.net/manual/en/book.tidy.php


 - Joseph Moniz
 (510) 509-0775 | @josephmoniz https://twitter.com/josephmoniz  |
 https://github.com/JosephMoniz GitHub |
 http://www.linkedin.com/pub/joseph-moniz/13/949/b54/ LinkedIn | Blog
 http://josephmoniz.github.io/  | CoderWall
 https://coderwall.com/josephmoniz
 
 Wake up early, Stay up late, Change the world
 
 On Wed, Apr 17, 2013 at 2:52 PM, Daevid Vincent dae...@daevid.com wrote:
 We do a lot with caching and storing in memecached as well as local copies
 so as to not hit the cache pool over the network and we have found some
 great tools to minimize our javascript and our css, and now we'd like to
 compress our HTML in these cache slabs.



 Anyone know of a good tool or even regex magic that I can call from PHP to
 compress/minimize the giant string web page before I store it in the cache?



 It's not quite as simple as stripping white space b/c obviously there are
 spaces between attributes in tags that need to be preserved, but also in the
 words/text on the page. I could strip out newlines I suppose, but then do I
 run into any issues in other ways? In any event, it seems like someone would
 have solved this by now before I go re-inventing the wheel.



 d.
 

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] PHP compiler - HipHop performance

2013-04-26 Thread ma...@behnke.biz
 Norah Jones nh.jone...@gmail.com hat am 26. April 2013 um 05:56 geschrieben:
 Hi,

 I have downloaded HipHop for my website, I am going through various web links
 which are suggesting that performance will improve 3-6 times. However I don't
 know the Stability of the HipHop.

 Please provide your inputs so that I can decide to use HipHop.

When I tried it I was amazed by the performance impact.

Just create yourself a PHP file that does 100.000 calculations and compare the
php execution vs. the native compiled one. That is awesome!

The drawback is, that hiphop does not support every php extension and that it
really takes some time to compile a really big framework.
If you have some code that you want to speed up and it can seperated from the
rest, then create a smaller module out of it and compile that.

Or think about creating own PECL extensions.


 Thanks,
 Norah Jones



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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Empty $_POST after submit.

2013-04-04 Thread ma...@behnke.biz


 Ashley Sheridan a...@ashleysheridan.co.uk hat am 4. April 2013 um 13:02
 geschrieben:


 I've noticed the first line looks a little odd. It might be valid, just
 probably not the way I've ever done it. For my own sanity, could you try
 changing it to:

 if (isset($_POST['lastname'])  isset($_POST['lastname']))


No, this is totally valid to check if all values are set

 If multiple parameters are supplied then isset() will return TRUE only if all
 of the parameters are set. Evaluation goes from left to right and stops as
 soon as an unset variable is encountered.

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



Re: [PHP] Empty $_POST after submit.

2013-04-04 Thread ma...@behnke.biz


 Ninad ninadsh...@iitb.ac.in hat am 4. April 2013 um 13:11 geschrieben:


 yes yes I tried that also...

 I have restarted apache as well as my entire system also...
 again I have cleared all the cache of my browser  restarted it also.
 but I am getting same result

Could you take a look at the output of

var_dump($_POST);
var_dump($_GET);
var_dump($_REQUEST);


 Regards,
 Ninad.

 On 04/04/2013 04:41 PM, Ashley Sheridan wrote:
  On Thu, 2013-04-04 at 16:33 +0530, Ninad wrote:
  I tried that already but same result ... no output...
 
 
  On 04/04/2013 04:32 PM, Ashley Sheridan wrote:
   On Thu, 2013-04-04 at 13:53 +0300, Sorin Badea wrote:
   So you have a single php file with the code from the first email and the
   $_POST var is empty. Am I right ?
  
  
   On Thu, Apr 4, 2013 at 1:49 PM, Ninad ninadsh...@iitb.ac.in
mailto:ninadsh...@iitb.ac.in   mailto:ninadsh...@iitb.ac.in wrote:
  
 Hi,
   
I am using httpd as a web server with default configuration.
   
Regards,
Ninad.
   
   
On 04/04/2013 04:11 PM, Sorin Badea wrote:
   
What are you using on the server for http ? nginx or apache ? can you
give
us more details about your configuration (mods, configuration,
htaccess ) ?
   
   
 On Thu, Apr 4, 2013 at 1:25 PM, Ninad ninadsh...@iitb.ac.in
 mailto:ninadsh...@iitb.ac.in   mailto:ninadsh...@iitb.ac.in
wrote:
   
 Hello,
   
Thanks for such a fast response.
   
Yes I tried bellow things but result is same --- no output..
   
$postdata = file_get_contents('php://input');
var_dump($postdata);
var_dump($_POST);
   
Regards,
Ninad.
   
   
On 04/04/2013 03:50 PM, Sorin Badea wrote:
   
Hi,
Did you tried a print_r($_POST) or a var_dump ?
   
   
On Thu, Apr 4, 2013 at 1:10 PM, Ninad ninadsh...@iitb.ac.in
 mailto:ninadsh...@iitb.ac.in   mailto:ninadsh...@iitb.ac.in
wrote:
   
Dear all,
   
I am having 2 servers. One is running fedora 10 with php 5.2.6-5 and
second one is running
fedora17 with php 5.4.13.
Below given code is working absolutely fine on fedora10 with php5.2
But
the same code is not working on fedora17 with php 5.4.13. After
submit I am
getting $_POST variable empty.
   
Please guide me in the same.
   
   
?php
if (isset($_POST['lastname'], $_POST['lastname']))
{
   echo(First name:  . $_POST['firstname'] . br /\n);
   echo(Last name:  . $_POST['lastname'] . br /\n);
}
?
   
html
head
/head
body
form action=index.php method=post
   pFirst name: input type=text name=firstname //p
   pLast name: input type=text name=lastname //p
   input type=submit name=submit value=Submit /
/form
/body
/html
   
   
Thanks  Regards,
Ninad.
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:http://www.php.net/unsub.php
   
   
   
   
 --
Badea Sorin (unu.sorin)
   sorin.bade...@gmail.com  mailto:sorin.bade...@gmail.com
 mailto:sorin.bade...@gmail.com
   unu_so...@yahoo.com  mailto:unu_so...@yahoo.com
 mailto:unu_so...@yahoo.com
Pagina personala:
   http://badeasorin.com
   
   
   
   
   
 --
Badea Sorin (unu.sorin)
   sorin.bade...@gmail.com  mailto:sorin.bade...@gmail.com
 mailto:sorin.bade...@gmail.com
   unu_so...@yahoo.com  mailto:unu_so...@yahoo.com
 mailto:unu_so...@yahoo.com
Pagina personala:
   http://badeasorin.com
   
   
   
  
  
  
   I've noticed the first line looks a little odd. It might be valid,
   just probably not the way I've ever done it. For my own sanity, could
   you try changing it to:
  
   if (isset($_POST['lastname'])  isset($_POST['lastname']))
  
   Thanks,
   Ash
  http://www.ashleysheridan.co.uk
  
  
 
 
  This is really starting to sound like some sort of weird bug
  somewhere. I know this is the typical IT response, but have you tried
  restarting Apache? Also, this shouldn't happen, but try restarting
  your browser too. Maybe it's exhibiting some strange cache bug.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] javascript cookie dissapears when adding session_start()

2013-03-20 Thread ma...@behnke.biz
Please re-send the link for your code.

 Norah Jones nh.jone...@gmail.com hat am 20. März 2013 um 15:19 geschrieben:


 I've been working on a PHP/Javascript Cookie Notify (Including multiple
 language support). Now I have one small problem, when session_start() is not
 at the top, the cookie message works as it should be.
 Now I am trying to add session_start(); at the top, as this will load the
 current language file the visitor has set it to. But then the cookie message
 will not show.
 I've cleaned all my cookies, and still can't get it to work ...
 I've put up a small code on jsFiddle, but when session_start(); is at the top,
 it launches correctly in jsFiddle. which can be viewed (here).
 Does anyone know what i'm doing wrong? And would you be able to explain me
 what I am doing wrong?

 Thanks


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Re: SPL Recursive Iterator Examples

2013-03-19 Thread ma...@behnke.biz
Why don't you post them on php.net?

http://www.php.net/manual/add-note.php?sect=class.recursiveiteratorredirect=http://www.php.net/manual/de/class.recursiveiterator.php


 NaMarPi nama...@yahoo.com hat am 19. März 2013 um 13:01 geschrieben:




 The usage of the examples:

 1. the name of the php file reflects to the method(s) under consideration -
 find the related php.net manual page for more information

 2. scroll down in the file, and you will find the result of the execution






 - Original Message -
 From: NaMarPi nama...@yahoo.com
 To: nama...@yahoo.com nama...@yahoo.com
 Cc:
 Sent: Tuesday, March 19, 2013 12:37 PM
 Subject: SPL Recursive Iterator Examples




 I have not found enough documents about Recursive iterators on the net, so
 started to colect mini-examples here:

 https://github.com/namarpi/PHP-SPL-Recursive-Examples

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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Re: Generating CRUD code for normalized db

2013-03-12 Thread ma...@behnke.biz


 Gary listgj-phpgene...@yahoo.co.uk hat am 11. März 2013 um 15:51
 geschrieben:
  I and others have pointed you towards open source solutions, the fact
  you don't want to put any effort in to make them work for you is not
  because of the state of open source software.

 If you think that solutions are things which do not work, following
 precisely the instructions on those solutions' websites, then I feel
 sorry for you.

I really feel sorry that I wasted my time and answered you request the first
time.

Do us all a favor abnd stay away from open source if you do not honor the work
us wannabes put into it.

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] How can I make PHP CodeSniffer Fixer ignore the namespace declaration?

2013-03-12 Thread ma...@behnke.biz
 Norah Jones nh.jone...@gmail.com hat am 12. März 2013 um 15:18 geschrieben:

 I am using the sublime text 2 plugin for PHP Coding Standards Fixer. It is
 working fine, except for the fact that it considers the namespace invalid (it
 is in fact invalid and I'm okay with it). this errors halts the script from
 correcting the rest of the file. I get the following error:

 The namespace Application\Controllers\Admin in  does not match the file
 path according to PSR-0 rules.

 How can I tell the the script to ignore the namespace constraint. Both command
 line arguments and Sublime text 2 user settings can be changed.

Have you looked at the configuration options? Do they help?

https://github.com/fabpot/PHP-CS-Fixer



--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Re: Generating CRUD code for normalized db

2013-03-11 Thread ma...@behnke.biz


 Gary listgj-phpgene...@yahoo.co.uk hat am 11. März 2013 um 10:10
 geschrieben:


 ma...@behnke.biz wrote:

  FLOW3 might be worth a look. TYPO3 with inline relational records.

 Seems to be in a similar state to yii as regards usability and
 documentation.

 = composer create-project --dev --keep-vcs typo3/flow-base-distribution
 Quickstart 2.0.0

   [InvalidArgumentException]
   Could not find package typo3/flow-base-distribution with version
   2.0.0.

Works for me? Mysterious.

If you simply need this relation crud stuff you can also check out PHP Maker :)

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



Re: [PHP] Generating CRUD code for normalized db

2013-03-08 Thread ma...@behnke.biz
FLOW3 might be worth a look. TYPO3 with inline relational records.

 Gary listgj-phpgene...@yahoo.co.uk hat am 8. März 2013 um 14:14 geschrieben:


 Does anyone know of any framework that can generate CRUD code for
 normalized database tables? Preferably FOSS.

 For example, if I have a table person and address, I would like to be
 able to generate a Create form which will capture the data from the user
 for *both* of those at the same time.

 Don't bother pointing me at yii's gii (or giix extension). What works is
 inadequte and what doesn't work seems to be rather a lot.

 --
 GaryPlease do NOT send me 'courtesy' replies off-list.


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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] if (empty versus if (isset

2013-02-20 Thread ma...@behnke.biz
isset checks if something is defined or if an array has a key with a value other
than null

read:
http://www.php.net/manual/en/function.isset.php#refsect1-function.isset-returnvalues

empty check isset PLUS if the value is not null, false, 0 and wahtever php
thinks is empty

read:
http://www.php.net/manual/en/function.empty.php#refsect1-function.empty-returnvalues

You should also checkout array_key_exists

read: http://www.php.net/manual/en/function.array-key-exists.php

 John Taylor-Johnston john.taylor-johns...@cegepsherbrooke.qc.ca hat am 20.
 Februar 2013 um 03:29 geschrieben:


 What is the difference between?

 if (empty... http://www.php.net/manual/en/function.empty.php Determine
 whether a variable is empty
 and
 if (isset... http://php.net/manual/en/function.isset.php Determine if a
 variable is set and is not *|NULL|*

 I have an input type=radio value=something.

 If it is not checked, it is NOT empty, because it has a value, right?
 But it is NOT set, right?

 Is this empty, because it's value is ?

 input type=text value=

 Just trying to understand ... :)

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Re: if (empty versus if (isset

2013-02-20 Thread ma...@behnke.biz


 Jim Giner jim.gi...@albanyhandball.com hat am 20. Februar 2013 um 15:10
 geschrieben:


 Basically it tells a savvy programmer whether or not his logic has
 caused the var in question to exist.  Many times it is important
 simply to know that, not what the var contains, which can lead to an
 error in processing.

 The isset() will tell you that yes, I have this variable, letting you
 then correctly interpret the contents.  If a $_POST var is not set
 (meaning the user made no input to it), the use of empty() will insist
 on telling you that the var is empty even tho it really was not provided
 by the user (assuming that you don't get an error msg for having an
 invalid index in the POST array).

keep in mind that isset returns false if the variable exists, but has a value of
null. The same applies to existing array keys with value null.


 They seem to be needlessly redundant, but in fact do provide knowledge
 for those seeking it.

No, they are not as I wrote in my last message


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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] APC opcode cache behavior

2013-02-14 Thread ma...@behnke.biz
 Aaron Holmes aa...@aaronholmes.net hat am 14. Februar 2013 um 03:53
 geschrieben:
 Hello,
 I'm trying to find some information on APC opcode cache behavior.
 We noticed an issue where, when switching symlinks to different versions
 of sites, old code was running from the previous version after switching
 the symlink.

 Anyone know where I can find more information on this?

Yes, that is the case. And iirc it will not update the cache if the mtime of the
new switched file is not newer. If you switch you must either restart the
apache or touch the files.

read more:
http://linuxaria.com/howto/everything-you-need-to-know-about-apc-alternate-php-cache?lang=en

And on php.net about ini configuration values


 Thanks,
 Aaron holmes

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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] fopen and load balancing

2013-02-12 Thread ma...@behnke.biz


Adam Tong adam.to...@gmail.com hat am 11. Februar 2013 um 16:11 geschrieben:
 I think this is what happened. As the application was trying to open
 our url domain the request was sent to the load balancer, and as it
 does not accept internal requests, the connection was timed out.

 The only way we could avoid that is to not use fopen our url, is that right?

You know the thing is: LoadBalancers are to balance the load from outside not
the other way around. If you need to make server requests, use the internal
server name. But accessing the file directly is much smarter and faster.




 On Mon, Feb 11, 2013 at 4:26 AM, ma...@behnke.biz ma...@behnke.biz wrote:
 
 
  Adam Tong adam.to...@gmail.com hat am 10. Februar 2013 um 23:41
  geschrieben:
  Hi,
 
  We had an issue with the code of a junior php developer that used
  fopen to load images using the url of the companies website that is
  load balanced.
 
  We could not the detect the problem in dev and test because the dev
  and test servers are not load balanced.
 
  I know that he could load the images using just the filesystem, but I
  am curious to know why it failed and if the load balancer is really
  the source of the problem or it is a limitation on the function
  itself.
 
  Do you have any error messages for us?
  If the load balancer accessable from the internal servers? Normally it is
  not.
 
 
 
  Thank you
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  Marco Behnke
  Dipl. Informatiker (FH), SAE Audio Engineer Diploma
  Zend Certified Engineer PHP 5.3
 
  Tel.: 0174 / 9722336
  e-Mail: ma...@behnke.biz
 
  Softwaretechnik Behnke
  Heinrich-Heine-Str. 7D
  21218 Seevetal
 
  http://www.behnke.biz
 
  --
  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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] fopen and load balancing

2013-02-11 Thread ma...@behnke.biz


Adam Tong adam.to...@gmail.com hat am 10. Februar 2013 um 23:41 geschrieben:
 Hi,

 We had an issue with the code of a junior php developer that used
 fopen to load images using the url of the companies website that is
 load balanced.

 We could not the detect the problem in dev and test because the dev
 and test servers are not load balanced.

 I know that he could load the images using just the filesystem, but I
 am curious to know why it failed and if the load balancer is really
 the source of the problem or it is a limitation on the function
 itself.

Do you have any error messages for us?
If the load balancer accessable from the internal servers? Normally it is not.



 Thank you

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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] PHP 5.4.11 warnings - how to make them go away ?

2013-02-11 Thread ma...@behnke.biz


Paul Lanken lanken.p...@gmail.com hat am 11. Februar 2013 um 14:27
geschrieben:
 I ran a quick mysql_connect test using the php 5.4.11 cli and was met
 with many annoying warnings :

 $ php -r mysql_connect( \localhost\, \username\, \password\ )
 or die(\Unable to connect to MySQL\); echo \Connected to
 MySQL\\n\; 21 | cat -n -
  1  PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/local/lib/php/extensions/gd.so' - ld.so.1: php: fatal:
 /usr/local/lib/php/extensions/gd.so: open failed: No such file or
 directory in Unknown on line 0
  2  PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/local/lib/php/extensions/gettext.so' - ld.so.1: php: fatal:
 /usr/local/lib/php/extensions/gettext.so: open failed: No such file or
 directory in Unknown on line 0
  3  PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/local/lib/php/extensions/ldap.so' - ld.so.1: php: fatal:
 /usr/local/lib/php/extensions/ldap.so: open failed: No such file or
 directory in Unknown on line 0
  4  PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/local/lib/php/extensions/mcrypt.so' - ld.so.1: php: fatal:
 /usr/local/lib/php/extensions/mcrypt.so: open failed: No such file or
 directory in Unknown on line 0
  5  PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/local/lib/php/extensions/mhash.so' - ld.so.1: php: fatal:
 /usr/local/lib/php/extensions/mhash.so: open failed: No such file or
 directory in Unknown on line 0
  6  PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/local/lib/php/extensions/mysql.so' - ld.so.1: php: fatal:
 /usr/local/lib/php/extensions/mysql.so: open failed: No such file or
 directory in Unknown on line 0
  7  PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/local/lib/php/extensions/mysqli.so' - ld.so.1: php: fatal:
 /usr/local/lib/php/extensions/mysqli.so: open failed: No such file or
 directory in Unknown on line 0
  8  Connected to MySQL

 So I am happy with the final line but annoyed by the seven previous.
 There seems to be no need for gd.so or any of the other dynamic libs
 that are being searched for.  Not sure why these messages are
 happening and I looked in /usr/local/lib/php.ini where I see this :

 ; Directory in which the loadable extensions (modules) reside.
 extension_dir = /usr/local/lib/php/extensions


 Seems reasonable.  However I do not need mysql.so because the php
 binaries were linked with -lmysqlclient.

 So how to get rid of these warnings ?


remove the loading entries from php.ini or from you /etc/php5/conf.d directory



 Paul

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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Web User Management

2013-01-31 Thread ma...@behnke.biz


Adolfo Olivera olivera.ado...@gmail.com hat am 30. Januar 2013 um 17:19
geschrieben:
 You can take a look at the classes from the Zend Framework (they can be
 used
 stand alone as well)

 Thanks Marco, which classes specifically are you talking about. Where can I
 download them from and get documentation on them? I looked into zend's web
 site and it is a bit overwhelming, so may be you can point me in the right
 direction.

http://framework.zend.com/manual/1.12/de/zend.acl.html



 On Wed, Jan 30, 2013 at 11:53 AM, ma...@behnke.biz ma...@behnke.biz wrote:

  Adolfo Olivera olivera.ado...@gmail.com hat am 30. Januar 2013 um 15:18
  geschrieben:
   My questions are
  
   1 Is there some kind of library, framework I could utilize to save me
  some
   work?
 
  You can take a look at the classes from the Zend Framework (they can be
  used
  stand alone as well)
 
   2 Any thoughts, lessons learned from more senior programmers, I'm fairly
   new with PHP.
 
  Think about security issues like encrypted transfer of passwords, sessions
  hijacking, sql injection, sessions without cookies and stuff like that.
 
  --
  Marco Behnke
  Dipl. Informatiker (FH), SAE Audio Engineer Diploma
  Zend Certified Engineer PHP 5.3
 
  Tel.: 0174 / 9722336
  e-Mail: ma...@behnke.biz
 
  Softwaretechnik Behnke
  Heinrich-Heine-Str. 7D
  21218 Seevetal
 
  http://www.behnke.biz
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 Adolfo Olivera
 15-3429-9743

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Web User Management

2013-01-30 Thread ma...@behnke.biz
Adolfo Olivera olivera.ado...@gmail.com hat am 30. Januar 2013 um 15:18
geschrieben:
 My questions are

 1 Is there some kind of library, framework I could utilize to save me some
 work?

You can take a look at the classes from the Zend Framework (they can be used
stand alone as well)

 2 Any thoughts, lessons learned from more senior programmers, I'm fairly
 new with PHP.

Think about security issues like encrypted transfer of passwords, sessions
hijacking, sql injection, sessions without cookies and stuff like that.

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Session ?

2012-12-12 Thread ma...@behnke.biz


Jim Giner jim.gi...@albanyhandball.com hat am 12. Dezember 2012 um 02:53
geschrieben:
 On 12/11/2012 7:27 PM, Marco Behnke wrote:
  Am 08.12.12 19:08, schrieb Jim Giner:
  All my debugging messages indicagte that I have the same session id,
  yet I don't have the same variables, ie, they're missing.
  Just to be sure ... the webspace is on the same server and has access to
  the same directory where the session data is stored? (session_save_path)?
 
 
 Yes - it points to a folder within my main domain's structure.

which is accessible from your subdomains?


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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Lucene library

2012-12-12 Thread ma...@behnke.biz


Louis Huppenbauer louis.huppenba...@gmail.com hat am 12. Dezember 2012 um
07:07 geschrieben:
 There's Zend_Search_Lucene, part of the Zend framework. I think it should
 be possible to use it without the whole framework though.

 http://framework.zend.com/manual/1.12/de/zend.search.lucene.html


see
http://www.phpgangsta.de/die-eigene-suchmaschine-in-php-leicht-gemacht-lucene



 2012/12/12 Larry Garfield la...@garfieldtech.com

  Yes, I've worked with Apache Solr quite a bit.  It's a separate server,
  however, and I'm looking for something with smaller requirements for a
  concept I want to try. I'd consider SQLite, but I really need something
  schema-free and PHP-native/easily-installable.
 
  --Larry Garfield
 
 
  On 12/11/2012 07:20 PM, israele...@gmail.com wrote:
 
  Check out apache solr.
 
  The php implementation of Lucene was very slow and had a lot of
  perfomance issues the last time I tried it
  --Original Message--
  From: Larry Garfield
  To: php-general@lists.php.net
  Subject: [PHP] Lucene library
  Sent: Dec 11, 2012 5:41 PM
 
  Hi all.
 
  I recall hearing about there being a PHP port of the Lucene library some
  years ago, but I don't recall whence it came.  It was a stand-alone PHP
  lib, which needed some integration to be viable as an actual search
  engine but worked up to a point by storing data straight on disk as
  files.  That meant it didn't scale beyond a few tens of thousands of
  records, but that's still a decent number.
 
  Does that ring a bell for anyone?  Anyone know if it still exists, and
  if so where?  I didn't find it in https://packagist.org/ , which is
  where I figured it would be if it were still maintained.
 
  I may have a use for it if it still exists.
 
  --Larry Garfield
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-12 Thread ma...@behnke.biz


Terry Ally (Gmail) terrya...@gmail.com hat am 11. November 2012 um 19:30
geschrieben:
 Hi all,

 I am having a problem with comparing time. I am using the following:

 $todaydate = date(D, M jS, Y g:i:s a);
 $showenddate = date(D, M jS, Y g:i:s a,
 strtotime($showsRecord['end_date']));

 if ($todaydate  $showenddate):

Read about http://de1.php.net/manual/en/datetime.diff.php


 echo The date of the show has not yet arrived;
 else:
 echo The show has ended;
 endif;

 The problem that I am encountering is that PHP is rendering the reverse of
 the equation. For example:

 If today's date is *11 Nov 2012* and the show's end date is *18 Nov 2012*,
 the message that I am getting is *the show has ended* which is wrong. A
 test example is at http://www.lakesidesurrey.co.uk/test.php.

 You can also me what I am doing wrong?

 Thanks
 Terry

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-31 Thread ma...@behnke.biz


Johannes Reichardt johannes.reicha...@googlemail.com hat am 30. Oktober 2012
um 16:37 geschrieben:
  In times of testability and several design patters, the use of static calls
  is
  really outdated.
  I understand that you can read and write the invocations of the methods much
  faster, but you should think more to the future on that point.
 I am not sure if that is true for TURBOPY. It has been organically
 grown over the years
 and I had no scenario where I needed instances. The benefit of more
 compact code is worth
 it for this scenario I think. The nature of a server request is still
 very procedural.

Yeah, but when thinking of your TURBOPY as an application, you will come to a
point where changes are neccessary,
They stopped programming procedural PHP for a reason. And they introduced things
like DIC for a reason.

If you want to make sure that your framework works even after changing or adding
somethink, you have to think about phpunit for example.

And if you think about add-ons or mods to your basic classes, you will consider
design patterns that are incompatible with static usage.

If your code will run a longer living CGI process for example, then you will
have to take care that all static members are resetted, otherwise the next user
gets them. That's where objects kick in.

think about it, if you want to make TURBOPY ready for the future.

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread ma...@behnke.biz
Florian Müller florian-muel...@outlook.com hat am 31. Oktober 2012 um 07:58
geschrieben:
 Hi guys
 I was wondering, what actually the reason is that PHP itself does not support
 multi-threading?
 I guess this would be realizable, or not? If not, why?
 Maybe this is a stupid question, but still somehow interesting. Realization in
 a way as Java does (or just something in that way) would actually be a very
 nice thing, don't you think?
 Thank you for your answers :)

That is because most parts of the PHP code is not threadsafe.

 Florian
 
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread ma...@behnke.biz


Ovidiu Farauanu ovidiugabr...@gmail.com hat am 31. Oktober 2012 um 09:59
geschrieben:
 Hello Florian,

 Usually you want to run a PHP script in two different environments:
 1. inside a webserver
 2. in a command line interface

 For a web application, the application server does the work for you.
 It is the server job to have a thread pool and balance it correctly.
 So you don't need threads for the same reason threads are prohibited in
 Java EE containers.
 I assume that you don't fork multiple threads for every single HTTP request
 inside a Java Servlet, for instance.

 When you are inside a command line usually you start processes instead of
 threads.
 And this is fully supported by PHP.

The drawback of forking is the memory overhead. With every fork you take the
same amount of memory which is not the case if you could use real threads.

 However, there are several reasons in choosing processes instead of threads.
 Several high-level programming languages are starting OS processes for
 language threads.
 But maybe this is not on our topic now.

 But I am wondering what do you mean by multithreading support?
 Do you need library functions as synchronization primitives?
 Or you are talking about something like synchronized keyword?

Since PHP is not threadsafe, it is not possible to run the APACHE in worker
mode, you have to use the prefork model.

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



Re: [PHP] Multithreading for OOP PHP

2012-10-31 Thread ma...@behnke.biz


Ovidiu Farauanu ovidiugabr...@gmail.com hat am 31. Oktober 2012 um 09:59
geschrieben:
 Yes Marco has right.

 But more than that, OOP is mainly designed to run in a single threaded

. I don't put a comment on that.

 environment and it is not the best idea to be used for concurrent
 programming because you will need synchronization everywhere and this slows
 down the code, but also ask for a lot of other troubles.

Well, just avoid the difficulties of creating a good program, because it is too
much efford?


 I think functional paradigm is more better suited for concurrent
 programming, and there are some nice features in PHP 5.4
 please see Closures and how callbacks can be used in PHP. Functional
 features are prepared for Java 8, and they are already in C++11.

What have closures and callbacks to do with concurrent programming?
Nothing. The execution is serialized. There is no parallel in it.

Together with your last message on the list on the same topic, you should
consider reading a bit more on that topic.

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



Re: Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-30 Thread ma...@behnke.biz
Lester Caine les...@lsces.co.uk hat am 30. Oktober 2012 um 11:07 geschrieben:
  And why PHP 5.2?

  Why not? With some tweaks it would work on PHP4 but for the sake of security
  it uses some filter_var methods that are 5.2 specific.

 And since 60% of the world is still stuck with ISP provided hosting on PHP5.2
 or
 less it does 'widen the market' ...

Ok, I can take that point. I haven't installed anything on a shared host for a
while. Always working with VServers.


Johannes Reichardt johannes.reicha...@googlemail.com hat am 30. Oktober 2012
um 10:24 geschrieben:
   From what I see most of your concepts are not up to date of how you
  would do things now.
  This starts with simple leave brackets on if else single line
  conditions which is from my point of view a no go and ends with using
  static calls instead of instances.
 Thank you for your feedback.
 Especially the static calls improve code quality a lot in my opinion.
 But it is different to common standards, I am aware of that.

In times of testability and several design patters, the use of static calls is
really outdated.
I understand that you can read and write the invocations of the methods much
faster, but you should think more to the future on that point.

  And I am curious if you have developed a real templating engine or if
  you are going by eval()? From what I see, it looks a bit like that.
 Yes, that is the default. But hardly any impact on performance. For
 Websites with
 highest traffic it would be simple to write out the controller code
 instead of storeing it in the db only,
 other ways would be stream sockets that allow including of db pages.

The/my problem with eval() comes from a security point of view.

 Thank you. Maybe you want to download and install it some time, would be
 glad to get more feedback from you  :)

Yeah, you known, I love to, but there are 29+some other project I want to do as
well.
For now I'll stick to I am doing right now and try to finish it first ;)



Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: Re: [PHP] TURBOPY cloud framework + IDE beta available NOW

2012-10-30 Thread ma...@behnke.biz
Sebastian Krebs krebs@gmail.com hat am 30. Oktober 2012 um 16:20
geschrieben:
 2012/10/30 ma...@behnke.biz ma...@behnke.biz

  Ok, I can take that point. I haven't installed anything on a shared host
  for a
  while. Always working with VServers.
 

 And if you want to take your job serious, thats definitely the way to go. I
 don't think it's useful to give the ISPs a legitimation to stay forever on
 outdated (5.3 exists since 06/2009, last 5.2 is from 01/2011) and
 unsupported (12/2010) (and therefore probably insecure) versions neither by
 tolerating their update-laziness, nor by providing software, that encourage
 their update-laziness. ;) Just my two cent, but really 5.2? 5.5 is
 (loosely) scheduled for Q1 2013 ;)

That is why I go for 5.3 at least.

And would recommend that to everyone, reasons mentioned above!

but I do get the point, that if you want to have customers using your product,
and they have access to 5.2 only, then you have to support it somehow.

But you can also take a look at others projects like TYPO3, they force you to
use PHP 5.3 to be up to date

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



Re: [PHP] Serving an image

2012-10-16 Thread ma...@behnke.biz


viper recursivepoin...@gmail.com hat am 16. Oktober 2012 um 08:54 geschrieben:
 On Tue, Oct 16, 2012 at 7:40 AM, Jan Ehrhardt php...@ehrhardt.nl wrote:
  Many receiving e-mail clients will not show external images. External
  images are used by spammers to trach if a message is read.

 true;

 you could embed images in email..
 http://www.campaignmonitor.com/blog/post/1761/embedding-images-in-email/

 so you could use this (or similar) to write the email:
 echo 'img
 src=data:image/png;base64,'.base64_encode(file_get_contents('test.png'));.';

Actually this is bad practice ... it blows up your code.
Use attachments for that.


 (i don't know if it works :D  )


 viper

 --
 +  http://vipertechnology.dyndns.org
 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
 +  http://vipertechnology.dyndns.org/cotnact/

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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: RES: [PHP] Re: problem with my login script

2012-10-02 Thread ma...@behnke.biz
Just for the record, I'll sign that one.
There is a reason for continue, break and return to exist.

Just make sure, that your code is understandable and there is no problem using
these exits.

If your code is that complicated, that you don't understand a break in it, the
problem is another.

Samuel Lopes Grigolato samuel.grigol...@gmail.com hat am 2. Oktober 2012 um
13:40 geschrieben:
 I follow this rule of thumb: small blocks of highly understandable code. If
 this demands ternary conditionals or breaks, so be it!

 -Mensagem original-
 De: Tim Streater [mailto:t...@clothears.org.uk]
 Enviada em: terça-feira, 2 de outubro de 2012 08:37
 Para: PHP General List
 Assunto: [PHP] Re: problem with my login script

 On 02 Oct 2012 at 12:07, Maciek Sokolewicz maciek.sokolew...@gmail.com
 wrote:

  On 02-10-2012 11:59, Bálint Horváth wrote:
  The problem was already solved. I forgot to send a copy to the list...
 
  Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT
  use break at all (in a loop)... (switch is an exception)
 
  I personally find this statement to be utter bullshit. There is
  nothing wrong with using break. There is a very good reason why it's
  available in the language. In very many cases, it costs a lot less
  code to add a break than to add additional clauses to your
  while-conditional.

 Agree 100%.

 --
 Cheers  --  Tim


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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Joining a team, where no wiki or docs are available

2012-09-25 Thread ma...@behnke.biz
AmirBehzad Eslami behzad.esl...@gmail.com hat am 24. September 2012 um 16:05
geschrieben:
 What approach do you use in a similar situation?
 Is there a systematic approach for this?
 Is there reverse-engineering technique to understand the design of code?

Hi Amir,

my first start in such situations is

- phpDocumentor or anything like that
- xdebug + Cachegrind

This way + a few requests and you'll get with the help of the profiling logs a
good overview about the code and where the data flows.

When you now browse the code, make sure you'll put comments everywhere you go
and setup the wiki for yourself to document any kind of workflow you find.



Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] PDO: extend or encapsulate?

2012-07-13 Thread ma...@behnke.biz



tamouse mailing lists tamouse.li...@gmail.com hat am 13. Juli 2012 um 07:06
geschrieben:

 It's Friday, so...

 Yes, it's true, I have just started looking at using PDO instead of
 mysqli -- a bit behind the times...

 My question at this stage, is do people tend to extend the PDO class
 for their own use, or encapsulate it in a class (or do most people use
 it mostly in procedural code?)

I stick to use it as components as it is said Do not use inheritance for code
re-use :)



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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Re: Find match of string if only at end of string

2012-07-12 Thread ma...@behnke.biz



tamouse mailing lists tamouse.li...@gmail.com hat am 11. Juli 2012 um 19:13
geschrieben:

 On Wed, Jul 11, 2012 at 11:45 AM, Marc Guay marc.g...@gmail.com wrote:
  Answered it myself (funny how writing out a problem as descriptively
  as possible makes the brain work better).
 
  $end_of_url = substr(http://domain.com/about/page/subpage/;,
  strlen(/about/page/) * -1);
  $same_post = ($end_of_url == /about/page/);

 or regex: ':/about/page/:$'

':/about/page/$:'

^^



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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] database hell

2012-07-12 Thread ma...@behnke.biz



Nick Edwards nick.z.edwa...@gmail.com hat am 12. Juli 2012 um 14:00
geschrieben:

 On 7/12/12, Gibbs li...@danielgibbs.net wrote:
 
  mysql_query(DELETE from userprefs where clientr='$User', $connmy);


Sidenote: And don't forget to validate user input and make use of mysql escape
and prepared statements ;)

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



Re: [PHP] why is (intval('444-44444') == '444-44444') EQUAL??!

2012-06-22 Thread ma...@behnke.biz


Daevid Vincent dae...@daevid.com hat am 22. Juni 2012 um 04:27 geschrieben:

 Huh? Why is this equal??!

http://de2.php.net/manual/en/language.types.type-juggling.php

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



RE: [PHP] global array

2012-06-15 Thread ma...@behnke.biz


Jeff Burcher j...@allredmetal.com hat am 14. Juni 2012 um 14:23 geschrieben:

 You're a genius!! Thank you. Uppercase 'R', sheesh. PHP is sooo picky. I
 worked for two days trying to figure that one out. Anyway, for future
 reference, you can pass the entire array as a variable like that?? and do you
 know if the '+=' statement will create an array entry if one doesn't exist?


If you are using a higher loglevel, you'll get a notice for a not existing array
key.
In the othercase

$array[$mykey] += 1;

will work without notice. But as the key does not exist, the value will be null
and right now I am not sure what

null + 1

evaluates to?

Well, works

maro@marco-behnke:~$ php -a
Interactive shell

php  $array = array();
php  $array['foo'] += 1;
PHP Notice:  Undefined index: foo in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
php  var_dump($array);
array(1) {
  [foo]=
  int(1)
}

BUT I stronly recommend not to do that.

make it this way:

$array[$mykey] = array_key_exists($mykey, $array) ? $array[$mykey] += 1 :
$array[$mykey] = 1;

or better:

if (array_key_exists($mykey, $array)) {
   $array[$mykey] += 1;
} else {
   $array[$mykey] = 1;
}


 Thanks,

 Jeff Burcher - IT Dept
 Allred Metal Stamping
 PO Box 2566
 High Point, NC 27261
 (336)886-5221 x229
 j...@allredmetal.com


  -Original Message-
  From: ma...@behnke.biz [mailto:ma...@behnke.biz]
  Sent: Thursday, June 14, 2012 8:04 AM
  To: php-general@lists.php.net; j...@allredmetal.com
  Subject: Re: [PHP] global array
 
 
 
 
  Jeff Burcher j...@allredmetal.com hat am 14. Juni 2012 um 13:55
  geschrieben:
 
  
   function Part_BOM($PartID, $need, $phase) {
  
  
  
   global $Invreq;
 
 
  uppercase R !!!
  And much better is adding it as another parameter and inject it:
 
  function Part_BOM($PartID, $need, $phase, $InvReq) { 
  }
 
  // call it
  Part_BOM(..., ..., ..., $InvReq);
 
  And please read about foreach() and what you can do with it.
 
  --
  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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Re: php form action breaks script

2012-06-15 Thread ma...@behnke.biz


Al n...@ridersite.org hat am 15. Juni 2012 um 14:29 geschrieben:



 On 6/14/2012 7:28 PM, Tim Dunphy wrote:
  However if I change the form action to this, it breaks the page
  resulting in a white screen of death:


error_reporting(E_ALL);
ini_set('display_errors', 'On');

And what is the error message?

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



Re: [PHP] Re: php form action breaks script

2012-06-15 Thread ma...@behnke.biz


Jim Lucas li...@cmsws.com hat am 15. Juni 2012 um 18:39 geschrieben:

 On 06/15/2012 06:35 AM, Jim Giner wrote:
  Hear, Hear for heredocs.  The only way to code up your html.  Took me a few
  months to discover it and haven't looked back since.
 
 
 

 The only problem I have with HEREDOC is I cannot use constants within them.

You shouldn't use constants anyway. Always inject your dependencies.



 --
 Jim Lucas

 http://www.cmsws.com/
 http://www.cmsws.com/examples/

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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] global array

2012-06-14 Thread ma...@behnke.biz



Jeff Burcher j...@allredmetal.com hat am 14. Juni 2012 um 13:55 geschrieben:


 function Part_BOM($PartID, $need, $phase) {

 

 global $Invreq;


uppercase R !!!
And much better is adding it as another parameter and inject it:

function Part_BOM($PartID, $need, $phase, $InvReq) {

}

// call it
Part_BOM(..., ..., ..., $InvReq);

And please read about foreach() and what you can do with it.

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



Re: [PHP] looking for a PHP texte indexer

2012-06-11 Thread ma...@behnke.biz


Mihamina Rakotomandimby miham...@rktmb.org hat am 11. Juni 2012 um 11:12
geschrieben:

 Hi all,

 I have a small job ad website, where some poster tend to flood with the
 same ad, just in order to be on top of the recent sort.

 To perturb the strict duplication detection (yes it's weak), they add
 one or two words that makes difference.

 The result is a duplication of many ads.

 I would like to search for duplicates by looking for ads with 80%-90%
 same words and decide they're the same, so that I can group them.

 Of course, putting a limiting mecanism or even a moderation is
 scheduled, but I want to process existing first.

 I dont want to use MySQL for indexing, I believe text indexers are best
 tools for this: Am I wrong?

 What would you suggest me to process and lookup for duplicates in that
 situation?

Maybe take a look at

http://de.php.net/manual/de/function.similar-text.php
http://de.php.net/manual/de/function.levenshtein.php



 --
 RMA.

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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Using default argument values in the middle of the argument list

2012-06-04 Thread ma...@behnke.biz


324...@mail.muni.cz hat am 1. Juni 2012 um 21:52 geschrieben:

 Hi,

 as I accidentally found out that PHP allows default argument values
 to occur not only at the end of parameter list:

 function ( Classname $a, Classname $b = null, Classname $c ) ...

 Unfortunately, documentation does not state what is supposed to happen in
 such situation.
 It appears $b can be an instance of Classname or a null.


You can find anything on that topic on the type hint section.
If you use type hinting:

Classname $a,

$a can only be instance of Classname, nothing else. But if you want to allow
null as well, you have to write

Classname $a = null,

Don't mistake this as default value! It is _meant_ as Classname or null are
allowed.

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



Re: [PHP] How to insert a file in a class?

2012-06-01 Thread ma...@behnke.biz


LAMP l...@afan.net hat am 1. Juni 2012 um 14:41 geschrieben:

 include(file.php);
 $box-box_content($content);
 $box-make_box();
 echo $box-get_box();


Wrong approach.
Right is:

$content = file_get_contents('file.php');
$box-box_content($content);


Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Exception Handling

2012-06-01 Thread ma...@behnke.biz

James Colannino crankycycl...@gmail.com hat am 1. Juni 2012 um 16:25
geschrieben:

 Hey guys,

 Haven't posted in a long time...  Happy Memorial Day!  I have an issue
 with exception handling.  I'm using a framework that throws a
 Database_Exception object.  I was expecting catch (Exception $var) to
 be sufficient to catch this, but it doesn't.  I have to do catch
 (Database_Exception $var) to make it work.  I've been reading that
 Exception should be sufficient, since every exception object is a child
 class of Exception.  Did this perhaps change in 5.4?  I think it was
 working properly in 5.3, but I'm not sure.


Look at the definition of Database_Exception and see if it extends Exception,
I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.


 Any clarification would be greatly appreciated!

 James

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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Simple XML, (x)html, and xpath

2012-05-25 Thread ma...@behnke.biz


Gary listgj-phpgene...@yahoo.co.uk hat am 25. Mai 2012 um 09:57
geschrieben:

 If I use simplexml_load_string to create an XML object with the
 following XHTML
 ,
 | ?xml version=1.0?
 | !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 | http://www.w3.org/TR/
 | xhtml1/DTD/xhtml1-strict.dtd
 | html xmlns=http://www.w3.org/1999/xhtml;
 | headmeta http-equiv=Content-Type content=text/html;
charset=UTF-8
 | /
 | titletest title/title
 | /head
 | body
 | !-- comment --
 | /body
 | /html
 `

 I get this SimpleXMLElement back
 ,
 | object(SimpleXMLElement)#1 (2) {
 |   [head]=
 |   object(SimpleXMLElement)#2 (1) {
 | [title]=
 | string(10) test title
 |   }
 |   [body]=
 |   object(SimpleXMLElement)#3 (1) {
 | [comment]=
 | object(SimpleXMLElement)#4 (0) {
 | }
 |   }
 | }
 `

 but I cannot seem to get anything out of an xpath expression, no matter
 what I try.

 If, however, I remove the 'xmlns=http://www.w3.org/1999/xhtml;' in the
 html element, it works fine. So yeah, I can just remove that text,
 but... is there something wrong here, in my expectation or in the xpath
 function?


Maybe you can show us your xpath expression?



 TIA.

 --
 GaryPlease do NOT send me 'courtesy' replies off-list.


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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)

2012-05-23 Thread ma...@behnke.biz

 my windowze dev box is completely frozen at startup now, before even
 mounting the drive that had the slow write rate today. booted into
 ubuntu which is still responsive, and ran disk utility to see that
 smart status and self-check for both system drive and the other drive
 that i noticed going slow today, is good.
 I wonder what's gotten my dev box ill.. Hope it aint a virus, but
 can't start the virus scanner coz the thing is frozen... :S


I guess that is the reason why your dev system is slow ;)

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



RE: [PHP]How to handle E_ERROR,E_PARSE with a user defined function

2012-05-23 Thread ma...@behnke.biz
  -Original Message-
 From: Yuchen Wang [mailto:phob...@gmail.com]
 Sent: Tuesday, May 22, 2012 10:19 PM
 To: php-general Maillist
 Subject: [PHP]How to handle E_ERROR,E_PARSE with a user defined function

 Hi all,

 How to handle E_ERROR,E_PARSE with a user defined function ?

Aren't these startup errors? I am not quite sure, but if the y can't be
handled with php.

This is from the PHP docs

The following error types cannot be handled with a user defined function:
E_ERROR , E_PARSE , E_CORE_ERROR , E_CORE_WARNING , E_COMPILE_ERROR ,
E_COMPILE_WARNING , and most of E_STRICT raised in the file where
set_error_handler() is called.
If errors occur before the script is executed (e.g. on file uploads) the
custom error handler cannot be called since it is not registered at that
time.

So the only thing you can do is have a watchdog on your phperror.log  and
dosomething if these errors occur.

To preparse syntax errors you can use find and php -l

$ find . -name *.php -exec php -l {} \;
No syntax errors detected in ./bootstrap.php
No syntax errors detected in ./htdocs/index.php
No syntax errors detected in ./templates/comment.php
No syntax errors detected in ./templates/postform.php
No syntax errors detected in ./templates/blog.php
No syntax errors detected in ./templates/main.php
No syntax errors detected in ./templates/error.php
No syntax errors detected in ./templates/commentform.php
No syntax errors detected in ./templates/post.php
No syntax errors detected in ./classes/rendering/View.php
No syntax errors detected in ./classes/storage/SqliteStorage.php
No syntax errors detected in ./classes/storage/Storage.php
No syntax errors detected in ./classes/models/Blog.php
No syntax errors detected in ./classes/models/Comment.php
No syntax errors detected in ./classes/models/Post.php
No syntax errors detected in ./classes/models/Model.php
No syntax errors detected in ./classes/helper/HTMLResult.php
No syntax errors detected in ./classes/helper/Result.php
No syntax errors detected in ./classes/helper/ApplicationConfig.php
No syntax errors detected in ./classes/helper/ErrorHandler.php
No syntax errors detected in ./classes/helper/Request.php
No syntax errors detected in ./classes/helper/ExceptionHandler.php
No syntax errors detected in ./classes/helper/JSONResult.php
No syntax errors detected in ./classes/app/Router.php
No syntax errors detected in ./classes/controller/BlogController.php
No syntax errors detected in ./classes/controller/Controller.php

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



Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)

2012-05-23 Thread ma...@behnke.biz


rene7705 rene7...@gmail.com hat am 23. Mai 2012 um 13:51 geschrieben:

 I think I'll leave it untouched for a few days
 (http://mediabeez.ws/stats/ and


404 on
http://mediabeez.ws/stats/code/libraries_rv/rajmvServiceLog-1.0.0/ajax_makeLogEntry.php?rajmvServiceLog_initialID=212.48.107.10__1337775183project_hd_root=/var/chroot/home/content/69/8082269/html/sites/mediabeez.ws/stats/

Seen in firebug. No log is loaded.

I know that you are not into optimizing bandwidth, but over 4 MB of image
data is a killer.

Could you seperate you log api code from jquery? Currently it is delivered
in one file. Makes it hard to read.

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



Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)

2012-05-23 Thread ma...@behnke.biz


rene7705 rene7...@gmail.com hat am 23. Mai 2012 um 14:46 geschrieben:

 you're right, and i'm putting it on the top of my todo list.

 i take it you were referring to project_hd_root, or anything else as
well?

Yes.


Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)

2012-05-23 Thread ma...@behnke.biz


rene7705 rene7...@gmail.com hat am 23. Mai 2012 um 14:55 geschrieben:

 And please explain what you mean by no log is loaded. No graph? No
 $hits under structure tab, no $errors under same tab?

As I wrote the mail to the list no tab had anything to display.
Now it's working. No idea what changed.

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



Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)

2012-05-22 Thread ma...@behnke.biz


rene7705 rene7...@gmail.com hat am 22. Mai 2012 um 15:23 geschrieben:

 Seems to be the writing of the html+json data to a file that's causing
 the delay on my dev server.

 Doing the totals calculation on my dev server for 3500 records takes
 about 2.5 seconds, with the old code.
 Will soon see how long it takes with the refactored code of today.

 Anyone got a clue about why a few ten thousand calls to fwrite() will
 slow down a wampserver so much?...

Maybe the hdd is not caching properly and is constantly writing and
re-arranging the data?
Is your hdd a bit to much fragmented?

Just 2 guesses.



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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] Re: How to send XML requests from PHP?

2012-05-09 Thread ma...@behnke.biz


Michelle Konzack linux4miche...@tamay-dogan.net hat am 8. Mai 2012 um
20:25 geschrieben:

 Hello Jim Lucas,

 Am 2012-05-08 11:08:13, hacktest Du folgendes herunter:
  Look into cURL http://php.net/curl

 I know curl but I do not know, HOW to send the XML stuff.

$ch  =  curl_init ();
curl_setopt ( $ch ,  CURLOPT_URL ,  http://www.example.com/; );


Look at http://de.php.net/manual/en/function.curl-setopt.php and set all
other options you need
- post method i guess
- post body with your xml
- 



curl_exec ( $ch );
curl_close ( $ch );


I you have build up you try and have some code, come back to the list and
tell us what didn't work and what you expect it to do. Then we can help
you. Do have a documentation how the request should look like? Headers to
be sent? Post/Get Parameters? Protocol?

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



Re: [PHP] I need a good access and error log..

2012-05-07 Thread ma...@behnke.biz


Lester Caine les...@lsces.co.uk hat am 7. Mai 2012 um 11:03 geschrieben:

 rene7705 wrote:
  But before I start coding, I thought it would be better to ask you all

 piwik ...
 http://piwik.org/
 A couple of my heavy google users are finding the results much more
informative,
 and we have started switch google analytics off on all the sites.

I can support this one too. I have been using for quite a few now. It
supports JS and NOSCRIPT.
And you can go from Track the visits up to campaign setups and so on.

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



Re: [PHP] Should I check imput for bad chars in this case?

2012-04-27 Thread ma...@behnke.biz


Simon Schick simonsimc...@googlemail.com hat am 27. April 2012 um 00:47
geschrieben:

 On Thu, Apr 26, 2012 at 3:59 PM, mirrys.net mirrys@gmail.com wrote:
  Thank you for your help Marco  Simon. No doubt, your code is much
  cleaner and better.
 
  One more question, without any filter or something could be my
  original code somehow compromised (mean some security bug)? Or rather
  was a major problem in the possibility of a script crash?
 

 Hi, Mirrys

 I personally can not see a security-hole at the first view ...
 Stuff in the global server-variable should only be set by the
 webserver and therefore it should be kind-of save (depending on the
 quality of the configuration of the webserver ;))

No, that is not correct. The Forwarded IP for example is generated by the
requesting Proxy Server and can therefor be manipulated.

But as far as your code simply writes this data into some textfile which is
never read inside you application or executed on your shell , there should
be no security reason.


 That was also the main reason why I would do a validation-check for this.
 Talking about a script-crash ... I don't know ... I just found this
 line in a comment for the function gethostbyaddress()

  If you use gethostbyaddr() with a bad IP address then it will send an
error message to the error log.

 Bye
 Simon
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] date() confustion

2012-04-26 Thread ma...@behnke.biz


Nathan Nobbe quickshif...@gmail.com hat am 26. April 2012 um 06:40
geschrieben:

 INSERT TIMESTAMP:  1335414561
 INSERT DATE TIME:  2012-04-26 4:29:21

 But then from the interactive interpreter on the same box (same php.ini
as
 well):

 php  echo date(Y-m-d G:i:s, 1335414561);
 2012-04-25 22:29:21

 I get this same output from another random computer of mine and I've
 verified date.timezone is consistent in both environments.


This definitly looks like a timezone offset!
Try the following code in your environments.

$date  = new  DateTime ( );
$tz  =  $date - getTimezone ();
echo  $tz - getName ();


PHP for CLI mode has a different php.ini than the one for apache2. Maybe
that is a problem?

Check also


php -i | grep date.timezone


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



Re: [PHP] Should I check imput for bad chars in this case?

2012-04-26 Thread ma...@behnke.biz


mirrys.net mirrys@gmail.com hat am 26. April 2012 um 14:15
geschrieben:

 Hi all,

 this is more question than real problem (I hope :)). I include this
 script into my pages to log IPs of visitors (they are saved info txt
 file and send to e-mail later):

You definitly should. There were some bugs (even in bigger applications
like Coppermine f.e.) that have been introduced by clients sending
manipulated ip oder hostname Strings.

For the IP address simply check if it is a valid IP4 or IP6 tupel. There
are checks for that.



 function getIPadress()
 {
 if (isset($_SERVER[HTTP_CLIENT_IP]))
 {
 return $_SERVER[HTTP_CLIENT_IP];
 }
 elseif (isset($_SERVER[HTTP_X_FORWARDED_FOR]))
 {
 return $_SERVER[HTTP_X_FORWARDED_FOR];
 }
 elseif (isset($_SERVER[HTTP_X_FORWARDED]))
 {
 return $_SERVER[HTTP_X_FORWARDED];
 }
 elseif (isset($_SERVER[HTTP_FORWARDED_FOR]))
 {
 return $_SERVER[HTTP_FORWARDED_FOR];
 }
 elseif (isset($_SERVER[HTTP_FORWARDED]))
 {
 return $_SERVER[HTTP_FORWARDED];
 }
 else
 {
 return $_SERVER[REMOTE_ADDR];
 }
 }

 // save log to txt
 $fh = fopen($fileWithLog, 'a+') or die(Oups  . $fileWithLog . !);
 $IPAdress = getIPadress();
 fwrite($fh, date('j.n.Y G:i:s') . $IPAdress .  ( .
 gethostbyaddr($IPAdress) . )\n);
 fclose($fh);

 ...can this be some possible security risk (XSS or so..), becose I
 does not check chars in IP adress and host name mainly. It is probably
 crazy, but on the other side I think it isn't imposibble to use some
 bad strings in host name.

 Would you recommend use $IPAdress = htmlspecialchars(getIPadress());
 or something like? Or is it nonsense?

 Thx and excuse me, if this question is too stupid :(. Br, Mir R.

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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] What is wrong here?

2012-04-25 Thread ma...@behnke.biz


Karl-Arne Gjersøyen karlar...@gmail.com hat am 25. April 2012 um 06:45
geschrieben:

 Hello again.
 I can't figure out what is wrong here.

 move_uploaded_file() get error message from die() and can't copy/move
 temp_file into directory bilder

 I have try to chmod 0777 bilder/ but it did not help.
 Also I have try to chown www-data.www-data bilder/ since Ubuntu Server
 run apache as www-data user...

 Here is my souce code
 --
 // Temfil lagres midlertidig på serveren som
 // spesifisert i php.ini
 $tmp_fil = $_FILES['filbane']['temp_name'];

tmp_name not temp_name

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



Re: [PHP] session lost problem

2012-04-24 Thread ma...@behnke.biz


bug zhu bugw...@gmail.com hat am 24. April 2012 um 08:28 geschrieben:

 thank you for your explanation,
 when i write to $_SESSION after session_commit(),$_SESSION is just a
 regular array

Yes. Actually session_commit does not terminate the session as mentioned
earlier but is closes it for writing. You cann still read session values.

The benefit of using session_commit is that the server saved associated
session file is no longer locked, so that parallel requests can both access
the values.

The approach ist as follows:
Call session_commit() as early in you code (after session_open) as possible
to avoid locking. So first do all the writing to the $_SESSION array, then
do write close (or commit). After that you can still read all session
relevant information.

If you want to write afterwards to your $_SESSIOn array you simply have to
call session_start to re-open the write context. Afterwards you can commit
it again to remove the lock.

But be careful! session_start and session_commit perform write operations
on your harddisk or whatever storage you use. Many calls to start and
commit will result in losing performance.

Regards,
Marco

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



Re: [PHP] tempnam() not working as expected...

2012-04-19 Thread ma...@behnke.biz


tamouse mailing lists tamouse.li...@gmail.com hat am 19. April 2012 um
07:10 geschrieben:

 On Mon, Apr 16, 2012 at 3:09 AM, ma...@behnke.biz ma...@behnke.biz
wrote:
  mkdir($d,777,true);/* make the directory */
  Try using mkdir($d, 0777, true);

 Herein, my friends, lies the problem. Silly me, using a DECIMAL number
 (777) instead of an OCTAL number (0777).

:-) well ... you could have written 511 which is 0777 in octal :D
The other way around 777 decimal is 1411 octal. No idea what kinda chmod
mode that is ;-)



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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] tempnam() not working as expected...

2012-04-16 Thread ma...@behnke.biz


tamouse mailing lists tamouse.li...@gmail.com hat am 14. April 2012 um
00:05 geschrieben:

 Can someone explain the following to me:


 ?php
 $d=tempnam(.,dir); /* create a temp named file *

 unlink($d); /* unlink it because we're going to
make it a directory */
 mkdir($d,777,true);/* make the directory */
 echo $d is . (is_dir($d)?'':'NOT'). a directory\n;


 $f=tempnam($d,file);/* using the first directory,
create a new
 temp named file */
 unlink($f);/* unlink it as we're going to make it
a directory */
 mkdir($f,777,true);/* make the directory */
 echo $f is . (is_dir($f)?'':'NOT'). a directory\n;
 ?

 /Users/tamara/Sites/gallery/lib/common/t/dirGuWOLW is  a directory
 /private/var/folders/pI/pIx-p0mhH5eEQ64yAiDQmE+++TI/-Tmp-/fileC7Rnzg
 is  a directory

Could you do an ls -la for both files and send the output?
Try using mkdir($d, 0777, true);



 Why isn't the second tempnam using the directory path I pass to it?

 The strange thing I notice is that if I pass in a directory path to
 tempnam that was NOT created initially by tempnam, it works:

 miishka:t tamara$ mkdir a
 miishka:t tamara$ php -r 'echo
 tempnam(/Users/tamara/Sites/gallery/lib/common/t/a,file).PHP_EOL;'
 /Users/tamara/Sites/gallery/lib/common/t/a/filepSwRzF
 miishka:t tamara$

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

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] PHP: a fractal of bad design

2012-04-12 Thread ma...@behnke.biz

Daevid Vincent dae...@daevid.com hat am 12. April 2012 um 02:06
geschrieben:

 http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
 
 Can't say he doesn't have some good points, but he sure goes about it in
a
 dickish way.

Well, he only says what everybody knows. So there is no new thing in it.
And I don't understand why people use tools that they hate.

I do not dislike PHP because of its disadvantages, I like it because of its
advantages,


Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] request for feedback on logAndHandler

2012-03-30 Thread ma...@behnke.biz


rene7705 rene7...@gmail.com hat am 30. März 2012 um 11:29 geschrieben:

 I thought now would be a good time to get some early feedback on what
else
 I can improve for this component, at least from an end-user perspective
(I
 haven't yet updated the download zip on http://mediabeez.ws with these
 latest changes).


First of all this is only my opinion but you should not mistaken this
maillist for a review my extension list. This a discussion group about
PHP. I think there are proper places on the internet for that.

Most people reading this list will have no interest in reading a discussion
about stuff they are not interested in it.

I suggest you set up a github project, groogle group or whatever wiki/forum
you like where people interested in it can post and discuss.

Then you can send a mail to this list where you announce your discussion
group. So there is no dicussion on this list and you can promote your work
to be discussed.

Just my 2 cents on that.

Regards,
Marco

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



Re: [PHP] Re: updating code asap to multiple domains, windows to unix, with source control software (was: Re: [PHP] including PHP code from another server..)

2012-03-27 Thread ma...@behnke.biz


rene7705 rene7...@gmail.com hat am 27. März 2012 um 12:16 geschrieben:

 On Tue, Mar 27, 2012 at 12:08 PM, rene7705 rene7...@gmail.com wrote:
  I've done a search for rsync windows, and I get some rsync apps
  allright, but it's not clear to me yet how I would use these windows
rsync
  clones to get done what I want.
 

 oh, one more thing; I just found that I won't always be working on the
 windows dev server's ...\htdocs\code, sometimes i'll find myself working
on
 the /code copy in one of the /sites/[domainname]/code on the windows 7
dev
 system. how would I use a modern source control system to distribute the
 code from one of the subdomains to all other locations?

Well, I guess google on rsync man page or read the documentation of these
tools OR write to a mailing list that focusses on the use of linux tools.
Then go and read about cron jobs or git/svn/putyoutoolhere
post-receive/post-commit hooks or anything like that.


Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



RE: [PHP] Re: Got HTML5 History API + caching LICKED, I think, grin

2012-03-23 Thread ma...@behnke.biz
 concerning your background image:
If I resize my window after loading finished, your images gets distorted
(the one with the bee)

I also think - this is not verified yet - that an animated gif with
interlacing is smaller than your logo png spritemap



Why is this frame loaded

http://mediabeez.ws/code/libraries_rv/animatedJavascriptWidgets-1.0.0/themes/dialogs/dialog_002/frame_normal_000.png

also it is not used in the page you see after loading?



The loading times for these

http://mediabeez.ws/code/libraries_rv/animatedJavascriptWidgets-1.0.0/get_animatedJavascriptWidgets_javascript.php
http://mediabeez.ws/code/libraries_rv/ultiCache-0.1.0/get_ultiCache_javascript.php?gotAnimatedJavascript=true

are greater than one second which is slow. These are cached objects and
should load much faster the second time you call the page

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



Re: [PHP] SimpleXML and the Single String (SOLVED)

2012-02-22 Thread ma...@behnke.biz
 There is another nice way.
You can pass a second value to the simple xml constructor which is a class
name to be used instead of SimpleXMLElement.
You can write your own class that extends SimpleXMLElement and override the
magic methods to skip the casting


Simon Schick simonsimc...@googlemail.com hat am 22. Februar 2012 um 00:16
geschrieben:

 Hi, Jay

 If you're not using the variable *$xmlCompany* somewhere else I'd try to
 skip the array and just do it with this single line:
 *$arrayLead[0]-Company = (string)
 $xml-SignonRq-SignonTransport-CustId-SPName;*

 The result should not differ from what you have now.

 Bye
 Simon

 2012/2/21 Jay Blanchard jay.blanch...@sigmaphinothing.org

  Howdy,
 
  My PHP chops are a little rough around the edges so I know that I am
  missing something. I am working with SimpleXML to retrieve values from
an
  XML file like this -
 
  $xmlCompany = $xml-SignonRq-SignonTransport-CustId-SPName;
 
  If I echo $xmlCompany I get the proper information.
 
  If I use $xmlCompany as an array value though, I get this object -
 
  $arrayLead[0]-Company = $xmlCompany; // what I did
  [Company] = SimpleXMLElement Object // what I got
 (
 [0] = Dadgummit
 )
  I tried casting AND THEN AS I TYPED THIS I figured it out...
 
  $xmlCompany = array((string)
  $xml-SignonRq-SignonTransport-CustId-SPName); // becomes an array
  $arrayLead[0]-Company = $xmlCompany[0]; // gets the right bit of the
array
 
  and the result is
 
   [Company] = Dadgummit
  Thanks for bearing with me!
 
 
 
 
 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] how to execute Exe file in system

2012-02-17 Thread ma...@behnke.biz


Negin Nickparsa nickpa...@gmail.com hat am 17. Februar 2012 um 12:26
geschrieben:

 if(system('gams.exe trnsport_php.gms'))
 echo 'Not Error';
 else echo'Error';

 it shows me Error

system() Returns the last line of the command output on success, and FALSE
on failure.

So, lets assume your gams program does not fail but prints nothing, the
output is empty.
By simply checking

if (system(...))

you will get echo 'Error'; even if everything is fine, but nothing is
print. Try checking on FALSE

if (($out = system(...)) !== FALSE)
{
  print('Not error');
  printf('Output is %s', $out);
}
else
{
  print('Error');
}


Besides: I would prefer setting the complete path to your exe-file.

if (system('C:\\PATH\\TO\\MY\\gams.exe trnsport_php.gms'))

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



Re: [PHP] syntax question

2012-02-07 Thread ma...@behnke.biz


ad...@buskirkgraphics.com hat am 7. Februar 2012 um 15:11 geschrieben:

 I have been struggling with this issue for an hour and honestly I am not
 sure why.

 I consider myself to be pretty savvy with MySQL but I am running into an
 syntax error that is just flat out eluding me.

 

 $query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
 `table2`.`user_id`=`table1`.`seller_id` AND
IF(`table2`.`name`='juice','No
 Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;

 This query works!!

 

 But If I try to add a GROUP BY to the query, complete failure.

 $query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
 `table2`.`user_id`=`table1`.`seller_id` AND
IF(`table2`.`name`='juice','No
 Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY `table1`.`ID`
 LIMIT 1;


This is a nice query but I am not sure if I understand what you want to do?
Maybe we could start with your error message and a table structure :-) That
would be handy.

You wanna get all users that have at least on sell? But only once?

Maybe something like that?

SELECT table2.name
FROM
  table2,
  (SELECT seller_id FROM table1 GROUP BY seller_id) as table1
WHERE
  table2.user_id = table1.seller_id
  AND IF(table2.name = 'juice','No Juice for YOU', table2.name =
table2.name)
;




Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] if http_referer is not reliable then how do we ...

2012-01-17 Thread ma...@behnke.biz


Haluk Karamete halukkaram...@gmail.com hat am 17. Januar 2012 um 04:51
geschrieben:

 Let' say we have a form mailer script, which takes any form ( whose
 action is directed to it ) and goes thru the submitting form's fields
 list ( programmatically) , to build a nice email on the fly and email
 the build up string to the email address that's coming in the hidden
 field. Let's say that's the case...

 And you do not want everyone to use this form mailier functionality.
 What's the best way to protect it?
 
Summed up there is no 100% secured way of building such a workflow.
As you said, everyone can modify the referer.
 
Captchas can hold back robots, but no real person who misuses your form.
 
You should not write the recipients email address in a hidden form, but instead
read it from a config file. This way you can make sure, that no one alters it.
Although this won't stop anyone from using the mailform.
 
You can implement session/cookie/ua/ipbased lockings to prevent mass mailing.
 
You can use a hidden token generated by your system, passed as hidden value to
the form, which is checked upon submit. That way you can make sure, that no
double submitting is allowed.
 
But as I stated earlier, there is no 100% protection.
 
 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] reporting errors when $ sign is missing in front of a variable

2012-01-11 Thread ma...@behnke.biz
 
Haluk Karamete halukkaram...@gmail.com hat am 12. Januar 2012 um 06:17
geschrieben:

 Thanks...
 Well I just changed the ?php error_reporting (E_ALL ^ E_NOTICE); ?
  to ?php error_reporting (E_ALL ); ?  and that does it for me.

 Notice: Use of undefined constant my_age - assumed 'my_age' in
 D:\Hosting\5291100\html\blueprint\bp_library.php on line 40
 my_age

 Now back in business :)
 
If you are programming with an IDE, it does the work for you. While programming
you will see warning notices, that you are refering to something unknown.
 

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