Re: [PHP] Enterprise

2008-05-20 Thread Zoltán Németh

Ray Hauge írta:
I just read an interesting article about enterprise software.  One of 
the most common arguments against PHP tends to be "It's not enterprise 
ready."  This article talks more about ruby, but it could be about any 
"non-enterprise" language as well.


http://lists.canonical.org/pipermail/kragen-tol/2005-April/000772.html

I recently got a new job at a hospital, and the "enterprise software" 
they have is no where near as high quality as it could/should be.  This 
is my first job at a somewhat large organization (500+ employees) so I 
was kind of shocked at the state of their software.  Typically 
healthcare systems are further behind in the technology adoption, but 
having to deal with workarounds all day long sure gets old.




hmm I read the article, and it seems to hit the nail on the head. I am 
currently leaving the company I work for because these symptoms. our 
project, which is large and well-designed, but not 'enterprise' in this 
way, is now transformed into something I do not want to participate in 
anymore. the company employed some uncompetent but highly paid 
consultants who sell the software although it is not nearly finished, 
they interfere with the development, and so on... so one by one the 
original developers quit, and the software becomes enterprise, developed 
by incompetent and cheap new developers :(


although it is completely written in PHP, with the Symfony framework, so 
it is a proof that PHP is enterprise-ready, whether it is good or not


greets,
Zoltán Németh

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



Re: [PHP] 0T - Request for quick test

2008-05-20 Thread Zoltán Németh
>
>
>  Hey guys,
>
> Just make a egreeting app and need people to just test the AJAXy upload
> that i have on the form, if you have any problems please tell me.. if it
> goes smooth please tell me... as usual, any comments and suggestions too
> would be appreciated.
>
> This is the form:
> http://www.ezee.se/ezee-ecard-egreetings/step2_v2.php
>
>
> All i want you to do is click the above link, click the file/browse button
> and try to upload a .jpg/jpeg image...

works here on firefox 3 beta 5 / ubuntu

greets,
Zoltán Németh

>
>
>
> Thanks in advance!
> Ryan
> P.S section is not yet open & am still testing stuff so dont try to create
> any egreetings right now :)
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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



Re: [PHP] Function not in the documentation

2008-05-20 Thread Zoltán Németh
> I ran across a PHP function, strip_illegal_chars(), but can't seem to
> find anything about it in the documentation.  Does anyone know
> precisely what it does?  Or where I can find actual documentation for
> that function?

it is not in the PHP source:
http://lxr.php.net/search?string=strip_illegal_chars

so it is not a php builtin function. also Google returns 0 results for
'strip_illegal_chars php' so it must be defined somewhere in the code you
found it

greets,
Zoltán Németh

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



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



Re: [PHP] Improving development process / help with developer setup

2008-05-19 Thread Zoltán Németh
> Hi Zoltan,
>
> If the windows would be used just for IE I think it's cheaper to have one
> windows machine (server 2003/2008), have the users connect via terminal
> service (rdesktop).  I think it's easier than having to install/maintain
> than multiple windows installations, even if it is a virtual machine.

one server is cheaper than multiple vmware windozes, but multiple wine
instances with IE are free. ;)

greets,
Zoltán Németh

>
>
>>
>> why not switch everything to linux and run IE in wine or vmware on the
>> developer's machine? that way you don't have to maintain windows
>> machines
>> at all
>>
>> greets,
>> Zoltán Németh
>>
>>
>



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



Re: [PHP] Improving development process / help with developer setup

2008-05-19 Thread Zoltán Németh
> Hi,
> Thanks for all answers.   Please let me add that I do use CVS (migrating
> to
>  SVN) and the reason to use samba is that doing this allows the developer
> machine (windows) to access the shares hosted in a linux server so when
> he/she tests it will be run in the 'same' environment that the staging and
> production servers and because in order to assure browser compatibility
> they
> have to test from firefox/IE.
>
> So, in order to allow phpunit to be ran, have the firefox/IE support and
> use
> xdebug I have two basic options:
> a) stay with windows, install XAMPP (or any other all-in-one).  And live
> with the fact that some things will have to be taken care of (such as
> PATH differences between unix/windows)
> b) switch to linux with the development stack, enable a windows server to
> be
> connected from rdesktop so they can test the IE
>
> In both cases I'll have extra work in order to maintain the developer's
> machine somewhat synchronized with the production server.
>
> Am I missing a third/fourth (better) etc option?

why not switch everything to linux and run IE in wine or vmware on the
developer's machine? that way you don't have to maintain windows machines
at all

greets,
Zoltán Németh

>
> thanks.
>
> On Sat, May 10, 2008 at 8:44 PM, Gabriel Sosa <[EMAIL PROTECTED]>
> wrote:
>
>> I suggest you if you are running live on linux, then developing on
>> linux, could be the same dist or not..
>> but definitely don't mix OS, because the extensions could fail, etc.
>> one big issue it's the case insensitive in windows.
>>
>> definitely some version control system such as SVN or GIT
>>
>> you can use Hudson for continuous integration
>>
>> and selenium for automatics QA test over browsers
>>
>> again, try to don't mix OS.
>>
>> saludos
>>
>> gabriel
>>
>> On Sat, May 10, 2008 at 1:44 PM, David Otton <[EMAIL PROTECTED]> wrote:
>> > 2008/5/10 robert mena <[EMAIL PROTECTED]>:
>> >
>> >> I am looking for tips regarding improving the development process.
>> I'll
>> >> explain my current setup and please feel free to comment.
>> >>
>> >> My developers all use windows + eclipse PDT, the workspace is hosted
>> (via
>> >> samba) in a Linux server with Apache/PHP/MySQL.   I am in the process
>> of
>> >> adopting Unit testing (PHPUnit2) and debug (Xdebug) so I have
>> concerns
>> about
>> >> how to property use this.
>> >>
>> >> For example, in my current setup I'd have to enable SSH so they could
>> run
>> >> the tests from the command line in the development server, but I am
>> not
>> sure
>> >> if I could remotely use Xdebug.
>> >
>> > Your description (specifically, Samba) suggests that you're not using
>> > source control. If you want to go for TDD (I don't know that you do,
>> > but IMO it's a good direction to move in) I would suggest a
>> > three-server setup - dev, staging and live.
>> >
>> > The dev server(s) are where you work. One per developer. Once you're
>> > happy with your code and your tests, you commit your changes to source
>> > control. This is where it gets clever. You can use pre- and
>> > post-commit hooks to run an automated build process that pushes the
>> > changes to a staging server, automatically runs the unit tests, and
>> > accepts/rejects the commits based on the test results. You can even
>> > lint the code, and reject anything that isn't in the house style.
>> >
>> > With larger projects, where an entire publish-and-test on each commit
>> > becomes impractical, you can just run the build process and unit tests
>> > every n hours, and mail out the results.
>> >
>> > Publishing to the live server is simply a matter of running the build
>> > scripts with a different destination.
>> >
>> > On top of all that, run an issue tracker. /Everything/ goes in the
>> > issue tracker, bugs, features, whatever. When you make a commit, that
>> > commit should be closing an issue in the issue tracker (via commit
>> > hooks again). That way you can track each change that's been made back
>> > to its reason.
>> >
>> > All of this is opinion, of course, there's no Right Way. Just take
>> > what's useful to you.
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>>
>>
>> --
>> Los sabios buscan la sabiduría; los necios creen haberla encontrado.
>> Gabriel Sosa
>>
>



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



RE: [PHP] Get array as string --Help

2008-05-09 Thread Zoltán Németh
> Yet another option is use serialize(array())

or you could use var_export if you need php code
http://php.net/var_export

greets,
Zoltán Németh

>
> Chetan Dattaram Rane
> Software Engineer
>
>
>
> -Original Message-
> From: Shelley [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 09, 2008 3:11 PM
> To: PHP General list
> Subject: [PHP] Get array as string --Help
>
> Hi all,
>
> If I have an array like this:
> $arr = array (
> 'c' => 'd',
> 'e' => 'f');
>
> How can I convert this array into a string? I want to write an array into
> a
> file.
>
> Thanks in advance.
>
> --
> Regards,
> Shelley
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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



Re: [PHP] using explode

2008-05-05 Thread Zoltán Németh

Jason Pruim írta:

Hi everyone,

I am wondering if I can write this cleaner?
$weightExplode = explode(".", $totalWeight);
$explodetest = ".";
$explodetest .= $weightExplode[1];
$explodetest = $explodetest*16;


I'm hoping I've missed something... Basically I just need to include the 
"." in $weightExplode[1] before I multiply it by 16. That's the only 
part that is confusing me right now...


Any ideas?


I can't write it cleaner, though I can write it shorter:

$weightExplode = explode('.', $totalWeight);
$explodetest = ((float)('.' . $weightExplode[1])) * 16;

(the (float) casting is maybe not required, but I think it's good practice)

greets,
Zoltán Németh



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]







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



Re: [PHP] where to put a function

2008-04-15 Thread Zoltán Németh

Rick Pasotto írta:

Probably been answered a thousand times; if so, just tell me where to
look.

I have a function that includes a specific sql query that is used on
only one page on the site. Should that function be coded (1) in the page
itself, (2) in a separate file that only that page includes, or (3) in a
master file that contains all the functions used on the site and is
included on every page?

I've been doing #1 (not actually a function in this case) but #3 is
appealing, especially since I would implement it as OOP and the page
itself would be really just a template. What is the cost of parsing a
bunch of functions that are not used on a given page load?




Q: where to put a function?
A: into the class where it belongs.

sorry I could not stand it ;)

to be more serious, one giant 'functions.php' include file is not a very 
good solution, because you might end up including dozens of unused 
functions in every page.


on the other hand, putting it into the page doesn't let you use it 
anywhere else.


so the solution should be somewhat like the oop class organization: put 
together those that are logically belonging together. this way you'll 
have libraries for each type of functions, and only include what you need


greets,
Zoltán Németh


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



Re: [PHP] Quarters

2008-04-15 Thread Zoltán Németh

tedd írta:

Hi gang:

Check out my new game:

http://webbytedd.com/quarters/

What do you think?


that's cool, the only problem is that I lost ten times out of ten ;)

maybe on the weekend I give it a deeper analysis and so I can figure out 
the winning strategy - because there must be one, which is used by the 
program


greets,
Zoltán Németh



Cheers,

tedd

PS: I originally wrote the game for the Mac over eight years ago.



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



Re: [PHP] require_once dying silently

2008-04-09 Thread Zoltán Németh

Greg Bowser írta:

the above won't work, as the parser will try to interpret $CFG and

put it in the string first,

In that case, $CFG is either null, or it is indeed an object. If it is
a standard object, which I it appears to be, then a fatal error will
be thrown because there is no __tostring() function.  If it's null,
then require_once is referencing a directory beginning with '->',
again, there *should* be an error. Anyway..

I've seen $obj->property used many times in double quotes, and never
had a problem with that working. Personally though, I always use the
curly braces though because it highlights better in VIM :p


I stand corrected, I just tried putting an object property into double 
quotes and it works


greets,
Zoltán Németh




Also, OOP is nice and all (not to start a thread about OOP again),

but putting your config into an object seems a bit overdo to me.

Me too!! (not to continue the unstarted OOP discussion) It's a
practice I've seen used more than once.  I think people find that
syntax attractive.




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



Re: [PHP] New Ajax search component

2008-04-09 Thread Zoltán Németh

Eric Butera írta:

On Wed, Apr 9, 2008 at 8:07 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:

On Wed, Apr 9, 2008 at 7:50 AM, Eric Butera <[EMAIL PROTECTED]> wrote:



On Wed, Apr 9, 2008 at 2:34 AM, Jeremy O'Connor

<[EMAIL PROTECTED]> wrote:


 OK, but my control only does the Ajax call when the user clicks the Go
 button, whereas the scriptaculous library does an Ajax call everytime

the

 user presses a key.

Any library should be flexible enough to register event listeners on
whatever trigger needed.  The event itself isn't as important as how
things are handled.

I use YUI because it lets me focus on my work instead of browser
quirks.  It is a little heavier but that is okay because they have a
team dedicated to testing all the A grade browsers so I don't have to.

any js lib worth mentioning these days fits that description and prototype /
scriptaculous is no exception.  i wish it were modular, so i didnt have to
send the whole damn library out to the browser on every request, when i
might just need a few classes.  whats more, although scriptaculous does
provide some ui components and controls out-of-the-box, they dont appear to
have nearly the gamut of extJs..
 one of the things thats great about prototype is that they sort of map
javascripts oo model to something of the paradigm that php has; primarily
inheritance.  i believe extJs errs more on the 'you need to understand js'
side of things.

-nathan




I figured as much.

The YUI stuff is all very split up into defined modules such as DOM,
Event, Connection, etc.  Of course they all seem to depend on each
other, so I end up sending like 8 files over the wire.  I create a
single file to stitch them together though, gzip it, and send it with
a far future expire header.  So in the end it really isn't the worst
thing.

I used prototype before but I was upset with my requests getting out
of order when I was doing stuff.  Then there is lots of talk about how
it doesn't play nice with other scripts.  The YUI stuff is all
namespaced out.  I also had compatibility issues with prototype using
opera.  But that was years ago and I'm sure everything is fine now,
but I've already left. ;)



I use prototype together with some parts of YUI, some parts of ExtJS, 
TinyMCE, and a bunch of my own scripts, and there is no interference 
between them. And it all seems to work on the latest opera.


greets,
Zoltán Németh

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



Re: [PHP] require_once dying silently

2008-04-09 Thread Zoltán Németh

Aschwin Wesselius írta:

Richard S. Crawford wrote:

Hi, everyone.

This one's been driving me bonkers for an hour now.  Anyone have any idea
why require_once would be dying silently in the script below?



$CFG->dirroot   = "/home/rcrawford/public_html/tanktrunk/tanktrunk";
$CFG->dataroot  = $CFG->dirroot.'/moodledata';

require_once("$CFG->dirroot/lib/setup.php");
  


Hi,

It reads as if $CFG is an object and ->dirroot is not a public property 
of that object. So, I don't know what $CFG is, but I think the problem 
lays there.


if that property is not public but protected or private it would throw a 
fatal error.




Also, OOP is nice and all (not to start a thread about OOP again), but 
putting your config into an object seems a bit overdo to me.




I think you know I don't agree with that, but I too don't want to start 
this over ;)


greets,
Zoltán Németh

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



Re: [PHP] require_once dying silently

2008-04-08 Thread Zoltán Németh

Richard S. Crawford írta:

Hi, everyone.

This one's been driving me bonkers for an hour now.  Anyone have any idea
why require_once would be dying silently in the script below?



$CFG->dirroot   = "/home/rcrawford/public_html/tanktrunk/tanktrunk";
$CFG->dataroot  = $CFG->dirroot.'/moodledata';

require_once("$CFG->dirroot/lib/setup.php");


the above won't work, as the parser will try to interpret $CFG and put 
it in the string first, then go ahead.

try this:
require_once($CFG->dirroot."/lib/setup.php");
or this:
require_once("{$CFG->dirroot}/lib/setup.php");

greets,
Zoltán Németh




I've confirmed that the file setup.php exists and is readable.  I've got
error_reporting in php.ini set to E_ALL.  I'm running Apache 2 and PHP5 on
Kubuntu 7.10.  Nothing shows up in my apache error log, and PHP itself
produces absolutely no output, even though it will produce output galore
when I put in a deliberate syntax error.

I've also tried:


require_once($CFG->dirroot."/lib/setup.php");


but this didn't help.

Any assistance at all would be greatly appreciated.




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



Re: [PHP] Recommended PHP Editors?

2008-04-08 Thread Zoltán Németh

Jason Pruim írta:


On Apr 8, 2008, at 1:48 PM, Zoltán Németh wrote:

Jason Pruim írta:

On Apr 8, 2008, at 11:02 AM, Andrew Ballard wrote:
On Tue, Apr 8, 2008 at 10:56 AM, Jochem Maas <[EMAIL PROTECTED]> 
wrote:

Robert Cummings schreef:


On Tue, 2008-04-08 at 07:21 +0200, Nitsan Bin-Nun wrote:


Hi,
I'm working with serveral PHP editors, each has it own restrictions.
So umm, What editors do you recommend and what special functions and
dis/adventages they have (maybe im overkilling my own back).



This comes up almost once a week. Read the archives.



indeed, although the proper answer never comes up. the proper 
answer is

ofcourse 'me' - as in I'm a highly recommended php editor - I have
integrated
code generation and refactoring functionality that is lightyears 
ahead of

any IDE

:-P


Perhaps, but I'm sure I can't afford the license -- especially the
multi-user version! :-)
If you're going to license a multi-user version... I'd look into the 
AI interface one of the list members was working on earlier... 
Although I can't find the e-mail right now about it :)


you mean Richard Lynch's AI, but I think that must be still in some 
beta stage, as we see Lynch only once in a while come and post a 
couple dozen messages ;)


That would be him! He might be trying to run it on a windows platform, 
which I've heard is tricky... Intelligence and Microsoft just don't seem 
to go together right ;)


well, I doubt he would ever touch anything M$... ;)



Also, you might want to double check if you're hitting reply or 
reply-all :P


good point, I already checked it :)

greets,
Zoltán Németh




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]







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



[Fwd: Re: [PHP] Recommended PHP Editors?]

2008-04-08 Thread Zoltán Németh

sorry, forgot to include the list

Jason Pruim írta:


On Apr 8, 2008, at 11:02 AM, Andrew Ballard wrote:
On Tue, Apr 8, 2008 at 10:56 AM, Jochem Maas <[EMAIL PROTECTED]> 
wrote:

Robert Cummings schreef:


On Tue, 2008-04-08 at 07:21 +0200, Nitsan Bin-Nun wrote:


Hi,
I'm working with serveral PHP editors, each has it own restrictions.
So umm, What editors do you recommend and what special functions and
dis/adventages they have (maybe im overkilling my own back).



This comes up almost once a week. Read the archives.



indeed, although the proper answer never comes up. the proper answer is
ofcourse 'me' - as in I'm a highly recommended php editor - I have
integrated
code generation and refactoring functionality that is lightyears 
ahead of

any IDE

:-P


Perhaps, but I'm sure I can't afford the license -- especially the
multi-user version! :-)


If you're going to license a multi-user version... I'd look into the AI 
interface one of the list members was working on earlier... Although I 
can't find the e-mail right now about it :)


you mean Richard Lynch's AI, but I think that must be still in some beta
stage, as we see Lynch only once in a while come and post a couple dozen
messages ;)

greets,
Zoltán Németh







Andrew

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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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






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



Re: [PHP] Posting Summary for Week Ending 4 April, 2008: php-general@lists.php.net

2008-04-06 Thread Zoltán Németh

Daniel Brown írta:

On Sun, Apr 6, 2008 at 11:27 AM, Zoltán Németh <[EMAIL PROTECTED]> wrote:

 maybe the problem didn't appear before, or I just didn't notice it...


It was the first time I'd noticed it myself, so it's possible that
it's the first time it happened.  I really only noticed it because I
was specifically looking for your post count, since you hit the "top
5" the week prior, as you pointed out.  ;-P  When I was scanning the
list of the rest, your name popped out again --- easily, as well,
because Gmail doesn't appropriately handle non-US characters in the
message each week.  At least not my account.



anyway, thanks for fixing it :)

greets,
Zoltán Németh

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



Re: [PHP] Posting Summary for Week Ending 4 April, 2008: php-general@lists.php.net

2008-04-06 Thread Zoltán Németh

Daniel Brown írta:

On Sun, Apr 6, 2008 at 7:31 AM, Zoltán Németh <[EMAIL PROTECTED]> wrote:

