're actually trying to
write a parser, I think you might do well to read up on how other parsers
work (like, using a stack). Anyway, don't do that, use an existing XML
parser.. unless you are on a learning quest.. then, by all means!
--
Kelly Hallman
//Ultrafancy/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
requirement...?
Maybe I'm not understanding the problem, but why not just use something
like $myarray = preg_split('/[\r\n]+/', $textarea) ?
--
Kelly Hallman
//Ultrafancy/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ually parse it. To simply pull one or two values
out of the file, a regex still might be the quickest/dirtiest..
If you do want to move forward testing parsers and stuff, make yourself a
valid XML file to test with, so that is not the issue...worry about fixing
malformed XML later with the pro
in a day
(86400 * days) + timestamp
--
Kelly Hallman
//Ultrafancy/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
actly where it found it last time.
So, naturally, you need to advance the character position by at least one
to find subsequent occurences. This isn't a workaround. You had the bug.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ng very little of any, if you're
working with more than a basic, one-page script.
Even if you are (gulp) generating your HTML output within functions, it
seems better to be returning that back to some level where there are only
a couple of echo/prints necessary..
Think output layer...
t it's a little unweildy.. especially if you want to change
the range later (changing the array may not be so bad, but then you've
got to figure out how many iterations your loops must do, etc).
How about something like this:
$hstart = 7; $hend = 19; $interval = 15;
for($h=$hstart; $h
earch criteria it comes back with no hits. How should this be
> done? Do I have to encrypt the password somehow?
You probably need to use ldap_compare() to verify the password. Most LDAP
servers won't send back the password field contents. Hope that helps!
--
Kelly Hallman
// Ultrafancy
e showy and 2) feared the example
would start losing it's demonstrative value with extra functionality.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ally be dropped from PHP? Plans to improve it?
Thanks in advance for any help or pointers!!
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Wed, 26 Nov 2003, Rasmus Lerdorf wrote:
> On Wed, 26 Nov 2003, Kelly Hallman wrote:
> > I am aware that the PHP documentation says that the Java extension is
> > experimental. I am also aware that people say the ISAPI version does not
> > work well and that running PHP
filter($data,$allowed) {
foreach($data as $k => $v) {
if (in_array($k,$allowed)) { $r[$k] = $v; } } return $r; }
Putting it all together:
$allow_keys = array("action", "page", "custtype", "gender");
$new_vars = array("page" => 3, "act
line, but as a CGI by the webserver.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
close a string with '' it will be treated as a literal.
You may also consider "object{$objectnumber}" if you need to avoid
ambiguities with the rest of your string. I personally think it's a good
habit to use the curlies anyway, but I'm sure that's a matter of d
something I'm doing, or is this an IE problem?
This is the workaround I use for the IE/https download problems.
Not sure if it's the same problem, but let me know if this helps:
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ions would determine if the logged-in user had
adequate permission, and redirect them if not. That way, you can control
this behavior from a central location--you don't want to have to go
through each page of your app and change a URL.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing
surprised I didn't see this mentioned.. Have you tried:
header("Location: http://url.redirect/\n\n";); exit; // ?
The browser may be particular about the headers. When you add the two
newlines to the end, it makes it look like the end of the headers.
It's good practi
idn't want are identical in
your post, it was hard to tell what you were trying to do, but...
I think this is what you want..
ereg_replace("(\.)([0-9])","\\1\\2",$string);
(minus the last decimal point, missing from your original string)
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
variable as an int also appears to result in the desired behavior:
(int)"NANC" < 0 == false
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
r script...
$is_secure = ($_SERVER['SERVER_PORT']==443) ? true : false ;
If you decide to use SERVER_PORT to sense secure connections, this logic
would work well. It only depends on knowing the port you consider secure.
For typical https, that would be port 443. Enjoy!
--
Kelly
single place. Also, it includes defaults that don't need to be specified
with each call, as you'd need to do with preg_replace() alone.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ave input like (),
but it would work as expected.
Many tricky regex problems can be solved by lookaheads. There is also a
negative lookahead (?!pattern) ... also note that this is an advanced
regex feature and won't it work on many regex engines not based on PCRE.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
don't mostly all contain PHP code.
Same performance hit if you were naming plain HTML files as .php...
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ould set the Content-type header like so:
header("Content-type: image/jpeg");
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
code (SquirrelMail) uses it in one place,
but not another. What say you, PHP gurus? Gotta love the syntactic sugar!
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
it (it's the SQL queries
themselves that are not always portable, so you have to solve that).
If you've never looked at PEAR, the DB class is a good start.
Also, despite all it's features, it's quite fast!
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I'm developing a web-based framework ("the application") and would like to
implement an ncurses-based realtime monitoring facility ("the console").
The application currently writes events to a database history table, but I
don't think having a console that constantly requeries that table would be
Apr 9 at 2:49pm, Jason Giangrande wrote:
> Kelly Hallman wrote:
> > Try it without serializing, it works.
>
> After retesting, it seems you are correct. I guess the same bad
> __sleep() code that was causing the object not to unserialize at all was
> also preventing au
Apr 10 at 1:39pm, Tom Rogers wrote:
> Is your __sleep() function returning the array required by serialization?
Since you mentioned it, I tried returning an array and it did not
segfault, thought it was initially unclear what the array was for.
After reading over most of the documentation about s
Apr 13 at 2:24am, Andy B wrote:
> instead of making one super huge class..
> turn that class into a bunch of mini classes.
> DbConnect, DbError, DbQuery, DbResult and so on...
Right; chances are if you had all the functionality in one class, it's
going to be pretty identical to writing it without
Apr 13 at 4:04pm, Terence wrote:
> while (10==10) { // cool while loop
> /* ... */ flush(); sleep(1); } ?>
Not sure I see the efficacy of this approach for the problem at hand, but
what gets me is the cool while loop :) 10==10 is always going to evaluate
true, and I realize that this is an infi
here with a sharp rock saying, "but this works too!"
Then the guy with the knife started using it to cut everything, while the
rock required constant honing to remain sharp enough to do half the work.
But the guy with the rock thought it was all he needed! I use a knife.
--
Kelly Hallman
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ir($dir_handle)) {
// remove files matching the prefix/suffix, that don't start with dot
if (preg_match($regexpattern,$fname) && substr($fname,0,1) != '.') {
$modtime = date(DATE_FMT,filemtime($rootpath.$fname));
logger(sprintf('Deleted: %s Last Modified
t;firstName(),
and may encourage mixing the way you access the object data from your
code, which could potentially defeat the purpose of the get/set method.
On that note, you may be interested in the __call(), __get() and __set()
magic methods in PHP5, as they will give you the best of both worlds.
...Among many other nice OO feature improvements in PHP5...
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ting too much into the constructor can add overhead if you
want to create lightweight instances of the object for another purpose
that you're not envisioning at the moment.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
> ...
As long as the directory containing the PEAR files is in your include
path, and it mimics the same structure as the PEAR directory you have on
the server (where PEAR is installed) you should be good to go.
--
Kelly Hallman
--
PHP General Mailing List (http://www.php.net/)
To uns
Apr 19 at 3:46pm, Chris W. Parker wrote:
> Kelly Hallman <mailto:[EMAIL PROTECTED]>
> > I think what you're talking about here is encapsulation.
>
> in that case what is abstraction?
I suppose it's pretty similar, but I believe that encapsulation is the
pe
', ',$array1), implode(', ',$array2));
The more complex the query gets, the easier it is to read using this
approach. I'm sure some find that debatable. After all, I'm crazy ;)
--
Kelly Hallman
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
could be a security issue, if you are on a shared server,
as it might allow other users to use that same key to access the remote
server as well. Proceed with caution!
> TIA for anyone who has done this and knows the answer!!!
Haven't done this, but I think it should work. Hope it helps at least.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ddslashes() is good for database insertions, but for HTML probably are
looking for something like http://www.php.net/htmlentities
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
learn C++ before you're going to do
much successful OOP with it. Not exactly a small learning curve.
Other languages dispense with a lot of the formalities found in C++ (a
good or bad thing, depending on your perspective). I found Python to be a
great language to learn OOP, since it f
ng OO with PHP simplified a lot of problems I'd had
trying to do more complex tasks with a procedural/functional approach.
I still use perl to whip up a sysadmin script here and there, but after
using Python I began to regard perl as a syntactic mess.
--
Kelly Hallman
// Ultrafancy
--
PHP G
haunt you down the road..
Design the object well and it could validate the data automatically or
contain other non-database data such as form headings, help text, etc.
Also hooking this into some kind of form class (I like PEAR's
HTML_QuickForm) may help speed things along...
--
Kelly Hallman
//
to escape something in the pattern,
> but will look further.
I think it means you need to put a delimiter around your regex...
Typically you would use slashes (preg_match("/regex/")) but the character
can be other than slash.. i.e. "not alphanumeric or backslash" :)
--
On 1 Mar 2004, Brian V Bonini wrote:
> while ($result = mysql_fetch_array($dbresult_riderlist)) {
> print('' . "\n");
> print(" $result["rider_id"] . '" />' . "\n");
> print(" $result["rider_name"] . '" size="15" />' . "\n");
> print(" $result["rider_license_cat"] . '" size="3" />' . "\n");
> print
Consider this method:
function xyz() {
return $this->data = unserialize($this->serial); }
A few assumptions:
- Resultant data large enough to warrant discussion of efficiency
- I always want to store the unserialized data into the object
- The return value is only needed sometimes
If
are really no specific rules.
On that note, something to keep in mind is that GET variables (being part
of the URL) are written to server logs. Depending on the data being
passed, this could be a security issue (especially in a shared hosting
environment where untrusted users may have access to the lo
ost would suggest against in PHP, anyway).
There IS something to OOP! Unfortunately, it's difficult to learn through
examples of car stereo panels or different types of fruit or trees
(though they do make perfect sense in hindsight).
--
Kelly Hallman
// Ultrafancy
--
PHP General Maili
it's a
myth to think simply avoiding (delving into) OOP because "I've heard that
it's slow in PHP" automatically means you're being more efficient. It's
not the prime language for OOP but I find that when it all balances out,
for web apps in PHP, OO offers an attractive
t loop over it as you like, to do your output.
If you're reading an XML file, you might look into PEAR, which has
packages for parsing and building data structures of XML data.
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Apr 6 at 5:33pm, Angelo Zanetti wrote:
> hi all has anyone used smarty before? what do you think of it? I think
> it's pretty nice to seperate your script (code) from your design.
> i would like to hear your comments and if you have any alternatives
There are a lot of templating systems for PHP, b
Apr 6 at 2:43pm, Chris de Vidal wrote:
> Given that scripts are compiled the first time they're ran, you'll
> never* notice the bloat and never lack performance; it's the same as
> real PHP code and can be optimized with a caching engine like Zend.
Certainly. However, the Smarty compiler is about
Apr 8 at 10:26am, Justin French wrote:
> PHP itself is a great templating language :)
>
>
>
>
>
>
> '>
>
Uhhh, yeah--that's not a templating, that's called spaghetti code :)
You get the concept. Smarty, as you know, basically takes a Smarty
template and writes PHP code similar to what you
Apr 7 at 10:01pm, Robert Cummings wrote:
> Smarty is a bit of a hack too... why do I need to declare my templates
> within the PHP code? If I'm an HTML designer I'd like to create a new
> page, include templates, use some data that's been made available and
> have it all in the template. I sure as
Apr 7 at 10:22pm, John W. Holmes wrote:
> > Uhhh, yeah--that's not templating, that's called spaghetti code :)
>
> +1 - Use of buzzword
Right about here I could sense where this was going I don't know, what
would you call it? Is there a non-buzzword term you'd be happier with?
That term pre
Apr 8 at 7:38am, Aaron Wolski wrote:
> I don't think this thread is tired. As someone who is about to dive into
> learning templating more than what I do now...
Tired in the sense that it had degenerated to a personal level that was
uncalled for and off-topic. The merits of templating are never t
Apr 9 at 1:44am, Jason Giangrande wrote:
> Jason Giangrande wrote:
> > I'm having a problem unserializing objects that are passed from page to
> > page with sessions. Registered globals is disabled so I am using the
> > $_SESSION array to store session variable
> >
> > When I var_dump() $_SESSI
ariable, without needing to convert it in and out every time.
--
Kelly Hallman
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
this should only be used for data that is NEVER
intended to be queried, but may be usefully extracted on SELECTed records.
And we know the wisdom of assuming something will NEVER be necessary! :)
--
Kelly Hallman
// Ultrafancy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
59 matches
Mail list logo