If by "creates a web page" you just mean it echos output to the browser,
and you want to do something else after that, then:
After you have sent your and have no more output for the
browser, just use the include() function to run your extra process.
e.g
On Thu, 2007-10-18 at 20:19 -040
r a date. I need a
single pager which aligns the two tables' entries' dates in each page of
results throughout the span.
I am very open to a ready-made class that can do this, especially if
it's based on Propel, or if it can take raw sql queries.
Thoughts?
Nathan
--
PHP General M
Are you running a multi-user hosting service?
If so you can create include files on a per-user or per-domain basis.
Use the Apache config directive php_value to set your include_path and
open_basedir appropriately for each account; and other options as
desired.
I don't know of a particular site,
Nevermind. Just because they can't afford a database redesign doesn't
mean they can't afford a new index table containing date-indexed links
to both tables entities.
On Sat, 2007-10-20 at 21:39 -0400, Nathan Hawks wrote:
> I'm doing a project where the database was desi
Possibly... I've never read about MySQL views, so I can't refute it :)
The problem at hand is solved, but thanks. Might have to give views a
glance in TFM.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Also, AFAIK, PHP has always thrown a warning or notice if you use
foreach() on a non-associative array. That doesn't mean it won't work,
but the strict standard is apparently:
foreach ($assoc as $key => $val)
not
foreach ($indexed as $item)
However, as we all know, the latter still works fine.
at all which is why I think empty() or "" should work, but
> they don't.
try using var_dump(); you will see that it is a string that has no contents,
or perhaps some
whitespace characters.
-nathan
Note: empty() only checks variables as anything else will result in a
parse error. In other words, the following will not work:
empty(trim($name)).
http://www.php.net/manual/en/function.empty.php
On Tue, 2007-10-23 at 13:20 -0400, Dan Shirah wrote:
> I am having some issues with empty().
>
something; perhaps you can show us the portion of
code that contains the string
"Changed database context to Database."
it seems to me like the echo statement is getting skipped over, otherwise
you would see the string "Do Something".
since it is getting bypassed, that statement is not getting executed and
processing is continuing probly to the point
where the string about the database is echoed out.
-nathan
http://www.qmailrocks.com/
I am mailserver-challenged and I changed my VPS from exim to qmail with
only one practice run using their guides, patch-kits, and add-on
bundles.
On Tue, 2007-10-23 at 10:52 -0400, Jeff Mckeon wrote:
> > -Original Message-
> > From: Daniel Brown [mailto:[EMAIL
, but instead it gives
> me the error, "Changed database context to Database."
>
>
> On 10/23/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> >
> > On 10/23/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> > >
> > > I made two variable
));
}
later you can check $comment using empty($comment)
where is the code w/ the statement about the database ?
-nathan
u could put them in there a few at a time ?
-nathan
eliminate the
> wierd slashes.
>
> Can anybody tell how to do it right?
how are you building the json object?
i recommend
json_encode(utf8_encode($dataToEncode));
if youre using php5. if youre using php4, try this:
http://mike.teczno.com/JSON/JSON.phps
also, you might want to check out firebug for firefox. it will let you
easily analyze the interaction between the client and server.
also, to verify that the json object youre generating is infact ok;
run it through here:
http://www.jslint.com/
-nathan
On 10/25/07, Rodrigo Poblanno Balp <[EMAIL PROTECTED]> wrote:
>
> Nathan Nobbe wrote:
>
> On 10/25/07, Rodrigo Poblanno Balp <[EMAIL PROTECTED]> wrote:
> >
> > Hi everybody!
> >
> > I'm building a small ajax app which consists of only 3 php fi
through eval(), the escape characters will
be stipped
out by the javascript interpreter. im not sure whats going on, but im
starting to think
its something on the client side..
-nathan
{"prevUpperNavId":"0:0","nextUpperNavId":"1:1","breadcrumb
On 10/26/07, Rodrigo Poblanno Balp <[EMAIL PROTECTED]> wrote:
>
> Nathan Nobbe wrote:
>
> On 10/26/07, Rodrigo Poblanno Balp <[EMAIL PROTECTED]> wrote:
> >
> > I get something like this is the content<\/div>
> > it seems like the '/' is
sible to sort alphabetical without
> going
> all array. That seems to me like doing the job twice over. Atleast part of
> it...
>
how are you doing the sorting part?
can you show us some of your code ?
-nathan
ile in the list
$fileList[] = (string) $path;
}
}
fclose($dynfile);
?>
-nathan
if it will, use double quotes.
if you have a particularly long string, with variables and special
characters
consider Heredoc.
-nathan
if you were going to do that you may as well use PHP_EOL
its cross-platform and doesnt require an define directive.
(php5 only)
-nathan
On 10/30/07, Crayon Shin Chan <[EMAIL PROTECTED]> wrote:
>
> On Monday 29 October 2007, Nathan Nobbe wrote:
> > if you were going to do that you may as well use PHP_EOL
> > its cross-platform and doesnt require an define directive.
> > (php5 only)
>
> It
ompiling down to binary. there are such
things
available for java
http://gcc.gnu.org/java/
albiet older jvms.
i dont know of anything like this available for php; but remember, in
general,
compiling an interpreted language will result in different behavior than
running
it through the interpreter.
-nathan
(
)
from the Ajax script.
session_start() is being called as the first line of the Ajax script.
Any thoughts?
Nathan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nevermind... I don't know what the problem is yet but it's not the
folder.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
session_module_name() returns 'files' for both.
Altering the session.cookie_path (to set it to /) and
session.cookie_domain (to set it to '') did not help.
Moving the files to DOCUMENT_ROOT where the Ajax scripts are didn't
help; the main app still has the session, the Ajax script still doesn't.
It was a symfony thing.
For anyone else's future reference, if you are integrating with some big
monolith of an app and you find that your sessions are "disconnected"
when going from the big app to your little script... check out
session_name().
K bye!
--
PHP General Mailing List (http://www.
PHP_EOL;
}
public function invoker($dynamicMethod) {
self::$dynamicMethod();
}
}
$instance = new DynamicMethodCaller();
$instance->invoker('memFunc');
in general the use of eval() should be avoided unless absolutely necessary.
in this case it is not necessary; just use the syntax supported by the
interpreter
and youre good to go.
-nathan
when invoking a method not defined as static from a static
context:
(5.2.4-pl2-gentoo)
Strict standards: Non-static method Foo::nonStaticMethod() should not be
called statically in
/home/nathan/workspace/sacd/svn/itc-dev/testStaticCall2.php on line 14
(original error message from this thread)
Fatal e
On 11/1/07, Eric Butera <[EMAIL PROTECTED]> wrote:
>
> I don't know if this has been said yet, but in 5.3 they added this:
> Dynamic static calls: $c = "classname"; $c::someMetod();
apparently it works in 5.2.4 as well:
staticMethod();
$foo->nonstaticMethod();
?>
-nathan
attributes of inputs on the page; and then build a
simple
form that posts those inputs to the same url with the same method.
-nathan
ate are supposed to be, the
stronger you can make the check; for instance here, it sounds like it
should be a date
so you wouldnt allow, say 'somecrazySting', to pass the validation.
-nathan
rim in a temporary variable:
$trimmed = trim($due_date);
if(!empty($trimmed)) {
$insert2 .= ", due_date='$due_date'";
}
-nathan
or die ("Query failed: />".mssql_get_last_message());
>
> Any ideas?
>
dont call trim() as an argument to empty(); it doesnt work that way.
see the manual <http://us.php.net/manual/en/function.empty.php>:
Note: empty() only checks variables as anything else will result in a parse
error. In other words, the following will not work: empty(trim($name)).
-nathan
> ?>
>
perhaps hes not working with an instance of the class.
it is perfectly reasonable to use the scope resolution operator in a
variable function.
you just cant include the scope resolution operator in the string that gets
handed to
the interpreter. take a look at the code fragments from yesterday for
examples.
-nathan
is page twice.
so if youre pages constitute a request that inovokes a change
in the data on the server, they are probly fine already. otherwise
switch the request method to get, and youll be able to use the
back button w/o warning.
-nathan
t have
> never seen anything like this...
is this a new box?
have you tried w/o suhosin and / or zend optimizer?
did the other box you tested on have suhosin?
-nathan
ve you looked in the php error logs?
i would enable NOTICE and STRICT for testing,
error_reporting = E_ALL | E_STRICT
perhaps something will turn up there.
have you hopped on the irc channel for gentoo-php?
irc://irc.freenode.net/gentoo-php
it takes a while to get a response sometimes, but this group knows
the most about php on gentoo.
-nathan
be overriden and where
here is an article regarding the process,
http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess
-nathan
ou input 20,000; then the script fires off 5 requests, to do 4000
inserts a piece.
you could easily implement a status bar and it would be guaranteed to work.
also, it would scale just about as high as you can imagine.
-nathan
On 11/5/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
>
> Hi Nathan:
>
> No, I'm not familiar with Ajax. Where can I read up on it? More
> important, how can I find out if Ajax is implemented on the server? Or is
> it something I can add myself?
>
if you ar
On 11/5/07, tanzeem <[EMAIL PROTECTED]> wrote:
>
>
> Thanks nathan, But i cant use 'get' since the string being submitted is
> very
> big.
i guess that is an ie6 limitation, im not sure it still exists in 7.
I tried PHP headers as referred to by another website
On 11/5/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
>
> Nathan Nobbe wrote:
> > On 11/5/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> >> Hi Nathan:
> >>
> >> No, I'm not familiar with Ajax. Where can I read up on it? More
> >> i
if youre running linux, you might also want to consider disown.
-nathan
On 11/6/07, Rahul S. Johari <[EMAIL PROTECTED]> wrote:
>
> I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been
> manually mounting after each boot, so still looking for an automated
> mounting solution.
look for /etc/fstab
-nathan
On 11/6/07, Rahul S. Johari <[EMAIL PROTECTED]> wrote:
>
>
> On 11/6/07 12:03 PM, "Nathan Nobbe" <[EMAIL PROTECTED]> wrote:
>
> > On 11/6/07, Rahul S. Johari <[EMAIL PROTECTED]> wrote:
> >>
> >> I couldn't find an /etc/rd.d or r
is case to both directives is no; they can only be
set in php.ini.
http://us.php.net/manual/en/ini.php
-nathan
f for my scripts via something like:
>
> ini_set( 'safe_mode', '0' ); ???
>
> It's not easy for me to test and that's why I'm asking.
see the manual for a description of where php.ini directives can be
overridden.
http://us.php.net/manual/en/ini.
On Nov 9, 2007 5:01 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> On Nov 9, 2007 4:24 PM, tedd <[EMAIL PROTECTED]> wrote:
> > Hi gang:
> >
> > I'm confronting a safe_mode problem and have a question.
> >
> > My PHP Info states that safe_mode is ON
rs
include paths etc.
check out my small article about setting up .htaccess if you want.
http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess
-nathan
= 0;
}
well i think that is really messy.
getting to the function idea.. were you planning to put the function in the
same file and thats why you view it as an alternative to including a file?
i would at least create a function and put it in the file you intend to
include.
i imagine it will be a hair slower, but it will be much more organized.
-nathan
: 0.001057
[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php
mainWFunction.php
10
totalTime: 0.000642
[EMAIL PROTECTED] ~/working/www/phpExperiments/functionVsInclude $ php
mainWExternalFunction.php
10
totalTime: 0.000604
ill show the code if anyone wants it.
-nathan
was surprised to see the function was faster at all. i though the
include would be faster.
so not only is the function faster (if only but a bit) its also cleaner as
well.
i think a decision between the 2 approaches no-brainer.
-nathan
On Nov 14, 2007 1:39 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> If you don't know how it works, you can
> bitch about the syntax manuals being "too vague".
im going to take the opportunity here and bitch about the documentation for
the DateTime object built into php5; it sucks :-O
-nathan
php.net/manual/en/function.curl-multi-init.php
-nathan
php|architect's Zend PHP 5 Certification Study
Guide<http://www.amazon.com/architects-Zend-Certification-Study-Guide/dp/0973862149>
is solid; even for people whove programmed in php for a little while.
i learned a few things in there.
its a great starting point; and not too long eithe
:)
and there alternatives to the methods ive suggested, of course.
take a look a firebug (firefox plugin) and jslint (javascript syntax
checker)
theyre great javascript debugging tools.
-nathan
On Nov 18, 2007 8:25 PM, samantha_o <[EMAIL PROTECTED]> wrote:
>
> I did not try using
your proposal is the following:
new users will enter the list sporadically as they already do. anybody who
enters the list
after this agreement is made (assuming it is universally accepted) will not
be privy to the
agreement. also, anybody who hasnt bothered to keep up with the list today
will probly
gloss over it and also ignore (inadvertently) the agreement.
its a good idea, but i doubt well ever see it come to fruition.
-nathan
ooked through the online manual and found no
reference to it.
nor did i find anything from google. i did encounter it in the php source,
but with no
useful documentation.
a reference of all the streams that are valid with the php:// scheme would
be helpful.
getting to your problem, i think this could perhaps be a bug.
you might file a bug report and post your code along with it; unless
somebody has a
better idea ;)
-nathan
s
walk() method
*/
function walk($elements, $to_depth) {
do something custom here
return $this->walkerInstance($elements, $to_depth);
}
/// .
}
-nathan
is is what youre looking for:
*$HTTP_RAW_POST_DATA*
see also
http://www.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data*
*
-nathan
couldnt you always like come back w/ a different username?
i mean seriously; how are those bans structured anyway?
-nathan
focus on development in my experience.
-nathan
guarantee top-listing
status 25%
of the time.
what you would need to determine is what to do if ever you didnt want to
increment the
number of listings that are designated as top-listing customers and you were
already
at capacity for the number of customers the current capacity supports.
perhaps you
could start charging more at that point.
-nathan
On Dec 6, 2007 9:14 PM, tedd <[EMAIL PROTECTED]> wrote:
> At 6:07 PM -0500 12/6/07, Nathan Nobbe wrote:
> >>On Dec 6, 2007 4:59 PM, tedd <[EMAIL PROTECTED]> wrote:
> >> > The problem is, could you guarantee to a "preferred" service
> provid
sorry one more
It also worked if i did the following..
Content-Type: multipart/alternative;
boundary="-=Part233475926a47beb07.46978329"
Delivered-To: [EMAIL PROTECTED]
---=Part233475926a47beb07.46978329
Content-Type:text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
...
I had the same problem last week and it turned out to be extra line
breaks, try..
Content-Type: multipart/alternative;
boundary="-=Part233475926a47beb07.46978329"
---=Part233475926a47beb07.46978329
Content-Type:text/plain; charset=utf-8
.....
Nathan
Sándor Tamás (Ho
is returned to php until the
stdin pipe is closed, even if I write hundreds of commands to it.
I'm on php 5.1.6/5.2.4 on various linux installs
recap:
spawn process, keep open for the duration of script execution, read and
write multiple times to same process, then close - even better lat
ny obvious ways to optimize this, but then I never did
> properly "get" the travelling salesman or 4-colour problem!
im ashamed to admit i blew off a couple of linear algebra classes and a
calc-based stats class in college. had i paid attention, this might still
be
a trivial problem =/
..., bah!
-nathan
1 - yes you can make a multichat daemon in php
2 - if you don't know that it's possible or where to begin, then odds
are you won't be able to make it.
Nathan
abderrazzak nejeoui wrote:
Hello,
i want build a multi chat server based in php.
1- is that possible
2- if yes can you
o ajax).
Many Regards
Nathan
Robert Cummings wrote:
On Sat, 2007-12-08 at 12:19 -0500, Robert Cummings wrote:
On Sat, 2007-12-08 at 16:46 +, Nathan Rixham wrote:
1 - yes you can make a multichat daemon in php
2 - if you don't know that it's possible or where to begin, then odds
are
Anybody up for (or indeed see a need for) a multi threaded php
daemonised jabber client? Looks like an interesting challenge!
Børge Holen wrote:
On Sunday 09 December 2007 11:17:36 you wrote:
thank you Børge Holen,
I think the third solution is very COOL , using the jabber 2.0 in the
backend
The DOMDocument Object is
> empty...
are the systems running the same major version of php; and have you
verified
the linux system has DOM support?
-nathan
ontext of your application, or have you
also
tried a focused test script? i would try something trivial, like:
1197026188_ec76
KO
500
Internal Server Error
XML;
$domDoc = new DOMDocument();
$domDoc->loadXML($xml);
echo $domDoc->saveXML() . PHP_EOL;
?>
just to ensure the DOM extension is available and working as expected.
-nathan
spaces in between the
xml declaration and the opening tag of the envelope () you should
see the following error
(or something similar [depending on the value of error_reporting])
Warning: DOMDocument::loadXML(): XML declaration allowed only at the start
of the document in Entity,
line: 3 in /home/na
nd.php> as this is
now done automatically.
-nathan
mly distributed numbers which is not suitable for
> simulation purposes.
>
> Is there any way to generate random numbers with
> normal distribution in PHP?
>
this is straight from a comment on the rand() documentation:
http://us3.php.net/rand
-nathan
Random numbers with Gauss distribu
ere is a function in there for getting a random value from a normal
distribution:
stats_rand_gen_normal
but it looks to be in pecl and i didnt see it in portage so i gave up on
trying it out pretty
quickly =/
-nathan
ting locations to derive a
> pseudo-random number since it is unlikely one could easily guess the
> precise landing location of each pea.
actually a couple of guys spent some time to figure that out many years
back and applied it to the roulette wheel. they made a small computer
you could put in your shoe and trained a bunch of people how to use it.
they then sent the people out to various casinos and became millionares.
-nathan
If you want a source to very verify against, send yourself an email,
then view it's source; then change your class till it outputs the same
info, gauranteed winner every time.
Nathan
Jim Lucas wrote:
Robert Cummings wrote:
Yeah, he's all over the place with his line endings. Per
ne to write)
(not needed for stateless http style request processing).
Nathan
M5 wrote:
Curiously, would you agree with this guy's comments concerning low-level
PHP socket functions vs stream_socket_server() ?
"If you want a high speed socket server, use the low-level sockets
instea
riables of the class thats being defined.
you can look at the structure of a class in one line with:
Reflection::export(new ReflectionClass('DomDocument'));
-nathan
inst the
abstraction layer) when you have to switch the underlying database client.
-nathan
sent 2*384kb loads per second through a terminal to it without
problems, 10 minutes since i stopped writing data to it and it's still
echoing out 1 line every 10 secs!
Nathan
René Fournier wrote:
"If you want a high speed socket server, use the low-level sockets
instead (socket_create/
they are both coded against an abstract database
interface. it could even make sense to write one test against an abstract
class
then create concrete subclasses for each specific library. then in the
future
adding a test for, say postgre, would be trivial.
-nathan
f the
program and have
more specific details for you.
I remember in the old days where they used roulette wheels to
> generate random lists.
>
get with the times; these are the days of decaying isotopes :-O
-nathan
lly cli
scripts are brief. however, if you have a long running cli script apc might
be
useful in the context of the cli.
ive been curious about this myself. if anyone has a definitive answer, im
looking forward to it.
-nathan
ractice in this case is to mark
said
dead code as a candidate for removal on the next release cycle of the
software.
using these techniques in concert i think you can keep the code fairly
clean.
-nathan
On Dec 14, 2007 2:49 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-12-14 at 14:09 -0500, Nathan Nobbe wrote:
> > On Dec 12, 2007 4:21 AM, Mathijs van Veluw <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > > Hello there,
> > >
> &g
OR', 'blue');
i dunno. to be honest i typically use a mixture of both approaches. class
constants
for classes when they are appropriate and define directives for global
configuration
values.
strictly speaking i dont think having a class of all constants qualifies an
app
as 'more oo'; id say in java for example you simply dont have any other
choice.
-nathan
= new SimpleXMLElement($xml);
$titleElements = $simpleXmlElt->xpath('//title');
foreach($titleElements as $curTitleElement) {
echo $curTitleElement . PHP_EOL;
}
?>
no charge ;) hehe
-nathan
s keyword just to
'implement' parent_class. you can only implement one interface in this way.
there is no way to reasonably emulate the interface construct in php4.
in c++ you can emulate the interface construct by having a class that is
entirely virtual, but too bad; php4 doesnt have abstract classes either.
i recommend an upgrade to php5.
-nathan
figured id top-post on this one, since the original message was so long..
i recommend debugging with a tool like wireshark. that way you can
see whats in the packets going over the wire and hopefully it will lead
to a solution.
-nathan
On Dec 19, 2007 12:54 AM, vixle <[EMAIL PROTECTED]>
'doSomething')) {
>$obj->doSomething();
> } else {
>// $obj does not support the required interface
> }
>
> This at least allows a way for your code to enforce the interface on
> an as-needed basis and recover gracefully.
this is indeed the best, if not only, way to emulate interfaces in php4;
i believe this was recommended some time back as well.
-nathan
eneric advice i can give you on a solid
'architecture'. if
all your scripts are designed with the premise of being accessed directly
from a client
browser youll be building a house of cards.
-nathan
Anti-IE..
an IE penalty, don't loose visitors, just frustrate them a little, never
know they may try firefox and see it works that bit faster :)
Xavier de Lapeyre wrote:
Lol!!! I need to implement that on ALL my sites ... XD!!
Xavier de Lapeyre
-Original Message-
From: Richa
global.php
one.php
might work..
Christoph Boget wrote:
Let's say I have the following 3 files
global.php
one.php
two.php
In each case, what is echoed out for __FILE__ is global.php. Apart from
analyzing the debug_backtrace array, is there any way that myFunc() would
display "one.php"
and first level defines a space for your project. In this
> way you're much less likely to run into variable clobbering issues. This
> is why I used 'myProject' as the first level key in the above example.
> Some purists out there will misguidedly say that nothing belongs in the
> global space; however, they are wrong since function and class
> definitions fall into global space and as such the solution is
> equivalent to stuffing all your config vars into a class or function.
> That said, I think use of the global space shouldn't be ad-hoc and
> sloppy.
the global space does have good uses; i prefer to use it to cache on a
per-request
basis. i think the global space can be easily abused however, as is the
case in
many projects ive encountered and unfortunately work on.
in many cases singleton is an excellent alternative, however, it add
complexity and
overhead, so sometimes globals are appropriate.
-nathan
a dark background.
murphy is runner up (also w/ dark bg).
-nathan
if you want to try out all the colorschemes on your system you can
do so pretty quickly and easily, with the following keystrokes:
1. Esc
2. (type) :colorscheme
3. space
4. tab through the available colorschemes
-nathan
1301 - 1400 of 2379 matches
Mail list logo