PostTrack [Dan Brown] írta:
 >   10 (3.4%)  33529   (8.5%)      Zoltán Németh 
 >   1  (0.3%)  2502(0.6%)  Zoltán Németh 


 what's the difference? they should be added up, no?


Yes.  Next week's report (and from there-on) should resolve that
once and for all.

By the way, I don't remember seeing you report that issue before.
Just the character problems.



maybe the problem didn't appear before, or I just didn't notice it...

greets,
Zoltán Németh

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



Re: [PHP] PostTrack Updates

2008-04-06 Thread Zoltán Németh

Jason Pruim írta:


On Apr 5, 2008, at 1:48 AM, Robert Cummings wrote:



On Fri, 2008-04-04 at 22:39 -0700, Jim Lucas wrote:

Robert Cummings wrote:
wrote:\n" ?>

 Some changes take effect with the PostTrack metrics\n" ?>
 system with this week (will show up in next week's\n" ?>
 report). There's one bug fix and a new feature added,
\n" ?>
 in which some of you may be really interested.\n" ?>
\n" ?>
 CHANGELOG\n" ?>

 Fixed a bug that would (seemingly random)\n" ?>
 split a user's post recording over multiple 
entries.\n" ?>

 (See this week's report: Zoltan Nemeth for example)\n" ?>
 Added a new CodeCount feature.  Explained\n" ?>
 below.\n" ?>
\n" ?>
 The CodeCount feature will, from now on, track\n" ?>
 the amount of [pseudo]code everyone posts to the\n" ?>
 list. However, for a variety of reasons (including\n" ?>
 enforcing Good Coding Practices[tm], there will be\n" ?>
 some rules:\n" ?>
\n" ?>
 * short_open_tags code will not be counted.\n" ?>
   It must begin with 
things won't count.\n" ?>
 * All code must be properly closed as well as
\n" ?>
   opened. Thus, .\n" ?>
 * You can include multiple blocks of code,\n" ?>
   and all will be tallied. So:\n" ?>
 
 // Block one\n" ?>
 ?>\n" ?>
  and \n" ?>
 
 // Block two\n" ?>
 ?>\n" ?>
  will both be counted.\n" ?>
\n" ?>
 Some notes that should be obvious:\n" ?>
 * HTML won't be counted unless included in an
\n" ?>
   echo/print construct or a HEREDOC/NOWDOC\n" ?>
   (when used). Only the code between the\n" ?>
tags will be counted.\n" ?>
 * The CodeCount procedure *does* count\n" ?>
   comments as code. This can be changed if\n" ?>
   there's enough desire.\n" ?>
 * CodeCount *will not* differentiate 
between\n" ?>
   \"Good\" and \"Bad\" code. If you forget 
a\n" ?>

   semicolon, it'll still count.\n" ?>
\n" ?>
 --\n" ?>
 \n" ?>
 Ask me about:\n" ?>
 Dedicated servers starting @ \$59.99/mo., VPS\n" ?>
 starting @ \$19.99/mo., and shared hosting starting @
\n" ?>
 \$2.50/mo. Unmanaged, managed, and fully-managed!\n" ?>

I don't know about anyone else, but I am absolutely stoked about this
development!

Cheers,
Rob.


wait you forgot the semi-colon...  ah, that's right, he said grammar
mistakes were not counted...


Perfectly valid to omit the last semi-colon when closing a PHP block.



with!';?>








greets,
Zoltán Németh





:)


;)

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


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





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





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



Re: [PHP] PostTrack Updates

2008-04-06 Thread Zoltán Németh

Daniel Brown írta:

Some changes take effect with the PostTrack metrics system with
this week (will show up in next week's report).  There's one bug fix
and a new feature added, in which some of you may be really
interested.

CHANGELOG
Fixed a bug that would (seemingly random) split a user's post
recording over multiple entries. (See this week's report: Zoltan
Nemeth for example)


oh I see. ignore my previous error report ;)


Added a new CodeCount feature.  Explained below.

The CodeCount feature will, from now on, track the amount of
[pseudo]code everyone posts to the list.  However, for a variety of
reasons (including enforcing Good Coding Practices[tm], there will be
some rules:

* short_open_tags code will not be counted.  It must begin
with  things won't count.
* All code must be properly closed as well as opened.  Thus,
.
* You can include multiple blocks of code, and all will be tallied.  So:

 and 

 will both be counted.

Some notes that should be obvious:
* HTML won't be counted unless included in an echo/print
construct or a HEREDOC/NOWDOC (when used).  Only the code between the
 tags will be counted.
* The CodeCount procedure *does* count comments as code.  This
can be changed if there's enough desire.
* CodeCount *will not* differentiate between "Good" and "Bad"
code.  If you forget a semicolon, it'll still count.



that's a cool feature!

greets,
Zoltán Németh

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



Re: [PHP] Posting Summary for Week Ending 4 April, 2008: php-general@lists.php.net

2008-04-06 Thread Zoltán Németh

PostTrack [Dan Brown] írta:
> 	10 (3.4%)  33529   (8.5%)      Zoltán Németh alterationx dot hu>
> 	1  (0.3%)  2502(0.6%)      Zoltán Németh alterationx dot hu>



what's the difference? they should be added up, no?

greets,
Zoltán Németh

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



Re: [PHP] How to write simpleXML object to a file

2008-04-04 Thread Zoltán Németh

It Maq írta:

Hi,

I am reading an xml file. After that i modify one
node. IN the xml object that i'm handling it is
modified but not in the original file. Can you tell me
how i can make   the modification to an xml file or
how to write an xml object to a file?


$xml->asXML('whatever.xml');

http://hu.php.net/manual/en/function.simplexml-element-asXML.php

greets,
Zoltán Németh



Thank you


  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com






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



Re: [PHP] Dynamic dropdown lists (select)

2008-04-04 Thread Zoltán Németh

Angelo Zanetti írta:
Hi all, 


I am looking at options for creating a dynamic dropdown list.

Ok here is the scenario: 


All values in the dropdown list (select/option field) are coming from the
database.

So there will be 2 dropdown lists. First one say gets (for example) a list
of cars, 


Then once the car is choosen the second list is populated with the list of
models for the car choosen.

I would like to know if its possible to do this without posting as well as
without the use of JS. I have seen js examples where the values are all
stored in arrays.



without JS it is not possible, unless you put a submit button next to 
the first select




This is not desireable as I will be getting the values from the the DB using
PHP, unless I can write the JS values to the arrays using PHP? Also not sure
of that.


sure you can generate the JS arrays with php. just echo out the 
necessary js, like:


echo 'var whatever = new Array();';
foreach ($cars as $idx => $car)
echo 'whatever['.$idx.'] = "'.$car->getName().'";';
echo '';



Is there any other idea or thing I can do? Im thinking maybe AJAX but this
is for a mobile site (WAP/xHTML) site and Im not sure if the functionality
will work on these devices.


I would go for ajax, if possible, but I don't know if it works on wap or not

greets,
Zoltán Németh



Please advise.

Thanks in advance

Angelo

Web: http://www.elemental.co.za 








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



Re: [PHP] April Fools Easter Egg

2008-04-01 Thread Zoltán Németh

Ray Hauge írta:

tedd wrote:

At 9:23 AM -0500 4/1/08, Ray Hauge wrote:

Don't forget to check your phpinfo() page for the annual easter egg.

--
Ray Hauge
www.primateapplications.com



You got me.

Cheers,

tedd



Here's the image that I see on PHP 5.1.0. My 5.2.5 site has a distorted 
image instead of the dog.


5.1.0:
http://www.primateapplications.com/info.php.gif

5.2.5:
http://www.primateapplications.com/info.php



same here, distorted image on 5.2.5 and dog on 5.1.2 :)

greets,
Zoltán Németh

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



Re: [PHP] Dates Again

2008-03-31 Thread Zoltán Németh

VamVan írta:

Hello All,

I have a date in 2008-03-29 12:15:00  format.

   - How can I reduce one day from it?
   - How can I reduce one hour from it?
   - How can I add 1 hour to today's date?

Thanks



just convert it to a timestamp with strtotime()
then you can manipulate it by adding/substracting
- 86400 for a day
- 3600 for an hour
then convert back with strftime()

http://hu.php.net/strtotime
http://hu.php.net/strftime

greets,
Zoltán Németh

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



Re: [PHP] Re: optimilize web page loading

2008-03-30 Thread Zoltán Németh

Robert Cummings írta:

On Sat, 2008-03-29 at 10:16 +0100, Zoltán Németh wrote:

 One last thing though...
even if this were escaped and even if there were fifty variables
embedded, a good bytecode optimizer (not quite the same as a bytecode
cacher) would optimize the bytecode for caching so that the string is
broken up according to what needs to be interpolated and what does not.

could you tell me more about this bytecode optimizer stuff? how does it
work, how much better/faster is it then APC/EAccelerator/etc?


It really depends on what an optimizer optimizes. TurckMMCache had.has
an optimizer. Zend offers an optimizer too. Optimizer can work in a
number of ways. They may be an explicit part of the bytecode cache
mechanism or possibly plugged as one element in a chain of bytecode
processors... parser -> optmizer -> cacher. I'm not exactly sure how it
works for PHP.

The main difference between a cacher and an optimizer though is that
generally speaking a caher only deals with caching the bytecode. No
processing occurs on the produced bytecode. On the other hand an
optimizer may perform alterates on the bytecodes to enhance speed.

For example... by now most people on the list probably know that:

++$i;

Is faster than:

$i++;

An optmizer might see $i++ and determine that the return value is not
used and thus the operation can be changed from $i++ to ++$i. Smilarly,
the optimizer might encounter the following expression:

$foo = 1 << 8

And reduce the constant expression (1 << 8) to (256). So the expression
essentially becomes:

$foo = 256

Similarly if you take the following expression:

$text = "There was an old man from Nantuckit\n"
   ."Who's sole possession was a bucket.\n"
   ."One day with a grin,\n"
   ."While scratching his chin\n"
   ."He thought, \"I think I'll build a rocket.\"\n";

This could be optimized by removing concatenation operations and
producing a single unified string within the bytecode.

These are just basic optimizations obviously. Optimization is not a new
thing, if you've ever used the -O flags when building a C program then
you know that C compilers can also perform optimizations.

Cheers,
Rob.


thanks, I get the concept

greets,
Zoltán Németh


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



Re: [PHP] Simple RegEx to pull out content between 2 markers

2008-03-29 Thread Zoltán Németh
2008. 03. 29, szombat keltezéssel 11.26-kor Jon Bennett ezt írta:
> Hi,
> 
> I need to grab the what's between 2 markers in a Textile / html
> string, but my regex skills aren't all that hot. The text I have is:
> 
> 
> 
> h3. Article Content
> 
> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
> minim veniam, quis nostrud exercitation ullamco laboris nisi ut
> aliquip ex ea commodo consequat. Duis aute irure dolor in
> reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
> pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
> culpa qui officia deserunt mollit anim id est laborum.
> 
> p(image). !/app/image/1/large! Caption
> 
> p(image). !/app/image/24/large! drunken jonty
> 
> 
> 
> 
> 
> h3. Article Content
> 
> !/app/image/7/thumb! Lorem ipsum dolor sit amet, consectetur
> adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
> magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
> irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
> fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
> sunt in culpa qui officia deserunt mollit anim id est laborum.
> 
> 
> 
> 
> 
> h3. Article Content
> 
> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> eiusmod tempor incididunt ut labore et dolore magna aliqua.
> 
> * Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
> nisi ut aliquip ex ea commodo consequat.
> * Duis aute irure dolor in reprehenderit in voluptate velit esse
> cillum dolore eu fugiat nulla pariatur.
> * Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
> officia deserunt mollit anim id est laborum.
> 
> 
> 
> I'd like to grab the contents of left, right and main individually so
> I can place them in separate form fields.
> 
> Any help greatly appreciated. I'm certain this is a cinch for people
> who use regex often.

preg_match('/(.*)/sUi', $string,
$matches);
echo $matches[1];

it's not very complicated, the only interesting bits are the s and U
modifiers at the end of the pattern. s makes the dot (.) to match
newlines too, so the matched text can be more than one line, the U makes
the engine 'ungreedy' which means that it stops after the first match.
this means that if you have a string like  and
match for (.*), without the U modifier you would get the
part between the first  and the last . with the modifier
you get the parts between any  and the next 

more info here:
http://hu.php.net/manual/en/reference.pcre.pattern.modifiers.php
http://hu.php.net/manual/en/reference.pcre.pattern.syntax.php

greets,
Zoltán Németh

> 
> Thanks,
> 
> Jon
> 
> 
> -- 
> 
> jon bennett
> w: http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
> 


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



Re: [PHP] Posting Summary for Week Ending 28 March, 2008: php-general@lists.php.net

2008-03-29 Thread Zoltán Németh
hey I made into the top five! celebrating this, now I top post :D ;)

greets,
Zoltán Németh

2008. 03. 28, péntek keltezéssel 16.00-kor PostTrack [Dan Brown] ezt
írta:
>   Posting Summary for PHP-General List
>   Week Ending: Friday, 28 March, 2008
> 
>   Messages| Bytes  | Sender
>   ++--
>   311 (100%)  850774 (100%)   EVERYONE
>   18 (5.8%)  24095   (2.8%)  Daniel Brown  dot com>
>   18 (5.8%)  24878   (2.9%)  Mark Weaver  dot com>
>   16 (5.1%)  14590   (1.7%)  tedd  dot com>
>   14 (4.5%)  20197   (2.4%)  Nilesh Govindrajan  itech7 dot com>
>   10 (3.2%)  22378   (2.6%)  Zoltán Németh  alterationx dot hu>
>   9  (2.9%)  10777   (1.3%)  Casey  com>
>   9  (2.9%)  19224   (2.3%)  Robert Cummings  interjinn dot com>
>   9  (2.9%)  16853   (2%)Shawn McKenzie  mckenzies dot net>
>   9  (2.9%)  7941(0.9%)  Wolf  com>
>   8  (2.6%)  15638   (1.8%)  Eric Butera  gmail dot com>
>   8  (2.6%)  10532   (1.2%)  Andrew Ballard  gmail dot com>
>   7  (2.3%)  13758   (1.6%)  Jason Pruim  dot com>
>   7  (2.3%)  12869   (1.5%)  Lamp Lists  yahoo dot com>
>   7  (2.3%)  10655   (1.3%)  Al 
>   7  (2.3%)  11444   (1.3%)  Jim Lucas  com>
>   7  (2.3%)  11986   (1.4%)  Richard Lynch  com>
>   4  (1.3%)  13584   (1.6%)  Peter Ford  dot com>
>   4  (1.3%)  6940(0.8%)  Philip Thompson  gmail dot com>
>   4  (1.3%)  5937(0.7%)  Robin Vickery  dot com>
>   4  (1.3%)  5202(0.6%)  Sudhakar  dot com>
>   4  (1.3%)  3466(0.4%)  Greg Bowser  dot com>
>   3  (1%)3596(0.4%)  Alain Roger  gmail dot com>
>   3  (1%)4162(0.5%)  Bastien Koert  dot com>
>   3  (1%)4872(0.6%)  VamVan  com>
>   3  (1%)3178(0.4%)  Colin Guthrie  dot guthr dot ie>
>   3  (1%)9221(1.1%)  Richard 
>   3  (1%)4352(0.5%)  Michelle Konzack  at freenet dot de>
>   3  (1%)3090(0.4%)  Bill  com>
>   3  (1%)3208(0.4%)  Richard Heyes  phpguru dot org>
>   2  (0.6%)  95298   (11.2%) Andy Chong com>
>   2  (0.6%)  1890(0.2%)  Chris 
>   2  (0.6%)  2032(0.2%)  Bill Guion  dot net>
>   2  (0.6%)  2417(0.3%)  Liz Kim  com>
>   2  (0.6%)  95298   (11.2%) Andy Chong com dot sg>
>   2  (0.6%)  2299(0.3%)  Christoph Boget  boget at gmail dot com>
>   2  (0.6%)  10009   (1.2%)  N dot Boatswain  hotmail dot com>
>   2  (0.6%)  95298   (11.2%) Andy Chong com dot cn>
>   2  (0.6%)  1889(0.2%)  Eric Wood  com>
>   2  (0.6%)  2183(0.3%)  Paul Scott  dot za>
>   2  (0.6%)  2549(0.3%)  Dan 
>   2  (0.6%)  1504(0.2%)  It Maq  com>
>   2  (0.6%)  2288(0.3%)  Manuel Lemos  org>
>   2  (0.6%)  1704(0.2%)  Jeremy Privett  omegavortex dot net>
>   2  (0.6%)  1591(0.2%)  Mário Gamito  dot com>
>   2  (0.6%)  1987(0.2%)  Aschwin Wesselius  illuminated dot nl>
>   2  (0.6%)  2682(0.3%)  Olivier Dupuis  olivier at lemonde dot fr>
>   2  (0.6%)  2557(0.3%)  Simon Welsh  co dot nz>
>   2  (0.6%)  1606(0.2%)  M dot  Sokolewicz  php dot net>
>   2  (0.6%)  95298   (11.2%) Andy Chong url dot com dot tw>
>   2  (0.6%)  3904(0.5%)  Brandon Orther  orther at think-done dot com>
>   2  (0.6%)  2619(0.3%)  Ron Piggott  actsministries dot org>
>   2  (0.6%)  1371(0.2%)  Bagus Nugroho  unisemgroup dot com>
>   2  (0.6%)  4248(0.5%)  Thiago Pojda  at softpartech dot com dot br>
>   2  (0.6%)  1942(0.2%)  Ray Hauge  lists at gmail dot com>
>   2  (0.6%)  2551(0.3%)  Kirk dot Johnson at zootweb dot 
> com
>   1  (0.3%)  475 (0.1%)  thomas Armstrong  gmail dot com>
>   1  (0.3%)  1377(0.2%)  Alfredo CV  loslibrosusados dot net>
>   1  (0.3%)  793 (0.1%)  Rod Clay

Re: [PHP] why won't my array work?

2008-03-29 Thread Zoltán Németh
2008. 03. 28, péntek keltezéssel 12.28-kor Jason Pruim ezt írta:
> Hi everyone :) Happy friday to all of you!
> 
> Here's my issues, I am attempting to echo the results of mysqli query  
> out to my script just so I can make sure it's working right, what I'm  
> hoping to do in the long run is compare what was typed in a text box  
> to this info... It's for verifying a old password before changing to a  
> new password... So here is my query:
> 
> $oldpasswordquery = "SELECT loginPassword, Record FROM current WHERE  
> loginPassword='{$oldPassHash}' AND Record='{$Record}'";
> $chpwold[] = mysqli_query($chpwpostlink, $oldpasswordquery) or  
> die("Sorry read failed: ". mysqli_error($chpwpostlink));
> $chpwresult = $chpwold[0];
> $chpwrow[] = mysqli_fetch_assoc($chpwresult) or die('Sorry it didn\'t  
> work' .mysqli_error($chpwpostlink));
> echo $chpwrow['loginPassword'];
> print_r($chpwrow);
> 
> 
> The echo and the print_r are for debugging and obviously wont' be in  
> the final script... Here is the error that I am getting:
> 
> [Fri Mar 28 12:14:39 2008] [error] PHP Notice:  Undefined index:   
> loginPassword in /Volumes/RAIDer/webserver/Documents/dev/OLDBv2/admin/ 
> chpwpost.php on line 18
> 
> 
> Line 18 is where the echo is...
> 
> the print_r though shows this:
> 
> Array ( [0] => Array ( [loginPassword] =>  
> 42205baa2581d3fcd8d8f9c6b9746a1f [Record] => 2 ) )
> 
> So why can't I access it via $chpwrow['loginPassword']?  I'm  
> stumped Anyone that can help me has a free beer waiting for them  
> the next time they are in my town! :)

from the print_r it looks like that you could access it like
$chpwrow[0]['loginPassword']

greets,
Zoltán Németh

> 
> --
> 
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424-9337
> www.raoset.com
> [EMAIL PROTECTED]
> 
> 
> 


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



Re: [PHP] Re: optimilize web page loading

2008-03-29 Thread Zoltán Németh
2008. 03. 28, péntek keltezéssel 11.31-kor tedd ezt írta:
> At 9:14 AM +0100 3/28/08, Zoltán Németh wrote:
> >  > This way for literal strings, the PHP parser doesn't have to evaluate
> >  > this string to determine if anything needs to be translated (e.g.,
> >  > $report .= "I like to $foo"). A minimal speedup, but nonetheless...
> >
> >that above statement is simply not true. parsing "foo" and 'foo' is all
> >the same
> >a good read about it:
> >http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html
> >
> >greets,
> >Zoltán Németh
> 
> I read it, but it still doesn't disprove the premise.

yeah, that was morning time and I got mixed up a bit :)

Anyway, I had to admit that I was wrong in this matter, Rob Cummings has
just proven me that there is a difference, however little is it

greets,
Zoltán Németh

> 
> Cheers,
> 
> tedd
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


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



Re: [PHP] Re: optimilize web page loading

2008-03-29 Thread Zoltán Németh
2008. 03. 28, péntek keltezéssel 10.59-kor Robert Cummings ezt írta:
> On Fri, 2008-03-28 at 15:30 +0100, Zoltán Németh wrote:
> > 2008. 03. 28, péntek keltezéssel 10.24-kor Robert Cummings ezt írta:
> > > On Fri, 2008-03-28 at 14:46 +0100, Zoltán Németh wrote:
> > > > 
> > > > yeah maybe. you're right, the bytecode is the same. but somewhere I
> > > > heard that the parsing is the same too - because escaped characters can
> > > > be in any string, though I'm not that sure about this anymore, as my
> > > > link proved something else ;)
> > > 
> > > Single quoted strings do support some escape characters. As far as I
> > > know only you can only escape a single quote and a backslash when
> > > creating a string via single quotes.
> > 
> > yes, but I think the parser would still need to tokenize the string and
> > verify each token whether it contains an escape character or not - which
> > should be the same process as tokenizing and checking for escape
> > character and $ signs.
> 
> Nope, when processing a single quoted string there should be 4 available
> parse branches:
> 
> EOF
> '(end of string)
> \
> EOF
> \
> '
> anything else
> anything else
> 
> Whereas with a double quoted string you have something along the lines
> of:
> 
> EOF
> "(end of string)
> $(begin variable)
> {(possible begin interpolation)
> $(begin interpolation)
> \
> EOF
> \
> '
> "
> t
> n
> r
> x
> v
> f
> 
> anything else
> anything else
> 
> So presuming no variable is embeded and assuming no escaped
> characters... double quotes still need to check for the beginning of
> variable interpolation which has 2 different start possibilities. With
> respect to creating the byte code single quotes have 4 branches, double
> quotes have 6 branches in the simplest of cases with no escape and no
> interpolation. So one would expect compile time for double quotes to be
> approximately 33% slower than for single quotes.

good points, thanks for the detailed info (not that I'd focus on it
while coding but its sooo interesting :) )


>  Once compiled though,
> the point is moot especially since most sites use a bytecode cache like
> eAccelerator or APC. Even without a cache htough, the time difference is
> tncy, and this is just for informational purposes :) There are
> usually bigger eggs to fry when optimizing.

sure, these questions like 'echo or print' and 'single or double quotes'
and 'for or while' and so on should never be mentioned when talking
about real life code optimizing, as the difference they may make is so
minimal. talking about these is good only for satisfying some of my (and
maybe some other people's) curiosity about how php works internally :)


>  One last thing though...
> even if this were escaped and even if there were fifty variables
> embedded, a good bytecode optimizer (not quite the same as a bytecode
> cacher) would optimize the bytecode for caching so that the string is
> broken up according to what needs to be interpolated and what does not.

could you tell me more about this bytecode optimizer stuff? how does it
work, how much better/faster is it then APC/EAccelerator/etc?

greets,
Zoltán Németh

> 
> Cheers,
> Rob.


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



Re: [PHP] Re: optimilize web page loading

2008-03-28 Thread Zoltán Németh
2008. 03. 28, péntek keltezéssel 10.24-kor Robert Cummings ezt írta:
> On Fri, 2008-03-28 at 14:46 +0100, Zoltán Németh wrote:
> > 
> > yeah maybe. you're right, the bytecode is the same. but somewhere I
> > heard that the parsing is the same too - because escaped characters can
> > be in any string, though I'm not that sure about this anymore, as my
> > link proved something else ;)
> 
> Single quoted strings do support some escape characters. As far as I
> know only you can only escape a single quote and a backslash when
> creating a string via single quotes.

yes, but I think the parser would still need to tokenize the string and
verify each token whether it contains an escape character or not - which
should be the same process as tokenizing and checking for escape
character and $ signs.

greets,
Zoltán Németh


> 
> Cheers,
> Rob.


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



Re: [PHP] Re: optimilize web page loading

2008-03-28 Thread Zoltán Németh
2008. 03. 28, péntek keltezéssel 09.00-kor Robert Cummings ezt írta:
> On Fri, 2008-03-28 at 09:31 +0100, Zoltán Németh wrote:
> > 2008. 03. 28, péntek keltezéssel 09.19-kor Zoltán Németh ezt írta:
> > > 2008. 03. 27, csütörtök keltezéssel 10.21-kor Shawn McKenzie ezt írta:
> > > > Jason Pruim wrote:
> > > > > 
> > > > > On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
> > > > >> Al wrote:
> > > > >>> Good point.  I usually do use the single quotes, just happened to 
> > > > >>> key
> > > > >>> doubles for the email.
> > > > >>>
> > > > >>> Actually, it's good idea for all variable assignments.
> > > > >>>
> > > > >>> Philip Thompson wrote:
> > > > >>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
> > > > >>>>> Depends on the server and it's load.  I've strung together some
> > > > >>>>> rather large html strings and they aways take far less time than 
> > > > >>>>> the
> > > > >>>>> transient time on the internet. I used to use OB extensively until
> > > > >>>>> one day I took the time to measure the difference. I don't recall 
> > > > >>>>> the
> > > > >>>>> numbers; but, I do recall it was not worth the slight extra 
> > > > >>>>> trouble
> > > > >>>>> to use OB.
> > > > >>>>>
> > > > >>>>> Now, I simple assemble by html strings with $report .= "foo"; And
> > > > >>>>> then echo $report at the end. It also makes the code very easy to
> > > > >>>>> read and follow.
> > > > >>>>
> > > > >>>> You might as well take it a step further. Change the above to:
> > > > >>>>
> > > > >>>> $report .= 'foo';
> > > > >>>>
> > > > >>>> This way for literal strings, the PHP parser doesn't have to 
> > > > >>>> evaluate
> > > > >>>> this string to determine if anything needs to be translated (e.g.,
> > > > >>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
> > > > >>>>
> > > > >>>> ~Philip
> > > > >>>>
> > > > >>>>
> > > > >>>>> Andrew Ballard wrote:
> > > > >>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <[EMAIL PROTECTED]> wrote:
> > > > >>>>>>> You are really asking an HTML question, if you think about it.
> > > > >>>>>>>
> > > > >>>>>>> At the PHP level, either use output buffering or assemble all 
> > > > >>>>>>> your
> > > > >>>>>>> html string as a variable and
> > > > >>>>>>> then echo it.  The goal is to compress the string into the 
> > > > >>>>>>> minimum
> > > > >>>>>>> number of packets.
> > > > >>>>>> Yes, but do so smartly. Excessive string concatenation can slow
> > > > >>>>>> things
> > > > >>>>>> down as well. On most pages you probably won't notice much
> > > > >>>>>> difference,
> > > > >>>>>> but I have seen instances where the difference was painfully 
> > > > >>>>>> obvious.
> > > > >>>>>> Andrew
> > > > >>
> > > > >> Yes and if your script takes .0002 
> > > > >> seconds
> > > > >> to run using double quotes it will only take
> > > > >> .00019 seconds with single (depending 
> > > > >> upon
> > > > >> how many quotes you have of course)  :-)
> > > > > 
> > > > > I'm coming in late to this thread so sorry if I missed this :)
> > > > > 
> > > > > How much of a difference would it make if you have something like 
> > > > > this:
> > > > > echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar bar 
> > > > > bar
> > > > > bar" . $foo $foo; ?In other words... You have a large application 
> > > > > which
> > > > > is most likely to be faster? :)
> > > > > 
> > > > > 
> > > > I would assume your 2 examples to be the same because the point is that
> > > > the PHP interpreter must parse for vars to substitute when it encounters
> > > > double-quotes whether there are any vars in it or not.  With
> > > > single-quotes the interpreter does not have to worry about it.
> > > > Regardless, the speed diff is probably negligible, hence my flame
> > > > inviting post. :-)
> > > > 
> > 
> > ehh my answer is meant to be here:
> 
> It's still wrong >:)
> 
> > 
> > nope. it parses both, since you may have escaped characters within
> > > single quotes too. so the difference only comes in when you actually
> > > have a variable in the string.
> >
> > sorry its morning ;)
> 
> Aaah, that's why you're confused :P

yeah maybe. you're right, the bytecode is the same. but somewhere I
heard that the parsing is the same too - because escaped characters can
be in any string, though I'm not that sure about this anymore, as my
link proved something else ;)

greets
Zoltán Németh

> 
> ;)
> 
> Cheers,
> Rob.


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



Re: [PHP] Re: optimilize web page loading

2008-03-28 Thread Zoltán Németh
2008. 03. 28, péntek keltezéssel 09.19-kor Zoltán Németh ezt írta:
> 2008. 03. 27, csütörtök keltezéssel 10.21-kor Shawn McKenzie ezt írta:
> > Jason Pruim wrote:
> > > 
> > > On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
> > >> Al wrote:
> > >>> Good point.  I usually do use the single quotes, just happened to key
> > >>> doubles for the email.
> > >>>
> > >>> Actually, it's good idea for all variable assignments.
> > >>>
> > >>> Philip Thompson wrote:
> > >>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
> > >>>>> Depends on the server and it's load.  I've strung together some
> > >>>>> rather large html strings and they aways take far less time than the
> > >>>>> transient time on the internet. I used to use OB extensively until
> > >>>>> one day I took the time to measure the difference. I don't recall the
> > >>>>> numbers; but, I do recall it was not worth the slight extra trouble
> > >>>>> to use OB.
> > >>>>>
> > >>>>> Now, I simple assemble by html strings with $report .= "foo"; And
> > >>>>> then echo $report at the end. It also makes the code very easy to
> > >>>>> read and follow.
> > >>>>
> > >>>> You might as well take it a step further. Change the above to:
> > >>>>
> > >>>> $report .= 'foo';
> > >>>>
> > >>>> This way for literal strings, the PHP parser doesn't have to evaluate
> > >>>> this string to determine if anything needs to be translated (e.g.,
> > >>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
> > >>>>
> > >>>> ~Philip
> > >>>>
> > >>>>
> > >>>>> Andrew Ballard wrote:
> > >>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <[EMAIL PROTECTED]> wrote:
> > >>>>>>> You are really asking an HTML question, if you think about it.
> > >>>>>>>
> > >>>>>>> At the PHP level, either use output buffering or assemble all your
> > >>>>>>> html string as a variable and
> > >>>>>>> then echo it.  The goal is to compress the string into the minimum
> > >>>>>>> number of packets.
> > >>>>>> Yes, but do so smartly. Excessive string concatenation can slow
> > >>>>>> things
> > >>>>>> down as well. On most pages you probably won't notice much
> > >>>>>> difference,
> > >>>>>> but I have seen instances where the difference was painfully obvious.
> > >>>>>> Andrew
> > >>
> > >> Yes and if your script takes .0002 seconds
> > >> to run using double quotes it will only take
> > >> .00019 seconds with single (depending upon
> > >> how many quotes you have of course)  :-)
> > > 
> > > I'm coming in late to this thread so sorry if I missed this :)
> > > 
> > > How much of a difference would it make if you have something like this:
> > > echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar bar bar
> > > bar" . $foo $foo; ?In other words... You have a large application which
> > > is most likely to be faster? :)
> > > 
> > > 
> > >>
> > >>
> > >> -Shawn
> > >>
> > >> -- 
> > >> PHP General Mailing List (http://www.php.net/)
> > >> To unsubscribe, visit: http://www.php.net/unsub.php
> > >>
> > >>
> > > 
> > > -- 
> > > 
> > > Jason Pruim
> > > Raoset Inc.
> > > Technology Manager
> > > MQC Specialist
> > > 3251 132nd ave
> > > Holland, MI, 49424-9337
> > > www.raoset.com
> > > [EMAIL PROTECTED]
> > > 
> > > 
> > > 
> > I would assume your 2 examples to be the same because the point is that
> > the PHP interpreter must parse for vars to substitute when it encounters
> > double-quotes whether there are any vars in it or not.  With
> > single-quotes the interpreter does not have to worry about it.
> > Regardless, the speed diff is probably negligible, hence my flame
> > inviting post. :-)
> > 

ehh my answer is meant to be here:

nope. it parses both, since you may have escaped characters within
> single quotes too. so the difference only comes in when you actually
> have a variable in the string.


sorry its morning ;)

greets,
Zoltán Németh

> > -Shawn
> > 
> 
> 


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



Re: [PHP] Re: optimilize web page loading

2008-03-28 Thread Zoltán Németh
2008. 03. 27, csütörtök keltezéssel 09.29-kor Philip Thompson ezt írta:
> On Mar 26, 2008, at 6:28 PM, Al wrote:
> > Depends on the server and it's load.  I've strung together some  
> > rather large html strings and they aways take far less time than the  
> > transient time on the internet. I used to use OB extensively until  
> > one day I took the time to measure the difference. I don't recall  
> > the numbers; but, I do recall it was not worth the slight extra  
> > trouble to use OB.
> >
> > Now, I simple assemble by html strings with $report .= "foo"; And  
> > then echo $report at the end. It also makes the code very easy to  
> > read and follow.
> 
> You might as well take it a step further. Change the above to:
> 
> $report .= 'foo';
> 
> This way for literal strings, the PHP parser doesn't have to evaluate  
> this string to determine if anything needs to be translated (e.g.,  
> $report .= "I like to $foo"). A minimal speedup, but nonetheless...


that above statement is simply not true. parsing "foo" and 'foo' is all
the same

a good read about it:
http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html

greets,
Zoltán Németh

> 
> ~Philip
> 
> 
> > Andrew Ballard wrote:
> >> On Wed, Mar 26, 2008 at 1:18 PM, Al <[EMAIL PROTECTED]> wrote:
> >>> You are really asking an HTML question, if you think about it.
> >>>
> >>> At the PHP level, either use output buffering or assemble all your  
> >>> html string as a variable and
> >>> then echo it.  The goal is to compress the string into the minimum  
> >>> number of packets.
> >> Yes, but do so smartly. Excessive string concatenation can slow  
> >> things
> >> down as well. On most pages you probably won't notice much  
> >> difference,
> >> but I have seen instances where the difference was painfully obvious.
> >> Andrew
> 


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



Re: [PHP] Re: optimilize web page loading

2008-03-28 Thread Zoltán Németh
2008. 03. 27, csütörtök keltezéssel 10.21-kor Shawn McKenzie ezt írta:
> Jason Pruim wrote:
> > 
> > On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
> >> Al wrote:
> >>> Good point.  I usually do use the single quotes, just happened to key
> >>> doubles for the email.
> >>>
> >>> Actually, it's good idea for all variable assignments.
> >>>
> >>> Philip Thompson wrote:
> >>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
> >>>>> Depends on the server and it's load.  I've strung together some
> >>>>> rather large html strings and they aways take far less time than the
> >>>>> transient time on the internet. I used to use OB extensively until
> >>>>> one day I took the time to measure the difference. I don't recall the
> >>>>> numbers; but, I do recall it was not worth the slight extra trouble
> >>>>> to use OB.
> >>>>>
> >>>>> Now, I simple assemble by html strings with $report .= "foo"; And
> >>>>> then echo $report at the end. It also makes the code very easy to
> >>>>> read and follow.
> >>>>
> >>>> You might as well take it a step further. Change the above to:
> >>>>
> >>>> $report .= 'foo';
> >>>>
> >>>> This way for literal strings, the PHP parser doesn't have to evaluate
> >>>> this string to determine if anything needs to be translated (e.g.,
> >>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
> >>>>
> >>>> ~Philip
> >>>>
> >>>>
> >>>>> Andrew Ballard wrote:
> >>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <[EMAIL PROTECTED]> wrote:
> >>>>>>> You are really asking an HTML question, if you think about it.
> >>>>>>>
> >>>>>>> At the PHP level, either use output buffering or assemble all your
> >>>>>>> html string as a variable and
> >>>>>>> then echo it.  The goal is to compress the string into the minimum
> >>>>>>> number of packets.
> >>>>>> Yes, but do so smartly. Excessive string concatenation can slow
> >>>>>> things
> >>>>>> down as well. On most pages you probably won't notice much
> >>>>>> difference,
> >>>>>> but I have seen instances where the difference was painfully obvious.
> >>>>>> Andrew
> >>
> >> Yes and if your script takes .0002 seconds
> >> to run using double quotes it will only take
> >> .00019 seconds with single (depending upon
> >> how many quotes you have of course)  :-)
> > 
> > I'm coming in late to this thread so sorry if I missed this :)
> > 
> > How much of a difference would it make if you have something like this:
> > echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar bar bar
> > bar" . $foo $foo; ?In other words... You have a large application which
> > is most likely to be faster? :)

nope. it parses both, since you may have escaped characters within
single quotes too. so the difference only comes in when you actually
have a variable in the string.

greets,
Zoltán Németh

> > 
> > 
> >>
> >>
> >> -Shawn
> >>
> >> -- 
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> > 
> > -- 
> > 
> > Jason Pruim
> > Raoset Inc.
> > Technology Manager
> > MQC Specialist
> > 3251 132nd ave
> > Holland, MI, 49424-9337
> > www.raoset.com
> > [EMAIL PROTECTED]
> > 
> > 
> > 
> I would assume your 2 examples to be the same because the point is that
> the PHP interpreter must parse for vars to substitute when it encounters
> double-quotes whether there are any vars in it or not.  With
> single-quotes the interpreter does not have to worry about it.
> Regardless, the speed diff is probably negligible, hence my flame
> inviting post. :-)
> 
> -Shawn
> 


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



Re: [PHP] Re: optimilize web page loading

2008-03-28 Thread Zoltán Németh
2008. 03. 27, csütörtök keltezéssel 11.13-kor Jason Pruim ezt írta:
> On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
> > Al wrote:
> >> Good point.  I usually do use the single quotes, just happened to key
> >> doubles for the email.
> >>
> >> Actually, it's good idea for all variable assignments.
> >>
> >> Philip Thompson wrote:
> >>> On Mar 26, 2008, at 6:28 PM, Al wrote:
> >>>> Depends on the server and it's load.  I've strung together some
> >>>> rather large html strings and they aways take far less time than  
> >>>> the
> >>>> transient time on the internet. I used to use OB extensively until
> >>>> one day I took the time to measure the difference. I don't recall  
> >>>> the
> >>>> numbers; but, I do recall it was not worth the slight extra trouble
> >>>> to use OB.
> >>>>
> >>>> Now, I simple assemble by html strings with $report .= "foo"; And
> >>>> then echo $report at the end. It also makes the code very easy to
> >>>> read and follow.
> >>>
> >>> You might as well take it a step further. Change the above to:
> >>>
> >>> $report .= 'foo';
> >>>
> >>> This way for literal strings, the PHP parser doesn't have to  
> >>> evaluate
> >>> this string to determine if anything needs to be translated (e.g.,
> >>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
> >>>
> >>> ~Philip
> >>>
> >>>
> >>>> Andrew Ballard wrote:
> >>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <[EMAIL PROTECTED]> wrote:
> >>>>>> You are really asking an HTML question, if you think about it.
> >>>>>>
> >>>>>> At the PHP level, either use output buffering or assemble all  
> >>>>>> your
> >>>>>> html string as a variable and
> >>>>>> then echo it.  The goal is to compress the string into the  
> >>>>>> minimum
> >>>>>> number of packets.
> >>>>> Yes, but do so smartly. Excessive string concatenation can slow  
> >>>>> things
> >>>>> down as well. On most pages you probably won't notice much  
> >>>>> difference,
> >>>>> but I have seen instances where the difference was painfully  
> >>>>> obvious.
> >>>>> Andrew
> >
> > Yes and if your script takes .0002 seconds
> > to run using double quotes it will only take
> > .00019 seconds with single (depending upon
> > how many quotes you have of course)  :-)
> 
> I'm coming in late to this thread so sorry if I missed this :)
> 
> How much of a difference would it make if you have something like  
> this: echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar  
> bar bar bar" . $foo $foo; ?In other words... You have a large  
> application which is most likely to be faster? :)

if you have variables in the mix, concatenation is better than
interpolation

greets,
Zoltán Németh

> 
> 
> >
> >
> > -Shawn
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> --
> 
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424-9337
> www.raoset.com
> [EMAIL PROTECTED]
> 
> 
> 
> 


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



Re: [PHP] character encoding

2008-03-26 Thread Zoltán Németh
2008. 03. 26, szerda keltezéssel 18.04-kor Bill ezt írta:
> Hi Zoltan,
> 
> >> A column in a table has" Brbeuf " in it. (3rd caracter is é)
> >> In the body that column shows " Brbeuf " in Windows Outlook.
> >>
> >> How could I translate to the correct encoding so that accents show 
> >> correctly
> >> in Outlook ?
> >
> > based on the encoding of your e-mail, my guess is that your data is in
> > some ISO-8859-1 encoding or something like that. of course, you should
> > verify that first.
> > so try to send those emails with that encoding, or what's much better,
> > use utf8 for both your data and your email. I think outlook can cope
> > with that, though I'm not sure ;)
> 
> The encoding can be set to utf-8 in the recieved email, what translates the 
> encoding but the sender's outlook window doesn't.
> 
> It's a site where you can ask the owner to upgrade your account limit by 
> clicking on a mailto link who writes most of the email body. The data used 
> is your record from a Mysql table.


> When you use that link it opens a email window and the body of that message 
> isn't translated. So the people will see some garbage and may not send the 
> email.
> 
> If I try to change the encoding in the editing window of Outlook while this 
> garbaged email shows it doesn't work. I still see the garbage, yet my 
> outlook is set for utf-8 !!

then change the collation of that table to utf8 and store all data in
utf8

greets
Zoltán Németh

> 
> Bill 
> 
> 
> 


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



Re: [PHP] character encoding

2008-03-26 Thread Zoltán Németh
2008. 03. 26, szerda keltezéssel 15.57-kor Bill ezt írta:
> Hi
> 
> LAMP
> 
> A column in a table has" Brbeuf " in it. (3rd caracter is é)
> 
> I use that table to send emails.
> 
> In the body that column shows " Brébeuf " in Windows Outlook.
> 
> How could I translate to the correct encoding so that accents show correctly 
> in Outlook ?

based on the encoding of your e-mail, my guess is that your data is in
some ISO-8859-1 encoding or something like that. of course, you should
verify that first.
so try to send those emails with that encoding, or what's much better,
use utf8 for both your data and your email. I think outlook can cope
with that, though I'm not sure ;)

greets,
Zoltán Németh


> 
> Thanks
> 
> 
> 
> 


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



Re: [PHP] Manipulating PDF

2008-03-25 Thread Zoltán Németh
2008. 03. 23, vasárnap keltezéssel 11.57-kor tedd ezt írta:
> At 4:36 PM +0100 3/23/08, Aschwin Wesselius wrote:
> >Again, I'm not after PHPLib or FPDF, since these libraries are 
> >either old or insufficient for what I want.
> 
> Hey, don't discount old things. :-)
> 
> I can do just about anything I want with those old files.
> 
> http://webbytedd.com/bb/pdf/
> 

where's the source for that?

greets,
Zoltán Németh

> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


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



Re: [PHP] Why won't this query work?

2008-03-25 Thread Zoltán Németh
2008. 03. 24, hétfő keltezéssel 14.40-kor Daniel Brown ezt írta:
> On Mon, Mar 24, 2008 at 2:29 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >
> >  It's already been escaped, $business is pulled out of the database
> >  after they log in. :)
> 
> I don't care, Prune.
> 
> (I still get a kick out of knowing that.  Who was it, Jochem or
> Zoltan who said that?  ;-P)

/me points at Jochem ;)

greets
Zoltán Németh

> 
> NEVER trust that the data is escaped regardless of where it
> originated.  Supposed someone else writes a script to tie into your
> database and doesn't escape it, and Hagar The Horrible's
> great-great(^15) grandson, Hacker The Horndog comes in and finds the
> vulnerability, and enters the company name as "';DELETE FROM current
> WHERE 1;SELECT * FROM current WHERE 1 "?
> 
> Bye, data.
> 
> Learn: http://xkcd.com/327/
> 
> -- 
> 
> Forensic Services, Senior Unix Engineer
> 1+ (570-) 362-0283
> 


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



Re: [PHP] Closures

2008-03-19 Thread Zoltán Németh

> in short, functional programming support would have been great in php if it
> had been incorporated early on, at this point i can live without it.  if we
> were going to see support for anything anonymous that i would welcome it
> would be anonymous objects and the ability to create an object on the fly
> from an interface as per java 5.  o and inner classes would be nice too, but
> maybe traits would address that desire, i dont know.
> 
> -nathan


I agree with this

greets,
Zoltán Németh


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



Re: [PHP] How to get error context

2008-03-17 Thread Zoltán Németh

2008. 03. 14, péntek keltezéssel 10.03-kor It Maq ezt írta:
> Here is the error message captured by my error
> handling function:
> 
> mysql_connect() [function.mysql-connect]: Access
> denied for user 'admin'@'localhost' (using password:
> YES)
> 
> i put a wrong password and username

the manual also says this, which I too did not notice earlier:

"Note: You can suppress the error message on failure by prepending a @
to the function name."

this implies that error message is raised on error, but don't ask me
why ;)

greets,
Zoltán Németh

> --- Zoltán Németh <[EMAIL PROTECTED]> wrote:
> 
> > 2008. 03. 14, péntek keltezéssel 07.40-kor It Maq
> > ezt írta:
> > > For example "mysql_connect" reprted automatically
> > the
> > > error but in the manual
> > >
> >
> http://us3.php.net/manual/en/function.mysql-connect.php
> > >  all they give as information is the return:
> > "Returns
> > > a MySQL link identifier on success, or FALSE on
> > > failure.", where can i see if it throws an error,
> > and
> > > when you say throwing do you mean that i can catch
> > the
> > > error without throwing it myself?
> > 
> > hmm actually what error did mysql_connect throw?
> > because if it just fails connecting, it returns
> > false. on the other
> > hand, if you provide it wrong arguments (e.g. less
> > arguments, or wrong
> > data type, or whatever) that raises a php error and
> > the function does
> > not even run.
> > this is true for most functions which return false
> > on error. the
> > returning false means there was some error with the
> > action itself, while
> > php errors are raised when the action can not be
> > executed because of
> > some error in the code itself.
> > 
> > greets,
> > Zoltán Németh
> > 
> > >  
> > > --- Zoltán Németh <[EMAIL PROTECTED]> wrote:
> > > 
> > > > 2008. 03. 14, péntek keltezéssel 07.20-kor It
> > Maq
> > > > ezt írta:
> > > > > So i'm wondering if there are some rules
> > > > > that can help me know if an error will be
> > reported
> > > > > automatically or not. 
> > > > 
> > > > there is no general rule for that. you have to
> > check
> > > > the manual for each
> > > > function, some of them just returns false on
> > error,
> > > > others throw
> > > > warnings/notices/errors...
> > > > 
> > > > greets,
> > > > Zoltán Németh
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > >  
> >
> 
> > > Never miss a thing.  Make Yahoo your home page. 
> > > http://www.yahoo.com/r/hs
> > > 
> > > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> 
> 
>   
> 
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> 
> 


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



Re: [PHP] How to get error context

2008-03-14 Thread Zoltán Németh
2008. 03. 14, péntek keltezéssel 07.40-kor It Maq ezt írta:
> For example "mysql_connect" reprted automatically the
> error but in the manual
> http://us3.php.net/manual/en/function.mysql-connect.php
>  all they give as information is the return: "Returns
> a MySQL link identifier on success, or FALSE on
> failure.", where can i see if it throws an error, and
> when you say throwing do you mean that i can catch the
> error without throwing it myself?

hmm actually what error did mysql_connect throw?
because if it just fails connecting, it returns false. on the other
hand, if you provide it wrong arguments (e.g. less arguments, or wrong
data type, or whatever) that raises a php error and the function does
not even run.
this is true for most functions which return false on error. the
returning false means there was some error with the action itself, while
php errors are raised when the action can not be executed because of
some error in the code itself.

greets,
Zoltán Németh

>  
> --- Zoltán Németh <[EMAIL PROTECTED]> wrote:
> 
> > 2008. 03. 14, péntek keltezéssel 07.20-kor It Maq
> > ezt írta:
> > > So i'm wondering if there are some rules
> > > that can help me know if an error will be reported
> > > automatically or not. 
> > 
> > there is no general rule for that. you have to check
> > the manual for each
> > function, some of them just returns false on error,
> > others throw
> > warnings/notices/errors...
> > 
> > greets,
> > Zoltán Németh
> > 
> > 
> 
> 
> 
>   
> 
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
> 
> 


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



Re: [PHP] How to get error context

2008-03-14 Thread Zoltán Németh
2008. 03. 14, péntek keltezéssel 07.20-kor It Maq ezt írta:
> So i'm wondering if there are some rules
> that can help me know if an error will be reported
> automatically or not. 

there is no general rule for that. you have to check the manual for each
function, some of them just returns false on error, others throw
warnings/notices/errors...

greets,
Zoltán Németh


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



Re: [PHP] Sending multiple values from a form having same field names.

2008-03-14 Thread Zoltán Németh
2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt írta:
> Hi,
> 
> How can I send multiple values from a form to be stored in a database, as
> name of the fields is the same?
> 
> For example:
> 
>  foreach ($field_data as $field) {
> 
>  $field_name=$field["field_name"];
>  $field_id=$field["field_id"];
>  $datatype=$field["datatype_name"];
> 
> ?>
> 
> 
> 
>   if ($datatype=="text" || $datatype=="integer") {
> echo "";

make field_data an array indexed by field_id

  }
>  elseif ($datatype=="textarea") {
>   echo " name=\"field_data\">";
>   }
>   echo "";
> }
> ?>
> 
> This creates a form with field names and text box or textarea box next to
> each field name depending on the datatype. After the user enters the
> values in the text or textarea and clicks submit, the values should get
> stored in a database. But what is happening is that only the value entered
> in the last field of the form is getting entered into the database.
> This code is embedded in an application which is having an inbuilt
> structure of taking the values from a form in a hash. Since key is the
> same (i.e. field_id) everytime, the value gets overwritten and only the
> last value gets stored in db. But I am not able to work out a solution for
> this.
> I hope I am able to make my problem clear enough.
> 
> Thanks,
> Suamya.
> 
> 
> 
>  
> -
> DISCLAIMER:- 
>   "The information in this e-mail is confidential, and is intended 
> solely for the addressee or addressees. If you are not the intended recipient,
>  please delete the mail and kindly notify the sender of misdelivery. Any 
> unauthorised use or disclosure of the contents of the mail is not permitted 
> and may be unlawful."
> -
> 
>  "Scanned By MailScanner"
> 
> 


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



Re: [PHP] What's wrong the __autoload()?

2008-03-14 Thread Zoltán Németh
2008. 03. 14, péntek keltezéssel 08.52-kor Aschwin Wesselius ezt írta:
> Robert Cummings wrote:
> > It works like follows...
> >
> > - $z asserts $a or claims $b
> > - $y disagrees with $a or $b or both and responds with rebuttal $h
> >   and makes claims $c, $d, sometimes $e
> > - $z responds with rebuttal $i and often asserts a few other things
> >   that well call $f, $g
> > - $x throws in $Q
> > - $w throws in $wtf
> > - $foo, $fee, and $fii join in
> > - $someone mentions $TLC
> > - $o calls us all immature
> > - $SJHSKJ mentions Nazis
> > - $x invokes Godwin's Law
> > - $y asserts Quirk's Exception
> > - $G_Zus resurrects point $d
> > - $nobody wins
> > - $r, $u, $stillWithMe
> >   
> 
> Aaah. so we're just six points before the end of this thread? ;-)

threads like this live forever. after we all finish with it, sooner or
later someone will say something which will trigger its resurrection

greets,
Zoltán Németh


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



Re: [PHP] What's wrong the __autoload()?

2008-03-12 Thread Zoltán Németh
2008. 03. 12, szerda keltezéssel 15.20-kor Robert Cummings ezt írta:
> Even JavaScript has it.

oh yes, I could have thought of that. in JS you can assign a function to
a property or variable at runtime, even I did something similar, when I
assign the action functions of the buttons of a modal dialog
dynamically. it's good because the same simple JS library can handle any
number of use cases, and my main page with the JS libraries load only
once, ajax does the rest of stuff, so I could not change the class
definition for the separate cases.
but on server side, why not throw everything you might need in the class
definition?

greets,
Zoltán Németh


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



RE: [PHP] What's wrong the __autoload()?

2008-03-12 Thread Zoltán Németh
2008. 03. 12, szerda keltezéssel 15.07-kor Stephane Ulysse ezt írta:
> Anyone know any PHP Developers who are looking for employment

don't hijack other people's threads, start your own if you want to ask
anything.

and job offers should contain some information about the job and the
employer, and the subject line should be relevant to your question, and
etc etc etc

greets,
Zoltán Németh

> 
> -Original Message-
> From: Andrés Robinet [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 12, 2008 2:53 PM
> To: 'Robert Cummings'; 'Zoltán Németh'
> Cc: 'Greg Donald'; php-general@lists.php.net
> Subject: RE: [PHP] What's wrong the __autoload()?
> 
> > -Original Message-
> > From: Robert Cummings [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 12, 2008 1:51 PM
> > To: Zoltán Németh
> > Cc: Greg Donald; php-general@lists.php.net
> > Subject: Re: [PHP] What's wrong the __autoload()?
> > 
> > 
> > On Wed, 2008-03-12 at 18:21 +0100, Zoltán Németh wrote:
> > > 2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta:
> > > > On 3/12/08, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> > > > > but I strongly think that Ruby as a
> > > > > language just plain sucks ;)
> > > >
> > > > And exactly how many projects do you have under your belt to allow you
> > > > to develop this opinion?  What's the url to any one of them?
> > > >
> > > > Unlike you I actually have thousands of lines of Ruby code under my
> > > > belt that allows me to properly develop an opinion of Ruby and Rails
> > > > and how they both compare to every other programming language and
> > > > framework I know and have developed in.  Need a URL?
> > >
> > > ok, I admit I don't have experience with Ruby but I have experience with
> > > php. and I don't have experience with Ruby because I read some manuals
> > > and example codes and whatnot and I just could not get to like it at
> > > all. it's just so strange and different from anything I know (php, c,
> > > java) - and I could not find out any good reasons for most of the
> > > differences... e.g. how come function definitions are between 'def' and
> > > 'end'?
> > 
> > Because they didn't follow convention... *HAHAHA* oh my, I think I just
> > pee'd myself.
> > 
> > Cheers,
> > Rob.
> > --
> > http://www.interjinn.com
> > Application and Templating Framework for PHP
> > 
> > 
> 
> I think __autoload would make much more sense if it worked like an event 
> registration feature. Such as:
> 
> function myAutoloadCallback($className) {
>   if ($className == 'ShakeItBaby') {
>   require_once 'ShakeItBaby.class.php';
>   return true;
>   }
>   return false;
> }
> .
> 
> __autoloadRegisterCallback('myAutoloadCallback');
> .
> 
> $shaker = new ShakeItBaby();
> 
> This way, multiple frameworks and project requirements for autoload wouldn't 
> clash. If one of the autoload callbacks returns "true" that would be it. 
> Otherwise the next autoload callback would be called, and so on.
> 
> The problem with the current implementation is that if you get some piece of 
> code that uses __autoload and you are using __autoload too, you'll have to 
> either patch that piece of code (if the "piece of code" is a framework, 
> things will get much more complicated when updating to the next version) or 
> patch your own code, or just make a promise not to use __autoload (my current 
> choice... just in case) or not to use "pieces of code that use __autoload". 
> Bottom line, I hate it.
> 
> Something similar applies to the set_error_handling function, anyone can 
> overwrite your error handling and you can overwrite the error handling of 
> anyone. I hate it also, so I rather check the return value of functions, 
> and/or use exceptions for custom error handling.
> 
> I don't see why autoload and error handling can't be implemented in a 
> stack-like way, returning false from the callback moves to the next error 
> handler / autoloader, returning true ends the "handler search" process... 
> though this is more of a question to be made to the interlals list (b... 
> can't face their karma yet).
> 
> Anyway... the more PHP approaches OOP and gets OOP features, the more it can 
> be done through design patterns such as the Registry/Singleton/etc... and the 
> more Exceptions are used for PECL extensions, and this seems the trend for 
> the future of PHP.
> 
> Regards,
> 
> Rob(inet)
> 
> Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
> 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 
> | TEL 954-607-4296 | FAX 954-337-2695 | 
> Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace 
> |  Web: bestplace.biz  | Web: seo-diy.com
> 
> 
> 
> 
> 


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



Re: [PHP] What's wrong the __autoload()?

2008-03-12 Thread Zoltán Németh
2008. 03. 12, szerda keltezéssel 13.27-kor Greg Donald ezt írta:
> On 3/12/08, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> > ok, I admit I don't have experience with Ruby but I have experience with
> >  php. and I don't have experience with Ruby because I read some manuals
> >  and example codes and whatnot and I just could not get to like it at
> >  all.
> 
> That's a lot different from your previous blanket statement of "Ruby
> as a language just plain sucks".  I hate you less now that I know a
> bit more about you, see how that works?

didn't you notice the smiley at the end of that line? that was not a
serious plain statement but some mocking at you because you made a plain
statement about RoR being better.

> 
> > it's just so strange and different from anything I know (php, c,
> >  java) -
> 
> Ruby has a lot of functional language influence.  Once you use it you
> really start to like how much shorter your iterative loops are for
> example.  The first two developers I worked with using Ruby also knew
> ML and Scheme.  One of them suggested I go study Scheme so I would
> appreciate Ruby more.  I did so for several weeks and now I do.  Ruby
> provides everything from the procedural world we're currently used to
> seeing in PHP, C, and Java, but it also adds functional style that
> makes for some utterly beautiful, compact code.

'utterly beautiful' is again a matter of taste :)
of course, I admit that Ruby would provide me all the features I
currently use, it has to, otherwise noone would start using it instead
of their current language. and yes, I see from the examples that it is
shorter. but is shortness/compactness such a great advantage? I'm not at
all sure about that.

> 
> > and I could not find out any good reasons for most of the
> >  differences...
> 
> And you won't until you use it in practice more than once.  But that's
> true of most any language.  I worked in Python by day for the better
> part of last year and man was it fun seeing other ideas for how to do
> things.

that might be true, but in the last year I've been working on the same
big project, and it seems I will be working on it for this year too, you
know, next versions and such, so at this moment I don't have serious
amount of time to experiment with anything. in fact, I'm also a bit
workaholic and also I'm attending some evening university so I hardly
have time to read a manual completely...

> 
> > e.g. how come function definitions are between 'def' and
> >  'end'?
> 
> def is shorter than PHP's "function" qualifier?  I give up.  'end' is
> optionally replacable with '}',  as is 'do' and '{' but you probably
> didn't ever get to that page in the Ruby book you read.

as I said above, I had/have not much time, so my reading might have been
sloppy... and is shortness that important?

> 
> > I just don't like it and it's a matter of taste,
> 
> In my experience "matter of taste" usually equates to "resistance to
> learning", but call it what you will.

well, there is difference between that. its like if you have a very
limited time frame you can spend on learning, you choose to learn more
of something you like already, no? sure, if I had more time, I would
experiment more with things I don't like or I don't know really.

> 
> > so there is no
> >  need to argue about it more... :)
> 
> There's always reason to argue the features of a given language.  For
> example you may need to try and convince me at some point that Zombie
> is a great language:
> 
> http://www.dangermouse.net/esoteric/zombie.html
> 
> Or not.



> 
> >  however that's not about the framework, I admit that Rails had several
> >  new and useful concepts, and I know that the framework I currently use
> >  took a lot of ideas from there.
> 
> Those other frameworks can never be as powerful as Rails because they
> aren't written in something as meta-capable as Ruby.  Can you do this
> in PHP?
> 
> class Foo
> end
> 
> f = Foo.new
> 
> class Foo
>   Resource.find( :all ).each do |r|
> res = r.name.downcase
> define_method( "op_cost_#{ res }".to_sym ) do
>   self.properties.inject( 0 ){ |c,p| c + p.send( "op_cost_#{ res }" ) }
> end
>   end
> end
> 
> cost = f.op_cost_wheat
> 
> No you can't.  PHP doesn't support adding methods to classes at
> runtime, nor does it support adding methods to instantiated objects of
> those classes at runtime.  And that's just one example.  These sort of
> OO advantages exis

Re: [PHP] What's wrong the __autoload()?

2008-03-12 Thread Zoltán Németh
2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta:
> On 3/12/08, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> > but I strongly think that Ruby as a
> > language just plain sucks ;)
> 
> And exactly how many projects do you have under your belt to allow you
> to develop this opinion?  What's the url to any one of them?
> 
> Unlike you I actually have thousands of lines of Ruby code under my
> belt that allows me to properly develop an opinion of Ruby and Rails
> and how they both compare to every other programming language and
> framework I know and have developed in.  Need a URL?

ok, I admit I don't have experience with Ruby but I have experience with
php. and I don't have experience with Ruby because I read some manuals
and example codes and whatnot and I just could not get to like it at
all. it's just so strange and different from anything I know (php, c,
java) - and I could not find out any good reasons for most of the
differences... e.g. how come function definitions are between 'def' and
'end'? I just don't like it and it's a matter of taste, so there is no
need to argue about it more... :)

however that's not about the framework, I admit that Rails had several
new and useful concepts, and I know that the framework I currently use
took a lot of ideas from there.

greets,
Zoltán Németh

> 
> 
> -- 
> Greg Donald
> http://destiney.com/
> 


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



Re: [PHP] What's wrong the __autoload()?

2008-03-12 Thread Zoltán Németh
2008. 03. 12, szerda keltezéssel 11.12-kor Greg Donald ezt írta:
> On 3/12/08, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > But then you'd end up with something like Ruby on Rails... and we all
> >  know about Ruby on Rails *VOMIT*.
> 
> You clearly don't know much about it or else you wouldn't be bashing
> it.  Period.  Just admit the fact that you're resistant to learn new,
> better ways of doing things and move on.

hey, we had a conversation about this a while back, and I'm still not
convinced about RoR being 'better'. it has several cool ideas, which
some php frameworks also follow now (and a few that would be cool in php
frameworks but not yet implemented), but I strongly think that Ruby as a
language just plain sucks ;)

greets,
Zoltán Németh

> 
> On the other hand, if there's something in Rails you genuinely don't
> understand, I'll be happy to assist you with that particular
> understanding, off-list or wherever, free of charge.
> 
> >  Who wants to be stuck on a track when they can soar with the eagles.
> 
> I dunno, why not ask the many Rails clone authors?  I certainly don't
> see any Ruby programmers trying to copy ZF or Symphony.
> 
> >  > http://en.wikipedia.org/wiki/Convention_over_Configuration
> >
> > Interesting how the article promotes the ideas of both convention and
> >  configuration co-existing so that one doesn't lose versatility. Thus,
> >  one could infer that any good framework would allow both paradigms.
> 
> Rails supports both naturally.  It has configurable environments for
> development, testing, and production, all pre-configured for the most
> common cases.  You can even create your own new environments if you
> have something that doesn't fit into dev/test/prod very easily.
> Complete versatility in every regard thanks to Ruby's meta-ness.
> 
> 
> -- 
> Greg Donald
> http://destiney.com/
> 


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



Re: [PHP] best practices in error handling in PHP

2008-03-12 Thread Zoltán Németh
2008. 03. 12, szerda keltezéssel 07.18-kor It Maq ezt írta:
> Hi,
> 
> I want to know what is the best solution for handling errors. After reading 
> some documents dealing with the subject, i have three options:
> * Using a class for error handling
> * Using PEAR error object
> * Using try and catch exceptions

I would go for try/catch, define different exception classes if
different actions need to be taken, catch them based on their class to
take appropriate action, and catch anything else in the top layer.

greets,
Zoltán Németh

> 
> The error handling i want to implement will be done in a big application that 
> was developed from the beginning without any concern about error handling.
> 
> Thank you
> 
> 
> 
> 
>   
> 
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping


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



Re: [PHP] maintaining [user] state without a session ...

2008-03-11 Thread Zoltán Németh
2008. 03. 11, kedd keltezéssel 12.34-kor Stut ezt írta:
> On 4 Mar 2008, at 13:57, Jochem Maas wrote:
> > Stut mentioned a little while back that he avoids using the built-in  
> > session
> 
> > mechanism if at all possible, but still manages to track user  
> > state ... now I
> > can think of a way or two that he might do that but I was wondering if
> > any one could give an idea about the write way to do it in terms of
> > high performance :-)
> 
> Finally found time to finish the article, sorry for the delay...
> 
> http://stut.net/articles/sessionless_sessions.html
> 
> Constructive criticism welcome.

good article. I've also realized long ago that I only need user id in to
be stored in the session, and also considered storing that in some
encrypted cookie, so I might just take and use your solution if you
don't mind ;)

greets,
Zoltán Németh

> 
> -Stut
> 
> -- 
> http://stut.net/
> 
> 


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



Re: [PHP] /?feed=rss2

2008-03-11 Thread Zoltán Németh
2008. 03. 11, kedd keltezéssel 09.37-kor Richard Heyes ezt írta:
>  > /etch/hosts
> 
> Typo. That should be:
> 
> /etch/hosts

I bet you mean /etc/hosts :)

greets,
Zoltán Németh

> 
> -- 
> Richard Heyes
> Employ me:
> http://www.phpguru.org/cv
> 


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



Re: [PHP] Re: Variable post as array

2008-03-05 Thread Zoltán Németh
2008. 03. 5, szerda keltezéssel 13.42-kor Pieter du Toit ezt írta:
> This is line 49
> 
> $txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
> filesize($txtPhoto)));

add this before:
$txtPhoto = $_FILES['txtPhoto']['tmp_name'];

and don't use addslashes but rather mysql_real_escape_string or whatever
suits your database most

greets,
Zoltán Németh

> 
> the $txtPhoto is the parameter
> 
> ""Angelo Zanetti"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> > What is on line 49?
> >
> > What variable are you passing as the parameter?
> >
> >
> >
> > -Original Message-
> > From: Pieter du Toit [mailto:[EMAIL PROTECTED]
> > Sent: 05 March 2008 13:36
> > To: php-general@lists.php.net
> > Subject: [PHP] Re: Variable post as array
> >
> > This is my problem
> >
> > Warning: fopen() expects parameter 1 to be string, array given in
> > /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49
> >
> > "Colin Guthrie" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> Pieter du Toit wrote:
> >>> Hi
> >>>
> >>> I have this weird problem, when i select a file to upload, the variable
> >>> arrives as an array at the action php file, this is the code, and the
> >>> variable name is txtPhoto
> >>
> >> I'd give a shorter example. People don't want to read through all your
> >> code..
> >>
> >> Also you shoudl post some sort of indication of what you are trying to
> >> do to get the results you describe... just saying "the variable arrives
> >> as an array" and we don't really know how you are accessing "the
> >> variable".
> >>
> >> A short example and expected/actual behaviour listing is good :)
> >>
> >> Col
> >>
> >
> >
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > 
> 
> 
> 


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



Re: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread Zoltán Németh
2008. 03. 4, kedd keltezéssel 18.05-kor Nathan Rixham ezt írta:
> tedd wrote:
> > At 12:15 PM -0500 3/4/08, Daniel Brown wrote:
> >> Amazingly, I do get all of my stuff done.  Granted, I'm in front
> >> of a computer seven days per week, and usually a minimum of 10-12
> >> hours per day, but what else would I do?  Spend time with the
> >> pre-wife?
> > 
> > 
> > You're working on wife 1.0 beta -- wait until you're fully developed 
> > into wife 2.0.
> > 
> > Cheers,
> > 
> > tedd
> > 
> 
> If I ever had any doublt I was reading a programmer's list, I don't now.
> 
> ps: I'm on RC4

I've had a 1.0 a couple of years ago, but after some years it started
causing kernel panic and ended up crashing all my systems... since then
I had only pre-alfa candidates and one RC1, but none of them could
manage to release...

greets,
Zoltán Németh

> 


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



Re: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread Zoltán Németh
2008. 03. 4, kedd keltezéssel 12.15-kor Daniel Brown ezt írta:
> but what else would I do?  Spend time with the
> pre-wife?

sure that's what you should :)

greets,
Zoltán Németh


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



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

2008-02-29 Thread Zoltán Németh
2008. 02. 29, péntek keltezéssel 14.28-kor tedd ezt írta:
> At 4:36 PM +0100 2/29/08, Zoltán Németh wrote:
> >sure, all information belonging to an object is usually in a record of a
> >db.
> >but, you mean include('user_functions.php') automatically loads that
> >data? based on what? a global $user_id variable? if so, I would consider
> >that poor design...
> 
> Whoa there, you don't know what it's doing -- so 
> saying poor design is probably not a good call.
> 
> >  > And thus, two lines instead of three.
> >>
> >>  But in fairness, the user_functions.php would
> >>  establish a connection to the database and the
> >>  function "set_user_name($user, 'tedd')" would
> >>  simply use 'tedd' with respect to whatever
> >>  "$user" is.
> >
> >hmm that means you use only one user's info in the script. that's very
> >limiting.
> 
> Again, you don't know what's being called.
> 
> No reason to be insulting. What I am calling 
> could be a pointer or an id to a record -- BOTH 
> -- of which are no more limited than calling a 
> class. What do you think languages are doing when 
> they call segments of memory for data or function 
> -- you think they pass ton's of variables or just 
> a pointer? So, there's nothing limited here about 
> what I'm doing. Think about it.


hey, no insult intended here... sorry if seemed so.
but, my point was exactly what you stated above. you say 'you don't know
what's being called' - that's the main problem I found with non-oop code
organization. with clearly defined classes every developer knows what he
calls without further explanation.

> 
> >sure you can duplicate with procedural code anything my tons of classes
> >do... but above a certain project size it can easily become a
> >maintenance nightmare and an integration nightmare if there are more
> >than one developers. classes enforce some strict rules to everyone in
> >the team, so teamwork is much more efficient and the resulting codebase
> >is cleaner. I know from experience, as this project with the 400K lines
> >is a rewrite of the previous procedural version, which was developed and
> >maintained by a dozen of developers over the years, and it became such a
> >mess that none of us wants to touch it anymore...
> 
> Again -- the difference here is organizational 
> style. Everything you can do in your classes I 
> can do in my functions. Plus, you can have just 
> the same amount of screw-ups as I can when you 
> introduce more than one programmer and his style 
> into the mix.
> 
> I don't like the tone here -- it appears that 
> because I'm not agreeing with you that my code is 
> limited or of poor design -- because let me 
> assure you it's not!
> 
> So, let's just drop this -- you have your way and I have mine.

again, sorry for the tone if it was wrong - might be because I'm not a
native english speaker, or maybe because this is one of the craziest
fridays ever, I don't know. for sure, I didn't mean it.

and yes, let's drop this, I see I can't convince you.
anyway, I'm not an oop zealot, I just find it so useful and I tried to
explain my view of it - with absolutely no offense intended - so, happy
coding for you with your style and me with mine :)

greets,
Zoltán Németh

> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

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



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

2008-02-29 Thread Zoltán Németh
2008. 02. 29, péntek keltezéssel 10.12-kor tedd ezt írta:
> At 8:52 AM +0100 2/29/08, Zoltán Németh wrote:
> >it's not just that, it's also a different way of thinking about your
> >data. for example say you have a 'user' - you always have one of that ;)
> >in procedural code you would store the properties of the user in an
> >array or whatever, and have an include file with functions to manipulate
> >the user. so why not group those two together in a class?
> >
> >
> >
> >procedural code:
> >include('user_functions.php');
> >$user = load_user_data($userid);
> >$user = set_user_name($user, 'tedd');
> >
> >oop code:
> >include('user.class.php');
> >$user = new User($userid);
> >$user->setName('tedd');
> >
> >
> >
> >see, same number of lines, so no added complexity. however the second
> >one has some advantages:
> >- you don't have to pass around the data since it is grouped together
> >with the method you call
> >- you don't have to worry about some ignorant developer calling
> >set_user_name with, say, a product array - User->setName will always be
> >called on a user object
> >- the second one looks soo better ;) (ok, you said, new paint :) )
> 
> I can understand your oop code very well -- but 
> your procedural code example is lacking.
> 
> First, if I were to have information tied to a 
> user, then I would use MySQL and establish a 
> record with all the fields I needed for that 
> user. My code simply would be:

> include('user_functions.php');
> $user = set_user_name($user, 'tedd');
> 

sure, all information belonging to an object is usually in a record of a
db.
but, you mean include('user_functions.php') automatically loads that
data? based on what? a global $user_id variable? if so, I would consider
that poor design...

> And thus, two lines instead of three.
> 
> But in fairness, the user_functions.php would 
> establish a connection to the database and the 
> function "set_user_name($user, 'tedd')" would 
> simply use 'tedd' with respect to whatever 
> "$user" is.

hmm that means you use only one user's info in the script. that's very
limiting.

> 
> The number of lines of code really doesn't apply 
> with respect to organization value -- after all, 
> the best organization is to document your code 
> which certainly adds lines of "code". Sure, one 
> can argue that remarks are not code, but code 
> without them would be different, so in my mind 
> it's all code.
> 
> I don't think that you can show me an oop example 
> that I can't duplicate procedurally and that's my 
> point. Oop provides a different organization 
> method.

sure you can duplicate with procedural code anything my tons of classes
do... but above a certain project size it can easily become a
maintenance nightmare and an integration nightmare if there are more
than one developers. classes enforce some strict rules to everyone in
the team, so teamwork is much more efficient and the resulting codebase
is cleaner. I know from experience, as this project with the 400K lines
is a rewrite of the previous procedural version, which was developed and
maintained by a dozen of developers over the years, and it became such a
mess that none of us wants to touch it anymore...

greets,
Zoltán Németh

> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

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



Re: [PHP] Re: Sometimes I wonder why I even started programming...

2008-02-29 Thread Zoltán Németh
2008. 02. 29, péntek keltezéssel 10.17-kor Colin Guthrie ezt írta:
> Zoltán Németh wrote:
> > I strongly recommend git. it has several great advantages above cvs or
> > svn. for example, it does not store whole copies of the whole tree if
> > you make a branch, but stores only the differences. it is much faster,
> > and losing a commit is really hard even if you screw things up seriously
> > (I know I've done that a couple of times when I was new to git, but I
> > could manage to restore everything)
> 
> Yeah git is definitely good, I don't deny that, but your comment about
> storing whole copies when you make a branch does not hold true for SVN,
> at least not with that statement... If you make a branch in SVN it is
> free. If you make changes on the branch then commit it and subsequently
> merge that branch back to the trunk/master/whatever *then* SVN will
> store your changes twice, whereas git is cleverererer.

yeah, sure, I wasn't exact.

> 
> I think both have their advantages. For me, until Git integration into
> Trac it's a non-starter as I use Trac heavily to track tickets/bugs,
> time and view the repo etc.

trac integration would be cool, maybe it will happen one day

> 
> The other thing about git particularly for web projects that store
> multiple revisions of binary data (images etc.) is that the git-clone
> could end up taking up much more space than the SVN equiv. Due to the
> fact that a git clone is essentially a full copy of the whole
> repository, rather than just a "checkout" (SVN checkouts store twice as
> much as the raw data but that's a constant).
> 
> I love both systems but for me, I find that web projects with graphics
> that have high churn are more suited to SVN but pure code projects
> (which can include web projects) where branching is done often then git
> wins hands down for features.

yes, it might be true. for us, we have a very large codebase with
minimal amount of binary data, and several branches, so we definitely go
for git

greets,
Zoltán Németh

> 
> My €0.02 :)
> 
> Col
> 

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-29 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 22.42-kor Robert Cummings ezt írta:
> On Thu, 2008-02-28 at 23:52 +, Nathan Rixham wrote:
> > Robert Cummings wrote:
> > > On Thu, 2008-02-28 at 20:43 +, Nathan Rixham wrote:
> > >> [snip]
> > >> Eric Butera wrote:
> > >>> I can hit tab and shift/tab too and it puts in spaces for me.
> > >> [snip]
> > >> Robert Cummings wrote:
> > >>  > Uhhhm, I hit the tab button also and it does the right thing (namely
> > >>  > inserts 4 spaces). Also, when I hit enter it auto tabs.
> > >> [snip]
> > >>
> > >> *kicks zend studio* [and nano and textpad and dreamweaver] :(
> > >>
> > >> what ide's editor's do you two use? zend's use of javaw is killing my 
> > >> win2k3 dev machine anyways.
> > > 
> > > I don't use an IDE. I use JOE. It's a terminal based editor. Works the
> > > same whether I'm local or remote. The nice thing about linux is how easy
> > > it is to make things work the way you want. My browser source viewer
> > > links to a PHP wrapper script that pops up a gnome-terminal with the
> > > specification to load the JOE editor on the page source. My default
> > > editor in linux is JOE. It just works. Plain, simple, 100% keyboard,
> > > keystroke macros, etc, etc. I love it. You probably won't :)
> > 
> > couldn't be further from the truth! sounds perfect - I spend most of my 
> > life in putty anyways, generally using nano to "type".
> 
> I did say probably... you may be the only one ;)
> 
> >   When
> > > working I click an icon on my taskbar, it opens three terminals in my
> > > favourite layout. I usually use one to edit HTML, one to edit whatever
> > > module I'm working on, and another for whatever else needs to be done
> > > (CVS commits, CVS updates, SSH, etc).
> > 
> > see I've only recently started using versioning software all the time, 
> > I'm currenly svn'ing, how does CVS weight up against it?
> 
> I need to look into SVN. I've been meaning to take a look at it for over
> a year now but the motivation isn't terribly strong since CVS does
> everything I need and I have a lot of stuff in CVS. The main problem
> with CVS I see is that it can be pig-assed slow when updating. Also it
> has deficiencies when handling directories. I imagine whenever I get
> around to taking a look at SVN I'll also have a poke at GIT.

I strongly recommend git. it has several great advantages above cvs or
svn. for example, it does not store whole copies of the whole tree if
you make a branch, but stores only the differences. it is much faster,
and losing a commit is really hard even if you screw things up seriously
(I know I've done that a couple of times when I was new to git, but I
could manage to restore everything)

greets,
Zoltán Németh

> 
> > I use a workspace to the right of
> > > my dev workspace in which I load my browser for checking layout and
> > > JavaScript etc. To the left I have a workspace where I keep a tails on
> > > my log files. I rarely tab through more than 3 windows in a workspace
> > > and I rarely use the mouse.
> > > 
> > > Cheers,
> > > Rob.
> > 
> > snap, keyboard for 99% of things, I seem to have my left hand glued 
> > around ctrl/shift/tab/z/x/c/v/q
> >
> > cheers for giving away some of your set up, I'm going to give joe a try!
> 
> No problem.
> 
> Cheers,
> Rob.
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'
> 

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-29 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 20.25-kor Nathan Rixham ezt írta:
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 19:37 +, Stut wrote:
> >> On 28 Feb 2008, at 19:17, Wolf wrote:
> >>> Jason Pruim wrote:
> >>>> My editor automatically replaces like 4 spaces with a tab... Is  
> >>>> there a reason not to use tabs instead of spaces? :)
> >>> I use spaces since when I indent with 4 spaces it is significantly  
> >>> easier to read the code then with 4 tabs...
> >>>
> >>>4 spaces are before this
> >>>   4 tabs are before this
> >>>
> >>> Pretty easy to follow code that does
> >>> {
> >>> {
> >>>  {
> >>>   {
> >>>   }
> >>>  }
> >>> }
> >>> }
> >>>
> >>> Versus the alternative, especially with the character wrapping in vi  
> >>> and other text editors.
> >>>
> >>> At least, that's IMO
> >>>
> >>> YMMV
> >> Except that if I inherit your code and I find it easier if it's  
> >> indented to 8 spaces you've taken that choice away from me. Tabs are  
> >> configurable on nearly all editors that exist in the world. If yours  
> >> doesn't let you change the tab width, get a new one. But if you don't  
> >> care about people who might end up working on your stuff, keep using  
> >> spaces. Just hope you never change your mind.
> > 
> > It's almost a standard across the industry to use spaces. But hey, if
> > you wanna take away my choice to use spaces whenever I work on your code
> > down the very long line, that's fine. I'm just gonna use my JOE editor
> > to fix them and purify any mixed tab/space indentation. If your editor
> > can't do that then you should get a better editor ;)
> > 
> > Cheers,
> > Rob.
> 
> I use tab's in all my code, and replace them with spaces when 
> posting/mailing for legibility.
> 
> couldn't imagine ever hitting space 4/8/12/16+ times to write a line of 
> code when i can just tab/shit+tab to indent.

I use spaces for indentation but never hit the space bar. my editor
converts my tab hits to the configured number of spaces, that's it.

greets,
Zoltán Németh

> 

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



Re: [PHP] auto-wrap on posts

2008-02-29 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 10.38-kor Nathan Nobbe ezt írta:
> On Thu, Feb 28, 2008 at 10:35 AM, David Giragosian <[EMAIL PROTECTED]>
> wrote:
> 
> > On 2/28/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> > > take a look here on the marc archives.
> > > http://marc.info/?l=php-general&m=120415418217911&w=2
> > >
> > > there are several lines that have 1 word only in them, some of the words
> > > (for reference) are access, good, patterns, nested.
> > > when i wrote the post (looking in my gmail client) these words are not
> > on
> > > their own line..
> > > does the post look as it does on marc in your mail clients or are the
> > words
> > > in sentences where they belong ?
> > >
> > > thanks,
> > >
> > > -nathan
> > >
> >
> > Your emails come through to my gmail account as you first described,
> > Nathan, ie, sometimes with just one word on a line, and just like the
> > marc archives.
> 
> 
> thanks, ill just have to be careful editing from gmail then..
> 
> Ray, if I start a thread, I'm fairly sure the list sends the email back to
> > me.
> 
> 
> i dont get an email back until someone replies.

that must be a gmail thing, I get everything back

greets,
Zoltán Németh

> 
> -nathan


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



Re: [PHP] Choose Your Common Design Patterns

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 11.16-kor skylark ezt írta:
> Hi guys,
> 
> Relex a little on the topic "What design patterns do you usually use".
> Choose the ones you use often at: http:// phparch [dot] cn
> And this will answer that question, isn't it?

you should've made the poll with the possibility to vote for more than
one. since you're asking which ones we use, not which one. and most of
us has more than one very frequently used pattern ;)

anyway, I voted for MVC since nowadays I use that one most of the time

greets
Zoltán Németh

> 
> Those options are the ones that we often use. If there is any option needed
> to be replaced, just let me know.
> You can choose 2, 3, 4, ... or even more :-)
> And you can check the result if interested.
> 
> Ill report the results regularly if needed. :)
> 

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



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

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 09.12-kor tedd ezt írta:
> At 8:57 AM +0100 2/28/08, Zoltán Németh wrote:
> >2008. 02. 27, szerda keltezéssel 14.02-kor tedd ezt írta:
> >  > Just about all my code was reduced to functions
> >>  and all functions were placed in files according
> >>  theme. My "main" was probably less than 50 lines
> >>  of code.
> >
> >this is absolutely similar to a well-organized class structure, just
> >replace 'file' with 'class' :)
> 
> and
> 
> >well, if classes are not convenient for you, then sure it would take
> >more time but only for the first time. after that, my experience is that
> >development time is less with classes
> 
> A rose by any other name.
> 
> Outside of being up on the current trend, I don't 
> see much difference -- just new paint on an old 
> thing. I've seen a couple of paint jobs over the 
> years. What I haven't seen is something that I 
> can't do with what I've got.
> 
> Classes only provide me with a different way to 
> organize my code. Sure you can cite data hiding, 
> inheritance, and polymorphism, but I didn't have 
> problems that required those before -- so why 
> should I worry about them now? (however, 
> polymorphism is cool).

> Yes, it's kind of neat to make a class with it's 
> own variables and methods and set a level of 
> abstraction that permits you to not care what is 
> is used for, but I really do that with functions 
> anyway.
> 
> From my perspective, increasing complexity doesn't always make things simpler.

it's not just that, it's also a different way of thinking about your
data. for example say you have a 'user' - you always have one of that ;)
in procedural code you would store the properties of the user in an
array or whatever, and have an include file with functions to manipulate
the user. so why not group those two together in a class?



procedural code:
include('user_functions.php');
$user = load_user_data($userid);
$user = set_user_name($user, 'tedd');

oop code:
include('user.class.php');
$user = new User($userid);
$user->setName('tedd');



see, same number of lines, so no added complexity. however the second
one has some advantages:
- you don't have to pass around the data since it is grouped together
with the method you call
- you don't have to worry about some ignorant developer calling
set_user_name with, say, a product array - User->setName will always be
called on a user object
- the second one looks soo better ;) (ok, you said, new paint :) )

and this example does not illustrate the most powerful advantages of
oop, some of which you already mentioned above, like inheritance, access
control, interfaces, etc

greets
Zoltán Németh

> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

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



Re: [PHP] Guidance

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 04.15-kor Timothy Asiedu ezt írta:
> Dear Sir/Madam,
>
>   Please I would be grateful if you could remove my e-mail address: [EMAIL 
> PROTECTED] from the general Mailing List. 
>
>   I look forward to having a favourable response from you. Thank you.

remove yourself. look at the bottom of this message.

greets,
Zoltán Németh

>
>
>   Best regards,
>
>
>   Timothy Asiedu.
>
>   
> 
> Stut <[EMAIL PROTECTED]> wrote:
>   On 27 Feb 2008, at 21:50, Shawn McKenzie wrote:
> > Shawn McKenzie wrote:
> >> Stut wrote:
> >>> I've interviewed more than my fair share of "web developers" who
> >>> couldn't reverse an array without using array_reverse if their life
> >>> depended on it. Sometimes it really does scare me!
> >>>
> >>> So my experience is that there are far more web developers out there
> >>> than software engineers who do web development, and it's getting 
> >>> harder
> >>> to find decent software engineers to do web-based work at a 
> >>> reasonable
> >>> price. The good ones are rare - so rare in fact that I'm having 
> >>> trouble
> >>> finding one at the moment. If anyone considers themselves a software
> >>> engineer rather than a web developer and would like a job in Windsor
> >>> drop me a note.
> >>>
> >> Job! Now!
> >>
> >> foreach($array as $k => $v) {
> >> $reversed[$v] = $k;
> >> }
> >> $array = $reversed; //optional
> > No wait!
> 
> Yeah, nice try ;)
> 
> Anyways, I assume you're based in the US somewhere so unless you're 
> considering emigrating to the UK you were never in the running.
> 
> -Stut
> 
> -- 
> http://stut.net/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
>
> -
> Never miss a thing.   Make Yahoo your homepage.

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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 11.23-kor Dotan Cohen ezt írta:
> On 28/02/2008, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> >  > Thank you very much, Zoltan. Is there a known UTF-8 limitation?
> >  > Because it works fine for me in English letters (well, the opposite of
> >  > what I needed but I was able to work with it as which polar I start
> >  > with was arbitrary), but not in Hebrew letters. For instance, this
> >  > works as expected:
> >  >
> >  > $test="aabacada aa a f";
> >  > $test=preg_replace('/\b([^\s]+)a\b.*/U', '$1A', $test);
> >  > print $test; // PRINTS aabacadA aA a f
> >  >
> >  > However, this does not:
> >  >
> >  > $test="אאבאגאדא אא א ";
> >  > $test=preg_replace('/\b([^\s]+)ע\b.*/U', '$1א', $test);
> >  > print $test; // PRINTS אאבאגאדא אא א
> >  >
> >  > Am I misunderstanding something, or is there a UTF-8 problem, or
> >  > something else? Thank you for your assistance, it is much appreciated
> >  > and I'm learning what I can.
> >
> >
> > in the above example I don't see the character-to-be-replaced in the
> >  original string, so I'm not surprised it does not get replaced ;)
> 
> It was supposed to be this:
> 
> $test="אאבאגאדא אא א ";
> $test=preg_replace('/\b([^\s]+)א\b.*/U', '$1ע', $test);
> print $test; // PRINTS אאבאגאדא אא א
> 
> But I reversed them while trying a string of different letters, and
> apparently only CTRL-Z'ed part of the code before copying to here.
> Sorry. The code above also does not work. Not on my server, and not at
> spaweditor.com (Thanks for that resource, by the way). You can see the
> result and the exact code used here:
> http://gibberish.co.il/test.html
> 
> >  you can test the regex further here:
> >  http://www.spaweditor.com/scripts/regex/index.php
> 
> Thanks, that is a great resource.
> 
> >  I pasted your data in there (don't be surprised that after posting it
> >  turns them into html entities), replaced the last character to the one
> >  in the regex and the preg_replace worked
> 
> Not for me. These are my parameters:
> 
> Enter regular expression here: /\b([^\s]+)א\b.*/U
> Enter your data here: אאבאגאדא אא א ח
> Enter text to replace matches with here: (backreferences are ok): $1ע
> Regular expression options: PERL
> Function: preg_replace
> Flags: 0 limit

strange, now for a second try it did not work for me either... maybe I
confused some hebrew letters last time...

with html entities it won't work, as a html entity is a set of
characters for the regex interpreter.

anyone utf8 experts in here? I've run out of ideas...

greets,
Zoltán Németh


> 
> I really appreciate the help.
> 
> Dotan Cohen
> 
> http://what-is-what.com
> http://gibberish.co.il
 <א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
> 
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?

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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 00.02-kor Dotan Cohen ezt írta:
> On 27/02/2008, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> >
> > sorry that's messed up a bit, as I typed it right here in my mailer ;)
> >
> >  preg_replace('/\b([^\s]+)a\b.*/U', '$1A', 'whatever i want that hasa a
> >  on the end');
> >
> >  greets
> >
> > Zoltán Németh
> >
> 
> Thank you very much, Zoltan. Is there a known UTF-8 limitation?
> Because it works fine for me in English letters (well, the opposite of
> what I needed but I was able to work with it as which polar I start
> with was arbitrary), but not in Hebrew letters. For instance, this
> works as expected:
> 
> $test="aabacada aa a f";
> $test=preg_replace('/\b([^\s]+)a\b.*/U', '$1A', $test);
> print $test; // PRINTS aabacadA aA a f
> 
> However, this does not:
> 
> $test="אאבאגאדא אא א ";
> $test=preg_replace('/\b([^\s]+)ע\b.*/U', '$1א', $test);
> print $test; // PRINTS אאבאגאדא אא א
> 
> Am I misunderstanding something, or is there a UTF-8 problem, or
> something else? Thank you for your assistance, it is much appreciated
> and I'm learning what I can.

in the above example I don't see the character-to-be-replaced in the
original string, so I'm not surprised it does not get replaced ;)

you can test the regex further here:
http://www.spaweditor.com/scripts/regex/index.php

I pasted your data in there (don't be surprised that after posting it
turns them into html entities), replaced the last character to the one
in the regex and the preg_replace worked

greets
Zoltán Németh

> 
> Dotan Cohen
> 
> http://what-is-what.com
> http://gibberish.co.il
 <א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
> 
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?

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



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

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 14.02-kor tedd ezt írta:
> At 6:32 PM +0100 2/27/08, Zoltán Németh wrote:
> >thanks to its good class structure if we need to modify something we
> >know which file to open and where to modify, even if that class was
> >originally the work of someone else in the team. how would you do that
> >without class structure?
> >
> >greets
> >Zoltán Németh
> 
> Zoltán:
> 
> How? Same as you -- good organization.
> 
> My largest program (a Street Atlas type program 
> for the Mac) was about 10 percent the size of 
> yours (not counting data). But, I was the only 
> programmer. It took me almost two years to write 
> from scratch.
> 
> Just about all my code was reduced to functions 
> and all functions were placed in files according 
> theme. My "main" was probably less than 50 lines 
> of code.

this is absolutely similar to a well-organized class structure, just
replace 'file' with 'class' :)

> 
> I seldom use any globals -- for example, this program had only 4 globals.
> 
> If I needed to modify anything, I knew exactly 
> where to go. That was not a problem.
> 
> I understand how classes work and this project 
> could have been done that way. But, I think it 
> would have taken me longer if I had been forced 
> to use them.

well, if classes are not convenient for you, then sure it would take
more time but only for the first time. after that, my experience is that
development time is less with classes

greets,
Zoltán Németh

> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

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



Re: [PHP] Are these Truthful Proof about PHP ??

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 10.03-kor Dare Williams ezt írta:
> Dear Developers,
>
>   http://msdn2.microsoft.com/en-us/library/aa479002.aspx
>   I read an Article on the above Microsoft website stating the reason why to 
> Migrate from PHP to ASP.NET. So can you please justify this proofs from 
> Microsoft and let everybody knows if they are all TRUE and MEANIFUL atall or 
> they are just cheap lies to backup their product. Please advice?
>

the article is from September 2003. so honestly I did not fully read it,
just scanned the main titles, because it's talking about the state of
php in 2003 (which was some v4.1 or so) - and php now is completely
different.

the other thing is, AFAIK ASP.NET is not just a language but a
framework, which php in itself is not. if someone wanted a comparison,
he should compare with php and a php-based framework (symfony, zend,
etc)

and the third thing is, never believe anything from microsoft ;)

greets,
Zoltán Németh

>   Thanks.
> Williams.
> 
> 
>
> -
> Never miss a thing.   Make Yahoo your homepage.

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



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

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 12.45-kor Nathan Nobbe ezt írta:
> On Wed, Feb 27, 2008 at 12:32 PM, Zoltán Németh <[EMAIL PROTECTED]>
> wrote:
> 
> > 2008. 02. 27, szerda keltezéssel 17.42-kor Aschwin Wesselius ezt írta:
> > > Nathan Nobbe wrote:
> > > > i understand designing for simplicity is key, however, things can only
> > be
> > > > kept
> > > > so simple beyond reason.  the more something does, the more complex it
> > is;
> > > > period.
> > > >
> > > > -nathan
> > >
> > >
> > > Nice touch, but what I'm most afraid of is abstraction layers. It is
> > > good to know what to abstract, but also how it is abstracted and where
> > > it came from.
> > >
> > > Sometimes, abstraction makes it so unbelievable complex, just because of
> > > the sake of abstraction (or over-engineering). Maybe it's just me, but I
> > > like things clean and simple. I can't grasp oversight easily. Especially
> > > when it's someone else's code.
> > >
> > > I do acknowledge the need (or purpose) of OOP, but sometimes you can
> > > make it more clean and simple by getting rid of the clutter. If you
> > > don't know anymore where the code is that you need to edit, you have to
> > > read the code over and over again (parsing it in your head to something
> > > that makes sense). If you have to do this 10, 20 or even 50 times a day
> > > my head explodes.
> > >
> > > I have to deal with spaghetti code from some old code-base every day, it
> > > frustrates me because I can't get inside the head of the programmer who
> > > wrote this trash. Nice patterns, nice classes (not so OOP), no
> > > documentation. It takes to much memory, to much included files (125+),
> > > to many templates, sometimes a 1000+ queries per page (mad!).
> > >
> > > No. Give me procedural code please. I can read that from top to bottom,
> > > it sticks on 1 flow of the processing. Downside is having some code
> > > multiple times all over the place (hence an argument for OOP). But that
> > > saves me time and a huge headache every day. I like it to maintain it
> > > that way. And maybe the programmer after me has to clean it up too. But
> > > refactoring procedural code is way easier that refactoring OOP code is
> > > my opinion.
> > >
> > >
> >
> > nowadays I work on a project which currently has 413415 lines of php
> > code in hundreds of files, part of which are generated by the other
> > part, but at least half of it is coded by us... its well-structured oop,
> > we know we're using some patterns like mvc, singleton, registry, factory
> > and there may be several ones we are using without knowing.
> > now please tell me can you read 413415 lines of code from top to
> > bottom? ;)
> > (and before anybody asks, no that number does not include the framework
> > -symfony- and the orm -propel- we are using, only the propel generated
> > object classes and the classes generated by our generator and the
> > classes written by ourselves)
> >
> > thanks to its good class structure if we need to modify something we
> > know which file to open and where to modify, even if that class was
> > originally the work of someone else in the team. how would you do that
> > without class structure?
> 
> 
> if i were going to design a system consisting largely of functions, i would
> use the same practice i use for designing classes; each function would be
> concise.  that is, if functions became large, eg over 20 - 30 lines (NOTE:
> this value is obviously not a scientific coefficient) then i would probly
> try
> to rethink them.  and per organizing the functions, i would group them in
> files that indicated related functionality.
> if i were to design a procedural system, i would do the same thing still;
> except that each file would essentially be 'a function' and the 'parameters'
> would be the global variables expected by said file.  there would be probly
> some sort of validation script, to ensure required variables were supplied;
> that one would be included a lot ;)
> but for me i choose classes; why; (and im not starting another holy war, for
> real ;)) i started out coding on c++ then to java, now to php;  i suppose i
> never learned, or had any need to learn techniques of building complex
> systems with functions and/or procedural code.  yes, i started out w/ basic
> back on the ti-86 if you really want to get down to it and i had a lot of
> got

Re: [PHP] Multiple Inheritance

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 22.35-kor chetan rane ezt írta:
> Hi All
> 
> Dose anyone know how to implement multiple inheritance in PHP 5.
> Interfaces dosent work . I have already Tried it.
> 

there is no multiple inheritance in php5, but multiple interfaces do
work, I have already tried that ;)

greets
Zoltán Németh

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



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

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 17.42-kor Aschwin Wesselius ezt írta:
> Nathan Nobbe wrote:
> > i understand designing for simplicity is key, however, things can only be
> > kept
> > so simple beyond reason.  the more something does, the more complex it is;
> > period.
> >
> > -nathan
> 
> 
> Nice touch, but what I'm most afraid of is abstraction layers. It is 
> good to know what to abstract, but also how it is abstracted and where 
> it came from.
> 
> Sometimes, abstraction makes it so unbelievable complex, just because of 
> the sake of abstraction (or over-engineering). Maybe it's just me, but I 
> like things clean and simple. I can't grasp oversight easily. Especially 
> when it's someone else's code.
> 
> I do acknowledge the need (or purpose) of OOP, but sometimes you can 
> make it more clean and simple by getting rid of the clutter. If you 
> don't know anymore where the code is that you need to edit, you have to 
> read the code over and over again (parsing it in your head to something 
> that makes sense). If you have to do this 10, 20 or even 50 times a day 
> my head explodes.
> 
> I have to deal with spaghetti code from some old code-base every day, it 
> frustrates me because I can't get inside the head of the programmer who 
> wrote this trash. Nice patterns, nice classes (not so OOP), no 
> documentation. It takes to much memory, to much included files (125+), 
> to many templates, sometimes a 1000+ queries per page (mad!).
> 
> No. Give me procedural code please. I can read that from top to bottom, 
> it sticks on 1 flow of the processing. Downside is having some code 
> multiple times all over the place (hence an argument for OOP). But that 
> saves me time and a huge headache every day. I like it to maintain it 
> that way. And maybe the programmer after me has to clean it up too. But 
> refactoring procedural code is way easier that refactoring OOP code is 
> my opinion.
> 
> 

nowadays I work on a project which currently has 413415 lines of php
code in hundreds of files, part of which are generated by the other
part, but at least half of it is coded by us... its well-structured oop,
we know we're using some patterns like mvc, singleton, registry, factory
and there may be several ones we are using without knowing.
now please tell me can you read 413415 lines of code from top to
bottom? ;)
(and before anybody asks, no that number does not include the framework
-symfony- and the orm -propel- we are using, only the propel generated
object classes and the classes generated by our generator and the
classes written by ourselves)

thanks to its good class structure if we need to modify something we
know which file to open and where to modify, even if that class was
originally the work of someone else in the team. how would you do that
without class structure?

greets
Zoltán Németh

> 
> 
> -- 
> Aschwin Wesselius
> 
> 
> 
> What you would like to be done to you, do that to the other
> 
> 
> 

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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 13.51-kor Zoltán Németh ezt írta:
> 2008. 02. 27, szerda keltezéssel 12.46-kor Dotan Cohen ezt írta:
> > Hi all, it's been a while since I've written with a regex problem.
> > This time, I'm stumped.
> > 
> > I've got some text that needs to have five letters, if found not at
> > the end of a word, to be replaced with different letters. For
> > instance, should the letter "a" be found at the end of a word, leave
> > it alone. Should the letter "a" be found anywhere else in the word
> > (beginning, middle, or by itself) then change it into "A". Sound
> > frustrating? It is, at least to me. Can someone help out?
> 
> echo preg_replace('/\b[^\s]+a\b.*/U', 'A', 'whatever i want that hasa a
> on the end');

sorry that's messed up a bit, as I typed it right here in my mailer ;)

preg_replace('/\b([^\s]+)a\b.*/U', '$1A', 'whatever i want that hasa a
on the end');

greets
Zoltán Németh

> 
> if you want to replace standalone 'a'-s too, change the pattern to
> '/\b[^\s]*a\b.*/U'
> 
> look up the meaning of \b here, that's what you missed I think:
> http://hu.php.net/manual/en/reference.pcre.pattern.syntax.php
> 
> and also the meaning of the U modifier here:
> http://hu.php.net/manual/en/reference.pcre.pattern.modifiers.php
> 
> greets
> Zoltán Németh
> 
> > 
> > For those who want more details for curiosity's sake, I'm writing a
> > Hebrew transliteration engine for the gibberish.co.il website. This
> > function will handle the Final Letter situations.
> > 
> > Thanks in advance.
> > 
> > Dotan Cohen
> > 
> > http://what-is-what.com
> > http://gibberish.co.il
 < <א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
> > 
> > A: Because it messes up the order in which people normally read text.
> > Q: Why is top-posting such a bad thing?
> 

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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 12.46-kor Dotan Cohen ezt írta:
> Hi all, it's been a while since I've written with a regex problem.
> This time, I'm stumped.
> 
> I've got some text that needs to have five letters, if found not at
> the end of a word, to be replaced with different letters. For
> instance, should the letter "a" be found at the end of a word, leave
> it alone. Should the letter "a" be found anywhere else in the word
> (beginning, middle, or by itself) then change it into "A". Sound
> frustrating? It is, at least to me. Can someone help out?

echo preg_replace('/\b[^\s]+a\b.*/U', 'A', 'whatever i want that hasa a
on the end');

if you want to replace standalone 'a'-s too, change the pattern to
'/\b[^\s]*a\b.*/U'

look up the meaning of \b here, that's what you missed I think:
http://hu.php.net/manual/en/reference.pcre.pattern.syntax.php

and also the meaning of the U modifier here:
http://hu.php.net/manual/en/reference.pcre.pattern.modifiers.php

greets
Zoltán Németh

> 
> For those who want more details for curiosity's sake, I'm writing a
> Hebrew transliteration engine for the gibberish.co.il website. This
> function will handle the Final Letter situations.
> 
> Thanks in advance.
> 
> Dotan Cohen
> 
> http://what-is-what.com
> http://gibberish.co.il
 <א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
> 
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?

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



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

2008-02-27 Thread Zoltán Németh
2008. 02. 27, szerda keltezéssel 19.50-kor skylark ezt írta:
> Hi guys,
> 
> What design patterns do you usually use?
> 

whichever seems fit to the situation ;)
for me its most often singleton, registry, factory, activerecord

and you could also read the thread about these last week...

greets
Zoltán Németh

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



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

2008-02-27 Thread Zoltán Németh
2008. 02. 26, kedd keltezéssel 11.27-kor Daniel Brown ezt írta:
> On Tue, Feb 26, 2008 at 10:57 AM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >  Marriage?? That's for backwards people stuck in ancient pointless
> >  traditions >:) And moreso in today's culture... it's just a commercial
> >  suckfest when your money could better go to student loans and raising a
> >  family.
> 
> http://debianddan.com/
> 
> CC: Debs
> 

congratulations :)

greets
Zoltán Németh

> -- 
> 
> 
> Daniel P. Brown
> Senior Unix Geek
> 
> 

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



Re: [PHP] RE: temprorary error

2008-02-25 Thread Zoltán Németh
2008. 02. 24, vasárnap keltezéssel 15.55-kor tedd ezt írta:
> At 7:38 PM +0100 2/24/08, Zoltán Németh wrote:
> >2008. 02. 24, vasárnap keltezéssel 09.59-kor Mary Anderson ezt írta:
> >>  Hey guys,
> >>   Isn't this thread a bit OT?
> >
> >well, for a php list sure it is... but not the first one, and it seems
> >to me that many members of the list are interested in it...
> >
> >>   Anyway, as  areligious person I have to say that I really do not
> >>  like to hear religions trashed and smeared the way you are doing.  And
> >>  just for the record, we Quakers do not believe God tells us to kill
> >>  people and we have no priests.
> >
> >actually I think there was no trashing and smearing here, only some
> >decent talking about religion and some humor (the 'rewrite the bible'
> >site)
> 
> 
> I'm sure you'll get an argument over the "no trashing and smearing here" 
> claim.
> 
> But, in your defense, you probably don't realize 
> the disrespect shown, or that's perceived by 
> others, regarding beliefs.
> 
> It's a touchy subject and usually not one to 
> discuss with a wide range of different beliefs, 
> some of which hold other's beliefs in low esteem 
> -- as does the 'rewrite the bible' site. 
> Incidentally, which started the religious portion 
> of this thread.

you know, for me now it looks like the case of the Muhammad cartoons.
nobody meant any offense but it seems its offending for someone...
however I don't know why.
anyway, lets drop this thread.

greets
Zoltán Németh

> 
> I think we've about beat this to death, so we can 
> let it go and get our collective thoughts back to 
> more worldly endeavors. Besides, I'm starting to 
> get emails from the OT police, which I tend to 
> agree with.
> 
> Cheers,
> 
> tedd

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



Re: [PHP] RE: temprorary error

2008-02-24 Thread Zoltán Németh
2008. 02. 24, vasárnap keltezéssel 09.59-kor Mary Anderson ezt írta:
> Hey guys,
>  Isn't this thread a bit OT?

well, for a php list sure it is... but not the first one, and it seems
to me that many members of the list are interested in it...

>  Anyway, as  areligious person I have to say that I really do not 
> like to hear religions trashed and smeared the way you are doing.  And 
> just for the record, we Quakers do not believe God tells us to kill 
> people and we have no priests.

actually I think there was no trashing and smearing here, only some
decent talking about religion and some humor (the 'rewrite the bible'
site)

greets
Zoltán Németh

> 
> Mary Anderson
> 

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



Re: [PHP] Re: temporary error

2008-02-24 Thread Zoltán Németh
2008. 02. 22, péntek keltezéssel 14.49-kor Greg Donald ezt írta:
> On 2/22/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
> > So help me God
> 
> Speaking of imaginary things, check out this new site I built few weeks back:
> 
> http://rewriteproject.com/
> 
> I do believe I am the first person to ever "tag cloud" a bible  :)

hehe that site rocks :)

greets
Zoltán Németh

> 
> 
> -- 
> Greg Donald
> http://destiney.com/
> 

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



Re: [PHP] PHP: Ajax send()

2008-02-22 Thread Zoltán Németh
please reply to the list also...

2008. 02. 22, péntek keltezéssel 15.25-kor germana ezt írta:
> nuevoAjax() is the name of the ajax object :P  in spanish

OK, but that does not tell me anything about what kind of ajax library
you're using... anyway, maybe it's better to ask on an ajax list because
this is clearly not a php problem

greets
Zoltán Németh

> 
> On Fri, 2008-02-22 at 20:54 +0100, Zoltán Németh wrote: 
> > 2008. 02. 22, péntek keltezéssel 14.32-kor germana ezt írta:
> > > So... i was checking my localhost with wireshark (a sniffer) and i
> > > found that the DATA is send after the POST ¿¿¿ i dont understand
> > > why the data is not send completly.
> > 
> > the problem must be in your ajax library... I don't know what kind of
> > ajax scripts you use, I've never seen 'nuevoAjax' before, but its
> > clearly a problem with your javascript, not php. correctly sent requests
> > contain the post data, so $_POST is not empty if you send anything
> > 
> > greets
> > Zoltán Németh
> > 
> > > 
> > > 
> > > 
> > > if i do var_dump($_POST) is: array(0){}
> > > 
> > > On Fri, 2008-02-22 at 17:41 +0100, Zoltán Németh wrote: 
> > > > 2008. 02. 22, péntek keltezéssel 12.03-kor germana ezt írta:
> > > > > Hi!!
> > > > > 
> > > > > Im trying to sent data to and php with Ajax, so..
> > > > > this is what im sending>_url= "table='historia'$'='$''$'string'$''&";
> > > > > 
> > > > > then i do:
> > > > > 
> > > > > _url = _url.substring(0,_url.length-1)  //quita el & de sobra al final
> > > > > var ajax = nuevoAjax();
> > > > >   ajax.open("POST", "atrapalo_x.php", true);
> > > > >   ajax.setRequestHeader("Content-Type",
> > > > > "aplication/x-www-form-urlencoded");
> > > > >   ajax.send(_url);
> > > > >   
> > > > >   ajax.onreadystatechange = function()
> > > > >   {
> > > > >   if(ajax.readyState == 4)
> > > > >   {
> > > > >   alert(ajax.responseText)
> > > > >         .
> > > > > .
> > > > > .
> > > > > ..
> > > > > 
> > > > > and in the php i do:
> > > > > 
> > > > > $datafield=explode("$",str_replace("\'","'",$_POST["table"]));
> > > > > $main_table="".str_replace("'","",$datafield[0])."";
> > > > > $main_table=strtolower($main_table);
> > > > > 
> > > > > but when i do and echo $datafield[0] or echo $main_table
> > > > > 
> > > > > it returns  nothing... just blank
> > > > > 
> > > > 
> > > > and if you var_dump($_POST) what does it show?
> > > > 
> > > > greets
> > > > Zoltán Németh
> > > > 
> > > > > 
> > > > 
> > 

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



Re: [PHP] Date Function

2008-02-22 Thread Zoltán Németh
2008. 02. 22, péntek keltezéssel 11.48-kor VamVan ezt írta:
> Hi All,
> 
> Greetings!!
> 
> A small PHP Script for help
> 
>  $date_format = '02/22/2008 14:00:00';
> 
> $start_date =  date("Y-m-d h:i:s", strtotime($date_format));

$start_date =  date("Y-m-d H:i:s", strtotime($date_format));

RTFM: http://hu.php.net/date ;)

greets
Zoltán Németh

> echo $start_date;
> ?>
> 
> output is 2008-02-22 02:00:00
> 
> but not 2008-02-22 14:00:00
> 
> How can i get my output as 2008-02-22 14:00:00.
> 
> Thanks
> V
> 

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



Re: [PHP] PHP: Ajax send()

2008-02-22 Thread Zoltán Németh
2008. 02. 22, péntek keltezéssel 14.32-kor germana ezt írta:
> So... i was checking my localhost with wireshark (a sniffer) and i
> found that the DATA is send after the POST ¿¿¿ i dont understand
> why the data is not send completly.

the problem must be in your ajax library... I don't know what kind of
ajax scripts you use, I've never seen 'nuevoAjax' before, but its
clearly a problem with your javascript, not php. correctly sent requests
contain the post data, so $_POST is not empty if you send anything

greets
Zoltán Németh

> 
> 
> 
> if i do var_dump($_POST) is: array(0){}
> 
> On Fri, 2008-02-22 at 17:41 +0100, Zoltán Németh wrote: 
> > 2008. 02. 22, péntek keltezéssel 12.03-kor germana ezt írta:
> > > Hi!!
> > > 
> > > Im trying to sent data to and php with Ajax, so..
> > > this is what im sending>_url= "table='historia'$'='$''$'string'$''&";
> > > 
> > > then i do:
> > > 
> > > _url = _url.substring(0,_url.length-1)  //quita el & de sobra al final
> > > var ajax = nuevoAjax();
> > >   ajax.open("POST", "atrapalo_x.php", true);
> > >   ajax.setRequestHeader("Content-Type",
> > > "aplication/x-www-form-urlencoded");
> > >   ajax.send(_url);
> > >   
> > >   ajax.onreadystatechange = function()
> > >   {
> > >   if(ajax.readyState == 4)
> > >   {
> > >   alert(ajax.responseText)
> > > .
> > > .
> > > .
> > > ..
> > > 
> > > and in the php i do:
> > > 
> > > $datafield=explode("$",str_replace("\'","'",$_POST["table"]));
> > > $main_table="".str_replace("'","",$datafield[0])."";
> > > $main_table=strtolower($main_table);
> > > 
> > > but when i do and echo $datafield[0] or echo $main_table
> > > 
> > > it returns  nothing... just blank
> > > 
> > 
> > and if you var_dump($_POST) what does it show?
> > 
> > greets
> > Zoltán Németh
> > 
> > > 
> > 

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



Re: [PHP] PHP: Ajax send()

2008-02-22 Thread Zoltán Németh
2008. 02. 22, péntek keltezéssel 12.03-kor germana ezt írta:
> Hi!!
> 
> Im trying to sent data to and php with Ajax, so..
> this is what im sending>_url= "table='historia'$'='$''$'string'$''&";
> 
> then i do:
> 
> _url = _url.substring(0,_url.length-1)  //quita el & de sobra al final
> var ajax = nuevoAjax();
>   ajax.open("POST", "atrapalo_x.php", true);
>   ajax.setRequestHeader("Content-Type",
> "aplication/x-www-form-urlencoded");
>   ajax.send(_url);
>   
>   ajax.onreadystatechange = function()
>   {
>   if(ajax.readyState == 4)
>   {
>   alert(ajax.responseText)
> .
> .
> .
> ..
> 
> and in the php i do:
> 
> $datafield=explode("$",str_replace("\'","'",$_POST["table"]));
> $main_table="".str_replace("'","",$datafield[0])."";
> $main_table=strtolower($main_table);
> 
> but when i do and echo $datafield[0] or echo $main_table
> 
> it returns  nothing... just blank
> 

and if you var_dump($_POST) what does it show?

greets
Zoltán Németh

> 

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



Re: [PHP] Help on running external command

2008-02-20 Thread Zoltán Németh
2008. 02. 20, szerda keltezéssel 14.31-kor Mário Gamito ezt írta:
> Hi,
> 
> I need to run an eternal command from a PHP page.
> 
> My code is:
> "
> $username= 'lixo';
> 
> $username = 'lixo';
> 
> exec('su - vpopmail -c 
> "/var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/" . $username');
> "
> 
> But I get the error:
> "/var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/: Not a 
> directory"
> 
> Which means that the $username variable isn't being appended to the string.

you're putting . and a variable inside a string delimited by ' which
will never work.
to avoid confusion like this, why not build the string first, then
exec() it? that way you can always echo out the string to check what
might be the problem.

$cmd = 'su -
vpopmail /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/' .
$username;

exec($cmd);

greets
Zoltán Németh

> 
> Any help would be appreciated.
> 
> Warm Regards,
> Mário Gamito
> 

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



Re: [PHP] Re: unable to unset reference

2008-02-20 Thread Zoltán Németh
2008. 02. 19, kedd keltezéssel 13.39-kor Shawn McKenzie ezt írta:
> Sylvain Rabot wrote:
> > Hello,
> > 
> > First of all I would like to know if one day we will be able to unset
> > $this into a class in order to destroy the object. It could really be
> > useful to prevent big memory usage.
> > 
> > As it can't be done I tried to unset an object by unsetting a reference
> > of this object but it has no effect on the object but only on the
> > reference.
> > 
> > Should unset destroy the reference itself and the object ???
> > 
> > if you don't think so can you think of something different to destroy
> > both of them like I don't know, destroy($obejctsreference)
> > 
> > Regards.
> > 
> > Reproduce code:
> > ---
> >  > 
> > $x = new stdClass();
> > $x->a = 'ayayaye';
> > 
> > $b[0] =& $x;
> > 
> > unset($b[0]);
> > 
> > var_dump($x);
> > 
> > ?>
> > 
> > Expected result:
> > 
> > NULL
> > 
> > Actual result:
> > --
> > object(stdClass)#1 (1) {
> >   ["a"]=>
> >   string(7) "ayayaye"
> > } 
> 
> So if you unset a reference you are dereferencing it.  If you want to
> unset both, then unset the object, in this case $x.

I think he should unset all references to the object, $x and $b[0] as
well.

greets
Zoltán Németh

> 
> -Shawn
> 

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Zoltán Németh
2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:
> Richard Heyes wrote:
> > Shawn McKenzie wrote:
> >> nihilism machine wrote:
> >>> I have a user saving a VARCHAR(255) field in a mysql db which has single
> >>> quotes in the text, how can i replace them so that they dont fuck up my
> >>> mysql command?
> >>>
> >>> -e
> >>
> >>
> >> Have you tried:  dont_fuck_up_my_mysql_command()
> > 
> > Hrmph, I can't seem to find that in the manual...
> > 
> 
> it's been depricated I heard in favour of unfuck();
> 

as I remember its also in SPL.
$whatever = new MySqlCommandUnFucker($command);
$whatever->unFuck();

:D

greets
Zoltán Németh

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



Re: [PHP] Call PHP script from MySQL

2008-02-19 Thread Zoltán Németh
2008. 02. 19, kedd keltezéssel 21.08-kor Mário Gamito ezt írta:
> Hi,
> 
> Is it possible to call from within MySQL an external PHP script ?
> I've read "MySQL Stored Procedure Programming" from O'Reilly but found 
> nothing :(
> 
> How can I do this ?

I think from MySQL you can not call outside applications.

greets
Zoltán Németh

> 
> Any help would be appreciated.
> 
> Warm Regards,
> Mário Gamito
> 

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



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread Zoltán Németh
2008. 02. 18, hétfő keltezéssel 13.59-kor julian ezt írta:
> 
> Hi,
> 
> I have an application that along  filling in some forms, it produces a 
> pdf file, as confirmation of all entered data.
> 
> I want to send this pdf file to a different window/tab of the browser, 
> so it is displayed and can latter be printed.
> 
> In the mean time, the original window contains a confirmation message, 
> to continue with the work flow.
> 
> I would like to do this without use of JavaScript

I don't think you can do that...

greets
Zoltán Németh

> 
> Any combination of headers ??
> 
> Any hints appreciated.
> 
> JCG
> 

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



Re: [PHP] XSLTProcessor without validation

2008-02-15 Thread Zoltán Németh
2008. 02. 15, péntek keltezéssel 07.54-kor Siegfried Gipp ezt írta:
> Am Donnerstag, 14. Februar 2008 21:01:42 schrieb Richard Lynch:
> 
> > You could also consider filing a "Feature Request" in
> > http://bugs.php.net/
> Well, the bug reporting page has a bug. A graphical captcha is needed, but 
> there is no such captcha. Repetitive loading does not change this.
> 
> From an accessibility point of view graphical captchas are a bad idea. Not 
> existing, but required graphical captchas are an even worse idea. This way 
> the bug report mechanism is essentially 100% inaccessible :)

you mean this page?
http://bugs.php.net/report.php

the captcha is clearly there for me (firefox, ubuntu linux)... however
if it is not there in every browser that's a bug which should be
reported :)

greets
Zoltán Németh

> 
> Regards
> Siegfried
> 

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



Re: [PHP] Static variable in a class method

2008-02-14 Thread Zoltán Németh
2008. 02. 14, csütörtök keltezéssel 14.07-kor Richard Lynch ezt írta:
> On Thu, February 14, 2008 11:10 am, Eric Butera wrote:
> > Just FYI the static keyword was quite popular in PHP4 for the
> > singleton pattern.  You could do something like:
> 
> I have used and will continue to use the static keyword in functions,
> and will most likely never use a class in PHP...
> 
> If a website is complicated enough to need a class hierarchy, then
> something is wrong in your Design. :-) :-) :-)

who said we make websites with all those classes and frameworks? ;)

greets
Zoltán Németh

> 
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
> 

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



Re: [PHP] Template system in PHP

2008-02-14 Thread Zoltán Németh

> REST is the new SOAP.  Yaml is the new XML.  I'm guessing this news
> just hasn't made it into any PHP frameworks yet.

that's a very oversimplifying statement.
REST is good for small requests and stuff but there are cases when SOAP
is needed (at least in cases when you have to connect to some external
app with SOAP interface)
YAML is good for configuration files and stuff like that, but in no way
is replacement for XML, which is much more flexible and has the DOM API
which is very powerful.

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

greets
Zoltán Németh

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



Re: [PHP] Exception handling with file()

2008-02-11 Thread Zoltán Németh
2008. 02. 11, hétfő keltezéssel 14.34-kor John Papas ezt írta:
> I need to open a remote file with file() and I would like to put it
> inside a try-catch but as far as I can tell file() does not raise an
> exception if it fails. The following code:
> 
>   try {
>  $data = file('http://myserver.com/myfile.txt');
$data = @file('http://myserver.com/myfile.txt');
if ($data === FALSE) throw new Exception('whatever');


hope that helps
Zoltán Németh

>  $date = substr($data, 0);
>   } catch (Exception $e) {
>  $data = "it failed";
>   }
>   
>   echo $data;
> 
> echoes a warning:
> 
>   Warning: file('http://myserver.com/myfile.txt') [function.file]:
> failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
> in.
> 

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



Re: [PHP] PEAR website and MSIE 6

2008-02-11 Thread Zoltán Németh
2008. 02. 1, péntek keltezéssel 04.40-kor Robert Cummings ezt írta:
> On Fri, 2008-02-01 at 10:11 +0100, Zoltán Németh wrote:
> > 2008. 01. 31, csütörtök keltezéssel 12.47-kor Robert Cummings ezt írta:
> > > On Thu, 2008-01-31 at 18:18 +0100, Jochem Maas wrote:
> > > > Eric Butera schreef:
> > > > > On Jan 31, 2008 12:02 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> > > > >> Robert Cummings schreef:
> > > > >>> On Thu, 2008-01-31 at 17:14 +0100, Jochem Maas wrote:
> > > > >>>> let's not forget that nobody outside of IT actually uses Opera
> > > > >>> Please back up that st-ass-tistic please. Methinks you reached 
> > > > >>> around
> > > > >>> and pulled it out of your lightless nether regions.
> > > > >> given that you can prove anything with statistics, I'd say that's 
> > > > >> where
> > > > >> all stats come from - well not all from my ass but always someone's 
> > > > >> ;-)
> > > > >>
> > > > >> let me guess you use Opera ... and you work in IT right? :-P
> > > > >>
> > > > >>> Cheers,
> > > > >>> Rob.
> > > > >>
> > > > > 
> > > > > My wife uses Opera and she doesn't know much about computers.  I
> > > > > installed IE7, FF, Opera, & Safari for Windows and she picked Opera on
> > > > > her own.  I can't really get into it though.
> > > > 
> > > > I guess the shitty interface is appealing to people with more taste 
> > > > than us :-)
> > > > Steve Job's would be annoyed though - which is funny in and of itself 
> > > > :-P
> > > 
> > > I dunno, Opera comes with a built in flag for disabling that wretching
> > > thing called tabbed browsing. Firefox requires you to install a plugin.
> > 
> > ahh the Great Browser Holy War :)
> > I must join in...
> > 
> > I never wanted to turn tabbed browsing off (in fact I find it useful and
> > convenient), so it is not a real concern
> > 
> > > Also, I find the configurability of Opera's interface to be superior to
> > > what I last used for Firefox.
> > 
> > okay, then how do you stop Opera caching? I tried to turn it off
> > everywhere but it keeps on creating local files while I browse.
> > (ubuntu linux/opera 9.25)
> 
> I never noticed that before... with a little ingenuity though I found the
> following to be successful:
> 
> cd ~/.opera
> sudo chown root:root cache4
> sudo chmod 000 cache4
> 
> ;)

that indeed does work, at least in the last few days opera couldn't work
it around ;)
however it is not a proof of the superior configurability...

aside from that, does anyone know some plugin for Opera which does the
same as AdBlock Plus does for FF?

greets
Zoltán Németh

> 
> Cheers,
> Rob.

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



Re: [PHP] mysql question #2

2008-02-10 Thread Zoltán Németh
2008. 02. 10, vasárnap keltezéssel 13.12-kor nihilism machine ezt írta:
> Ok, I read the php.net info. so with this function though:
> 
>   public function select_one($sql) {
>   $this->last_query = $sql;
>   $r = mysql_query($sql);
>   if (!$r) {
>   $this->last_error = mysql_error();
>   return false;
>   }
>   if (mysql_num_rows($r) != 1) {
>   return false;   
>   }
>   $ret = mysql_result($r, 0);
>   mysql_free_result($r);
>   if ($this->auto_slashes) {
>   return stripslashes($ret);
>   } else {
>   return $ret;
>   }
>   }
> 
> 
> how can i get the contents of a column in the returned row say for  
> something called "Email" as the column name. here is my code now:
> 
>  // Attempt to login a user
>   public function CheckValidUser($Email, $Password) {
>   $PasswordEncoded = $this->encode($Password);
>   $sql = "SELECT * FROM CMS_Users WHERE Email='$Email' AND  
> Password='$PasswordEncoded'";
>   $result = $this->DB->select_one($sql);
>   if ($result) {
>   // User info stored in Sessions
>   $_SESSION['Status'] = "loggedIn";
>   $_SESSION['ID'] = $row['ID'];
>   $_SESSION['Email'] = $row['Email'];
>   $_SESSION['AdminLevel'] = $row['AdminLevel'];
>   $_SESSION['FirstName'] = $row['FirstName'];
>   $_SESSION['LastName'] = $row['LastName'];
>   return true;
>   } else {
>   return false;
>   }
>   }
> 

it seems to me you do not want a real 'select_one' but instead a
'select_one_row'

like this:

public function select_one_row($sql) {
$this->last_query = $sql;
$r = mysql_query($sql);
if (!$r) {
$this->last_error = mysql_error();
return false;
}
if (mysql_num_rows($r) != 1) {
return false;   
}
$ret = mysql_fetch_assoc($r);
mysql_free_result($r);
if ($this->auto_slashes) {
return array_map('stripslashes', $ret);
} else {
return $ret;
}
}

and then you would call it in your code like:

public function CheckValidUser($Email, $Password) {
$PasswordEncoded = $this->encode($Password);
$sql = "SELECT * FROM CMS_Users WHERE Email='$Email'
AND  
Password='$PasswordEncoded'";
$row = $this->DB->select_one_row($sql);
if ($row) {
// User info stored in Sessions
$_SESSION['Status'] = "loggedIn";
$_SESSION['ID'] = $row['ID'];
$_SESSION['Email'] = $row['Email'];
$_SESSION['AdminLevel'] = $row['AdminLevel'];
$_SESSION['FirstName'] = $row['FirstName'];
$_SESSION['LastName'] = $row['LastName'];
return true;
} else {
return false;
}
}


note the changes:
- use of mysql_fetch_assoc in the select_one_row function
- putting the return value of the function into $row and then using that
between the if function

// this above might contain bugs as I just wrote it up here in my mailer

greets
Zoltán Németh

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



Re: [PHP] fgets???

2008-02-08 Thread Zoltán Németh
2008. 02. 8, péntek keltezéssel 12.46-kor Daniel Brown ezt írta:
> On Feb 8, 2008 12:35 PM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> 
> I knew it.   After silence, Lynch comes back with a vengeance
> three hours before the week's stats come out.
> 
> And not only that he top-posts.  ;-P

Wait, this might not be the real Lynch, but his new AI instead, not
programmed yet for bottom posting :)

greets
Zoltán Németh

> 
> -- 
> 
> 
> Daniel P. Brown
> Senior Unix Geek
> 
> 

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



Re: [PHP] fgets???

2008-02-08 Thread Zoltán Németh
2008. 02. 8, péntek keltezéssel 12.17-kor Daniel Brown ezt írta:
> On Feb 8, 2008 12:11 PM, Pastor Steve <[EMAIL PROTECTED]> wrote:
> > I think I may have written the question wrong. I only want to display the
> > first line. It is a news story with a headline. I only want to display the
> > headline in the link.
> >
> > The output I want is:
> >
> > The
> >
> > But I am getting:
> >
> > The file looks like this.
> >
> > Does that make more sense?
> 
>  $handle = fopen($filename);
> $data = fgets($handle);
> echo $data."\n";
> ?>
> 
> So long as you don't do a while() loop or something similar,
> fgets() will only read the first line.

sure, and much more efficient than my last letter, so ignore that...
its friday, and late, and I'm still at work, so my mind is not on the
top now... :)

greets
Zoltán Németh

> 

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



Re: [PHP] fgets???

2008-02-08 Thread Zoltán Németh
2008. 02. 8, péntek keltezéssel 11.11-kor Pastor Steve ezt írta:
> I think I may have written the question wrong. I only want to display
> the first line. It is a news story with a headline. I only want to
> display the headline in the link.
> 
> The output I want is:
> 
> The
> 
> But I am getting:
> 
> The file looks like this.
> 
> Does that make more sense?

in that case why not read the file as an array of lines and display the
first line?
$f = file('whatever.txt');
echo $f[0];

http://hu.php.net/file

greets
Zoltán Németh

> 
> Thanks,
> 
> --
> Steve M.
> 
> on 2/8/08 11:03 AM Zoltán Németh ([EMAIL PROTECTED]) wrote:
> 
> 2008. 02. 8, péntek keltezéssel 10.54-kor Pastor Steve ezt
> írta:
> > Is it possible to read each line of data from a file?
> > 
> > I have a text file that has several lines on it. I only want
> to display the
> > first line only.
> > 
> > The 
> > file I have 
> > looks like this.
> > 
> > But outputs:
> > 
> > "The file I have looks like this."
> 
> you need nl2br()
> http://hu.php.net/nl2br
> 
> greets
> Zoltán Németh
> 
> > 
> > Here is my code:
> > 
> >  > 
> > 
> > 
> > $dir = "path/to/files/";
> > 
> > // set pattern
> > $pattern = ".txt*|.TXT*";
> > 
> > // open directory and parse file list
> > if (is_dir($dir))
> > {
> > if ($dh = opendir($dir))
> > {
> > 
> > echo " Roman, Times,
> > serif; font-size: 12px; width: 290px;\">
> >  padding: 3px;\">
> > Breaking News
> > Please check here often for breaking news
> stories.
> > 
> > 
> > 
> > ";
> > 
> > // iterate over file list
> > while (($filename = readdir($dh)) !== false)
> > {
> > // if filename matches search pattern, print it
> > if (ereg($pattern, $filename))
> >if(strpos($filename,'.')>0)
> >
> > //  if ($filename = str_replace('.html','',$filename))
> > 
> > {
> > $fh = fopen($dir . $filename, 'r');
> > $filehead = fread($fh, 72);
> > fclose($fh);
> > echo " > href=\"/breaking_news/$filename\">".$filehead."";
> > }
> > }
> > echo "
> > 
> > ";
> > 
> > // close directory
> > closedir($dh);
> > }
> > }
> > 
> > ?>
> > 
> 
> 

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



Re: [PHP] fgets???

2008-02-08 Thread Zoltán Németh
2008. 02. 8, péntek keltezéssel 10.54-kor Pastor Steve ezt írta:
> Is it possible to read each line of data from a file?
> 
> I have a text file that has several lines on it. I only want to display the
> first line only.
> 
> The 
> file I have 
> looks like this.
> 
> But outputs:
> 
> "The file I have looks like this."

you need nl2br()
http://hu.php.net/nl2br

greets
Zoltán Németh

> 
> Here is my code:
> 
>  
> 
> 
> $dir = "path/to/files/";
> 
> // set pattern
> $pattern = ".txt*|.TXT*";
> 
> // open directory and parse file list
> if (is_dir($dir))
> {
> if ($dh = opendir($dir))
> {
> 
> echo " serif; font-size: 12px; width: 290px;\">
> 
> Breaking News
> Please check here often for breaking news stories.
> 
> 
> 
> ";
> 
> // iterate over file list
> while (($filename = readdir($dh)) !== false)
> {
> // if filename matches search pattern, print it
> if (ereg($pattern, $filename))
>if(strpos($filename,'.')>0)
>
> //  if ($filename = str_replace('.html','',$filename))
> 
> {
> $fh = fopen($dir . $filename, 'r');
> $filehead = fread($fh, 72);
> fclose($fh);
> echo " href=\"/breaking_news/$filename\">".$filehead."";
> }
> }
> echo "
> 
> ";
> 
> // close directory
> closedir($dh);
> }
> }
> 
> ?>
> 

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



Re: [PHP] Re: Recommended ORM for PHP

2008-02-08 Thread Zoltán Németh
2008. 02. 8, péntek keltezéssel 11.38-kor Manuel Lemos ezt írta:
> Hello,
> 
> on 02/08/2008 06:15 AM Zoltán Németh said the following:
> >> Another aspect is that Metastorage features what is called report
> >> classes. These are classes that perform queries that you define and
> >> generates SQL and PHP at compile time to retrieve data from the
> >> persistent objects for read-only purposes.
> > 
> > and what if you want to switch sql server from mysql to oracle or
> > whatever? in propel, you change 1 line in the config, you don't have to
> > regenerate or rewrite anything.
> >
> > the base classes are useful too because if you change your schema, you
> > simply regenerate them and all your extensions remain the same in the
> > child classes.
> 
> Metastorage generates totaly database independent code . You don't need
> to regenerate the code to support multiple databases nor have fat base
> classes to access your database or do any other ORM operations.
> 
> Currently it generates code that uses Metabase database abstraction
> layer, although it can support other database abstraction layers. It
> supports many databases like MySQL, PostgreSQL, Oracle, Microsoft SQL
> server, SQLite, etc..

ok, so there is not much difference in that :)

> 
> Metabase also generates a separate class for installing or upgrading
> your database schema. If you change the definition of you objects, you
> just need to call that class to install, upgrade, downgrade your
> database schemas, safely without loosing any data that was already in
> the database.
> 
> This is something very secure, as it does not do any schema changes if
> the underlying database does not support certain things you want to
> change. If you ask for a change that is not possible, it simply fails
> without changing anything. It is not that error prone migrations method
> of Ruby on Rails, that you have to write "SQL" manually to do your
> migrations, and if you made a mistake, your database data is lost.
> 
> 

schema versioning is cool, AFAIK it is missing from propel but of course
it can transform your schema without data loss.

> 
> >> For instance, if you want to send a newsletter to a million subscribers
> >> and you just need the e-mail address and names of the subscribers, you
> >> can tell Metastorage to generate a report class that queries the users
> >> objects and retrives just the name and e-mail address. The report
> >> classes return arrays just like plain SELECT queries.
> >>
> >> If you use the Propel approach you would need to retrieve 1 million
> >> objects of the users class just to pick the name and e-mail address,
> >> which is totally inefficient in terms of memory and very slow.
> > 
> > not at all. you can build the criteria for the select and then run a
> > doSelectRS method which gives you only the result set in an array, no
> > objects involved.
> 
> That is not exactly what I am talking about. Metastorage has an Object
> Query Language (OQL) that lets you express whatever query conditions you
> want. It generates PHP code with the necessary SQL queries you need. You
> do not have to build any queries programatically at run-time.

in propel you do not touch SQL too ;)
you initialize an object of class Criteria and define whatever you want.
e.g.
$c = new Criteria();
$c->add('whatevercolumn', 'whatevervalue');

of course it can do much more, joins and everything you may need

> 
> The generated code can return full SQL statements if you want to execute
> them separately by some other application code, but usually I just use
> the generated report classes directly, as they take care of many things
> like pagination, so I do not have to deal with SQL directly. That is one
> of the great benefits of ORM.
> 
> With Metastorage I just do not have to deal with SQL manually nor I am
> forced to retrieve all as objects, not even when I am retrieving just a
> few variables of multiple classes. I do not have to SQL joins manually.
> That would be walking backwards in productivity.
> 
> 
> >> There are more differences between Metastorage and Propel (and probably
> >> others approach). I just wanted to make the point that the fact that
> >> approaches use generated code, it does not mean that all provide the
> >> same efficiency.
> > 
> > yeah, sure. however there is a payoff between efficiency and portability
> > and maintainability, and of course not all these orms have the same
> > level of these. choose the one that fits your needs best.
> 
> Exactly. I choose to develop my own because nothing that existe

  1   2   3   4   >